Address Contract Verified
Address
0x9d5407C08FEBe35F3A747da422dC2Da45ca30b61
Balance
0 ETH
Nonce
1
Code Size
14296 bytes
Creator
0xc63705e1...54b4 at tx 0x7c8485df...345272
Last Active
Indexed Transactions
1 (24,310,326 → 24,310,326)
Gas Used (indexed)
46,148
Contract Bytecode
14296 bytes
0x60806040526004361061024e5760003560e01c806361c2654b11610138578063aa1b103f116100b0578063c1df65381161007f578063e985e9c511610064578063e985e9c5146106b1578063f19e75d4146106fa578063f2fde38b1461071a57600080fd5b8063c1df653814610671578063c87b56dd1461069157600080fd5b8063aa1b103f14610609578063aad2b7231461061e578063b88d4fde1461063e578063bfc78b2d1461065e57600080fd5b8063753868e3116101075780638da5cb5b116100ec5780638da5cb5b146105b657806395d89b41146105d4578063a22cb465146105e957600080fd5b8063753868e3146105815780638a616bc01461059657600080fd5b806361c2654b146104fc5780636352211e1461052c57806370a082311461054c578063715018a61461056c57600080fd5b806323b872dd116101cb57806342966c681161019a5780634f6ccce71161017f5780634f6ccce71461049c57806355f804b3146104bc5780635944c753146104dc57600080fd5b806342966c68146104465780634c0f38c21461046657600080fd5b806323b872dd146103a75780632a55205a146103c75780632f745c591461040657806342842e0e1461042657600080fd5b8063081812fc116102225780630e208d08116102075780630e208d08146103445780631414124a1461036457806318160ddd1461038457600080fd5b8063081812fc146102ec578063095ea7b31461032457600080fd5b8062f714ce1461025357806301ffc9a71461027557806304634d8d146102aa57806306fdde03146102ca575b600080fd5b34801561025f57600080fd5b5061027361026e366004612f52565b61073a565b005b34801561028157600080fd5b50610295610290366004612fb0565b61084a565b60405190151581526020015b60405180910390f35b3480156102b657600080fd5b506102736102c5366004612ff5565b6108a6565b3480156102d657600080fd5b506102df61090e565b6040516102a191906130a0565b3480156102f857600080fd5b5061030c6103073660046130b3565b6109a0565b6040516001600160a01b0390911681526020016102a1565b34801561033057600080fd5b5061027361033f3660046130cc565b610a39565b34801561035057600080fd5b5061027361035f3660046130f8565b610b66565b34801561037057600080fd5b5061027361037f36600461313a565b610cdf565b34801561039057600080fd5b50610399610dde565b6040519081526020016102a1565b3480156103b357600080fd5b506102736103c236600461315d565b610df5565b3480156103d357600080fd5b506103e76103e236600461319e565b610e7c565b604080516001600160a01b0390931683526020830191909152016102a1565b34801561041257600080fd5b506103996104213660046130cc565b610f59565b34801561043257600080fd5b5061027361044136600461315d565b6110b8565b34801561045257600080fd5b506102736104613660046130b3565b6110d3565b34801561047257600080fd5b5061047b61111b565b6040516fffffffffffffffffffffffffffffffff90911681526020016102a1565b3480156104a857600080fd5b506103996104b73660046130b3565b611131565b3480156104c857600080fd5b506102736104d7366004613283565b6111c0565b3480156104e857600080fd5b506102736104f73660046132cc565b611294565b34801561050857600080fd5b506102956105173660046130b3565b60009081526009602052604090205460ff1690565b34801561053857600080fd5b5061030c6105473660046130b3565b6112f9565b34801561055857600080fd5b5061039961056736600461330a565b611399565b34801561057857600080fd5b5061027361147a565b34801561058d57600080fd5b50610273611536565b3480156105a257600080fd5b506102736105b13660046130b3565b6115cd565b3480156105c257600080fd5b506005546001600160a01b031661030c565b3480156105e057600080fd5b506102df61163b565b3480156105f557600080fd5b50610273610604366004613327565b61164a565b34801561061557600080fd5b5061027361172d565b34801561062a57600080fd5b5061027361063936600461330a565b611793565b34801561064a57600080fd5b50610273610659366004613373565b61188e565b61027361066c3660046133df565b61191c565b34801561067d57600080fd5b50600c5461030c906001600160a01b031681565b34801561069d57600080fd5b506102df6106ac3660046130b3565b611981565b3480156106bd57600080fd5b506102956106cc366004613421565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b34801561070657600080fd5b506102736107153660046130b3565b611a15565b34801561072657600080fd5b5061027361073536600461330a565b611b01565b6005546001600160a01b031633146107995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b4782111561080f5760405162461bcd60e51b815260206004820152602960248201527f43616e6e6f74207769746864726177206d6f7265207468616e2063757272656e60448201527f742062616c616e636500000000000000000000000000000000000000000000006064820152608401610790565b6040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610845573d6000803e3d6000fd5b505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a0000000000000000000000000000000000000000000000000000000014806108a057506108a082611c4b565b92915050565b6005546001600160a01b031633146109005760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b61090a8282611ca1565b5050565b60606000805461091d9061344f565b80601f01602080910402602001604051908101604052809291908181526020018280546109499061344f565b80156109965780601f1061096b57610100808354040283529160200191610996565b820191906000526020600020905b81548152906001019060200180831161097957829003601f168201915b5050505050905090565b60006109ab82611dcc565b610a1d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610790565b506000908152600360205260409020546001600160a01b031690565b6000610a44826112f9565b9050806001600160a01b0316836001600160a01b03161415610ace5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610790565b336001600160a01b0382161480610aea5750610aea81336106cc565b610b5c5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610790565b6108458383611e16565b6005546001600160a01b03163314610bc05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b600b54700100000000000000000000000000000000900460ff1615610c275760405162461bcd60e51b815260206004820152600f60248201527f436f6e7472616374206c6f636b656400000000000000000000000000000000006044820152606401610790565b806fffffffffffffffffffffffffffffffff16610c42610dde565b1115610c905760405162461bcd60e51b815260206004820152601b60248201527f43616e6e6f742062652062656c6f7720746f74616c537570706c7900000000006044820152606401610790565b610c9b8160016134d2565b600b80547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff9290921691909117905550565b6005546001600160a01b03163314610d395760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b600b54700100000000000000000000000000000000900460ff1615610da05760405162461bcd60e51b815260206004820152600f60248201527f436f6e7472616374206c6f636b656400000000000000000000000000000000006044820152606401610790565b60009182526009602052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b600254600090610df090600190613506565b905090565b610dff3382611e9c565b610e715760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610790565b610845838383611f97565b60008281526007602090815260408083208151808301909252546001600160a01b038116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff16928201929092528291610f1d5750604080518082019091526006546001600160a01b03811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b602081015160009061271090610f41906bffffffffffffffffffffffff168761351d565b610f4b9190613589565b915196919550909350505050565b6000610f6483611399565b8210610fd85760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610790565b6000805b6002548110156110495760028181548110610ff957610ff961359d565b6000918252602090912001546001600160a01b038681169116141561103757838214156110295791506108a09050565b81611033816135cc565b9250505b80611041816135cc565b915050610fdc565b5060405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610790565b6108458383836040518060200160405280600081525061188e565b60405162461bcd60e51b815260206004820152601560248201527f4275726e206973206e6f7420737570706f7274656400000000000000000000006044820152606401610790565b60006001611127612132565b610df09190613605565b600254600090611142836001613636565b106111b55760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610790565b6108a0826001613636565b6005546001600160a01b0316331461121a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b600b54700100000000000000000000000000000000900460ff16156112815760405162461bcd60e51b815260206004820152600f60248201527f436f6e7472616374206c6f636b656400000000000000000000000000000000006044820152606401610790565b805161090a906008906020840190612ea4565b6005546001600160a01b031633146112ee5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b61084583838361216e565b6000806002838154811061130f5761130f61359d565b6000918252602090912001546001600160a01b03169050806108a05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610790565b60006001600160a01b0382166114175760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610790565b6000805b60025481101561147357600281815481106114385761143861359d565b6000918252602090912001546001600160a01b038581169116141561146357611460826135cc565b91505b61146c816135cc565b905061141b565b5092915050565b6005546001600160a01b031633146114d45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6005546001600160a01b031633146115905760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b600b80547fffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffff16700100000000000000000000000000000000179055565b6005546001600160a01b031633146116275760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b600090815260076020526040812055565b50565b60606001805461091d9061344f565b6001600160a01b0382163314156116a35760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610790565b3360008181526004602090815260408083206001600160a01b0387168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6005546001600160a01b031633146117875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b6117916000600655565b565b6005546001600160a01b031633146117ed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b600b54700100000000000000000000000000000000900460ff16156118545760405162461bcd60e51b815260206004820152600f60248201527f436f6e7472616374206c6f636b656400000000000000000000000000000000006044820152606401610790565b600c80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6118983383611e9c565b61190a5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610790565b611916848484846122aa565b50505050565b61192a848385333486612333565b6119765760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e61747572650000000000000000000000000000006044820152606401610790565b6119168484846123f2565b6060600082118015611997575061199782611dcc565b6119e35760405162461bcd60e51b815260206004820152601560248201527f546f6b656e20646f6573206e6f742065786973742e00000000000000000000006044820152606401610790565b60086119ee83612572565b6040516020016119ff92919061366a565b6040516020818303038152906040529050919050565b6005546001600160a01b03163314611a6f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b60fa81611a7a610dde565b611a849190613636565b1115611af85760405162461bcd60e51b815260206004820152602660248201527f4f776e65722063616e6e6f74206d696e74206d6f7265207468616e203235302060448201527f746f6b656e7300000000000000000000000000000000000000000000000000006064820152608401610790565b611638816126a4565b6005546001600160a01b03163314611b5b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610790565b6001600160a01b038116611bd75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610790565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a0000000000000000000000000000000000000000000000000000000014806108a057506108a08261273f565b6127106bffffffffffffffffffffffff82161115611d275760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c655072696365000000000000000000000000000000000000000000006064820152608401610790565b6001600160a01b038216611d7d5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610790565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff90911660209092018290527401000000000000000000000000000000000000000090910217600655565b600254600090821080156108a0575060006001600160a01b031660028381548110611df957611df961359d565b6000918252602090912001546001600160a01b0316141592915050565b600081815260036020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091558190611e63826112f9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611ea782611dcc565b611f195760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610790565b6000611f24836112f9565b9050806001600160a01b0316846001600160a01b03161480611f5f5750836001600160a01b0316611f54846109a0565b6001600160a01b0316145b80611f8f57506001600160a01b0380821660009081526004602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611faa826112f9565b6001600160a01b0316146120265760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610790565b6001600160a01b0382166120a15760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610790565b6120ac600082611e16565b81600282815481106120c0576120c061359d565b6000918252602082200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03938416179055604051839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4505050565b600b546000906fffffffffffffffffffffffffffffffff1661215557506122b990565b50600b546fffffffffffffffffffffffffffffffff1690565b6127106bffffffffffffffffffffffff821611156121f45760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c655072696365000000000000000000000000000000000000000000006064820152608401610790565b6001600160a01b03821661224a5760405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606401610790565b6040805180820182526001600160a01b0393841681526bffffffffffffffffffffffff9283166020808301918252600096875260079052919094209351905190911674010000000000000000000000000000000000000000029116179055565b6122b5848484611f97565b6122c184848484612795565b6119165760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610790565b604080516020808201899052818301889052606082018790523060808301526001600160a01b03861660a083015260c08083018690528351808403909101815260e0830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000061010084015261011c808401919091528351808403909101815261013c90920190925280519101206000906123d58184612960565b600c546001600160a01b0391821691161498975050505050505050565b6000811180156124035750600a8111155b6124755760405162461bcd60e51b815260206004820152602260248201527f6e756d546f6b656e73206d757374206265206265747765656e203120616e642060448201527f31300000000000000000000000000000000000000000000000000000000000006064820152608401610790565b60008381526009602052604090205460ff166124d35760405162461bcd60e51b815260206004820152601160248201527f6d696e744c697374206e6f74206f70656e0000000000000000000000000000006044820152606401610790565b6000828152600a602052604090205460ff16156125325760405162461bcd60e51b815260206004820152601260248201527f4e6f6e636520616c7265616479207573656400000000000000000000000000006044820152606401610790565b6000828152600a6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610845816126a4565b6060816125b257505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156125dc57806125c6816135cc565b91506125d59050600a83613589565b91506125b6565b60008167ffffffffffffffff8111156125f7576125f76131c0565b6040519080825280601f01601f191660200182016040528015612621576020820181803683370190505b5090505b8415611f8f57612636600183613506565b9150612643600a8661373f565b61264e906030613636565b60f81b8183815181106126635761266361359d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061269d600a86613589565b9450612625565b6002546126af612132565b6fffffffffffffffffffffffffffffffff166126cb8383613636565b11156127195760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f7420657863656564206d6178537570706c790000000000000000006044820152606401610790565b60005b828110156108455761272d33612a2f565b80612737816135cc565b91505061271c565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d630000000000000000000000000000000000000000000000000000000014806108a057506108a082612a48565b60006001600160a01b0384163b15612955576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a02906127f2903390899088908890600401613753565b602060405180830381600087803b15801561280c57600080fd5b505af192505050801561285a575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261285791810190613785565b60015b61290a573d808015612888576040519150601f19603f3d011682016040523d82523d6000602084013e61288d565b606091505b5080516129025760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610790565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050611f8f565b506001949350505050565b60008060008084516041141561298a5750505060208201516040830151606084015160001a612a19565b8451604014156129d15750505060408201516020830151907f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81169060ff1c601b01612a19565b60405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610790565b612a2586828585612b2b565b9695505050505050565b6116388160405180602001604052806000815250612d28565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd000000000000000000000000000000000000000000000000000000001480612adb57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806108a057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146108a0565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115612bc35760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610790565b8360ff16601b1480612bd857508360ff16601c145b612c4a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610790565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015612c9e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001519150506001600160a01b038116612d1f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610790565b95945050505050565b6000612d3383612db4565b9050612d426000848385612795565b6108455760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610790565b60006001600160a01b038216612e0c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610790565b6002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038616908117909155604051919283927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a492915050565b828054612eb09061344f565b90600052602060002090601f016020900481019282612ed25760008555612f18565b82601f10612eeb57805160ff1916838001178555612f18565b82800160010185558215612f18579182015b82811115612f18578251825591602001919060010190612efd565b50612f24929150612f28565b5090565b5b80821115612f245760008155600101612f29565b6001600160a01b038116811461163857600080fd5b60008060408385031215612f6557600080fd5b823591506020830135612f7781612f3d565b809150509250929050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461163857600080fd5b600060208284031215612fc257600080fd5b8135612fcd81612f82565b9392505050565b80356bffffffffffffffffffffffff81168114612ff057600080fd5b919050565b6000806040838503121561300857600080fd5b823561301381612f3d565b915061302160208401612fd4565b90509250929050565b60005b8381101561304557818101518382015260200161302d565b838111156119165750506000910152565b6000815180845261306e81602086016020860161302a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000612fcd6020830184613056565b6000602082840312156130c557600080fd5b5035919050565b600080604083850312156130df57600080fd5b82356130ea81612f3d565b946020939093013593505050565b60006020828403121561310a57600080fd5b81356fffffffffffffffffffffffffffffffff81168114612fcd57600080fd5b80358015158114612ff057600080fd5b6000806040838503121561314d57600080fd5b823591506130216020840161312a565b60008060006060848603121561317257600080fd5b833561317d81612f3d565b9250602084013561318d81612f3d565b929592945050506040919091013590565b600080604083850312156131b157600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff8084111561320a5761320a6131c0565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715613250576132506131c0565b8160405280935085815286868601111561326957600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561329557600080fd5b813567ffffffffffffffff8111156132ac57600080fd5b8201601f810184136132bd57600080fd5b611f8f848235602084016131ef565b6000806000606084860312156132e157600080fd5b8335925060208401356132f381612f3d565b915061330160408501612fd4565b90509250925092565b60006020828403121561331c57600080fd5b8135612fcd81612f3d565b6000806040838503121561333a57600080fd5b823561334581612f3d565b91506130216020840161312a565b600082601f83011261336457600080fd5b612fcd838335602085016131ef565b6000806000806080858703121561338957600080fd5b843561339481612f3d565b935060208501356133a481612f3d565b925060408501359150606085013567ffffffffffffffff8111156133c757600080fd5b6133d387828801613353565b91505092959194509250565b600080600080608085870312156133f557600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff8111156133c757600080fd5b6000806040838503121561343457600080fd5b823561343f81612f3d565b91506020830135612f7781612f3d565b600181811c9082168061346357607f821691505b6020821081141561349d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006fffffffffffffffffffffffffffffffff8083168185168083038211156134fd576134fd6134a3565b01949350505050565b600082821015613518576135186134a3565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613555576135556134a3565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826135985761359861355a565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156135fe576135fe6134a3565b5060010190565b60006fffffffffffffffffffffffffffffffff8381169083168181101561362e5761362e6134a3565b039392505050565b60008219821115613649576136496134a3565b500190565b6000815161366081856020860161302a565b9290920192915050565b600080845481600182811c91508083168061368657607f831692505b60208084108214156136bf577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b8180156136d357600181146137025761372f565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0086168952848901965061372f565b60008b81526020902060005b868110156137275781548b82015290850190830161370e565b505084890196505b505050505050612d1f818561364e565b60008261374e5761374e61355a565b500690565b60006001600160a01b03808716835280861660208401525083604083015260806060830152612a256080830184613056565b60006020828403121561379757600080fd5b8151612fcd81612f8256fea2646970667358221220c403752b3ca996fbaede92b5c44e9891a8bc378f2203f42a9cb77ad8f353d9ab64736f6c63430008090033
Verified Source Code Full Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (10000 runs)
NFT.sol 262 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./openzeppelin/ERC2981.sol";
/**
* @title Ballerz NFT of your team
* @notice In this NFT sale we chose to only allow transactions signed by our server, in order to prioritize human buyers
* over bots.
*/
contract NFT is ERC721Enumerable, Ownable, ERC2981 {
using ECDSA for bytes32;
// Base URI
string private _baseURI;
// Mapping from whitelist ID to bool determining if the sale is open to that list
mapping(uint256 => bool) private _canMint;
// Mapping from nonce value to bool documenting whether the given nonce was already used, used to guard against replay attacks
mapping(uint256 => bool) private _nonceUsed;
// Max supply that overrides the hard-coded value of 8889
uint128 private _maxSupply;
// Used to lock owner configuration functions
bool private _locked;
// The address of the server that signs all buy transactions; see docs on the buy function for more info
address public _signerAddress;
/**
* @dev Burns token ID 0 because we want tokens to start at 1.
*/
constructor(
string memory baseURI,
string memory name,
string memory symbol,
address owner,
address signer,
address royaltiesReceiver,
uint96 royaltiesFeeNumerator
) ERC721(name, symbol) {
_baseURI = baseURI;
_signerAddress = signer;
_setDefaultRoyalty(royaltiesReceiver, royaltiesFeeNumerator);
transferOwnership(owner);
// Product decision: burn token 0 to start minting at ID 1
_owners.push(address(0));
}
/**
* Public Transactions
*/
/**
* @notice Buy NFTs with transactions signed by our server, to prioritize human buyers over bots.
* @param mintList The whitelist the buyer is part of.
* @param nonceSeq The nonce of this transaction; must be unique to protect against replay attacks.
* @param numTokens The number of tokens to mint in this transaction.
* @param sig The server's signature over all inputs: mintList, numTokens, nonceSeq, this.address, msg.sender, msg.value
*/
function buy(
uint256 mintList,
uint256 nonceSeq,
uint256 numTokens,
bytes memory sig
) external payable {
require(checkSig(mintList, numTokens, nonceSeq, msg.sender, msg.value, sig), "Invalid signature");
_buy(mintList, nonceSeq, numTokens);
}
/**
* @notice Burn is not supported, because the gas optimizations we've implemented make it so that burning tokens renders
* other functions buggy, like {totalSupply} and {tokenByIndex}.
*/
function burn(uint256) external pure {
revert("Burn is not supported");
}
/**
* Public View Functions
*/
function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(tokenId > 0 && _exists(tokenId), "Token does not exist.");
return string(abi.encodePacked(_baseURI, Strings.toString(tokenId)));
}
function mintingOpen(uint256 mintList) public view returns (bool) {
return _canMint[mintList];
}
function getMaxSupply() public view returns (uint128) {
return _getMaxSupply() - 1; // Account for having Zero TokenId burnt
}
function totalSupply() public view virtual override returns (uint256) {
return _owners.length - 1; // Subtract Zero TokenId burnt
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index + 1 < _owners.length, "ERC721Enumerable: global index out of bounds");
return index + 1;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC2981, ERC721Enumerable)
returns (bool)
{
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* Internal Functions
*/
function _buy(
uint256 mintList,
uint256 nonceSeq,
uint256 numTokens
) internal {
require(numTokens > 0 && numTokens <= 10, "numTokens must be between 1 and 10");
require(_canMint[mintList], "mintList not open");
require(_nonceUsed[nonceSeq] == false, "Nonce already used");
_nonceUsed[nonceSeq] = true;
_mintTokens(numTokens);
}
function _mintTokens(uint256 numTokens) internal {
uint256 nextTokenId = _owners.length;
require(nextTokenId + numTokens <= _getMaxSupply(), "Cannot exceed maxSupply");
for (uint256 i = 0; i < numTokens; i++) {
_safeMint(msg.sender);
}
}
/**
* @dev Added nonce and contract address in sig to guard against replay attacks
*/
function checkSig(
uint256 mintList,
uint256 numTokens,
uint256 nonceSeq,
address user,
uint256 price,
bytes memory sig
) internal view returns (bool) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encode(mintList, numTokens, nonceSeq, address(this), user, price))
)
);
return _signerAddress == hash.recover(sig);
}
/**
* @dev this function is designed to allow the compiler to inline.
* @return the real max supply plus one, because token IDs start at one.
*/
function _getMaxSupply() internal view returns (uint128) {
if (_maxSupply == 0) {
// We actually have 8888 tokens, we're just starting at ID 1
return 8889;
}
return _maxSupply;
}
/**
* Owner Functions
*/
/**
* @notice Owner must mint before the sale starts, to get the first 250 tokens.
* @dev We're avoiding using {balanceOf} because it would use up a lot of gas.
*/
function ownerMint(uint256 numTokens) external onlyOwner {
require(totalSupply() + numTokens <= 250, "Owner cannot mint more than 250 tokens");
_mintTokens(numTokens);
}
function setBaseURI(string memory baseURI) public onlyOwner {
require(!_locked, "Contract locked");
_baseURI = baseURI;
}
function setMintingOpen(uint256 mintList, bool isOpen) public onlyOwner {
require(!_locked, "Contract locked");
_canMint[mintList] = isOpen;
}
function changeSigner(address signerAddress) public onlyOwner {
require(!_locked, "Contract locked");
_signerAddress = signerAddress;
}
function updateMaxSupply(uint128 maxSupply) public onlyOwner {
require(!_locked, "Contract locked");
require(totalSupply() <= maxSupply, "Cannot be below totalSupply");
// Adding 1 due to burning token 0
_maxSupply = maxSupply + 1;
}
function lockContract() public onlyOwner {
_locked = true;
}
function withdraw(uint256 amount, address payable to) public onlyOwner {
require(amount <= address(this).balance, "Cannot withdraw more than current balance");
to.transfer(amount);
}
/**
* @dev External onlyOwner version of {ERC2981-_setDefaultRoyalty}.
*/
function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
/**
* @dev External onlyOwner version of {ERC2981-_deleteDefaultRoyalty}.
*/
function deleteDefaultRoyalty() external onlyOwner {
_deleteDefaultRoyalty();
}
/**
* @dev External onlyOwner version of {ERC2981-_setTokenRoyalty}.
*/
function setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) external onlyOwner {
_setTokenRoyalty(tokenId, receiver, feeNumerator);
}
/**
* @dev External onlyOwner version of {ERC2981-_resetTokenRoyalty}.
*/
function resetTokenRoyalty(uint256 tokenId) external onlyOwner {
_resetTokenRoyalty(tokenId);
}
}
ERC721.sol 350 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./Address.sol";
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
string private _name;
string private _symbol;
// Mapping from token ID to owner address
address[] internal _owners;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
uint256 count;
for (uint256 i; i < _owners.length; ++i) {
if (owner == _owners[i]) ++count;
}
return count;
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId < _owners.length && _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to) internal virtual {
_safeMint(to, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, bytes memory _data) internal virtual {
uint256 tokenId = _mint(to);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to) internal virtual returns (uint256) {
require(to != address(0), "ERC721: mint to the zero address");
uint256 tokenId = _owners.length;
_owners.push(to);
emit Transfer(address(0), to, tokenId);
return tokenId;
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
// Clear approvals
_approve(address(0), tokenId);
_owners[tokenId] = address(0);
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
}
Address.sol 12 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
library Address {
function isContract(address account) internal view returns (bool) {
uint size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
}
ERC721Enumerable.sol 52 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account but rips out the core of the gas-wasting processing that comes from OpenZeppelin.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _owners.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < _owners.length, "ERC721Enumerable: global index out of bounds");
return index;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256 tokenId) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
uint count;
for(uint i; i < _owners.length; i++){
if(owner == _owners[i]){
if(count == index) return i;
else count++;
}
}
revert("ERC721Enumerable: owner index out of bounds");
}
}
ERC2981.sol 112 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "./IERC2981.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `tokenId` must be already minted.
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
IERC2981.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 68 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
IERC721.sol 129 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
ECDSA.sol 111 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
// Divide the signature in r, s and v variables
bytes32 r;
bytes32 s;
uint8 v;
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solhint-disable-next-line no-inline-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
} else if (signature.length == 64) {
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solhint-disable-next-line no-inline-assembly
assembly {
let vs := mload(add(signature, 0x40))
r := mload(add(signature, 0x20))
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
} else {
revert("ECDSA: invalid signature length");
}
return recover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value");
require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
require(signer != address(0), "ECDSA: invalid signature");
return signer;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 21 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
_signerAddress 0xc1df6538 → address
balanceOf 0x70a08231 → uint256
burn 0x42966c68
getApproved 0x081812fc → address
getMaxSupply 0x4c0f38c2 → uint128
isApprovedForAll 0xe985e9c5 → bool
mintingOpen 0x61c2654b → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
buy 0xbfc78b2d
uint256 mintList
uint256 nonceSeq
uint256 numTokens
bytes sig
changeSigner 0xaad2b723
address signerAddress
deleteDefaultRoyalty 0xaa1b103f
No parameters
lockContract 0x753868e3
No parameters
ownerMint 0xf19e75d4
uint256 numTokens
renounceOwnership 0x715018a6
No parameters
resetTokenRoyalty 0x8a616bc0
uint256 tokenId
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string baseURI
setDefaultRoyalty 0x04634d8d
address receiver
uint96 feeNumerator
setMintingOpen 0x1414124a
uint256 mintList
bool isOpen
setTokenRoyalty 0x5944c753
uint256 tokenId
address receiver
uint96 feeNumerator
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateMaxSupply 0x0e208d08
uint128 maxSupply
withdraw 0x00f714ce
uint256 amount
address to
Top Interactions
| Address | Txns | Sent | Received |
|---|---|---|---|
| 0xfe6687DE...fFF4 | 1 | 1 |
Recent Transactions
|
| Hash | Block | Age | From/To | Value | |
|---|---|---|---|---|---|
| 0x15d4ad0c...06ddaf | 24,310,326 | IN | 0xfe6687DE...fFF4 | 0 ETH |