Address Contract Partially Verified
Address
0x701b2E775a82dbF50bd80a22a0d32EB13Fb81825
Balance
0 ETH
Nonce
1
Code Size
16149 bytes
Creator
0x9b3b9eaf...6648 at tx 0x02a2484e...488338
Indexed Transactions
0
Contract Bytecode
16149 bytes
0x6080604052600436106103225760003560e01c80638b83209b116101a5578063c87b56dd116100ec578063e1fcd70711610095578063efd0cbf91161006f578063efd0cbf91461095a578063f2fde38b1461096d578063f452472e1461098d578063f91798b1146109ad57600080fd5b8063e1fcd707146108d9578063e33b7de3146108ef578063e985e9c51461090457600080fd5b8063ce7c2ac2116100c6578063ce7c2ac214610860578063d5abeb01146108a3578063dd0d1bbc146108b957600080fd5b8063c87b56dd1461080a578063cafbfa611461082a578063cd1133d81461084057600080fd5b80639ddf7ad31161014e578063b88d4fde11610128578063b88d4fde146107aa578063bd986a2c146107ca578063c6baf917146107ea57600080fd5b80639ddf7ad31461075a578063a22cb46514610774578063ac9384b91461079457600080fd5b806395d89b411161017f57806395d89b41146106e257806396ea3a47146106f75780639852595c1461071757600080fd5b80638b83209b146106775780638da5cb5b1461069757806391b7f5ed146106c257600080fd5b806348808c1011610269578063715018a61161021257806384a303d6116101ec57806384a303d61461062457806388dfe18b146106445780638b533ea41461065757600080fd5b8063715018a6146105c25780637934f505146105d75780638462151c146105f757600080fd5b80636352211e116102435780636352211e1461056d5780636c0360eb1461058d57806370a08231146105a257600080fd5b806348808c10146105175780634f6ccce7146105375780635cd5a8b41461055757600080fd5b806319165587116102cb5780633a98ef39116102a55780633a98ef39146104da5780633ccfd60b146104ef57806342842e0e146104f757600080fd5b8063191655871461047a57806323b872dd1461049a5780632f745c59146104ba57600080fd5b8063081812fc116102fc578063081812fc146103f6578063095ea7b31461043b57806318160ddd1461045b57600080fd5b806301ffc9a71461037d57806302fe5305146103b257806306fdde03146103d457600080fd5b36610378577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be770336040805173ffffffffffffffffffffffffffffffffffffffff90921682523460208301520160405180910390a1005b600080fd5b34801561038957600080fd5b5061039d610398366004613723565b6109cc565b60405190151581526020015b60405180910390f35b3480156103be57600080fd5b506103d26103cd36600461381a565b610a28565b005b3480156103e057600080fd5b506103e9610aab565b6040516103a991906138c5565b34801561040257600080fd5b506104166104113660046138d8565b610b3d565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016103a9565b34801561044757600080fd5b506103d2610456366004613913565b610be3565b34801561046757600080fd5b506002545b6040519081526020016103a9565b34801561048657600080fd5b506103d261049536600461393f565b610d3c565b3480156104a657600080fd5b506103d26104b536600461395c565b610f77565b3480156104c657600080fd5b5061046c6104d5366004613913565b610ffe565b3480156104e657600080fd5b5060065461046c565b6103d261111a565b34801561050357600080fd5b506103d261051236600461395c565b6111d9565b34801561052357600080fd5b5061041661053236600461399d565b6111f4565b34801561054357600080fd5b5061046c6105523660046138d8565b611207565b34801561056357600080fd5b5061046c60115481565b34801561057957600080fd5b506104166105883660046138d8565b611264565b34801561059957600080fd5b506103e9611311565b3480156105ae57600080fd5b5061046c6105bd36600461393f565b61139f565b3480156105ce57600080fd5b506103d261149e565b3480156105e357600080fd5b506103d26105f23660046138d8565b611511565b34801561060357600080fd5b5061061761061236600461393f565b61157d565b6040516103a99190613a01565b34801561063057600080fd5b506103d261063f366004613a5a565b611677565b6103d2610652366004613a75565b611715565b34801561066357600080fd5b506103d26106723660046138d8565b6119e8565b34801561068357600080fd5b506104166106923660046138d8565b611a54565b3480156106a357600080fd5b5060055473ffffffffffffffffffffffffffffffffffffffff16610416565b3480156106ce57600080fd5b506103d26106dd3660046138d8565b611a91565b3480156106ee57600080fd5b506103e9611afd565b34801561070357600080fd5b506103d2610712366004613b27565b611b0c565b34801561072357600080fd5b5061046c61073236600461393f565b73ffffffffffffffffffffffffffffffffffffffff1660009081526009602052604090205490565b34801561076657600080fd5b50600d5461039d9060ff1681565b34801561078057600080fd5b506103d261078f366004613b93565b611cd1565b3480156107a057600080fd5b5061046c600f5481565b3480156107b657600080fd5b506103d26107c5366004613bc8565b611dce565b3480156107d657600080fd5b506103d26107e5366004613a5a565b611e56565b3480156107f657600080fd5b506103d26108053660046138d8565b611eee565b34801561081657600080fd5b506103e96108253660046138d8565b611f5a565b34801561083657600080fd5b5061046c60125481565b34801561084c57600080fd5b5061046c61085b36600461393f565b611fc6565b34801561086c57600080fd5b5061046c61087b36600461393f565b73ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604090205490565b3480156108af57600080fd5b5061046c600c5481565b3480156108c557600080fd5b5061046c6108d436600461393f565b611ff9565b3480156108e557600080fd5b5061046c60105481565b3480156108fb57600080fd5b5060075461046c565b34801561091057600080fd5b5061039d61091f366004613c34565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260046020908152604080832093909416825291909152205460ff1690565b6103d26109683660046138d8565b61202c565b34801561097957600080fd5b506103d261098836600461393f565b61227c565b34801561099957600080fd5b506103d26109a83660046138d8565b612375565b3480156109b957600080fd5b50600d5461039d90610100900460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d63000000000000000000000000000000000000000000000000000000001480610a225750610a22826123e1565b92915050565b60055473ffffffffffffffffffffffffffffffffffffffff163314610a945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b8051610aa790600b906020840190613665565b5050565b606060008054610aba90613c6d565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae690613c6d565b8015610b335780601f10610b0857610100808354040283529160200191610b33565b820191906000526020600020905b815481529060010190602001808311610b1657829003601f168201915b5050505050905090565b6000610b48826124c4565b610bba5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610a8b565b5060009081526003602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6000610bee82611264565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c925760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610a8b565b3373ffffffffffffffffffffffffffffffffffffffff82161480610cbb5750610cbb813361091f565b610d2d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a8b565b610d378383612528565b505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040902054610dd45760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201527f73686172657300000000000000000000000000000000000000000000000000006064820152608401610a8b565b600060075447610de49190613cf0565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600960209081526040808320546006546008909352908320549394509192610e289085613d08565b610e329190613d74565b610e3c9190613d88565b905080610eb15760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201527f647565207061796d656e740000000000000000000000000000000000000000006064820152608401610a8b565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260096020526040902054610ee2908290613cf0565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260096020526040902055600754610f16908290613cf0565b600755610f2383826125c8565b6040805173ffffffffffffffffffffffffffffffffffffffff85168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b610f8133826126ee565b610ff35760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610a8b565b610d3783838361282a565b60006110098361139f565b82106110575760405162461bcd60e51b815260206004820152601660248201527f455243373231456e756d3a206f776e657220696f6f62000000000000000000006044820152606401610a8b565b6000805b6002548110156110d1576002818154811061107857611078613d9f565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff868116911614156110c157838214156110b5579150610a229050565b6110be82613dce565b91505b6110ca81613dce565b905061105b565b5060405162461bcd60e51b815260206004820152601660248201527f455243373231456e756d3a206f776e657220696f6f62000000000000000000006044820152606401610a8b565b60055473ffffffffffffffffffffffffffffffffffffffff1633146111815760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b604051600090339047908381818185875af1925050503d80600081146111c3576040519150601f19603f3d011682016040523d82523d6000602084013e6111c8565b606091505b50509050806111d657600080fd5b50565b610d3783838360405180602001604052806000815250611dce565b600061120083836129f9565b9392505050565b600061121260025490565b82106112605760405162461bcd60e51b815260206004820152601760248201527f455243373231456e756d3a20676c6f62616c20696f6f620000000000000000006044820152606401610a8b565b5090565b6000806002838154811061127a5761127a613d9f565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905080610a225760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610a8b565b600b805461131e90613c6d565b80601f016020809104026020016040519081016040528092919081815260200182805461134a90613c6d565b80156113975780601f1061136c57610100808354040283529160200191611397565b820191906000526020600020905b81548152906001019060200180831161137a57829003601f168201915b505050505081565b600073ffffffffffffffffffffffffffffffffffffffff821661142a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610a8b565b600254600090815b81811015611495576002818154811061144d5761144d613d9f565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff868116911614156114855761148283613dce565b92505b61148e81613dce565b9050611432565b50909392505050565b60055473ffffffffffffffffffffffffffffffffffffffff1633146115055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b61150f6000612a11565b565b60055473ffffffffffffffffffffffffffffffffffffffff1633146115785760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b601155565b60606115888261139f565b6000106115d75760405162461bcd60e51b815260206004820152601660248201527f455243373231456e756d3a206f776e657220696f6f62000000000000000000006044820152606401610a8b565b60006115e28361139f565b905060008167ffffffffffffffff8111156115ff576115ff613740565b604051908082528060200260200182016040528015611628578160200160208202803683370190505b50905060005b8281101561166f576116408582610ffe565b82828151811061165257611652613d9f565b60209081029190910101528061166781613dce565b91505061162e565b509392505050565b60055473ffffffffffffffffffffffffffffffffffffffff1633146116de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b600d8054911515610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909216919091179055565b600061172060025490565b90503361172d84846111f4565b73ffffffffffffffffffffffffffffffffffffffff16146117905760405162461bcd60e51b815260206004820152601160248201527f5369676e617475726520496e76616c69640000000000000000000000000000006044820152606401610a8b565b600d5460ff166117e25760405162461bcd60e51b815260206004820152601c60248201527f57686974656c6973742073616c65206973206e6f7420616374697665000000006044820152606401610a8b565b600084116118325760405162461bcd60e51b815260206004820152601060248201527f4d696e74206d6f7265207468616e2030000000000000000000000000000000006044820152606401610a8b565b6011548411156118845760405162461bcd60e51b815260206004820152600960248201527f4d696e74206c65737300000000000000000000000000000000000000000000006044820152606401610a8b565b600c546118918583613cf0565b11156118df5760405162461bcd60e51b815260206004820152600960248201527f4d696e74206c65737300000000000000000000000000000000000000000000006044820152606401610a8b565b83600e546118ed9190613d08565b34101561193c5760405162461bcd60e51b815260206004820152601260248201527f45544820696e7075742069732077726f6e6700000000000000000000000000006044820152606401610a8b565b600161194733611fc6565b10156119955760405162461bcd60e51b815260206004820152601360248201527f596f75206d696e74656420746f6f206d616e79000000000000000000000000006044820152606401610a8b565b60005b848110156119d3576119c3336119ae8385613cf0565b60405180602001604052806000815250612a88565b6119cc81613dce565b9050611998565b50600090506119e23385612b11565b50505050565b60055473ffffffffffffffffffffffffffffffffffffffff163314611a4f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b601055565b6000600a8281548110611a6957611a69613d9f565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1692915050565b60055473ffffffffffffffffffffffffffffffffffffffff163314611af85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b600e55565b606060018054610aba90613c6d565b60055473ffffffffffffffffffffffffffffffffffffffff163314611b735760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b828114611b7f57600080fd5b600080611b8b60025490565b905060005b85811015611bce57868682818110611baa57611baa613d9f565b9050602002013583611bbc9190613cf0565b9250611bc781613dce565b9050611b90565b50600c54611bdc8383613cf0565b1115611c2a5760405162461bcd60e51b815260206004820152600860248201527f546f6f206d616e790000000000000000000000000000000000000000000000006044820152606401610a8b565b6000915060005b83811015611cc85760005b878783818110611c4e57611c4e613d9f565b90506020020135811015611cb757611ca7868684818110611c7157611c71613d9f565b9050602002016020810190611c86919061393f565b84611c9081613dce565b955060405180602001604052806000815250612a88565b611cb081613dce565b9050611c3c565b50611cc181613dce565b9050611c31565b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff8216331415611d375760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a8b565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611dd833836126ee565b611e4a5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610a8b565b6119e284848484612b4f565b60055473ffffffffffffffffffffffffffffffffffffffff163314611ebd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b600d80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60055473ffffffffffffffffffffffffffffffffffffffff163314611f555760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b601255565b6060600c54821115611f6b57600080fd5b6000611f75612bd8565b90506000815111611f955760405180602001604052806000815250611200565b80611f9f84612be7565b604051602001611fb0929190613e07565b6040516020818303038152906040529392505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260136020526040812054601254610a229190613d88565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260156020526040812054601054610a229190613d88565b600061203760025490565b600d54909150610100900460ff166120915760405162461bcd60e51b815260206004820152601960248201527f5075626c69632073616c65206973206e6f7420616374697665000000000000006044820152606401610a8b565b600082116120e15760405162461bcd60e51b815260206004820152601060248201527f4d696e74206d6f7265207468616e2030000000000000000000000000000000006044820152606401610a8b565b600f548211156121335760405162461bcd60e51b815260206004820152600960248201527f4d696e74206c65737300000000000000000000000000000000000000000000006044820152606401610a8b565b600c546121408383613cf0565b111561218e5760405162461bcd60e51b815260206004820152600960248201527f4d696e74206c65737300000000000000000000000000000000000000000000006044820152606401610a8b565b81600e5461219c9190613d08565b3410156121eb5760405162461bcd60e51b815260206004820152601260248201527f45544820696e7075742069732077726f6e6700000000000000000000000000006044820152606401610a8b565b60016121f633611ff9565b10156122445760405162461bcd60e51b815260206004820152601360248201527f596f75206d696e74656420746f6f206d616e79000000000000000000000000006044820152606401610a8b565b60005b8281101561226d5761225d336119ae8385613cf0565b61226681613dce565b9050612247565b5060009050610aa73383612d19565b60055473ffffffffffffffffffffffffffffffffffffffff1633146122e35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b73ffffffffffffffffffffffffffffffffffffffff811661236c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610a8b565b6111d681612a11565b60055473ffffffffffffffffffffffffffffffffffffffff1633146123dc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8b565b600f55565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd00000000000000000000000000000000000000000000000000000000148061247457507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610a2257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610a22565b60025460009082108015610a225750600073ffffffffffffffffffffffffffffffffffffffff16600283815481106124fe576124fe613d9f565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141592915050565b600081815260036020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155819061258282611264565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b804710156126185760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610a8b565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114612672576040519150601f19603f3d011682016040523d82523d6000602084013e612677565b606091505b5050905080610d375760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610a8b565b60006126f9826124c4565b61276b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610a8b565b600061277683611264565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806127e557508373ffffffffffffffffffffffffffffffffffffffff166127cd84610b3d565b73ffffffffffffffffffffffffffffffffffffffff16145b80612822575073ffffffffffffffffffffffffffffffffffffffff80821660009081526004602090815260408083209388168352929052205460ff165b949350505050565b8273ffffffffffffffffffffffffffffffffffffffff1661284a82611264565b73ffffffffffffffffffffffffffffffffffffffff16146128d35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610a8b565b73ffffffffffffffffffffffffffffffffffffffff821661295b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610a8b565b612966600082612528565b816002828154811061297a5761297a613d9f565b6000918252602082200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff938416179055604051839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4505050565b600080612a0584612d4e565b90506128228184612db1565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612a928383612dcd565b612a9f6000848484612f27565b610d375760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610a8b565b73ffffffffffffffffffffffffffffffffffffffff821660009081526013602052604081208054839290612b46908490613cf0565b90915550505050565b612b5a84848461282a565b612b6684848484612f27565b6119e25760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610a8b565b6060600b8054610aba90613c6d565b606081612c2757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612c515780612c3b81613dce565b9150612c4a9050600a83613d74565b9150612c2b565b60008167ffffffffffffffff811115612c6c57612c6c613740565b6040519080825280601f01601f191660200182016040528015612c96576020820181803683370190505b5090505b841561282257612cab600183613d88565b9150612cb8600a86613e36565b612cc3906030613cf0565b60f81b818381518110612cd857612cd8613d9f565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612d12600a86613d74565b9450612c9a565b73ffffffffffffffffffffffffffffffffffffffff821660009081526015602052604081208054839290612b46908490613cf0565b6000610a227f28bcf37b3cf2bc5fb85e4153569e33942b67dedd3a52f5007e880261d298bb9c8380519060200120604051602001612d96929190918252602082015260400190565b604051602081830303815290604052805190602001206130fd565b6000806000612dc08585613166565b9150915061166f816131d6565b73ffffffffffffffffffffffffffffffffffffffff8216612e305760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a8b565b612e39816124c4565b15612e865760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a8b565b6002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091556040518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600073ffffffffffffffffffffffffffffffffffffffff84163b156130f2576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290612f9e903390899088908890600401613e4a565b6020604051808303816000875af1925050508015612ff7575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612ff491810190613e93565b60015b6130a7573d808015613025576040519150601f19603f3d011682016040523d82523d6000602084013e61302a565b606091505b50805161309f5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610a8b565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050612822565b506001949350505050565b6000610a2261310a6133c7565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008082516041141561319d5760208301516040840151606085015160001a613191878285856134fb565b945094505050506131cf565b8251604014156131c757602083015160408401516131bc868383613613565b9350935050506131cf565b506000905060025b9250929050565b60008160048111156131ea576131ea613eb0565b14156131f35750565b600181600481111561320757613207613eb0565b14156132555760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610a8b565b600281600481111561326957613269613eb0565b14156132b75760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610a8b565b60038160048111156132cb576132cb613eb0565b141561333f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610a8b565b600481600481111561335357613353613eb0565b14156111d65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610a8b565b60003073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000701b2e775a82dbf50bd80a22a0d32eb13fb818251614801561342d57507f000000000000000000000000000000000000000000000000000000000000000146145b1561345757507f5dcfe509b79dce5456b39f2162af95d17cb049770f750db95ebeb4ade6aad81990565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fb16ae277305a9a87b4d714b6ff6d16515269e7a9a85bcd9f6350ae73a5052d86828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613532575060009050600361360a565b8460ff16601b1415801561354a57508460ff16601c14155b1561355b575060009050600461360a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156135af573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166136035760006001925092505061360a565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161364960ff86901c601b613cf0565b9050613657878288856134fb565b935093505050935093915050565b82805461367190613c6d565b90600052602060002090601f01602090048101928261369357600085556136d9565b82601f106136ac57805160ff19168380011785556136d9565b828001600101855582156136d9579182015b828111156136d95782518255916020019190600101906136be565b506112609291505b8082111561126057600081556001016136e1565b7fffffffff00000000000000000000000000000000000000000000000000000000811681146111d657600080fd5b60006020828403121561373557600080fd5b8135611200816136f5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261378057600080fd5b813567ffffffffffffffff8082111561379b5761379b613740565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156137e1576137e1613740565b816040528381528660208588010111156137fa57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60006020828403121561382c57600080fd5b813567ffffffffffffffff81111561384357600080fd5b6128228482850161376f565b60005b8381101561386a578181015183820152602001613852565b838111156119e25750506000910152565b6000815180845261389381602086016020860161384f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000611200602083018461387b565b6000602082840312156138ea57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146111d657600080fd5b6000806040838503121561392657600080fd5b8235613931816138f1565b946020939093013593505050565b60006020828403121561395157600080fd5b8135611200816138f1565b60008060006060848603121561397157600080fd5b833561397c816138f1565b9250602084013561398c816138f1565b929592945050506040919091013590565b600080604083850312156139b057600080fd5b823567ffffffffffffffff808211156139c857600080fd5b6139d48683870161376f565b935060208501359150808211156139ea57600080fd5b506139f78582860161376f565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015613a3957835183529284019291840191600101613a1d565b50909695505050505050565b80358015158114613a5557600080fd5b919050565b600060208284031215613a6c57600080fd5b61120082613a45565b600080600060608486031215613a8a57600080fd5b83359250602084013567ffffffffffffffff80821115613aa957600080fd5b613ab58783880161376f565b93506040860135915080821115613acb57600080fd5b50613ad88682870161376f565b9150509250925092565b60008083601f840112613af457600080fd5b50813567ffffffffffffffff811115613b0c57600080fd5b6020830191508360208260051b85010111156131cf57600080fd5b60008060008060408587031215613b3d57600080fd5b843567ffffffffffffffff80821115613b5557600080fd5b613b6188838901613ae2565b90965094506020870135915080821115613b7a57600080fd5b50613b8787828801613ae2565b95989497509550505050565b60008060408385031215613ba657600080fd5b8235613bb1816138f1565b9150613bbf60208401613a45565b90509250929050565b60008060008060808587031215613bde57600080fd5b8435613be9816138f1565b93506020850135613bf9816138f1565b925060408501359150606085013567ffffffffffffffff811115613c1c57600080fd5b613c288782880161376f565b91505092959194509250565b60008060408385031215613c4757600080fd5b8235613c52816138f1565b91506020830135613c62816138f1565b809150509250929050565b600181811c90821680613c8157607f821691505b60208210811415613cbb577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115613d0357613d03613cc1565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d4057613d40613cc1565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613d8357613d83613d45565b500490565b600082821015613d9a57613d9a613cc1565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613e0057613e00613cc1565b5060010190565b60008351613e1981846020880161384f565b835190830190613e2d81836020880161384f565b01949350505050565b600082613e4557613e45613d45565b500690565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152613e89608083018461387b565b9695505050505050565b600060208284031215613ea557600080fd5b8151611200816136f5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea26469706673582212201dda6f0a9d6ca4fb75aee1c4624a5d28f480abccc456c6dceb6108b222b7809764736f6c634300080b0033
Verified Source Code Partial Match
Compiler: v0.8.11+commit.d7f03943
EVM: london
Optimization: Yes (20000 runs)
ECDSA.sol 230 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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));
}
}
EIP712.sol 104 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)
pragma solidity ^0.8.0;
import "./ECDSA.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
ERC721.sol 199 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.10;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "./Address.sol";
import "./Context.sol";
import "./ERC165.sol";
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
string private _name;
string private _symbol;
address[] internal _owners;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
uint count = 0;
uint length = _owners.length;
for( uint i = 0; i < length; ++i ){
if( owner == _owners[i] ){
++count;
}
}
delete length;
return count;
}
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;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
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);
}
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
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);
}
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
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);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
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);
}
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");
}
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId < _owners.length && _owners[tokenId] != address(0);
}
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));
}
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
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"
);
}
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);
}
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);
}
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);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
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;
}
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
Address.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @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 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
ERC721A.sol 38 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.10;
import "./ERC721.sol";
import "./IERC721Enumerable.sol";
abstract contract ERC721A is ERC721, IERC721Enumerable {
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256 tokenId) {
require(index < ERC721.balanceOf(owner), "ERC721Enum: owner ioob");
uint count;
for( uint i; i < _owners.length; ++i ){
if( owner == _owners[i] ){
if( count == index )
return i;
else
++count;
}
}
require(false, "ERC721Enum: owner ioob");
}
function tokensOfOwner(address owner) public view returns (uint256[] memory) {
require(0 < ERC721.balanceOf(owner), "ERC721Enum: owner ioob");
uint256 tokenCount = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenCount);
for (uint256 i = 0; i < tokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(owner, i);
}
return tokenIds;
}
function totalSupply() public view virtual override returns (uint256) {
return _owners.length;
}
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721A.totalSupply(), "ERC721Enum: global ioob");
return index;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./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;
}
Ownable.sol 70 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Payment.sol 132 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Address.sol";
import "./Context.sol";
import "./SafeMath.sol";
/**
* @title PaymentSplitter
* @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
* that the Ether will be split in this way, since it is handled transparently by the contract.
*
* The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
* account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
* an amount proportional to the percentage of total shares they were assigned.
*
* `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
* accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
* function.
*/
contract Payment is Context {
event PayeeAdded(address account, uint256 shares);
event PaymentReleased(address to, uint256 amount);
event PaymentReceived(address from, uint256 amount);
uint256 private _totalShares;
uint256 private _totalReleased;
mapping(address => uint256) private _shares;
mapping(address => uint256) private _released;
address[] private _payees;
/**
* @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
* the matching position in the `shares` array.
*
* All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
* duplicates in `payees`.
*/
constructor(address[] memory payees, uint256[] memory shares_) payable {
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares_[i]);
}
}
/**
* @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
* reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
* reliability of the events, and not the actual splitting of Ether.
*
* To learn more about this see the Solidity documentation for
* https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
* functions].
*/
receive() external payable virtual {
emit PaymentReceived(_msgSender(), msg.value);
}
/**
* @dev Getter for the total shares held by payees.
*/
function totalShares() public view returns (uint256) {
return _totalShares;
}
/**
* @dev Getter for the total amount of Ether already released.
*/
function totalReleased() public view returns (uint256) {
return _totalReleased;
}
/**
* @dev Getter for the amount of shares held by an account.
*/
function shares(address account) public view returns (uint256) {
return _shares[account];
}
/**
* @dev Getter for the amount of Ether already released to a payee.
*/
function released(address account) public view returns (uint256) {
return _released[account];
}
/**
* @dev Getter for the address of the payee number `index`.
*/
function payee(uint256 index) public view returns (address) {
return _payees[index];
}
/**
* @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the
* total shares and their previous withdrawals.
*/
function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + _totalReleased;
uint256 payment = (totalReceived * _shares[account]) / _totalShares - _released[account];
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] = _released[account] + payment;
_totalReleased = _totalReleased + payment;
Address.sendValue(account, payment);
emit PaymentReleased(account, payment);
}
/**
* @dev Add a new payee to the contract.
* @param account The address of the payee to add.
* @param shares_ The number of shares owned by the payee.
*/
function _addPayee(address account, uint256 shares_) private {
require(account != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account] == 0, "PaymentSplitter: account already has shares");
_payees.push(account);
_shares[account] = shares_;
_totalShares = _totalShares + shares_;
emit PayeeAdded(account, shares_);
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
SafeMath.sol 226 lines
// SPDX-License-Identifier: MIT
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 no longer needed starting with Solidity 0.8. 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;
}
}
}
BoozeBears.sol 206 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "./ERC721A.sol";
import "./Ownable.sol";
import "./ECDSA.sol";
import "./EIP712.sol";
import "./Payment.sol";
contract BoozeBears is ERC721A, EIP712, Ownable, Payment {
using Strings for uint256;
string public baseURI;
//signature
string private constant SINGING_DOMAIN = "BOOZEBEARS";
string private constant SIGNATURE_VERSION = "1";
//settings
uint256 public maxSupply = 3333;
bool public whitelistStatus = false;
bool public publicStatus = false;
uint256 private price = 0.03 ether;
uint256 public maxMintPerTxPublic = 5;
uint256 public maxMintPerWalletPublic = 20;
uint256 public maxMintPerTxWhitelist = 2;
uint256 public maxMintPerWalletWhitelist = 2;
//mappings
mapping(address => uint256) private mintCountMapWhitelist;
mapping(address => uint256) private allowedMintCountMapWhitelist;
mapping(address => uint256) private mintCountMapPublic;
mapping(address => uint256) private allowedMintCountMapPublic;
//shares
address[] private addressList = [
0xEcc03efB7C0A7BD09A5cC7e954Ac42E8f949A0B5,
0x1f301d288FAd9E11E1Ca8411500720a375154764,
0xEa66DB6c0aA43387aa2A5828428Da71fb6305122,
0x4892cfe386f14Cf8640F6CA124E0F97DC1b7af57,
0x6E8c8B9E868dA7aC2a46403C7F530e565CbFB762,
0x25bC5dCb73E4C800bF95adCCb95451a3fBf434f6,
0x2A27E3B5e8194cf7bd329759B7ED8e2bEBE77Cb1,
0x5C610C2371c82B7bad631c3F13A80307cDF99762,
0x34275F6fc1635A15546ce6696Eb298423bcc5E6b,
0x00F8085B11b09dDDde756Cb5C3bCa6BC5EfBf37F,
0xe558bcCbA1Ee470d07d42E09817eeC622A78FeAD,
0x9b3b9eaf47647C28a842520d1757Da190eDf6648
];
uint[] private shareList = [10,
10,
3,
3,
4,
3,
5,
20,
8,
28,
5,
1];
constructor(
string memory _name,
string memory _symbol,
string memory _initBaseURI
)
ERC721(_name, _symbol)
EIP712(SINGING_DOMAIN, SIGNATURE_VERSION)
Payment(addressList, shareList) {
setURI(_initBaseURI);
}
function mintWhitelist(uint256 _tokenAmount, string memory name, bytes memory signature) public payable {
uint256 s = totalSupply();
require(check(name, signature) == msg.sender, "Signature Invalid"); //server side signature
require(whitelistStatus,"Whitelist sale is not active");
require(_tokenAmount > 0, "Mint more than 0" );
require(_tokenAmount <= maxMintPerTxWhitelist, "Mint less");
require( s + _tokenAmount <= maxSupply, "Mint less");
require(msg.value >= price * _tokenAmount, "ETH input is wrong");
require(allowedMintCountWhitelist(msg.sender) >= 1,"You minted too many");
for (uint256 i = 0; i < _tokenAmount; ++i) {
_safeMint(msg.sender, s + i, "");
}
delete s;
updateMintCountWhitelist(msg.sender, _tokenAmount);
}
function mintPublic(uint256 _tokenAmount) public payable {
uint256 s = totalSupply();
require(publicStatus,"Public sale is not active");
require(_tokenAmount > 0, "Mint more than 0" );
require(_tokenAmount <= maxMintPerTxPublic, "Mint less");
require( s + _tokenAmount <= maxSupply, "Mint less");
require(msg.value >= price * _tokenAmount, "ETH input is wrong");
require(allowedMintCountPublic(msg.sender) >= 1,"You minted too many");
for (uint256 i = 0; i < _tokenAmount; ++i) {
_safeMint(msg.sender, s + i, "");
}
delete s;
updateMintCountPublic(msg.sender, _tokenAmount);
}
// admin minting
function gift(uint[] calldata gifts, address[] calldata recipient) external onlyOwner{
require(gifts.length == recipient.length);
uint g = 0;
uint256 s = totalSupply();
for(uint i = 0; i < gifts.length; ++i){
g += gifts[i];
}
require( s + g <= maxSupply, "Too many" );
delete g;
for(uint i = 0; i < recipient.length; ++i){
for(uint j = 0; j < gifts[i]; ++j){
_safeMint( recipient[i], s++, "" );
}
}
delete s;
}
function check(string memory name, bytes memory signature) public view returns (address) {
return _verify( name, signature);
}
function _verify(string memory name, bytes memory signature) internal view returns (address) {
bytes32 digest = _hash(name);
return ECDSA.recover(digest, signature);
}
function _hash(string memory name) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("Web3Struct(string name)"),
keccak256(bytes(name))
)));
}
//read metadata
function _baseURI() internal view virtual returns (string memory) {
return baseURI;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(tokenId <= maxSupply);
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString())) : "";
}
function updateMintCountWhitelist(address minter, uint256 count) private {
mintCountMapWhitelist[minter] += count;
}
function allowedMintCountWhitelist(address minter) public view returns (uint256) {
return maxMintPerWalletWhitelist - mintCountMapWhitelist[minter];
}
function updateMintCountPublic(address minter, uint256 count) private {
mintCountMapPublic[minter] += count;
}
function allowedMintCountPublic(address minter) public view returns (uint256) {
return maxMintPerWalletPublic - mintCountMapPublic[minter];
}
//price switch
function setPrice(uint256 _newPrice) public onlyOwner {
price = _newPrice;
}
//max switch
function setMaxPerTxWhitelist(uint256 _newMaxMintAmount) public onlyOwner {
maxMintPerTxWhitelist = _newMaxMintAmount;
}
//max switch
function setMaxPerTxPublic(uint256 _newMaxMintAmount) public onlyOwner {
maxMintPerTxPublic = _newMaxMintAmount;
}
//max switch
function setMaxPerWalletWhitelist(uint256 _newMaxMintAmount) public onlyOwner {
maxMintPerWalletWhitelist = _newMaxMintAmount;
}
function setMaxPerWalletPublic(uint256 _newMaxMintAmount) public onlyOwner {
maxMintPerWalletPublic = _newMaxMintAmount;
}
//onoff switch
function setWL(bool _wlstatus) public onlyOwner {
whitelistStatus = _wlstatus;
}
function setP(bool _pstatus) public onlyOwner {
publicStatus = _pstatus;
}
//write metadata
function setURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function withdraw() public payable onlyOwner {
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
require(success);
}
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC721Enumerable.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
allowedMintCountPublic 0xdd0d1bbc → uint256
allowedMintCountWhitelist 0xcd1133d8 → uint256
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
check 0x48808c10 → address
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMintPerTxPublic 0xac9384b9 → uint256
maxMintPerTxWhitelist 0x5cd5a8b4 → uint256
maxMintPerWalletPublic 0xe1fcd707 → uint256
maxMintPerWalletWhitelist 0xcafbfa61 → uint256
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
payee 0x8b83209b → address
publicStatus 0xf91798b1 → bool
released 0x9852595c → uint256
shares 0xce7c2ac2 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
tokensOfOwner 0x8462151c → uint256[]
totalReleased 0xe33b7de3 → uint256
totalShares 0x3a98ef39 → uint256
totalSupply 0x18160ddd → uint256
whitelistStatus 0x9ddf7ad3 → bool
Write Contract 20 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
gift 0x96ea3a47
uint256[] gifts
address[] recipient
mintPublic 0xefd0cbf9
uint256 _tokenAmount
mintWhitelist 0x88dfe18b
uint256 _tokenAmount
string name
bytes signature
release 0x19165587
address account
renounceOwnership 0x715018a6
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
setMaxPerTxPublic 0xf452472e
uint256 _newMaxMintAmount
setMaxPerTxWhitelist 0x7934f505
uint256 _newMaxMintAmount
setMaxPerWalletPublic 0x8b533ea4
uint256 _newMaxMintAmount
setMaxPerWalletWhitelist 0xc6baf917
uint256 _newMaxMintAmount
setP 0x84a303d6
bool _pstatus
setPrice 0x91b7f5ed
uint256 _newPrice
setURI 0x02fe5305
string _newBaseURI
setWL 0xbd986a2c
bool _wlstatus
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address