Address Contract Verified
Address
0x20Bd0551f05Dc40117D6B91DFA9f67D25307d1D8
Balance
0 ETH
Nonce
1
Code Size
13923 bytes
Creator
0xf4de73ac...C47a at tx 0xc43ca2f3...8d83bb
Indexed Transactions
0
Contract Bytecode
13923 bytes
0x6080604052600436106102c95760003560e01c8063715018a611610175578063ba74be1a116100dc578063e985e9c511610095578063f2fde38b1161006f578063f2fde38b146108ac578063f4a560a5146108cc578063f7640d45146108e1578063ffa3cdb71461090157600080fd5b8063e985e9c514610829578063e9b5b66214610872578063ef8a92351461088557600080fd5b8063ba74be1a1461077e578063ba7a86b814610794578063c87b56dd146107a9578063cd6a3ea5146107c9578063cdfa59a9146107e9578063d5a72c1c1461081657600080fd5b80639182a9df1161012e5780639182a9df146106d457806395d89b41146106e9578063a22cb465146106fe578063ad2f852a1461071e578063aec06a281461073e578063b88d4fde1461075e57600080fd5b8063715018a61461063c5780637c86bcb8146106515780637ff9b5961461066b57806381ff4d0b146106815780638da5cb5b146106965780638f93e1a6146106b457600080fd5b80633ccfd60b1161023457806351830227116101ed5780636352211e116101c75780636352211e146105c6578063676c0d77146105e657806368fc68c71461060657806370a082311461061c57600080fd5b8063518302271461056157806355f804b3146105805780635b7633d0146105a057600080fd5b80633ccfd60b1461049b57806342842e0e146104b0578063453c2310146104d057806349251bfb146104e65780634c5ff4f7146105215780634f6ccce71461054157600080fd5b806323b872dd1161028657806323b872dd146103be5780632a55205a146103de5780632b905bf61461041d5780632f745c591461044557806332cb6b0c1461046557806335b36c441461047b57600080fd5b806301ffc9a7146102ce57806306fdde03146103035780630768329514610325578063081812fc14610347578063095ea7b31461037f57806318160ddd1461039f575b600080fd5b3480156102da57600080fd5b506102ee6102e9366004612fec565b610921565b60405190151581526020015b60405180910390f35b34801561030f57600080fd5b5061031861094c565b6040516102fa91906132b5565b34801561033157600080fd5b506103456103403660046130c6565b6109de565b005b34801561035357600080fd5b506103676103623660046130c6565b610a16565b6040516001600160a01b0390911681526020016102fa565b34801561038b57600080fd5b5061034561039a366004612f4c565b610a9e565b3480156103ab57600080fd5b506002545b6040519081526020016102fa565b3480156103ca57600080fd5b506103456103d9366004612e58565b610bb4565b3480156103ea57600080fd5b506103fe6103f936600461312b565b610be5565b604080516001600160a01b0390931683526020830191909152016102fa565b34801561042957600080fd5b5061036773f71a729fd5c58fa1096cce576690d0cd4deb4eb881565b34801561045157600080fd5b506103b0610460366004612f4c565b610c5d565b34801561047157600080fd5b506103b06122b881565b34801561048757600080fd5b506103456104963660046130c6565b610d10565b3480156104a757600080fd5b50610345610d70565b3480156104bc57600080fd5b506103456104cb366004612e58565b610de9565b3480156104dc57600080fd5b506103b060085481565b3480156104f257600080fd5b506102ee610501366004612f4c565b601160209081526000928352604080842090915290825290205460ff1681565b34801561052d57600080fd5b5061034561053c366004612dde565b610e04565b34801561054d57600080fd5b506103b061055c3660046130c6565b610e50565b34801561056d57600080fd5b50600a546102ee90610100900460ff1681565b34801561058c57600080fd5b5061034561059b36600461307d565b610ebd565b3480156105ac57600080fd5b50600a54610367906201000090046001600160a01b031681565b3480156105d257600080fd5b506103676105e13660046130c6565b61101c565b3480156105f257600080fd5b506103456106013660046130c6565b6110a8565b34801561061257600080fd5b506103b061115c81565b34801561062857600080fd5b506103b0610637366004612dde565b61113d565b34801561064857600080fd5b5061034561120b565b34801561065d57600080fd5b50600a546102ee9060ff1681565b34801561067757600080fd5b506103b060095481565b34801561068d57600080fd5b506103b0601c81565b3480156106a257600080fd5b506005546001600160a01b0316610367565b3480156106c057600080fd5b50600c54610367906001600160a01b031681565b3480156106e057600080fd5b50610345611241565b3480156106f557600080fd5b5061031861127c565b34801561070a57600080fd5b50610345610719366004612f19565b61128b565b34801561072a57600080fd5b50600d54610367906001600160a01b031681565b34801561074a57600080fd5b506102ee610759366004613026565b611350565b34801561076a57600080fd5b50610345610779366004612e99565b611365565b34801561078a57600080fd5b506103b060125481565b3480156107a057600080fd5b5061034561139d565b3480156107b557600080fd5b506103186107c43660046130c6565b611486565b3480156107d557600080fd5b506103456107e4366004612f4c565b6115c8565b3480156107f557600080fd5b506103b0610804366004612dde565b60136020526000908152604090205481565b610345610824366004612f78565b611620565b34801561083557600080fd5b506102ee610844366004612e1f565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6103456108803660046130df565b611921565b34801561089157600080fd5b5060145461089f9060ff1681565b6040516102fa919061328d565b3480156108b857600080fd5b506103456108c7366004612dde565b611cc1565b3480156108d857600080fd5b50610345611d5c565b3480156108ed57600080fd5b50600b54610367906001600160a01b031681565b34801561090d57600080fd5b5061034561091c366004612dde565b611de8565b60006001600160e01b0319821663780e9d6360e01b1480610946575061094682611e34565b92915050565b60606000805461095b9061352a565b80601f01602080910402602001604051908101604052809291908181526020018280546109879061352a565b80156109d45780601f106109a9576101008083540402835291602001916109d4565b820191906000526020600020905b8154815290600101906020018083116109b757829003601f168201915b5050505050905090565b6005546001600160a01b03163314610a115760405162461bcd60e51b8152600401610a08906133d5565b60405180910390fd5b600855565b6000610a2182611e84565b610a825760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a08565b506000908152600360205260409020546001600160a01b031690565b6000610aa98261101c565b9050806001600160a01b0316836001600160a01b03161415610b175760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a08565b336001600160a01b0382161480610b335750610b338133610844565b610ba55760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a08565b610baf8383611ece565b505050565b610bbe3382611f3c565b610bda5760405162461bcd60e51b8152600401610a089061340a565b610baf838383612022565b6000806000600f54600e5485610bfb91906134c8565b610c0591906134b4565b600086815260106020526040812054919250906001600160a01b0316610c3657600d546001600160a01b0316610c4f565b6000868152601060205260409020546001600160a01b03165b9350909150505b9250929050565b6000610c688361113d565b8210610c865760405162461bcd60e51b8152600401610a08906132ed565b6000805b600254811015610cf75760028181548110610ca757610ca76135d6565b6000918252602090912001546001600160a01b0386811691161415610ce55783821415610cd75791506109469050565b81610ce181613565565b9250505b80610cef81613565565b915050610c8a565b5060405162461bcd60e51b8152600401610a08906132ed565b6005546001600160a01b03163314610d3a5760405162461bcd60e51b8152600401610a08906133d5565b806003811115610d4c57610d4c6135c0565b6014805460ff19166001836003811115610d6857610d686135c0565b021790555050565b6005546001600160a01b03163314610d9a5760405162461bcd60e51b8152600401610a08906133d5565b47610dad6005546001600160a01b031690565b6001600160a01b03166108fc829081150290604051600060405180830381858888f19350505050158015610de5573d6000803e3d6000fd5b5050565b610baf83838360405180602001604052806000815250611365565b6005546001600160a01b03163314610e2e5760405162461bcd60e51b8152600401610a08906133d5565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6002546000908210610eb95760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610a08565b5090565b6005546001600160a01b03163314610ee75760405162461bcd60e51b8152600401610a08906133d5565b600a5460ff1615610f3a5760405162461bcd60e51b815260206004820152601a60248201527f4d6574616461746120616c72656164792066696e616c697365640000000000006044820152606401610a08565b600060078054610f499061352a565b80601f0160208091040260200160405190810160405280929190818152602001828054610f759061352a565b8015610fc25780601f10610f9757610100808354040283529160200191610fc2565b820191906000526020600020905b815481529060010190602001808311610fa557829003601f168201915b50508551939450610fde93600793506020870192509050612c51565b507f99562a81a2bc5868cd8c30b7b2964f5e52ec358ace402063ecd18a505f5d080081836040516110109291906132c8565b60405180910390a15050565b60008060028381548110611032576110326135d6565b6000918252602090912001546001600160a01b03169050806109465760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610a08565b6005546001600160a01b031633146110d25760405162461bcd60e51b8152600401610a08906133d5565b600060145460ff1660038111156110eb576110eb6135c0565b146111385760405162461bcd60e51b815260206004820152601e60248201527f50617573652073616c65206265666f72652070726963652075706461746500006044820152606401610a08565b600955565b60006001600160a01b0382166111a85760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610a08565b6000805b60025481101561120457600281815481106111c9576111c96135d6565b6000918252602090912001546001600160a01b03858116911614156111f4576111f182613565565b91505b6111fd81613565565b90506111ac565b5092915050565b6005546001600160a01b031633146112355760405162461bcd60e51b8152600401610a08906133d5565b61123f6000612178565b565b6005546001600160a01b0316331461126b5760405162461bcd60e51b8152600401610a08906133d5565b600a805461ff001916610100179055565b60606001805461095b9061352a565b6001600160a01b0382163314156112e45760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a08565b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600061135d8484846121ca565b949350505050565b61136f3383611f3c565b61138b5760405162461bcd60e51b8152600401610a089061340a565b611397848484846122c4565b50505050565b6005546001600160a01b031633146113c75760405162461bcd60e51b8152600401610a08906133d5565b6122b8601c6113d560025490565b6113df919061349c565b11156113fd5760405162461bcd60e51b8152600401610a089061338a565b60005b601c8110156114415761142f73f71a729fd5c58fa1096cce576690d0cd4deb4eb861142a60025490565b6122f7565b8061143981613565565b915050611400565b50604051601c9073f71a729fd5c58fa1096cce576690d0cd4deb4eb8907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427390600090a3565b606061149182611e84565b6114f55760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610a08565b600a54610100900460ff1661159657600780546115119061352a565b80601f016020809104026020016040519081016040528092919081815260200182805461153d9061352a565b801561158a5780601f1061155f5761010080835404028352916020019161158a565b820191906000526020600020905b81548152906001019060200180831161156d57829003601f168201915b50505050509050919050565b60076115a183612311565b6040516020016115b2929190613195565b6040516020818303038152906040529050919050565b6005546001600160a01b031633146115f25760405162461bcd60e51b8152600401610a08906133d5565b600090815260106020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b600260065414156116735760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a08565b6002600655600160145460ff166003811115611691576116916135c0565b14806116b35750600260145460ff1660038111156116b1576116b16135c0565b145b6116f45760405162461bcd60e51b815260206004820152601260248201527153616c65206973206e6f742061637469766560701b6044820152606401610a08565b8315158061170157508115155b6117635760405162461bcd60e51b815260206004820152602d60248201527f53686f756c642070726f76696465206174206c65617374206f6e6520746f6b6560448201526c6e20494420746f20636c61696d60981b6064820152608401610a08565b61176d828561349c565b8111156117d85760405162461bcd60e51b815260206004820152603360248201527f596f752063616e206f6e6c79206d696e74206f6e65206164646974696f6e616c60448201527220746f6b656e20706572206d696e747061737360681b6064820152608401610a08565b83156117f757600b546117f790869086906001600160a01b031661240f565b811561181657600c5461181690849084906001600160a01b031661240f565b60008111801561183c5750600160145460ff16600381111561183a5761183a6135c0565b145b15611915576012546118509061115c6134e7565b61185c906122b86134e7565b8161186660025490565b611870919061349c565b111561188e5760405162461bcd60e51b8152600401610a089061345b565b60095461189b90826134c8565b34146118e95760405162461bcd60e51b815260206004820152601860248201527f496e636f72726563742076616c75652070726f766964656400000000000000006044820152606401610a08565b60005b8181101561191357611901335b600254612677565b8061190b81613565565b9150506118ec565b505b50506001600655505050565b600260065414156119745760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a08565b6002600655826119bf5760405162461bcd60e51b815260206004820152601660248201527515dc9bdb99c8185b5bdd5b9d081c995c5d595cdd195960521b6044820152606401610a08565b600260145460ff1660038111156119d8576119d86135c0565b14806119fa5750600360145460ff1660038111156119f8576119f86135c0565b145b611a3b5760405162461bcd60e51b815260206004820152601260248201527153616c65206973206e6f742061637469766560701b6044820152606401610a08565b600260145460ff166003811115611a5457611a546135c0565b1415611afe57611a658282336121ca565b611ab15760405162461bcd60e51b815260206004820152601e60248201527f596f75722077616c6c6574206973206e6f742077686974656c697374656400006044820152606401610a08565b601254611ac09061115c6134e7565b611acc906122b86134e7565b83611ad660025490565b611ae0919061349c565b1115611afe5760405162461bcd60e51b8152600401610a089061345b565b600360145460ff166003811115611b1757611b176135c0565b1415611b52576122b883611b2a60025490565b611b34919061349c565b1115611b525760405162461bcd60e51b8152600401610a089061338a565b6005546001600160a01b03163314611c605760085433600090815260136020526040902054611b8290859061349c565b1115611bdf5760405162461bcd60e51b815260206004820152602660248201527f596f7520686176652068697420746865206d617820746f6b656e7320706572206044820152651dd85b1b195d60d21b6064820152608401610a08565b3460095484611bee91906134c8565b14611c3b5760405162461bcd60e51b815260206004820152601c60248201527f596f752068617665206e6f742073656e7420656e6f75676820455448000000006044820152606401610a08565b3360009081526013602052604081208054859290611c5a90849061349c565b90915550505b60005b83811015611c8957611c77336002546122f7565b80611c8181613565565b915050611c63565b50604051839033907f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427390600090a35050600160065550565b6005546001600160a01b03163314611ceb5760405162461bcd60e51b8152600401610a08906133d5565b6001600160a01b038116611d505760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a08565b611d5981612178565b50565b6005546001600160a01b03163314611d865760405162461bcd60e51b8152600401610a08906133d5565b600a5460ff1615611dd95760405162461bcd60e51b815260206004820152601a60248201527f4d6574616461746120616c72656164792066696e616c697365640000000000006044820152606401610a08565b600a805460ff19166001179055565b6005546001600160a01b03163314611e125760405162461bcd60e51b8152600401610a08906133d5565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b031982166380ac58cd60e01b1480611e6557506001600160e01b03198216635b5e139f60e01b145b8061094657506301ffc9a760e01b6001600160e01b0319831614610946565b60025460009082108015610946575060006001600160a01b031660028381548110611eb157611eb16135d6565b6000918252602090912001546001600160a01b0316141592915050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f038261101c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611f4782611e84565b611fa85760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a08565b6000611fb38361101c565b9050806001600160a01b0316846001600160a01b03161480611fee5750836001600160a01b0316611fe384610a16565b6001600160a01b0316145b8061135d57506001600160a01b0380821660009081526004602090815260408083209388168352929052205460ff1661135d565b826001600160a01b03166120358261101c565b6001600160a01b03161461209d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610a08565b6001600160a01b0382166120ff5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a08565b61210a600082611ece565b816002828154811061211e5761211e6135d6565b6000918252602082200180546001600160a01b0319166001600160a01b03938416179055604051839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60408051606083901b6bffffffffffffffffffffffff1916602080830191909152825160148184030181526034830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060548401526070808401829052845180850390910181526090909301909352815191012060009190600061228c8288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061279f92505050565b90506001600160a01b038116158015906122b95750600a546001600160a01b038281166201000090920416145b979650505050505050565b6122cf848484612022565b6122db848484846127c3565b6113975760405162461bcd60e51b8152600401610a0890613338565b610de58282604051806020016040528060008152506128d0565b6060816123355750506040805180820190915260018152600360fc1b602082015290565b8160005b811561235f578061234981613565565b91506123589050600a836134b4565b9150612339565b60008167ffffffffffffffff81111561237a5761237a6135ec565b6040519080825280601f01601f1916602001820160405280156123a4576020820181803683370190505b5090505b841561135d576123b96001836134e7565b91506123c6600a86613580565b6123d190603061349c565b60f81b8183815181106123e6576123e66135d6565b60200101906001600160f81b031916908160001a905350612408600a866134b4565b94506123a8565b60005b8281101561139757336001600160a01b038316636352211e86868581811061243c5761243c6135d6565b905060200201356040518263ffffffff1660e01b815260040161246191815260200190565b60206040518083038186803b15801561247957600080fd5b505afa15801561248d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b19190612e02565b6001600160a01b0316146124f75760405162461bcd60e51b815260206004820152600d60248201526c2737ba103a34329037bbb732b960991b6044820152606401610a08565b6001600160a01b038216600090815260116020526040812090858584818110612522576125226135d6565b602090810292909201358352508101919091526040016000205460ff161561258c5760405162461bcd60e51b815260206004820152601b60248201527f546f6b656e2068617320616c7265616479206265656e207573656400000000006044820152606401610a08565b6001600160a01b03821660009081526011602052604081206001918686858181106125b9576125b96135d6565b90506020020135815260200190815260200160002060006101000a81548160ff021916908315150217905550601260008154809291906125f890613565565b91905055506126076118f93390565b337f70eb43c4a8ae8c40502dcf22436c509c28d6ff421cf07c491be56984bd9870688386868581811061263c5761263c6135d6565b604080516001600160a01b0390951685526020918202939093013590840152500160405180910390a28061266f81613565565b915050612412565b6001600160a01b0382166126cd5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a08565b6126d681611e84565b156127235760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a08565b6002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0385169081179091556040518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008060006127ae8585612903565b915091506127bb81612970565b509392505050565b60006001600160a01b0384163b156128c557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612807903390899088908890600401613250565b602060405180830381600087803b15801561282157600080fd5b505af1925050508015612851575060408051601f3d908101601f1916820190925261284e91810190613009565b60015b6128ab573d80801561287f576040519150601f19603f3d011682016040523d82523d6000602084013e612884565b606091505b5080516128a35760405162461bcd60e51b8152600401610a0890613338565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061135d565b506001949350505050565b6128da8383612677565b6128e760008484846127c3565b610baf5760405162461bcd60e51b8152600401610a0890613338565b60008082516041141561293a5760208301516040840151606085015160001a61292e87828585612b2b565b94509450505050610c56565b8251604014156129645760208301516040840151612959868383612c18565b935093505050610c56565b50600090506002610c56565b6000816004811115612984576129846135c0565b141561298d5750565b60018160048111156129a1576129a16135c0565b14156129ef5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610a08565b6002816004811115612a0357612a036135c0565b1415612a515760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610a08565b6003816004811115612a6557612a656135c0565b1415612abe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610a08565b6004816004811115612ad257612ad26135c0565b1415611d595760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610a08565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612b625750600090506003612c0f565b8460ff16601b14158015612b7a57508460ff16601c14155b15612b8b5750600090506004612c0f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612bdf573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612c0857600060019250925050612c0f565b9150600090505b94509492505050565b6000806001600160ff1b03831681612c3560ff86901c601b61349c565b9050612c4387828885612b2b565b935093505050935093915050565b828054612c5d9061352a565b90600052602060002090601f016020900481019282612c7f5760008555612cc5565b82601f10612c9857805160ff1916838001178555612cc5565b82800160010185558215612cc5579182015b82811115612cc5578251825591602001919060010190612caa565b50610eb99291505b80821115610eb95760008155600101612ccd565b600067ffffffffffffffff80841115612cfc57612cfc6135ec565b604051601f8501601f19908116603f01168101908282118183101715612d2457612d246135ec565b81604052809350858152868686011115612d3d57600080fd5b858560208301376000602087830101525050509392505050565b60008083601f840112612d6957600080fd5b50813567ffffffffffffffff811115612d8157600080fd5b6020830191508360208260051b8501011115610c5657600080fd5b60008083601f840112612dae57600080fd5b50813567ffffffffffffffff811115612dc657600080fd5b602083019150836020828501011115610c5657600080fd5b600060208284031215612df057600080fd5b8135612dfb81613602565b9392505050565b600060208284031215612e1457600080fd5b8151612dfb81613602565b60008060408385031215612e3257600080fd5b8235612e3d81613602565b91506020830135612e4d81613602565b809150509250929050565b600080600060608486031215612e6d57600080fd5b8335612e7881613602565b92506020840135612e8881613602565b929592945050506040919091013590565b60008060008060808587031215612eaf57600080fd5b8435612eba81613602565b93506020850135612eca81613602565b925060408501359150606085013567ffffffffffffffff811115612eed57600080fd5b8501601f81018713612efe57600080fd5b612f0d87823560208401612ce1565b91505092959194509250565b60008060408385031215612f2c57600080fd5b8235612f3781613602565b915060208301358015158114612e4d57600080fd5b60008060408385031215612f5f57600080fd5b8235612f6a81613602565b946020939093013593505050565b600080600080600060608688031215612f9057600080fd5b853567ffffffffffffffff80821115612fa857600080fd5b612fb489838a01612d57565b90975095506020880135915080821115612fcd57600080fd5b50612fda88828901612d57565b96999598509660400135949350505050565b600060208284031215612ffe57600080fd5b8135612dfb81613617565b60006020828403121561301b57600080fd5b8151612dfb81613617565b60008060006040848603121561303b57600080fd5b833567ffffffffffffffff81111561305257600080fd5b61305e86828701612d9c565b909450925050602084013561307281613602565b809150509250925092565b60006020828403121561308f57600080fd5b813567ffffffffffffffff8111156130a657600080fd5b8201601f810184136130b757600080fd5b61135d84823560208401612ce1565b6000602082840312156130d857600080fd5b5035919050565b6000806000604084860312156130f457600080fd5b83359250602084013567ffffffffffffffff81111561311257600080fd5b61311e86828701612d9c565b9497909650939450505050565b6000806040838503121561313e57600080fd5b50508035926020909101359150565b600081518084526131658160208601602086016134fe565b601f01601f19169290920160200192915050565b6000815161318b8185602086016134fe565b9290920192915050565b600080845481600182811c9150808316806131b157607f831692505b60208084108214156131d157634e487b7160e01b86526022600452602486fd5b8180156131e557600181146131f657613223565b60ff19861689528489019650613223565b60008b81526020902060005b8681101561321b5781548b820152908501908301613202565b505084890196505b5050505050506132476132368286613179565b64173539b7b760d91b815260050190565b95945050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132839083018461314d565b9695505050505050565b60208101600483106132af57634e487b7160e01b600052602160045260246000fd5b91905290565b602081526000612dfb602083018461314d565b6040815260006132db604083018561314d565b8281036020840152613247818561314d565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f596f7520747269656420746f206d696e74206d6f7265207468616e207468652060408201526a1b585e08185b1b1bddd95960aa1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526021908201527f54727920746f206d696e74206d6f7265207468616e206d617820616c6c6f77656040820152601960fa1b606082015260800190565b600082198211156134af576134af613594565b500190565b6000826134c3576134c36135aa565b500490565b60008160001904831182151516156134e2576134e2613594565b500290565b6000828210156134f9576134f9613594565b500390565b60005b83811015613519578181015183820152602001613501565b838111156113975750506000910152565b600181811c9082168061353e57607f821691505b6020821081141561355f57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561357957613579613594565b5060010190565b60008261358f5761358f6135aa565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611d5957600080fd5b6001600160e01b031981168114611d5957600080fdfea2646970667358221220de555f528d4bba9fad04ec7217f40e4fd3ab3ca3e9027330d57c38f76cd01e2e64736f6c63430008070033
Verified Source Code Full Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (200 runs)
AbnormalJean.sol 245 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "./utils/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension and Enumerable extension.
*/
contract AbnormalJean is Context, ERC721Enumerable, Ownable, ReentrancyGuard {
using Strings for uint256;
using ECDSA for bytes32;
// Base URI
string private _jeanBaseURI;
// Max number of NFTs and restrictions per wallet
uint256 public constant MAX_SUPPLY = 8888;
uint256 public constant RESERVED_TOKENS = 4444;
uint256 public constant TEAM_TOKENS = 28;
uint256 public maxPerWallet;
uint256 public tokenPrice;
// Sale settings
bool public metadataFinalised;
bool public revealed;
// Address to validate WL
address public signerAddress;
address public constant TEAM_WALLET = 0xf71a729fd5C58Fa1096CcE576690d0cd4dEB4eb8;
// Mint pass contracts
IERC721 public MetroPass;
IERC721 public Passport;
// Royalty info
address public royaltyAddress;
uint256 private ROYALTY_SIZE = 1000;
uint256 private ROYALTY_DENOMINATOR = 10000;
mapping(uint256 => address) private _royaltyReceivers;
// Stores the tokenIds used for minting JEAN
mapping(address => mapping(uint256 => bool)) public mintPassUsed;
uint256 public totalMintPassesUsed;
// Stores the number of minted tokens by user
mapping(address => uint256) public _mintedByAddress;
enum Statuses {
Inactive,
Claim,
Whitelist,
Public
}
Statuses public currentStatus;
// Contract Events
event TokensMinted(address indexed mintedBy,uint256 indexed tokensNumber);
event BaseUriUpdated(string oldBaseUri,string newBaseUri);
event Claim(address indexed claimedBy,address mintPassAddress,uint256 tokenId);
constructor(address _royaltyAddress, address _signer, string memory _baseURI)
ERC721("Abnormal Jean", "JEAN")
{
royaltyAddress = _royaltyAddress;
signerAddress = _signer;
_jeanBaseURI = _baseURI;
MetroPass = IERC721(0x8338D085aAe3aC048b9e1DE285fDef508CE73E45);
Passport = IERC721(0xfB97f535d5bEF03599861929324ad019203aE617);
currentStatus = Statuses.Inactive;
maxPerWallet = 3;
tokenPrice = 0.1666 ether;
}
function claim(
uint256[] calldata metroPassIds,
uint256[] calldata passportIds,
uint256 paidTokensToMint
) public payable nonReentrant {
require(currentStatus == Statuses.Claim || currentStatus == Statuses.Whitelist, "Sale is not active");
require(metroPassIds.length > 0 || passportIds.length > 0, "Should provide at least one token ID to claim");
require(paidTokensToMint <= metroPassIds.length + passportIds.length, "You can only mint one additional token per mintpass");
if (metroPassIds.length > 0) {
_mintForMintPass(metroPassIds, address(MetroPass));
}
if (passportIds.length > 0) {
_mintForMintPass(passportIds, address(Passport));
}
if (paidTokensToMint > 0 && currentStatus == Statuses.Claim) {
require(totalSupply() + paidTokensToMint <= MAX_SUPPLY - (RESERVED_TOKENS - totalMintPassesUsed), "Try to mint more than max allowed");
require(msg.value == paidTokensToMint * tokenPrice, "Incorrect value provided");
for (uint256 i; i < paidTokensToMint; i++) {
_mint(_msgSender(), totalSupply());
}
}
}
// Public function to purchase JEAN tokens
function purchase(uint256 tokensNumber, bytes calldata signature) public payable nonReentrant {
require(tokensNumber > 0, "Wrong amount requested");
require(currentStatus == Statuses.Whitelist || currentStatus == Statuses.Public, "Sale is not active");
if (currentStatus == Statuses.Whitelist) {
require(_validateSignature(signature, _msgSender()), "Your wallet is not whitelisted");
require(totalSupply() + tokensNumber <= MAX_SUPPLY - (RESERVED_TOKENS - totalMintPassesUsed), "Try to mint more than max allowed");
}
if (currentStatus == Statuses.Public) {
require(totalSupply() + tokensNumber <= MAX_SUPPLY, "You tried to mint more than the max allowed");
}
if (_msgSender() != owner()) {
require(_mintedByAddress[_msgSender()] + tokensNumber <= maxPerWallet, "You have hit the max tokens per wallet");
require(tokensNumber * tokenPrice == msg.value, "You have not sent enough ETH");
_mintedByAddress[_msgSender()] += tokensNumber;
}
for(uint256 i = 0; i < tokensNumber; i++) {
_safeMint(_msgSender(), totalSupply());
}
emit TokensMinted(_msgSender(), tokensNumber);
}
function _mintForMintPass (uint256[] calldata tokenIds, address mintPass) internal {
for (uint256 i; i < tokenIds.length; i++) {
require(IERC721(mintPass).ownerOf(tokenIds[i]) == _msgSender(), "Not the owner");
require(!mintPassUsed[mintPass][tokenIds[i]], "Token has already been used");
mintPassUsed[mintPass][tokenIds[i]] = true;
totalMintPassesUsed++;
_mint(_msgSender(), totalSupply());
emit Claim(_msgSender(), mintPass, tokenIds[i]);
}
}
// Public function to validate whether user witelisted agains contract
function checkIfWhitelisted(bytes calldata signature, address caller) public view returns (bool) {
return (_validateSignature(signature, caller));
}
// Internal function to validate whether user witelisted
function _validateSignature(bytes calldata signature, address caller) internal view returns (bool) {
bytes32 dataHash = keccak256(abi.encodePacked(caller));
bytes32 message = ECDSA.toEthSignedMessageHash(dataHash);
address receivedAddress = ECDSA.recover(message, signature);
return (receivedAddress != address(0) && receivedAddress == signerAddress);
}
// EIP-2981: NFT Royalty Standard
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) {
uint256 amount = _salePrice * ROYALTY_SIZE / ROYALTY_DENOMINATOR;
address royaltyReceiver = _royaltyReceivers[_tokenId] != address(0) ? _royaltyReceivers[_tokenId] : royaltyAddress;
return (royaltyReceiver, amount);
}
// EIP-2981: NFT Royalty Standard
function addRoyaltyReceiverForTokenId(address receiver, uint256 tokenId) public onlyOwner {
_royaltyReceivers[tokenId] = receiver;
}
/// Admin function to update sale status. 0 - Inactive, 1 - Claim, 2 - Whitelist, 3 - Public
function updateSaleStatus(uint256 saleStatus) public onlyOwner {
currentStatus = Statuses(saleStatus);
}
// Publc funcition that returns token URI
function tokenURI(uint256 tokenId) external view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
if (!revealed) return _jeanBaseURI;
return string(abi.encodePacked(_jeanBaseURI, tokenId.toString(), ".json"));
}
/*
* ADMIN FUNCTIONS
*/
// Function to mint 28 tokens for the team
function teamMint() public onlyOwner {
require(totalSupply() + TEAM_TOKENS <= MAX_SUPPLY, "You tried to mint more than the max allowed");
for(uint256 i = 0; i < TEAM_TOKENS; i++) {
_safeMint(TEAM_WALLET, totalSupply());
}
emit TokensMinted(TEAM_WALLET, TEAM_TOKENS);
}
// Updates token sale price
function updateTokenPrice(uint256 _newPrice) public onlyOwner {
require(currentStatus == Statuses.Inactive, "Pause sale before price update");
tokenPrice = _newPrice;
}
// Sets base URI
function setBaseURI(string memory newBaseURI) public onlyOwner {
require(!metadataFinalised, "Metadata already finalised");
string memory currentURI = _jeanBaseURI;
_jeanBaseURI = newBaseURI;
emit BaseUriUpdated(currentURI, newBaseURI);
}
// Freezes metadata, i.e. makes it impossible to change baseURI
function finalizeMetadata() public onlyOwner {
require(!metadataFinalised, "Metadata already finalised");
metadataFinalised = true;
}
// Reveals metadata, after calling returns not just baseURI, but baseURI + Token ID
function revealMetadata() public onlyOwner {
revealed = true;
}
// Updates limit for mint per wallet (by deafult it's 1)
function updateMaxToMint(uint256 _max) public onlyOwner {
maxPerWallet = _max;
}
// Updates metropass address
function setMetropassAddress(address _address) public onlyOwner {
MetroPass = IERC721(_address);
}
// Updates passport address
function setPassportAddress(address _address) public onlyOwner {
Passport = IERC721(_address);
}
// Withdraws collected ether from the contract to the owner address
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
payable(owner()).transfer(balance);
}
}
ERC721.sol 457 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
library Address {
function isContract(address account) internal view returns (bool) {
uint size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
}
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
string private _name;
string private _symbol;
// Mapping from token ID to owner address
address[] internal _owners;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner)
public
view
virtual
override
returns (uint)
{
require(owner != address(0), "ERC721: balance query for the zero address");
uint count;
for( uint i; i < _owners.length; ++i ){
if( owner == _owners[i] )
++count;
}
return count;
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
address owner = _owners[tokenId];
require(
owner != address(0),
"ERC721: owner query for nonexistent token"
);
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId < _owners.length && _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, 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);
_owners.push(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);
_owners[tokenId] = address(0);
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(
ERC721.ownerOf(tokenId) == from,
"ERC721: transfer of token that is not own"
);
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721: transfer to non ERC721Receiver implementer"
);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @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 {}
}
ERC721Enumerable.sol 52 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "./ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account but rips out the core of the gas-wasting processing that comes from OpenZeppelin.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _owners.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < _owners.length, "ERC721Enumerable: global index out of bounds");
return index;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256 tokenId) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
uint count;
for(uint i; i < _owners.length; i++){
if(owner == _owners[i]){
if(count == index) return i;
else count++;
}
}
revert("ERC721Enumerable: owner index out of bounds");
}
}
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);
}
}
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;
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
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 making 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;
}
}
ECDSA.sol 230 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
ERC165.sol 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);
}
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
MAX_SUPPLY 0x32cb6b0c → uint256
MetroPass 0xf7640d45 → address
Passport 0x8f93e1a6 → address
RESERVED_TOKENS 0x68fc68c7 → uint256
TEAM_TOKENS 0x81ff4d0b → uint256
TEAM_WALLET 0x2b905bf6 → address
_mintedByAddress 0xcdfa59a9 → uint256
balanceOf 0x70a08231 → uint256
checkIfWhitelisted 0xaec06a28 → bool
currentStatus 0xef8a9235 → uint8
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxPerWallet 0x453c2310 → uint256
metadataFinalised 0x7c86bcb8 → bool
mintPassUsed 0x49251bfb → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
revealed 0x51830227 → bool
royaltyAddress 0xad2f852a → address
royaltyInfo 0x2a55205a → address, uint256
signerAddress 0x5b7633d0 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenPrice 0x7ff9b596 → uint256
tokenURI 0xc87b56dd → string
totalMintPassesUsed 0xba74be1a → uint256
totalSupply 0x18160ddd → uint256
Write Contract 20 functions
These functions modify contract state and require a wallet transaction to execute.
addRoyaltyReceiverForTokenId 0xcd6a3ea5
address receiver
uint256 tokenId
approve 0x095ea7b3
address to
uint256 tokenId
claim 0xd5a72c1c
uint256[] metroPassIds
uint256[] passportIds
uint256 paidTokensToMint
finalizeMetadata 0xf4a560a5
No parameters
purchase 0xe9b5b662
uint256 tokensNumber
bytes signature
renounceOwnership 0x715018a6
No parameters
revealMetadata 0x9182a9df
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string newBaseURI
setMetropassAddress 0xffa3cdb7
address _address
setPassportAddress 0x4c5ff4f7
address _address
teamMint 0xba7a86b8
No parameters
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateMaxToMint 0x07683295
uint256 _max
updateSaleStatus 0x35b36c44
uint256 saleStatus
updateTokenPrice 0x676c0d77
uint256 _newPrice
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address