Address Contract Verified
Address
0x7D0E26ae212734656f410bDBb53Eb3d665B46b3F
Balance
0 ETH
Nonce
1
Code Size
13096 bytes
Creator
0xF6127CE8...6da1 at tx 0x61e00f39...b0f3c4
Indexed Transactions
0
Contract Bytecode
13096 bytes
0x6080604052600436106103ad5760003560e01c80636c6e927e116101e7578063a0712d681161010d578063d0eb26b0116100a0578063e985e9c51161006f578063e985e9c514610a47578063eced387314610a90578063f2c4ce1e14610aa6578063f2fde38b14610ac657600080fd5b8063d0eb26b0146109db578063d5abeb01146109fb578063d7224ba014610a11578063da3ef23f14610a2757600080fd5b8063ba7d2c76116100dc578063ba7d2c761461097a578063c668286214610990578063c87b56dd146109a5578063cc9ff9c6146109c557600080fd5b8063a0712d6814610911578063a18116f114610924578063a22cb4651461093a578063b88d4fde1461095a57600080fd5b80637967a50a116101855780638da5cb5b116101545780638da5cb5b1461089e5780638fdcf942146108bc578063940cd05b146108dc57806395d89b41146108fc57600080fd5b80637967a50a146108325780637cb64759146108485780637effc0321461086857806383a076be1461087e57600080fd5b806370a08231116101c157806370a08231146107c8578063714c5398146107e8578063715018a6146107fd578063743c7f6b1461081257600080fd5b80636c6e927e1461077d5780636f8b44b0146107935780636f9fb98a146107b357600080fd5b80632e09282e116102d75780634f6ccce71161026a5780636352211e116102395780636352211e1461070857806363bc312a14610728578063669736c0146107485780636c0360eb1461076857600080fd5b80634f6ccce71461068f57806351830227146106af57806355f804b3146106ce5780635c975abb146106ee57600080fd5b806342842e0e116102a657806342842e0e1461060257806342f0ca0d14610622578063438b63001461064257806344a0d68a1461066f57600080fd5b80632e09282e146105ae5780632eb4a7ab146105c45780632f745c59146105da5780633ccfd60b146105fa57600080fd5b80630a50716b1161034f57806318160ddd1161031e57806318160ddd1461052f5780631985cc651461054457806323b872dd1461055a5780632913daa01461057a57600080fd5b80630a50716b146104b85780630c0a6b5e146104d85780630e54a883146104eb57806313faede61461050b57600080fd5b8063081812fc1161038b578063081812fc1461042b578063081c8c4414610463578063095ea7b3146104785780630a403f041461049857600080fd5b806301ffc9a7146103b257806302329a29146103e757806306fdde0314610409575b600080fd5b3480156103be57600080fd5b506103d26103cd366004612be0565b610ae6565b60405190151581526020015b60405180910390f35b3480156103f357600080fd5b50610407610402366004612c0d565b610b53565b005b34801561041557600080fd5b5061041e610b99565b6040516103de9190612c80565b34801561043757600080fd5b5061044b610446366004612c93565b610c2b565b6040516001600160a01b0390911681526020016103de565b34801561046f57600080fd5b5061041e610cb6565b34801561048457600080fd5b50610407610493366004612cc3565b610d44565b3480156104a457600080fd5b506104076104b3366004612c93565b610e5b565b3480156104c457600080fd5b506104076104d3366004612c93565b610e8a565b6104076104e6366004612ced565b610eb9565b3480156104f757600080fd5b50610407610506366004612c93565b611223565b34801561051757600080fd5b50610521600e5481565b6040519081526020016103de565b34801561053b57600080fd5b50610521611252565b34801561055057600080fd5b5061052160155481565b34801561056657600080fd5b50610407610575366004612d6c565b611268565b34801561058657600080fd5b506105217f000000000000000000000000000000000000000000000000000000000000001481565b3480156105ba57600080fd5b5061052160135481565b3480156105d057600080fd5b5061052160185481565b3480156105e657600080fd5b506105216105f5366004612cc3565b611273565b6104076113e9565b34801561060e57600080fd5b5061040761061d366004612d6c565b61146b565b34801561062e57600080fd5b5061040761063d366004612c93565b611486565b34801561064e57600080fd5b5061066261065d366004612da8565b6114b5565b6040516103de9190612dc3565b34801561067b57600080fd5b5061040761068a366004612c93565b611595565b34801561069b57600080fd5b506105216106aa366004612c93565b6115c4565b3480156106bb57600080fd5b506019546103d290610100900460ff1681565b3480156106da57600080fd5b506104076106e9366004612e93565b61162c565b3480156106fa57600080fd5b506019546103d29060ff1681565b34801561071457600080fd5b5061044b610723366004612c93565b61166d565b34801561073457600080fd5b50610407610743366004612c93565b61167f565b34801561075457600080fd5b50610407610763366004612c93565b6116ec565b34801561077457600080fd5b5061041e61171b565b34801561078957600080fd5b5061052160125481565b34801561079f57600080fd5b506104076107ae366004612c93565b611728565b3480156107bf57600080fd5b50610521611757565b3480156107d457600080fd5b506105216107e3366004612da8565b611789565b3480156107f457600080fd5b5061041e61181a565b34801561080957600080fd5b50610407611854565b34801561081e57600080fd5b5061040761082d366004612c93565b61188a565b34801561083e57600080fd5b5061052160165481565b34801561085457600080fd5b50610407610863366004612c93565b6118b9565b34801561087457600080fd5b5061052160115481565b34801561088a57600080fd5b50610407610899366004612edc565b6118e8565b3480156108aa57600080fd5b506008546001600160a01b031661044b565b3480156108c857600080fd5b506104076108d7366004612c93565b6119c4565b3480156108e857600080fd5b506104076108f7366004612c0d565b6119f3565b34801561090857600080fd5b5061041e611a37565b61040761091f366004612c93565b611a46565b34801561093057600080fd5b5061052160105481565b34801561094657600080fd5b50610407610955366004612f08565b611c0e565b34801561096657600080fd5b50610407610975366004612f32565b611cd2565b34801561098657600080fd5b5061052160145481565b34801561099c57600080fd5b5061041e611d05565b3480156109b157600080fd5b5061041e6109c0366004612c93565b611d12565b3480156109d157600080fd5b50610521600d5481565b3480156109e757600080fd5b506104076109f6366004612c93565b611e88565b348015610a0757600080fd5b50610521600f5481565b348015610a1d57600080fd5b5061052160075481565b348015610a3357600080fd5b50610407610a42366004612e93565b611eb7565b348015610a5357600080fd5b506103d2610a62366004612fae565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b348015610a9c57600080fd5b5061052160175481565b348015610ab257600080fd5b50610407610ac1366004612e93565b611ef4565b348015610ad257600080fd5b50610407610ae1366004612da8565b611f31565b60006001600160e01b031982166380ac58cd60e01b1480610b1757506001600160e01b03198216635b5e139f60e01b145b80610b3257506001600160e01b0319821663780e9d6360e01b145b80610b4d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6008546001600160a01b03163314610b865760405162461bcd60e51b8152600401610b7d90612fd8565b60405180910390fd5b6019805460ff1916911515919091179055565b606060018054610ba89061300d565b80601f0160208091040260200160405190810160405280929190818152602001828054610bd49061300d565b8015610c215780601f10610bf657610100808354040283529160200191610c21565b820191906000526020600020905b815481529060010190602001808311610c0457829003601f168201915b5050505050905090565b6000610c38826000541190565b610c9a5760405162461bcd60e51b815260206004820152602d60248201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b6064820152608401610b7d565b506000908152600560205260409020546001600160a01b031690565b600c8054610cc39061300d565b80601f0160208091040260200160405190810160405280929190818152602001828054610cef9061300d565b8015610d3c5780601f10610d1157610100808354040283529160200191610d3c565b820191906000526020600020905b815481529060010190602001808311610d1f57829003601f168201915b505050505081565b6000610d4f8261166d565b9050806001600160a01b0316836001600160a01b031603610dbd5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60448201526132b960f11b6064820152608401610b7d565b336001600160a01b0382161480610dd95750610dd98133610a62565b610e4b5760405162461bcd60e51b815260206004820152603960248201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656420666f7220616c6c000000000000006064820152608401610b7d565b610e56838383611fc9565b505050565b6008546001600160a01b03163314610e855760405162461bcd60e51b8152600401610b7d90612fd8565b601055565b6008546001600160a01b03163314610eb45760405162461bcd60e51b8152600401610b7d90612fd8565b601355565b60195460ff1615610f055760405162461bcd60e51b81526020600482015260166024820152751d1a194818dbdb9d1c9858dd081a5cc81c185d5cd95960521b6044820152606401610b7d565b601554421015610f575760405162461bcd60e51b815260206004820152601b60248201527f50726553616c6520686173206e6f7420737461727465642079657400000000006044820152606401610b7d565b6000610f6233611789565b9050610fd9838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506018546040516bffffffffffffffffffffffff193360601b166020820152909250603401905060405160208183030381529060405280519060200120612025565b6110315760405162461bcd60e51b8152602060048201526024808201527f596f7520617265206e6f7420656c696769626c6520666f72207468652070726560448201526373616c6560e01b6064820152608401610b7d565b60135461103e858361305d565b111561109a5760405162461bcd60e51b815260206004820152602560248201527f50726573616c65206c696d697420666f7220746869732077616c6c65742072656044820152641858da195960da1b6064820152608401610b7d565b6011548411156111035760405162461bcd60e51b815260206004820152602e60248201527f43616e6e6f742070757263686173652074686973206d616e79204e465420696e60448201526d1030903a3930b739b0b1ba34b7b760911b6064820152608401610b7d565b60105484600954611114919061305d565b11156111725760405162461bcd60e51b815260206004820152602760248201527f4d696e74696e6720776f756c64206578636565642050726573616c65206d617860448201526620737570706c7960c81b6064820152608401610b7d565b600084116111c25760405162461bcd60e51b815260206004820152601c60248201527f4d757374206d696e74206174206c65617374206f6e6520746f6b656e000000006044820152606401610b7d565b83600d546111d09190613075565b3410156112135760405162461bcd60e51b815260206004820152601160248201527045544820616d6f756e74206973206c6f7760781b6044820152606401610b7d565b61121d338561203b565b50505050565b6008546001600160a01b0316331461124d5760405162461bcd60e51b8152600401610b7d90612fd8565b601755565b600060016000546112639190613094565b905090565b610e56838383612055565b600061127e83611789565b82106112d75760405162461bcd60e51b815260206004820152602260248201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e604482015261647360f01b6064820152608401610b7d565b60006112e1611252565b905060008060005b83811015611389576000818152600360209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff16918301919091521561133c57805192505b876001600160a01b0316836001600160a01b0316036113765786840361136857509350610b4d92505050565b83611372816130ab565b9450505b5080611381816130ab565b9150506112e9565b5060405162461bcd60e51b815260206004820152602e60248201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060448201526d0deeedccae440c4f240d2dcc8caf60931b6064820152608401610b7d565b6008546001600160a01b031633146114135760405162461bcd60e51b8152600401610b7d90612fd8565b604051600090339047908381818185875af1925050503d8060008114611455576040519150601f19603f3d011682016040523d82523d6000602084013e61145a565b606091505b505090508061146857600080fd5b50565b610e5683838360405180602001604052806000815250611cd2565b6008546001600160a01b031633146114b05760405162461bcd60e51b8152600401610b7d90612fd8565b601655565b606060006114c283611789565b905060008167ffffffffffffffff8111156114df576114df612e07565b604051908082528060200260200182016040528015611508578160200160208202803683370190505b509050600160005b83811080156115215750600f548211155b1561158b5760006115318361166d565b9050866001600160a01b0316816001600160a01b031603611578578284838151811061155f5761155f6130c4565b602090810291909101015281611574816130ab565b9250505b82611582816130ab565b93505050611510565b5090949350505050565b6008546001600160a01b031633146115bf5760405162461bcd60e51b8152600401610b7d90612fd8565b600e55565b60006115ce611252565b82106116285760405162461bcd60e51b815260206004820152602360248201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f756044820152626e647360e81b6064820152608401610b7d565b5090565b6008546001600160a01b031633146116565760405162461bcd60e51b8152600401610b7d90612fd8565b805161166990600a906020840190612b3a565b5050565b6000611678826123dd565b5192915050565b6008546001600160a01b031633146116a95760405162461bcd60e51b8152600401610b7d90612fd8565b60195460ff16156116b957600080fd5b600081116116c657600080fd5b600f54816009546116d7919061305d565b11156116e257600080fd5b611468338261203b565b6008546001600160a01b031633146117165760405162461bcd60e51b8152600401610b7d90612fd8565b601155565b600a8054610cc39061300d565b6008546001600160a01b031633146117525760405162461bcd60e51b8152600401610b7d90612fd8565b600f55565b6008546000906001600160a01b031633146117845760405162461bcd60e51b8152600401610b7d90612fd8565b504790565b60006001600160a01b0382166117f55760405162461bcd60e51b815260206004820152602b60248201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b6064820152608401610b7d565b506001600160a01b03166000908152600460205260409020546001600160801b031690565b6008546060906001600160a01b031633146118475760405162461bcd60e51b8152600401610b7d90612fd8565b600a8054610ba89061300d565b6008546001600160a01b0316331461187e5760405162461bcd60e51b8152600401610b7d90612fd8565b6118886000612587565b565b6008546001600160a01b031633146118b45760405162461bcd60e51b8152600401610b7d90612fd8565b601555565b6008546001600160a01b031633146118e35760405162461bcd60e51b8152600401610b7d90612fd8565b601855565b6008546001600160a01b031633146119125760405162461bcd60e51b8152600401610b7d90612fd8565b600082116119625760405162461bcd60e51b815260206004820152601b60248201527f6e65656420746f206d696e74206174206c656173742031204e465400000000006044820152606401610b7d565b600f5482600954611973919061305d565b11156119ba5760405162461bcd60e51b81526020600482015260166024820152751b585e08139195081b1a5b5a5d08195e18d95959195960521b6044820152606401610b7d565b611669818361203b565b6008546001600160a01b031633146119ee5760405162461bcd60e51b8152600401610b7d90612fd8565b600d55565b6008546001600160a01b03163314611a1d5760405162461bcd60e51b8152600401610b7d90612fd8565b601980549115156101000261ff0019909216919091179055565b606060028054610ba89061300d565b60195460ff1615611a925760405162461bcd60e51b81526020600482015260166024820152751d1a194818dbdb9d1c9858dd081a5cc81c185d5cd95960521b6044820152606401610b7d565b601754421015611ae45760405162461bcd60e51b815260206004820152601860248201527f53616c6520686173206e6f7420737461727465642079657400000000000000006044820152606401610b7d565b6000611aef33611789565b601454909150611aff838361305d565b1115611b4d5760405162461bcd60e51b815260206004820152601b60248201527f6d6178204e4654207065722057616c6c657420657863656564656400000000006044820152606401610b7d565b601254821115611bb05760405162461bcd60e51b815260206004820152602860248201527f6d6178206d696e7420616d6f756e7420706572207472616e73616374696f6e20604482015267195e18d95959195960c21b6064820152608401610b7d565b6113bf82600954611bc1919061305d565b1115611c045760405162461bcd60e51b815260206004820152601260248201527113585e14dd5c1c1b1e48195e18d95959195960721b6044820152606401610b7d565b611669338361203b565b336001600160a01b03831603611c665760405162461bcd60e51b815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c65720000000000006044820152606401610b7d565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611cdd848484612055565b611ce9848484846125d9565b61121d5760405162461bcd60e51b8152600401610b7d906130da565b600b8054610cc39061300d565b6060611d1f826000541190565b611d835760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610b7d565b601954610100900460ff16611e2457600c8054611d9f9061300d565b80601f0160208091040260200160405190810160405280929190818152602001828054611dcb9061300d565b8015611e185780601f10611ded57610100808354040283529160200191611e18565b820191906000526020600020905b815481529060010190602001808311611dfb57829003601f168201915b50505050509050919050565b6000611e2e6126db565b90506000815111611e4e5760405180602001604052806000815250611e7c565b80611e58846126ea565b600b604051602001611e6c9392919061312d565b6040516020818303038152906040525b9392505050565b919050565b6008546001600160a01b03163314611eb25760405162461bcd60e51b8152600401610b7d90612fd8565b601455565b6008546001600160a01b03163314611ee15760405162461bcd60e51b8152600401610b7d90612fd8565b805161166990600b906020840190612b3a565b6008546001600160a01b03163314611f1e5760405162461bcd60e51b8152600401610b7d90612fd8565b805161166990600c906020840190612b3a565b6008546001600160a01b03163314611f5b5760405162461bcd60e51b8152600401610b7d90612fd8565b6001600160a01b038116611fc05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b7d565b61146881612587565b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60008261203285846127eb565b14949350505050565b61166982826040518060200160405280600081525061285f565b6000612060826123dd565b80519091506000906001600160a01b0316336001600160a01b0316148061209757503361208c84610c2b565b6001600160a01b0316145b806120a9575081516120a99033610a62565b9050806121135760405162461bcd60e51b815260206004820152603260248201527f455243373231413a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b6064820152608401610b7d565b846001600160a01b031682600001516001600160a01b0316146121875760405162461bcd60e51b815260206004820152602660248201527f455243373231413a207472616e736665722066726f6d20696e636f72726563746044820152651037bbb732b960d11b6064820152608401610b7d565b6001600160a01b0384166121eb5760405162461bcd60e51b815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608401610b7d565b6121fb6000848460000151611fc9565b6001600160a01b038516600090815260046020526040812080546001929061222d9084906001600160801b03166131f0565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0386166000908152600460205260408120805460019450909261227991859116613218565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b03808716825267ffffffffffffffff428116602080850191825260008981526003909152948520935184549151909216600160a01b026001600160e01b0319909116919092161717905561230184600161305d565b6000818152600360205260409020549091506001600160a01b03166123935761232b816000541190565b156123935760408051808201825284516001600160a01b03908116825260208087015167ffffffffffffffff9081168285019081526000878152600390935294909120925183549451909116600160a01b026001600160e01b03199094169116179190911790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b60408051808201909152600080825260208201526123fc826000541190565b61245b5760405162461bcd60e51b815260206004820152602a60248201527f455243373231413a206f776e657220717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610b7d565b60007f000000000000000000000000000000000000000000000000000000000000001483106124bc576124ae7f000000000000000000000000000000000000000000000000000000000000001484613094565b6124b990600161305d565b90505b825b818110612526576000818152600360209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff16918301919091521561251357949350505050565b508061251e81613243565b9150506124be565b5060405162461bcd60e51b815260206004820152602f60248201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560448201526e1037bbb732b91037b3103a37b5b2b760891b6064820152608401610b7d565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001600160a01b0384163b156126cf57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061261d90339089908890889060040161325a565b6020604051808303816000875af1925050508015612658575060408051601f3d908101601f1916820190925261265591810190613297565b60015b6126b5573d808015612686576040519150601f19603f3d011682016040523d82523d6000602084013e61268b565b606091505b5080516000036126ad5760405162461bcd60e51b8152600401610b7d906130da565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506126d3565b5060015b949350505050565b6060600a8054610ba89061300d565b6060816000036127115750506040805180820190915260018152600360fc1b602082015290565b8160005b811561273b5780612725816130ab565b91506127349050600a836132ca565b9150612715565b60008167ffffffffffffffff81111561275657612756612e07565b6040519080825280601f01601f191660200182016040528015612780576020820181803683370190505b5090505b84156126d357612795600183613094565b91506127a2600a866132de565b6127ad90603061305d565b60f81b8183815181106127c2576127c26130c4565b60200101906001600160f81b031916908160001a9053506127e4600a866132ca565b9450612784565b600081815b845181101561285757600085828151811061280d5761280d6130c4565b602002602001015190508083116128335760008381526020829052604090209250612844565b600081815260208490526040902092505b508061284f816130ab565b9150506127f0565b509392505050565b6000546001600160a01b0384166128c25760405162461bcd60e51b815260206004820152602160248201527f455243373231413a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610b7d565b6128cd816000541190565b1561291a5760405162461bcd60e51b815260206004820152601d60248201527f455243373231413a20746f6b656e20616c7265616479206d696e7465640000006044820152606401610b7d565b7f00000000000000000000000000000000000000000000000000000000000000148311156129955760405162461bcd60e51b815260206004820152602260248201527f455243373231413a207175616e7469747920746f206d696e7420746f6f2068696044820152610ced60f31b6064820152608401610b7d565b6001600160a01b0384166000908152600460209081526040918290208251808401845290546001600160801b038082168352600160801b90910416918101919091528151808301909252805190919081906129f1908790613218565b6001600160801b03168152602001858360200151612a0f9190613218565b6001600160801b039081169091526001600160a01b0380881660008181526004602090815260408083208751978301518716600160801b0297909616969096179094558451808601865291825267ffffffffffffffff4281168386019081528883526003909552948120915182549451909516600160a01b026001600160e01b031990941694909216939093179190911790915582905b85811015612b2f5760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4612af360008884886125d9565b612b0f5760405162461bcd60e51b8152600401610b7d906130da565b81612b19816130ab565b9250508080612b27906130ab565b915050612aa6565b5060008190556123d5565b828054612b469061300d565b90600052602060002090601f016020900481019282612b685760008555612bae565b82601f10612b8157805160ff1916838001178555612bae565b82800160010185558215612bae579182015b82811115612bae578251825591602001919060010190612b93565b506116289291505b808211156116285760008155600101612bb6565b6001600160e01b03198116811461146857600080fd5b600060208284031215612bf257600080fd5b8135611e7c81612bca565b80358015158114611e8357600080fd5b600060208284031215612c1f57600080fd5b611e7c82612bfd565b60005b83811015612c43578181015183820152602001612c2b565b8381111561121d5750506000910152565b60008151808452612c6c816020860160208601612c28565b601f01601f19169290920160200192915050565b602081526000611e7c6020830184612c54565b600060208284031215612ca557600080fd5b5035919050565b80356001600160a01b0381168114611e8357600080fd5b60008060408385031215612cd657600080fd5b612cdf83612cac565b946020939093013593505050565b600080600060408486031215612d0257600080fd5b83359250602084013567ffffffffffffffff80821115612d2157600080fd5b818601915086601f830112612d3557600080fd5b813581811115612d4457600080fd5b8760208260051b8501011115612d5957600080fd5b6020830194508093505050509250925092565b600080600060608486031215612d8157600080fd5b612d8a84612cac565b9250612d9860208501612cac565b9150604084013590509250925092565b600060208284031215612dba57600080fd5b611e7c82612cac565b6020808252825182820181905260009190848201906040850190845b81811015612dfb57835183529284019291840191600101612ddf565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612e3857612e38612e07565b604051601f8501601f19908116603f01168101908282118183101715612e6057612e60612e07565b81604052809350858152868686011115612e7957600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612ea557600080fd5b813567ffffffffffffffff811115612ebc57600080fd5b8201601f81018413612ecd57600080fd5b6126d384823560208401612e1d565b60008060408385031215612eef57600080fd5b82359150612eff60208401612cac565b90509250929050565b60008060408385031215612f1b57600080fd5b612f2483612cac565b9150612eff60208401612bfd565b60008060008060808587031215612f4857600080fd5b612f5185612cac565b9350612f5f60208601612cac565b925060408501359150606085013567ffffffffffffffff811115612f8257600080fd5b8501601f81018713612f9357600080fd5b612fa287823560208401612e1d565b91505092959194509250565b60008060408385031215612fc157600080fd5b612fca83612cac565b9150612eff60208401612cac565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c9082168061302157607f821691505b60208210810361304157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561307057613070613047565b500190565b600081600019048311821515161561308f5761308f613047565b500290565b6000828210156130a6576130a6613047565b500390565b6000600182016130bd576130bd613047565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b606082015260800190565b6000845160206131408285838a01612c28565b8551918401916131538184848a01612c28565b8554920191600090600181811c908083168061317057607f831692505b858310810361318d57634e487b7160e01b85526022600452602485fd5b8080156131a157600181146131b2576131df565b60ff198516885283880195506131df565b60008b81526020902060005b858110156131d75781548a8201529084019088016131be565b505083880195505b50939b9a5050505050505050505050565b60006001600160801b038381169083168181101561321057613210613047565b039392505050565b60006001600160801b0380831681851680830382111561323a5761323a613047565b01949350505050565b60008161325257613252613047565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061328d90830184612c54565b9695505050505050565b6000602082840312156132a957600080fd5b8151611e7c81612bca565b634e487b7160e01b600052601260045260246000fd5b6000826132d9576132d96132b4565b500490565b6000826132ed576132ed6132b4565b50069056fea2646970667358221220a5ea492ddb9460b1e31fcd604b9aa4e194c71795f427e8be5e3025a9c4ad992564736f6c634300080d0033
Verified Source Code Full Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: Yes (200 runs)
CKDMain.sol 260 lines
// SPDX-License-Identifier: GPL-3.0 //Developer:FazelPejmanfar , Twitter:@Pejmanfarfazel || [email protected] pragma solidity >=0.7.0 <0.9.0; import "./ERC721A.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; contract CryptoKidsDAO is ERC721A, Ownable { using Strings for uint256; uint256 supply = totalSupply(); string public baseURI; string public baseExtension = ".json"; string public notRevealedUri; uint256 public preSaleCost = 0 ether; uint256 public cost = 0 ether; uint256 public maxSupply = 5055; uint256 public preSaleMaxSupply = 5055; uint256 public maxMintAmountPresale = 5; uint256 public maxsize = 20 ; // max mint per tx, this cannot be changed after deploy uint256 public nftPerAddressLimitPresale = 5; uint256 public nftPerAddressLimit = 5; uint256 public preSaleDate = 1650188880; uint256 public preSaleEndDate = 1650322800; uint256 public publicSaleDate = 1650326400; bytes32 public merkleRoot = 0xdf0b572df57cfa352bb3574873e829550dc38fbf27d55036878882399ff267fa; bool public paused = false; bool public revealed = false; constructor( string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721A("Crypto Kids DAO", "CKD", maxsize) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } //MODIFIERS modifier notPaused { require(!paused, "the contract is paused"); _; } modifier saleStarted { require(block.timestamp >= publicSaleDate, "Sale has not started yet"); _; } modifier presasaleStarted { require(block.timestamp >= preSaleDate, "PreSale has not started yet"); _; } modifier minimumMintAmount(uint256 _mintAmount) { require(_mintAmount > 0, "need to mint at least 1 NFT"); _; } // INTERNAL function _baseURI() internal view virtual override returns (string memory) { return baseURI; } /// @dev PUBLICMINT function mint(uint256 _mintAmount) public payable notPaused saleStarted { uint256 ownerTokenCount = balanceOf(msg.sender); require(ownerTokenCount + _mintAmount <= nftPerAddressLimit, "max NFT per Wallet exceeded"); require(_mintAmount <= maxsize, "max mint amount per transaction exceeded"); require(supply + _mintAmount <= 5055, "MaxSupply exceeded"); _safeMint(_msgSender(), _mintAmount); } /// @dev PRESALEMINT function mintPresale(uint256 _mintAmount, bytes32[] calldata merkleProof) public payable notPaused presasaleStarted { uint256 ownerMintCount = balanceOf(msg.sender); require(MerkleProof.verify(merkleProof, merkleRoot, keccak256(abi.encodePacked(msg.sender))), "You are not eligible for the presale"); require(ownerMintCount + _mintAmount <= nftPerAddressLimitPresale, "Presale limit for this wallet reached"); require(_mintAmount <= maxMintAmountPresale, "Cannot purchase this many NFT in a transaction"); require(supply + _mintAmount <= preSaleMaxSupply, "Minting would exceed Presale max supply"); require(_mintAmount > 0, "Must mint at least one token"); require(msg.value >= preSaleCost * _mintAmount, "ETH amount is low"); _safeMint(_msgSender(), _mintAmount); } function mintForOwner(uint256 _mintAmount) public onlyOwner { require(!paused); require(_mintAmount > 0); require(supply + _mintAmount <= maxSupply); _safeMint(_msgSender(), _mintAmount); } function gift(uint256 _mintAmount, address destination) public onlyOwner { require(_mintAmount > 0, "need to mint at least 1 NFT"); require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded"); _safeMint(destination, _mintAmount); } //PUBLIC VIEWS function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount); uint256 currentTokenId = 1; uint256 ownedTokenIndex = 0; while (ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply) { address currentTokenOwner = ownerOf(currentTokenId); if (currentTokenOwner == _owner) { ownedTokenIds[ownedTokenIndex] = currentTokenId; ownedTokenIndex++; } currentTokenId++; } return ownedTokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if (!revealed) { return notRevealedUri; } else { string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension) ) : ""; } } //ONLY OWNER VIEWS function getBaseURI() public view onlyOwner returns (string memory) { return baseURI; } function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner { merkleRoot = _merkleRoot; } function getContractBalance() public view onlyOwner returns (uint256) { return address(this).balance; } //ONLY OWNER SETTERS function reveal(bool _state) public onlyOwner { revealed = _state; } function pause(bool _state) public onlyOwner { paused = _state; } function setNftPerAddressLimitPreSale(uint256 _limit) public onlyOwner { nftPerAddressLimitPresale = _limit; } function setNftPerAddressLimit(uint256 _limit) public onlyOwner { nftPerAddressLimit = _limit; } function setPresaleCost(uint256 _newCost) public onlyOwner { preSaleCost = _newCost; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setmaxMintAmountPreSale(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmountPresale = _newmaxMintAmount; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setPresaleMaxSupply(uint256 _newPresaleMaxSupply) public onlyOwner { preSaleMaxSupply = _newPresaleMaxSupply; } function setMaxSupply(uint256 _maxSupply) public onlyOwner { maxSupply = _maxSupply; } function setPreSaleDate(uint256 _preSaleDate) public onlyOwner { preSaleDate = _preSaleDate; } function setPreSaleEndDate(uint256 _preSaleEndDate) public onlyOwner { preSaleEndDate = _preSaleEndDate; } function setPublicSaleDate(uint256 _publicSaleDate) public onlyOwner { publicSaleDate = _publicSaleDate; } function withdraw() public payable onlyOwner { (bool success, ) = payable(msg.sender).call{value: address(this).balance}(""); require(success); } }
ERC721A.sol 546 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
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/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
*
* Does not support burning tokens to address(0).
*/
contract ERC721A is
Context,
ERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
uint256 private currentIndex = 1;
uint256 public immutable maxBatchSize;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) private _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// 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
* `maxBatchSize` refers to how much a minter can mint at a time.
*/
constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_
) {
require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero");
_name = name_;
_symbol = symbol_;
maxBatchSize = maxBatchSize_;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return currentIndex - 1;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view override returns (uint256) {
require(index < totalSupply(), "ERC721A: global index out of bounds");
return index;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
* This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
for (uint256 i = 0; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
revert("ERC721A: unable to get token of owner by index");
}
/**
* @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 ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721A: balance query for the zero address");
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
require(
owner != address(0),
"ERC721A: number minted query for the zero address"
);
return uint256(_addressData[owner].numberMinted);
}
function ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
require(_exists(tokenId), "ERC721A: owner query for nonexistent token");
uint256 lowestTokenToCheck;
if (tokenId >= maxBatchSize) {
lowestTokenToCheck = tokenId - maxBatchSize + 1;
}
for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
TokenOwnership memory ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
revert("ERC721A: unable to determine the owner of token");
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
/**
* @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 override {
address owner = ERC721A.ownerOf(tokenId);
require(to != owner, "ERC721A: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor approved for all"
);
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
require(_exists(tokenId), "ERC721A: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
require(operator != _msgSender(), "ERC721A: 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 override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721A: 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`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < currentIndex;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` cannot be larger than the max batch size.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
addressData.balance + uint128(quantity),
addressData.numberMinted + uint128(quantity)
);
_ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 updatedIndex = startTokenId;
for (uint256 i = 0; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
require(
_checkOnERC721Received(address(0), to, updatedIndex, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
updatedIndex++;
}
currentIndex = updatedIndex;
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
getApproved(tokenId) == _msgSender() ||
isApprovedForAll(prevOwnership.addr, _msgSender()));
require(
isApprovedOrOwner,
"ERC721A: transfer caller is not owner nor approved"
);
require(
prevOwnership.addr == from,
"ERC721A: transfer from incorrect owner"
);
require(to != address(0), "ERC721A: transfer to the zero address");
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (_exists(nextTokenId)) {
_ownerships[nextTokenId] = TokenOwnership(
prevOwnership.addr,
prevOwnership.startTimestamp
);
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
uint256 public nextOwnerToExplicitlySet = 0;
/**
* @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
*/
function _setOwnersExplicit(uint256 quantity) internal {
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
require(quantity > 0, "quantity must be nonzero");
uint256 endIndex = oldNextOwnerToSet + quantity - 1;
if (endIndex > currentIndex - 1) {
endIndex = currentIndex - 1;
}
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ownership.startTimestamp
);
}
}
nextOwnerToExplicitlySet = endIndex + 1;
}
/**
* @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("ERC721A: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* 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`.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal 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 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
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 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
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 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
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() {
_transferOwnership(_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 {
_transferOwnership(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");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
SafeMath.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
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;
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
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 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
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 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
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);
}
MerkleProof.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
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
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
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);
/**
* @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
balanceOf 0x70a08231 → uint256
baseExtension 0xc6682862 → string
baseURI 0x6c0360eb → string
cost 0x13faede6 → uint256
getApproved 0x081812fc → address
getBaseURI 0x714c5398 → string
getContractBalance 0x6f9fb98a → uint256
isApprovedForAll 0xe985e9c5 → bool
maxBatchSize 0x2913daa0 → uint256
maxMintAmountPresale 0x7effc032 → uint256
maxSupply 0xd5abeb01 → uint256
maxsize 0x6c6e927e → uint256
merkleRoot 0x2eb4a7ab → bytes32
name 0x06fdde03 → string
nextOwnerToExplicitlySet 0xd7224ba0 → uint256
nftPerAddressLimit 0xba7d2c76 → uint256
nftPerAddressLimitPresale 0x2e09282e → uint256
notRevealedUri 0x081c8c44 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
preSaleCost 0xcc9ff9c6 → uint256
preSaleDate 0x1985cc65 → uint256
preSaleEndDate 0x7967a50a → uint256
preSaleMaxSupply 0xa18116f1 → uint256
publicSaleDate 0xeced3873 → uint256
revealed 0x51830227 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
Write Contract 28 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
gift 0x83a076be
uint256 _mintAmount
address destination
mint 0xa0712d68
uint256 _mintAmount
mintForOwner 0x63bc312a
uint256 _mintAmount
mintPresale 0x0c0a6b5e
uint256 _mintAmount
bytes32[] merkleProof
pause 0x02329a29
bool _state
renounceOwnership 0x715018a6
No parameters
reveal 0x940cd05b
bool _state
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseExtension 0xda3ef23f
string _newBaseExtension
setBaseURI 0x55f804b3
string _newBaseURI
setCost 0x44a0d68a
uint256 _newCost
setMaxSupply 0x6f8b44b0
uint256 _maxSupply
setMerkleRoot 0x7cb64759
bytes32 _merkleRoot
setNftPerAddressLimit 0xd0eb26b0
uint256 _limit
setNftPerAddressLimitPreSale 0x0a50716b
uint256 _limit
setNotRevealedURI 0xf2c4ce1e
string _notRevealedURI
setPreSaleDate 0x743c7f6b
uint256 _preSaleDate
setPreSaleEndDate 0x42f0ca0d
uint256 _preSaleEndDate
setPresaleCost 0x8fdcf942
uint256 _newCost
setPresaleMaxSupply 0x0a403f04
uint256 _newPresaleMaxSupply
setPublicSaleDate 0x0e54a883
uint256 _publicSaleDate
setmaxMintAmountPreSale 0x669736c0
uint256 _newmaxMintAmount
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address