Address Contract Verified
Address
0xC4638af1e01720C4B5df3Bc8D833db6be85d2211
Balance
0 ETH
Nonce
1
Code Size
13235 bytes
Creator
0xc44a1c9e...BD67 at tx 0x26dd34ba...902c65
Indexed Transactions
0
Contract Bytecode
13235 bytes
0x6080604052600436106102c85760003560e01c806370a0823111610175578063a51312c8116100dc578063d832b87a11610095578063f2fde38b1161006f578063f2fde38b14610872578063f3fef3a314610892578063f51f96dd146108b2578063fd5e9177146108c857600080fd5b8063d832b87a146107e7578063df9ffc2d146107fc578063e985e9c51461082957600080fd5b8063a51312c81461073b578063a626b7611461075b578063a82524b21461077c578063b88d4fde14610792578063c87b56dd146107b2578063d7c3d774146107d257600080fd5b80638da5cb5b1161012e5780638da5cb5b1461069e57806395d89b41146106bc57806397304ced146106d1578063a035b1fe146106f1578063a22cb46514610706578063a4331d2d1461072657600080fd5b806370a08231146105db578063715018a6146105fb5780637263cfe21461061057806373f4de9f146106305780637a44c2971461065057806389c75b321461067e57600080fd5b80632f745c5911610234578063525b3fe3116101ed5780635868c32a116101c75780635868c32a146105715780636352211e1461058757806368428a1b146105a757806369c51730146105c157600080fd5b8063525b3fe31461050b57806353135ca01461053757806355f804b31461055157600080fd5b80632f745c591461045657806342842e0e14610476578063463f99d314610496578063469f42a9146104ab5780634c6865e5146104cb5780634f6ccce7146104eb57600080fd5b8063095ea7b311610286578063095ea7b3146103b75780630c41f497146103d757806318160ddd146103ec57806323b872dd146104015780632967aa74146104215780632ddcb21f1461044157600080fd5b80620e7fa8146102cd57806301173a74146102f657806301ffc9a71461031657806306fdde0314610346578063070f5c0914610368578063081812fc1461037f575b600080fd5b3480156102d957600080fd5b506102e360105481565b6040519081526020015b60405180910390f35b34801561030257600080fd5b506102e3610311366004612bb8565b6108e8565b34801561032257600080fd5b50610336610331366004612de7565b610a19565b60405190151581526020016102ed565b34801561035257600080fd5b5061035b610a44565b6040516102ed9190612fe4565b34801561037457600080fd5b5061037d610ad6565b005b34801561038b57600080fd5b5061039f61039a366004612e8e565b610b8e565b6040516001600160a01b0390911681526020016102ed565b3480156103c357600080fd5b5061037d6103d2366004612bd5565b610c23565b3480156103e357600080fd5b5061037d610d39565b3480156103f857600080fd5b506008546102e3565b34801561040d57600080fd5b5061037d61041c366004612c3a565b610ded565b34801561042d57600080fd5b5061037d61043c366004612ea7565b610e1e565b34801561044d57600080fd5b506018546102e3565b34801561046257600080fd5b506102e3610471366004612bd5565b610efa565b34801561048257600080fd5b5061037d610491366004612c3a565b610f90565b3480156104a257600080fd5b506019546102e3565b3480156104b757600080fd5b5061037d6104c6366004612edc565b610fab565b3480156104d757600080fd5b5061037d6104e6366004612e6a565b61107b565b3480156104f757600080fd5b506102e3610506366004612e8e565b6110c5565b34801561051757600080fd5b50600f546105259060ff1681565b60405160ff90911681526020016102ed565b34801561054357600080fd5b506011546103369060ff1681565b34801561055d57600080fd5b5061037d61056c366004612e21565b611158565b34801561057d57600080fd5b506102e360125481565b34801561059357600080fd5b5061039f6105a2366004612e8e565b611199565b3480156105b357600080fd5b506016546103369060ff1681565b3480156105cd57600080fd5b506014546105259060ff1681565b3480156105e757600080fd5b506102e36105f6366004612bb8565b611210565b34801561060757600080fd5b5061037d611297565b34801561061c57600080fd5b5061037d61062b366004612d2e565b6112cd565b34801561063c57600080fd5b5061033661064b366004612bb8565b611406565b34801561065c57600080fd5b50601a5461066b9061ffff1681565b60405161ffff90911681526020016102ed565b34801561068a57600080fd5b5061037d610699366004612e6a565b611413565b3480156106aa57600080fd5b50600a546001600160a01b031661039f565b3480156106c857600080fd5b5061035b611455565b6106e46106df366004612e8e565b611464565b6040516102ed9190612fa0565b3480156106fd57600080fd5b506102e36115ec565b34801561071257600080fd5b5061037d610721366004612cfb565b611668565b34801561073257600080fd5b506102e3611726565b34801561074757600080fd5b5061037d610756366004612d2e565b61173f565b34801561076757600080fd5b50601a5461066b9062010000900461ffff1681565b34801561078857600080fd5b506102e360135481565b34801561079e57600080fd5b5061037d6107ad366004612c7b565b61187d565b3480156107be57600080fd5b5061035b6107cd366004612e8e565b6118b5565b3480156107de57600080fd5b506102e3611990565b3480156107f357600080fd5b506102e3611a3b565b34801561080857600080fd5b506102e3610817366004612bb8565b600e6020526000908152604090205481565b34801561083557600080fd5b50610336610844366004612c01565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561087e57600080fd5b5061037d61088d366004612bb8565b611a47565b34801561089e57600080fd5b5061037d6108ad366004612bd5565b611ae2565b3480156108be57600080fd5b506102e360155481565b3480156108d457600080fd5b5061039f6108e3366004612e8e565b611b4f565b600a546000906001600160a01b0316331461091e5760405162461bcd60e51b81526004016109159061308c565b60405180910390fd5b6002600b5414156109715760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610915565b6002600b556001600160a01b03821661098957600080fd5b610991611726565b60085410156109e25760405162461bcd60e51b815260206004820152601c60248201527f44413a205075626c6963206d696e74696e6720697320616374697665000000006044820152606401610915565b60185460085410610a055760405162461bcd60e51b815260040161091590613049565b610a0e82611bb4565b6001600b5592915050565b60006001600160e01b0319821663780e9d6360e01b1480610a3e5750610a3e82611bd7565b92915050565b606060008054610a539061327a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7f9061327a565b8015610acc5780601f10610aa157610100808354040283529160200191610acc565b820191906000526020600020905b815481529060010190602001808311610aaf57829003601f168201915b5050505050905090565b600a546001600160a01b03163314610b005760405162461bcd60e51b81526004016109159061308c565b60115460ff16610b4e5760405162461bcd60e51b815260206004820152601960248201527844413a2050726573616c65206973206e6f742061637469766560381b6044820152606401610915565b6011805460ff19169055600854610b63611c27565b6040517f927e6cd2dce24f32508868820cdc35f09d9de0f4b44e945114110125196fba9f90600090a3565b6000818152600260205260408120546001600160a01b0316610c075760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610915565b506000908152600460205260409020546001600160a01b031690565b6000610c2e82611199565b9050806001600160a01b0316836001600160a01b03161415610c9c5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610915565b336001600160a01b0382161480610cb85750610cb88133610844565b610d2a5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610915565b610d348383611c45565b505050565b600a546001600160a01b03163314610d635760405162461bcd60e51b81526004016109159061308c565b60165460ff16610dae5760405162461bcd60e51b815260206004820152601660248201527544413a2053616c65206973206e6f742061637469766560501b6044820152606401610915565b6016805460ff1916905542610dc260085490565b6040517f15b4b3d2d25688c15ceeb8688ce5149f4a6e1a71e0df748b16be5a0dd04b607b90600090a3565b610df73382611cb3565b610e135760405162461bcd60e51b8152600401610915906130c1565b610d34838383611daa565b600a546001600160a01b03163314610e485760405162461bcd60e51b81526004016109159061308c565b60115460ff1615610e6b5760405162461bcd60e51b815260040161091590613184565b60165460ff1615610e8e5760405162461bcd60e51b815260040161091590613154565b42601381905560128490556010839055600f805460ff841660ff19918216811790925560118054909116600117905560405190815283919085907f615b78b080cf106121bbadd660087f35a15458e426e5678e59eff7c73a22f57c9060200160405180910390a4505050565b6000610f0583611210565b8210610f675760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610915565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b610d348383836040518060200160405280600081525061187d565b600a546001600160a01b03163314610fd55760405162461bcd60e51b81526004016109159061308c565b60115460ff1615610ff85760405162461bcd60e51b815260040161091590613184565b60165460ff161561101b5760405162461bcd60e51b815260040161091590613154565b60158290556014805460ff831660ff199182168117909255601680549091166001179055604051908152829042907f7ef3f57c7c810470372424b8e303f632778f314d2366d9239c0d6fad781da66d906020015b60405180910390a35050565b600a546001600160a01b031633146110a55760405162461bcd60e51b81526004016109159061308c565b601a805461ffff909216620100000263ffff000019909216919091179055565b60006110d060085490565b82106111335760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610915565b6008828154811061114657611146613326565b90600052602060002001549050919050565b600a546001600160a01b031633146111825760405162461bcd60e51b81526004016109159061308c565b8051611195906017906020840190612ab1565b5050565b6000818152600260205260408120546001600160a01b031680610a3e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610915565b60006001600160a01b03821661127b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610915565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146112c15760405162461bcd60e51b81526004016109159061308c565b6112cb6000611f55565b565b600a546001600160a01b031633146112f75760405162461bcd60e51b81526004016109159061308c565b60115460ff161561131a5760405162461bcd60e51b815260040161091590613184565b60165460ff161561133d5760405162461bcd60e51b815260040161091590613154565b601a54815161ffff90911610156113665760405162461bcd60e51b815260040161091590613112565b60005b81518110156111955761139f82828151811061138757611387613326565b6020026020010151600c611fa790919063ffffffff16565b156113f4578181815181106113b6576113b6613326565b60200260200101516001600160a01b03167fa29fd8e8b328183429f81e3acc10dc14196777efa4ccd23165f71d4dd027ac1b60405160405180910390a25b6113ff6001826131ec565b9050611369565b6000610a3e600c83611fbc565b600a546001600160a01b0316331461143d5760405162461bcd60e51b81526004016109159061308c565b601a805461ffff191661ffff92909216919091179055565b606060018054610a539061327a565b60115460609060ff168061147a575060165460ff165b6114c65760405162461bcd60e51b815260206004820152601a60248201527f44413a20416e792073616c65206973207465726d696e617465640000000000006044820152606401610915565b6002600b5414156115195760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610915565b6002600b5561152782611fde565b60008267ffffffffffffffff8111156115425761154261333c565b60405190808252806020026020018201604052801561156b578160200160208202803683370190505b50905060005b838110156115b15761158233611bb4565b82828151811061159457611594613326565b60209081029190910101526115aa6001826131ec565b9050611571565b5060115460ff1615610a0e57336000908152600e6020526040812080548592906115dc9084906131ec565b90915550506001600b5592915050565b60115460009060ff1680611602575060165460ff165b61164e5760405162461bcd60e51b815260206004820152601a60248201527f44413a20416e792073616c65206973207465726d696e617465640000000000006044820152606401610915565b60115460ff1661165f575060155490565b6010545b905090565b6001600160a01b0382163314156116c15760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610915565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910161106f565b600061173160195490565b6018545b6116639190613237565b600a546001600160a01b031633146117695760405162461bcd60e51b81526004016109159061308c565b60115460ff161561178c5760405162461bcd60e51b815260040161091590613184565b60165460ff16156117af5760405162461bcd60e51b815260040161091590613154565b601a5481516201000090910461ffff1610156117dd5760405162461bcd60e51b815260040161091590613112565b60005b8151811015611195576118168282815181106117fe576117fe613326565b6020026020010151600c6122b290919063ffffffff16565b1561186b5781818151811061182d5761182d613326565b60200260200101516001600160a01b03167f29beb8aae77ba82cbb9d5a13ac9153539286534ddea0dc0a0aa61c484585a61460405160405180910390a25b6118766001826131ec565b90506117e0565b6118873383611cb3565b6118a35760405162461bcd60e51b8152600401610915906130c1565b6118af848484846122c7565b50505050565b6000818152600260205260409020546060906001600160a01b03166119345760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610915565b600061193e6122fa565b9050600081511161195e5760405180602001604052806000815250611989565b8061196884612309565b604051602001611979929190612f34565b6040516020818303038152906040525b9392505050565b60115460009060ff166119e15760405162461bcd60e51b815260206004820152601960248201527844413a2050726573616c65206973206e6f742061637469766560381b6044820152606401610915565b600060135411611a335760405162461bcd60e51b815260206004820152601e60248201527f44413a2050726573616c65206861736e277420737461727465642079657400006044820152606401610915565b611663612407565b6000611663600c61243f565b600a546001600160a01b03163314611a715760405162461bcd60e51b81526004016109159061308c565b6001600160a01b038116611ad65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610915565b611adf81611f55565b50565b600a546001600160a01b03163314611b0c5760405162461bcd60e51b81526004016109159061308c565b47811115611b1957600080fd5b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610d34573d6000803e3d6000fd5b6000611b5b600c61243f565b8210611ba95760405162461bcd60e51b815260206004820152601760248201527f44413a20496e646578206f7574206f6620626f756e64730000000000000000006044820152606401610915565b610a3e600c83612449565b600080611bc060085490565b611bcb9060016131ec565b9050610a3e8382612455565b60006001600160e01b031982166380ac58cd60e01b1480611c0857506001600160e01b03198216635b5e139f60e01b145b80610a3e57506301ffc9a760e01b6001600160e01b0319831614610a3e565b60008060135411611c385750600090565b6013546116639042613237565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611c7a82611199565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316611d2c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610915565b6000611d3783611199565b9050806001600160a01b0316846001600160a01b03161480611d725750836001600160a01b0316611d6784610b8e565b6001600160a01b0316145b80611da257506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611dbd82611199565b6001600160a01b031614611e255760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610915565b6001600160a01b038216611e875760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610915565b611e9283838361246f565b611e9d600082611c45565b6001600160a01b0383166000908152600360205260408120805460019290611ec6908490613237565b90915550506001600160a01b0382166000908152600360205260408120805460019290611ef49084906131ec565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611989836001600160a01b038416612527565b6001600160a01b03811660009081526001830160205260408120541515611989565b33611fe857600080fd5b600081116120385760405162461bcd60e51b815260206004820181905260248201527f44413a204d757374206d696e74206174206c65617374206f6e6520746f6b656e6044820152606401610915565b612040611726565b8161204a60085490565b61205491906131ec565b11156120725760405162461bcd60e51b815260040161091590613049565b60115460ff1615612207576000612087612407565b116120ca5760405162461bcd60e51b815260206004820152601360248201527222209d10283932b9b0b6329034b99037bb32b960691b6044820152606401610915565b6120d333611406565b61212b5760405162461bcd60e51b815260206004820152602360248201527f44413a20416464726573732069736e277420696e2074686520616c6c6f77206c6044820152621a5cdd60ea1b6064820152608401610915565b600f54336000908152600e602052604090205460ff9091169061214e90836131ec565b11156121aa5760405162461bcd60e51b815260206004820152602560248201527f44413a2050726573616c652c206c696d6974656420616d6f756e74206f6620746044820152646f6b656e7360d81b6064820152608401610915565b34816010546121b99190613218565b1115611adf5760405162461bcd60e51b815260206004820152601f60248201527f44413a2050726573616c652c20696e73756666696369656e742066756e6473006044820152606401610915565b60145460ff1681111561225c5760405162461bcd60e51b815260206004820152601c60248201527f44413a204c696d6974656420616d6f756e74206f6620746f6b656e73000000006044820152606401610915565b348160155461226b9190613218565b1115611adf5760405162461bcd60e51b815260206004820152601660248201527544413a20496e73756666696369656e742066756e647360501b6044820152606401610915565b6000611989836001600160a01b038416612576565b6122d2848484611daa565b6122de84848484612669565b6118af5760405162461bcd60e51b815260040161091590612ff7565b606060178054610a539061327a565b60608161232d5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156123575780612341816132b5565b91506123509050600a83613204565b9150612331565b60008167ffffffffffffffff8111156123725761237261333c565b6040519080825280601f01601f19166020018201604052801561239c576020820181803683370190505b5090505b8415611da2576123b1600183613237565b91506123be600a866132d0565b6123c99060306131ec565b60f81b8183815181106123de576123de613326565b60200101906001600160f81b031916908160001a905350612400600a86613204565b94506123a0565b6000601354600014806124235750601254612420611c27565b10155b1561242e5750600090565b4260125460135461173591906131ec565b6000610a3e825490565b60006119898383612776565b6111958282604051806020016040528060008152506127a0565b6001600160a01b0383166124ca576124c581600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6124ed565b816001600160a01b0316836001600160a01b0316146124ed576124ed83826127d3565b6001600160a01b03821661250457610d3481612870565b826001600160a01b0316826001600160a01b031614610d3457610d34828261291f565b600081815260018301602052604081205461256e57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a3e565b506000610a3e565b6000818152600183016020526040812054801561265f57600061259a600183613237565b85549091506000906125ae90600190613237565b90508181146126135760008660000182815481106125ce576125ce613326565b90600052602060002001549050808760000184815481106125f1576125f1613326565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061262457612624613310565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a3e565b6000915050610a3e565b60006001600160a01b0384163b1561276b57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906126ad903390899088908890600401612f63565b602060405180830381600087803b1580156126c757600080fd5b505af19250505080156126f7575060408051601f3d908101601f191682019092526126f491810190612e04565b60015b612751573d808015612725576040519150601f19603f3d011682016040523d82523d6000602084013e61272a565b606091505b5080516127495760405162461bcd60e51b815260040161091590612ff7565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611da2565b506001949350505050565b600082600001828154811061278d5761278d613326565b9060005260206000200154905092915050565b6127aa8383612963565b6127b76000848484612669565b610d345760405162461bcd60e51b815260040161091590612ff7565b600060016127e084611210565b6127ea9190613237565b60008381526007602052604090205490915080821461283d576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061288290600190613237565b600083815260096020526040812054600880549394509092849081106128aa576128aa613326565b9060005260206000200154905080600883815481106128cb576128cb613326565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061290357612903613310565b6001900381819060005260206000200160009055905550505050565b600061292a83611210565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166129b95760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610915565b6000818152600260205260409020546001600160a01b031615612a1e5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610915565b612a2a6000838361246f565b6001600160a01b0382166000908152600360205260408120805460019290612a539084906131ec565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054612abd9061327a565b90600052602060002090601f016020900481019282612adf5760008555612b25565b82601f10612af857805160ff1916838001178555612b25565b82800160010185558215612b25579182015b82811115612b25578251825591602001919060010190612b0a565b50612b31929150612b35565b5090565b5b80821115612b315760008155600101612b36565b600067ffffffffffffffff831115612b6457612b6461333c565b612b77601f8401601f19166020016131bb565b9050828152838383011115612b8b57600080fd5b828260208301376000602084830101529392505050565b803560ff81168114612bb357600080fd5b919050565b600060208284031215612bca57600080fd5b813561198981613352565b60008060408385031215612be857600080fd5b8235612bf381613352565b946020939093013593505050565b60008060408385031215612c1457600080fd5b8235612c1f81613352565b91506020830135612c2f81613352565b809150509250929050565b600080600060608486031215612c4f57600080fd5b8335612c5a81613352565b92506020840135612c6a81613352565b929592945050506040919091013590565b60008060008060808587031215612c9157600080fd5b8435612c9c81613352565b93506020850135612cac81613352565b925060408501359150606085013567ffffffffffffffff811115612ccf57600080fd5b8501601f81018713612ce057600080fd5b612cef87823560208401612b4a565b91505092959194509250565b60008060408385031215612d0e57600080fd5b8235612d1981613352565b915060208301358015158114612c2f57600080fd5b60006020808385031215612d4157600080fd5b823567ffffffffffffffff80821115612d5957600080fd5b818501915085601f830112612d6d57600080fd5b813581811115612d7f57612d7f61333c565b8060051b9150612d908483016131bb565b8181528481019084860184860187018a1015612dab57600080fd5b600095505b83861015612dda5780359450612dc585613352565b84835260019590950194918601918601612db0565b5098975050505050505050565b600060208284031215612df957600080fd5b813561198981613367565b600060208284031215612e1657600080fd5b815161198981613367565b600060208284031215612e3357600080fd5b813567ffffffffffffffff811115612e4a57600080fd5b8201601f81018413612e5b57600080fd5b611da284823560208401612b4a565b600060208284031215612e7c57600080fd5b813561ffff8116811461198957600080fd5b600060208284031215612ea057600080fd5b5035919050565b600080600060608486031215612ebc57600080fd5b8335925060208401359150612ed360408501612ba2565b90509250925092565b60008060408385031215612eef57600080fd5b82359150612eff60208401612ba2565b90509250929050565b60008151808452612f2081602086016020860161324e565b601f01601f19169290920160200192915050565b60008351612f4681846020880161324e565b835190830190612f5a81836020880161324e565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612f9690830184612f08565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612fd857835183529284019291840191600101612fbc565b50909695505050505050565b6020815260006119896020830184612f08565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526023908201527f44413a204d696e74696e6720776f756c6420657863656564206d617820737570604082015262706c7960e81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526022908201527f44413a204c697374206f662061646472657373657320697320746f6f206c6172604082015261676560f01b606082015260800190565b60208082526016908201527511104e8814d85b19481a5cc81b9bdd081c185d5cd95960521b604082015260600190565b60208082526019908201527f44413a2050726573616c65206973206e6f742070617573656400000000000000604082015260600190565b604051601f8201601f1916810167ffffffffffffffff811182821017156131e4576131e461333c565b604052919050565b600082198211156131ff576131ff6132e4565b500190565b600082613213576132136132fa565b500490565b6000816000190483118215151615613232576132326132e4565b500290565b600082821015613249576132496132e4565b500390565b60005b83811015613269578181015183820152602001613251565b838111156118af5750506000910152565b600181811c9082168061328e57607f821691505b602082108114156132af57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156132c9576132c96132e4565b5060010190565b6000826132df576132df6132fa565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611adf57600080fd5b6001600160e01b031981168114611adf57600080fdfea2646970667358221220cb60ac20172e1251975aee1d76e985d81d2d4d04edb346d59895828c3745d33564736f6c63430008060033
Verified Source Code Full Match
Compiler: v0.8.6+commit.11564f7e
EVM: berlin
Optimization: Yes (200 runs)
Address.sol 210 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 23 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) {
return msg.data;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "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] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 71 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() {
_setOwner(_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 {
_setOwner(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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
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");
return _balances[owner];
}
/**
* @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 {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @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 _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, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @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,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
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, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, 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);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
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");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_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(to).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;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 142 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;
}
ReentrancyGuard.sol 62 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
Token.sol 241 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
contract Token is ERC721Enumerable, Ownable, ReentrancyGuard {
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet private _allowList;
event AddedToAllowList(address indexed _address);
event RemovedFromAllowList(address indexed _address);
mapping(address => uint) public presalePurchasedAmount;
uint8 public presaleLimit;
uint256 public presalePrice;
bool public presaleActive;
uint256 public presaleDuration;
uint256 public presaleStartTime;
event PresaleStart(
uint256 indexed _presaleDuration, uint256 indexed _presaleStartTime,
uint256 indexed _presalePrice, uint8 _presaleLimit
);
event PresalePaused(uint256 indexed _timeElapsed, uint256 indexed _totalSupply);
uint8 public saleTransactionLimit;
uint256 public salePrice;
bool public saleActive;
event SaleStart(uint256 indexed _saleStartTime, uint256 indexed _salePrice, uint8 _saleLimit);
event SalePaused(uint256 indexed _salePauseTime, uint256 indexed _totalSupply);
string private _baseTokenURI;
uint256 private _limitSupply;
uint256 private _ownerLimit;
uint16 public addToAllowListLimit;
uint16 public removeFromAllowListLimit;
modifier whenPresaleActive() {
require(presaleActive, "DA: Presale is not active");
_;
}
modifier whenPresalePaused() {
require(!presaleActive, "DA: Presale is not paused");
_;
}
modifier whenSaleActive() {
require(saleActive, "DA: Sale is not active");
_;
}
modifier whenSalePaused() {
require(!saleActive, "DA: Sale is not paused");
_;
}
modifier whenAnySaleActive() {
require(presaleActive || saleActive, "DA: Any sale is terminated");
_;
}
constructor(
string memory name_, string memory symbol_, string memory baseURI_, uint256 limitSupply_, uint256 ownerLimit_,
uint16 addToAllowListLimit_, uint16 removeFromAllowListLimit_
) ERC721(name_, symbol_) {
_baseTokenURI = baseURI_;
_limitSupply = limitSupply_;
_ownerLimit = ownerLimit_;
addToAllowListLimit = addToAllowListLimit_;
removeFromAllowListLimit = removeFromAllowListLimit_;
}
function limitSupply() public view virtual returns (uint256) {
return _limitSupply;
}
function ownerLimit() public view virtual returns (uint256) {
return _ownerLimit;
}
function publicLimit() public view virtual returns (uint256) {
return limitSupply() - ownerLimit();
}
function setBaseURI(string memory baseURI_) public onlyOwner {
_baseTokenURI = baseURI_;
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
function setAddToAllowListLimit(uint16 addToAllowListLimit_) external onlyOwner {
addToAllowListLimit = addToAllowListLimit_;
}
function setRemoveFromAllowListLimit(uint16 removeFromAllowListLimit_) external onlyOwner {
removeFromAllowListLimit = removeFromAllowListLimit_;
}
function addToAllowList(address[] memory addresses) external onlyOwner whenPresalePaused whenSalePaused {
require(addresses.length <= addToAllowListLimit, "DA: List of addresses is too large");
for(uint index = 0; index < addresses.length; index+=1) {
if (_allowList.add(addresses[index])) {
emit AddedToAllowList(addresses[index]);
}
}
}
function removeFromAllowList(address[] memory addresses) external onlyOwner whenPresalePaused whenSalePaused {
require(addresses.length <= removeFromAllowListLimit, "DA: List of addresses is too large");
for(uint index = 0; index < addresses.length; index+=1) {
if (_allowList.remove(addresses[index])) {
emit RemovedFromAllowList(addresses[index]);
}
}
}
function inAllowList(address value) public view returns (bool) {
return _allowList.contains(value);
}
function allowListLength() external view returns (uint256) {
return _allowList.length();
}
function allowAddressByIndex(uint256 index) external view returns (address) {
require(index < _allowList.length(), "DA: Index out of bounds");
return _allowList.at(index);
}
function startPresale(
uint256 presaleDuration_, uint256 presalePrice_, uint8 presaleLimit_
) external onlyOwner whenPresalePaused whenSalePaused {
presaleStartTime = block.timestamp;
presaleDuration = presaleDuration_;
presalePrice = presalePrice_;
presaleLimit = presaleLimit_;
presaleActive = true;
emit PresaleStart(presaleDuration, presaleStartTime, presalePrice, presaleLimit);
}
function pausePresale() external onlyOwner whenPresaleActive {
presaleActive = false;
emit PresalePaused(_elapsedPresaleTime(), totalSupply());
}
function startPublicSale(uint256 salePrice_, uint8 saleTransactionLimit_) external onlyOwner whenPresalePaused whenSalePaused {
salePrice = salePrice_;
saleTransactionLimit = saleTransactionLimit_;
saleActive = true;
emit SaleStart(block.timestamp, salePrice, saleTransactionLimit);
}
function pausePublicSale() external onlyOwner whenSaleActive {
saleActive = false;
emit SalePaused(totalSupply(), block.timestamp);
}
function price() external view whenAnySaleActive returns (uint256) {
return presaleActive ? presalePrice : salePrice;
}
function _elapsedPresaleTime() internal view returns (uint256) {
return presaleStartTime > 0 ? block.timestamp - presaleStartTime : 0;
}
function _remainingPresaleTime() internal view returns (uint256) {
if (presaleStartTime == 0 || _elapsedPresaleTime() >= presaleDuration) {
return 0;
}
return (presaleStartTime + presaleDuration) - block.timestamp;
}
function remainingPresaleTime() external view whenPresaleActive returns (uint256) {
require(presaleStartTime > 0, "DA: Presale hasn't started yet");
return _remainingPresaleTime();
}
function _preValidatePurchase(uint256 tokensAmount) internal view {
require(msg.sender != address(0));
require(tokensAmount > 0, "DA: Must mint at least one token");
require(totalSupply() + tokensAmount <= publicLimit(), "DA: Minting would exceed max supply");
if (presaleActive) {
require(_remainingPresaleTime() > 0, "DA: Presale is over");
require(inAllowList(msg.sender), "DA: Address isn't in the allow list");
require(tokensAmount + presalePurchasedAmount[msg.sender] <= presaleLimit, "DA: Presale, limited amount of tokens");
require(presalePrice * tokensAmount <= msg.value, "DA: Presale, insufficient funds");
} else {
require(tokensAmount <= saleTransactionLimit, "DA: Limited amount of tokens");
require(salePrice * tokensAmount <= msg.value, "DA: Insufficient funds");
}
}
function _processPurchaseToken(address recipient) internal returns (uint256) {
uint256 newItemId = totalSupply() + 1;
_safeMint(recipient, newItemId);
return newItemId;
}
function mintTokens(uint256 tokensAmount) external payable whenAnySaleActive nonReentrant returns (uint256[] memory) {
_preValidatePurchase(tokensAmount);
uint256[] memory tokens = new uint256[](tokensAmount);
for (uint index = 0; index < tokensAmount; index += 1) {
tokens[index] = _processPurchaseToken(msg.sender);
}
if (presaleActive) {
presalePurchasedAmount[msg.sender] += tokensAmount;
}
return tokens;
}
function mintToken(address recipient) external onlyOwner nonReentrant returns (uint256) {
require(recipient != address(0));
require(totalSupply() >= publicLimit(), "DA: Public minting is active");
require(totalSupply() < limitSupply(), "DA: Minting would exceed max supply");
return _processPurchaseToken(recipient);
}
function withdraw(address payable wallet, uint256 amount) external onlyOwner {
require(amount <= address(this).balance);
wallet.transfer(amount);
}
}
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);
}
EnumerableSet.sol 294 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
IERC721Receiver.sol 26 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 26 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);
}
ERC721Enumerable.sol 162 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./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.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @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-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 28 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
addToAllowListLimit 0x7a44c297 → uint16
allowAddressByIndex 0xfd5e9177 → address
allowListLength 0xd832b87a → uint256
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
inAllowList 0x73f4de9f → bool
isApprovedForAll 0xe985e9c5 → bool
limitSupply 0x2ddcb21f → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerLimit 0x463f99d3 → uint256
ownerOf 0x6352211e → address
presaleActive 0x53135ca0 → bool
presaleDuration 0x5868c32a → uint256
presaleLimit 0x525b3fe3 → uint8
presalePrice 0x000e7fa8 → uint256
presalePurchasedAmount 0xdf9ffc2d → uint256
presaleStartTime 0xa82524b2 → uint256
price 0xa035b1fe → uint256
publicLimit 0xa4331d2d → uint256
remainingPresaleTime 0xd7c3d774 → uint256
removeFromAllowListLimit 0xa626b761 → uint16
saleActive 0x68428a1b → bool
salePrice 0xf51f96dd → uint256
saleTransactionLimit 0x69c51730 → uint8
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.
addToAllowList 0x7263cfe2
address[] addresses
approve 0x095ea7b3
address to
uint256 tokenId
mintToken 0x01173a74
address recipient
returns: uint256
mintTokens 0x97304ced
uint256 tokensAmount
returns: uint256[]
pausePresale 0x070f5c09
No parameters
pausePublicSale 0x0c41f497
No parameters
removeFromAllowList 0xa51312c8
address[] addresses
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setAddToAllowListLimit 0x89c75b32
uint16 addToAllowListLimit_
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string baseURI_
setRemoveFromAllowListLimit 0x4c6865e5
uint16 removeFromAllowListLimit_
startPresale 0x2967aa74
uint256 presaleDuration_
uint256 presalePrice_
uint8 presaleLimit_
startPublicSale 0x469f42a9
uint256 salePrice_
uint8 saleTransactionLimit_
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0xf3fef3a3
address wallet
uint256 amount
Token Balances (1)
View Transfers →Recent Transactions
No transactions found for this address