Address Contract Partially Verified
Address
0x23690FCea8F98C83F4Ed3E3EB3663e1A4e961aC4
Balance
0 ETH
Nonce
1
Code Size
19832 bytes
Creator
0xe9EaEC03...D0fa at tx 0x19417919...c96d2f
Indexed Transactions
0
Contract Bytecode
19832 bytes
0x60806040526004361061023b5760003560e01c80639abc83201161012e578063c6682862116100ab578063e0a59e2c1161006f578063e0a59e2c14610867578063e985e9c514610892578063f2fde38b146108cf578063f4217648146108f8578063fe60d12c146109215761023b565b8063c668286214610782578063c87b56dd146107ad578063cc47a40b146107ea578063d5abeb0114610813578063da3ef23f1461083e5761023b565b8063a0bcfc7f116100f2578063a0bcfc7f146106b3578063a22cb465146106dc578063af979f2514610705578063b88d4fde1461072e578063ba11ecde146107575761023b565b80639abc8320146105db5780639b19251a146106065780639c2ade6114610643578063a035b1fe1461066c578063a0712d68146106975761023b565b8063438b6300116101bc5780637501f741116101805780637501f741146105065780638da5cb5b1461053157806391b7f5ed1461055c57806395d89b411461058557806399288dbb146105b05761023b565b8063438b6300146103fb5780634f6ccce7146104385780636352211e1461047557806370a08231146104b2578063715018a6146104ef5761023b565b80632324521611610203578063232452161461033957806323b872dd146103625780632f745c591461038b5780633ccfd60b146103c857806342842e0e146103d25761023b565b806301ffc9a71461024057806306fdde031461027d578063081812fc146102a8578063095ea7b3146102e557806318160ddd1461030e575b600080fd5b34801561024c57600080fd5b50610267600480360381019061026291906136d5565b61094c565b6040516102749190613df9565b60405180910390f35b34801561028957600080fd5b506102926109c6565b60405161029f9190613e14565b60405180910390f35b3480156102b457600080fd5b506102cf60048036038101906102ca9190613778565b610a58565b6040516102dc9190613d70565b60405180910390f35b3480156102f157600080fd5b5061030c6004803603810190610307919061361b565b610add565b005b34801561031a57600080fd5b50610323610bf5565b6040516103309190614176565b60405180910390f35b34801561034557600080fd5b50610360600480360381019061035b919061365b565b610c02565b005b34801561036e57600080fd5b5061038960048036038101906103849190613505565b610d1a565b005b34801561039757600080fd5b506103b260048036038101906103ad919061361b565b610d7a565b6040516103bf9190614176565b60405180910390f35b6103d0610e1f565b005b3480156103de57600080fd5b506103f960048036038101906103f49190613505565b610eed565b005b34801561040757600080fd5b50610422600480360381019061041d9190613498565b610f0d565b60405161042f9190613dd7565b60405180910390f35b34801561044457600080fd5b5061045f600480360381019061045a9190613778565b610fb9565b60405161046c9190614176565b60405180910390f35b34801561048157600080fd5b5061049c60048036038101906104979190613778565b61102a565b6040516104a99190613d70565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190613498565b6110dc565b6040516104e69190614176565b60405180910390f35b3480156104fb57600080fd5b50610504611194565b005b34801561051257600080fd5b5061051b61121c565b6040516105289190614176565b60405180910390f35b34801561053d57600080fd5b50610546611222565b6040516105539190613d70565b60405180910390f35b34801561056857600080fd5b50610583600480360381019061057e9190613778565b61124c565b005b34801561059157600080fd5b5061059a6112d2565b6040516105a79190613e14565b60405180910390f35b3480156105bc57600080fd5b506105c5611364565b6040516105d29190613df9565b60405180910390f35b3480156105e757600080fd5b506105f0611377565b6040516105fd9190613e14565b60405180910390f35b34801561061257600080fd5b5061062d60048036038101906106289190613498565b611405565b60405161063a9190613df9565b60405180910390f35b34801561064f57600080fd5b5061066a600480360381019061066591906136a8565b611425565b005b34801561067857600080fd5b506106816114be565b60405161068e9190614176565b60405180910390f35b6106b160048036038101906106ac9190613778565b6114c4565b005b3480156106bf57600080fd5b506106da60048036038101906106d5919061372f565b611843565b005b3480156106e857600080fd5b5061070360048036038101906106fe91906135db565b61185d565b005b34801561071157600080fd5b5061072c600480360381019061072791906136a8565b6119de565b005b34801561073a57600080fd5b5061075560048036038101906107509190613558565b611a77565b005b34801561076357600080fd5b5061076c611ad9565b6040516107799190613df9565b60405180910390f35b34801561078e57600080fd5b50610797611aec565b6040516107a49190613e14565b60405180910390f35b3480156107b957600080fd5b506107d460048036038101906107cf9190613778565b611b7a565b6040516107e19190613e14565b60405180910390f35b3480156107f657600080fd5b50610811600480360381019061080c919061361b565b611c25565b005b34801561081f57600080fd5b50610828611db2565b6040516108359190614176565b60405180910390f35b34801561084a57600080fd5b506108656004803603810190610860919061372f565b611db8565b005b34801561087357600080fd5b5061087c611e4e565b6040516108899190614176565b60405180910390f35b34801561089e57600080fd5b506108b960048036038101906108b491906134c5565b611e54565b6040516108c69190613df9565b60405180910390f35b3480156108db57600080fd5b506108f660048036038101906108f19190613498565b611ee8565b005b34801561090457600080fd5b5061091f600480360381019061091a919061365b565b611fe0565b005b34801561092d57600080fd5b50610936612101565b6040516109439190614176565b60405180910390f35b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806109bf57506109be82612107565b5b9050919050565b6060600080546109d59061447f565b80601f0160208091040260200160405190810160405280929190818152602001828054610a019061447f565b8015610a4e5780601f10610a2357610100808354040283529160200191610a4e565b820191906000526020600020905b815481529060010190602001808311610a3157829003601f168201915b5050505050905090565b6000610a63826121e9565b610aa2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9990614016565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610ae88261102a565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5090614096565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b78612255565b73ffffffffffffffffffffffffffffffffffffffff161480610ba75750610ba681610ba1612255565b611e54565b5b610be6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdd90613f56565b60405180910390fd5b610bf0838361225d565b505050565b6000600880549050905090565b610c0a612255565b73ffffffffffffffffffffffffffffffffffffffff16610c28611222565b73ffffffffffffffffffffffffffffffffffffffff1614610c7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7590614036565b60405180910390fd5b60005b82829050811015610d155760136000848484818110610ca357610ca2614618565b5b9050602002016020810190610cb89190613498565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff02191690558080610d0d906144e2565b915050610c81565b505050565b610d2b610d25612255565b82612316565b610d6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d61906140b6565b60405180910390fd5b610d758383836123f4565b505050565b6000610d85836110dc565b8210610dc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dbd90613e56565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610e27612255565b73ffffffffffffffffffffffffffffffffffffffff16610e45611222565b73ffffffffffffffffffffffffffffffffffffffff1614610e9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9290614036565b60405180910390fd5b610eda601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610ed5600a4761265090919063ffffffff16565b612666565b610eeb610ee5612255565b47612666565b565b610f0883838360405180602001604052806000815250611a77565b505050565b60606000610f1a836110dc565b905060008167ffffffffffffffff811115610f3857610f37614647565b5b604051908082528060200260200182016040528015610f665781602001602082028036833780820191505090505b50905060005b82811015610fae57610f7e8582610d7a565b828281518110610f9157610f90614618565b5b60200260200101818152505080610fa7906144e2565b9050610f6c565b508092505050919050565b6000610fc3610bf5565b8210611004576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffb906140d6565b60405180910390fd5b6008828154811061101857611017614618565b5b90600052602060002001549050919050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ca90613fd6565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490613fb6565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61119c612255565b73ffffffffffffffffffffffffffffffffffffffff166111ba611222565b73ffffffffffffffffffffffffffffffffffffffff1614611210576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120790614036565b60405180910390fd5b61121a6000612717565b565b60105481565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611254612255565b73ffffffffffffffffffffffffffffffffffffffff16611272611222565b73ffffffffffffffffffffffffffffffffffffffff16146112c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112bf90614036565b60405180910390fd5b80600d8190555050565b6060600180546112e19061447f565b80601f016020809104026020016040519081016040528092919081815260200182805461130d9061447f565b801561135a5780601f1061132f5761010080835404028352916020019161135a565b820191906000526020600020905b81548152906001019060200180831161133d57829003601f168201915b5050505050905090565b601260019054906101000a900460ff1681565b600b80546113849061447f565b80601f01602080910402602001604051908101604052809291908181526020018280546113b09061447f565b80156113fd5780601f106113d2576101008083540402835291602001916113fd565b820191906000526020600020905b8154815290600101906020018083116113e057829003601f168201915b505050505081565b60136020528060005260406000206000915054906101000a900460ff1681565b61142d612255565b73ffffffffffffffffffffffffffffffffffffffff1661144b611222565b73ffffffffffffffffffffffffffffffffffffffff16146114a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149890614036565b60405180910390fd5b80601260006101000a81548160ff02191690831515021790555050565b600d5481565b60008111611507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114fe90613f76565b60405180910390fd5b60105481111561154c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611543906140f6565b60405180910390fd5b601260009054906101000a900460ff16806115735750601260019054906101000a900460ff165b6115b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a990614116565b60405180910390fd5b6115ba611222565b73ffffffffffffffffffffffffffffffffffffffff166115d8612255565b73ffffffffffffffffffffffffffffffffffffffff16146117f857601260009054906101000a900460ff16801561161c5750601260019054906101000a900460ff16155b1561171757600f5461163e82611630610bf5565b6127dd90919063ffffffff16565b111561167f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167690613e36565b60405180910390fd5b6013600061168b612255565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611712576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170990613f96565b60405180910390fd5b6117a0565b601260019054906101000a900460ff161561179f57611743601154600e546127f390919063ffffffff16565b61175d8261174f610bf5565b6127dd90919063ffffffff16565b111561179e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179590613e36565b60405180910390fd5b5b5b346117b682600d5461280990919063ffffffff16565b11156117f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ee90614156565b60405180910390fd5b5b60005b8181101561183f5761182e61180e612255565b611829600161181b610bf5565b6127dd90919063ffffffff16565b61281f565b80611838906144e2565b90506117fb565b5050565b80600b9080519060200190611859929190613256565b5050565b611865612255565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ca90613f16565b60405180910390fd5b80600560006118e0612255565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661198d612255565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516119d29190613df9565b60405180910390a35050565b6119e6612255565b73ffffffffffffffffffffffffffffffffffffffff16611a04611222565b73ffffffffffffffffffffffffffffffffffffffff1614611a5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5190614036565b60405180910390fd5b80601260016101000a81548160ff02191690831515021790555050565b611a88611a82612255565b83612316565b611ac7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abe906140b6565b60405180910390fd5b611ad38484848461283d565b50505050565b601260009054906101000a900460ff1681565b600c8054611af99061447f565b80601f0160208091040260200160405190810160405280929190818152602001828054611b259061447f565b8015611b725780601f10611b4757610100808354040283529160200191611b72565b820191906000526020600020905b815481529060010190602001808311611b5557829003601f168201915b505050505081565b6060611b85826121e9565b611bc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bbb90614076565b60405180910390fd5b6000600b8054611bd39061447f565b905011611bef5760405180602001604052806000815250611c1e565b600b611bfa83612899565b600c604051602001611c0e93929190613d2a565b6040516020818303038152906040525b9050919050565b611c2d612255565b73ffffffffffffffffffffffffffffffffffffffff16611c4b611222565b73ffffffffffffffffffffffffffffffffffffffff1614611ca1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9890614036565b60405180910390fd5b600081118015611cb357506011548111155b611cf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce990614136565b60405180910390fd5b600e54611d0f82611d01610bf5565b6127dd90919063ffffffff16565b1115611d50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4790613e36565b60405180910390fd5b60005b81811015611d9257611d7f83611d7a6001611d6c610bf5565b6127dd90919063ffffffff16565b61281f565b8080611d8a906144e2565b915050611d53565b50611da8816011546127f390919063ffffffff16565b6011819055505050565b600e5481565b611dc0612255565b73ffffffffffffffffffffffffffffffffffffffff16611dde611222565b73ffffffffffffffffffffffffffffffffffffffff1614611e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e2b90614036565b60405180910390fd5b80600c9080519060200190611e4a929190613256565b5050565b600f5481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611ef0612255565b73ffffffffffffffffffffffffffffffffffffffff16611f0e611222565b73ffffffffffffffffffffffffffffffffffffffff1614611f64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f5b90614036565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611fd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fcb90613e96565b60405180910390fd5b611fdd81612717565b50565b611fe8612255565b73ffffffffffffffffffffffffffffffffffffffff16612006611222565b73ffffffffffffffffffffffffffffffffffffffff161461205c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205390614036565b60405180910390fd5b60005b828290508110156120fc5760016013600085858581811061208357612082614618565b5b90506020020160208101906120989190613498565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806120f4906144e2565b91505061205f565b505050565b60115481565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806121d257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806121e257506121e1826129fa565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166122d08361102a565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612321826121e9565b612360576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235790613f36565b60405180910390fd5b600061236b8361102a565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806123da57508373ffffffffffffffffffffffffffffffffffffffff166123c284610a58565b73ffffffffffffffffffffffffffffffffffffffff16145b806123eb57506123ea8185611e54565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166124148261102a565b73ffffffffffffffffffffffffffffffffffffffff161461246a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246190614056565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156124da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124d190613ef6565b60405180910390fd5b6124e5838383612a64565b6124f060008261225d565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546125409190614395565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461259791906142b4565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000818361265e919061430a565b905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff168260405161268c90613d5b565b60006040518083038185875af1925050503d80600081146126c9576040519150601f19603f3d011682016040523d82523d6000602084013e6126ce565b606091505b5050905080612712576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270990613ed6565b60405180910390fd5b505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081836127eb91906142b4565b905092915050565b600081836128019190614395565b905092915050565b60008183612817919061433b565b905092915050565b612839828260405180602001604052806000815250612b78565b5050565b6128488484846123f4565b61285484848484612bd3565b612893576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161288a90613e76565b60405180910390fd5b50505050565b606060008214156128e1576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506129f5565b600082905060005b600082146129135780806128fc906144e2565b915050600a8261290c919061430a565b91506128e9565b60008167ffffffffffffffff81111561292f5761292e614647565b5b6040519080825280601f01601f1916602001820160405280156129615781602001600182028036833780820191505090505b5090505b600085146129ee5760018261297a9190614395565b9150600a85612989919061452b565b603061299591906142b4565b60f81b8183815181106129ab576129aa614618565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856129e7919061430a565b9450612965565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612a6f838383612d6a565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612ab257612aad81612d6f565b612af1565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612af057612aef8382612db8565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612b3457612b2f81612f25565b612b73565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612b7257612b718282612ff6565b5b5b505050565b612b828383613075565b612b8f6000848484612bd3565b612bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bc590613e76565b60405180910390fd5b505050565b6000612bf48473ffffffffffffffffffffffffffffffffffffffff16613243565b15612d5d578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612c1d612255565b8786866040518563ffffffff1660e01b8152600401612c3f9493929190613d8b565b602060405180830381600087803b158015612c5957600080fd5b505af1925050508015612c8a57506040513d601f19601f82011682018060405250810190612c879190613702565b60015b612d0d573d8060008114612cba576040519150601f19603f3d011682016040523d82523d6000602084013e612cbf565b606091505b50600081511415612d05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cfc90613e76565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612d62565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612dc5846110dc565b612dcf9190614395565b9050600060076000848152602001908152602001600020549050818114612eb4576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050612f399190614395565b9050600060096000848152602001908152602001600020549050600060088381548110612f6957612f68614618565b5b906000526020600020015490508060088381548110612f8b57612f8a614618565b5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480612fda57612fd96145e9565b5b6001900381819060005260206000200160009055905550505050565b6000613001836110dc565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156130e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130dc90613ff6565b60405180910390fd5b6130ee816121e9565b1561312e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161312590613eb6565b60405180910390fd5b61313a60008383612a64565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461318a91906142b4565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b8280546132629061447f565b90600052602060002090601f01602090048101928261328457600085556132cb565b82601f1061329d57805160ff19168380011785556132cb565b828001600101855582156132cb579182015b828111156132ca5782518255916020019190600101906132af565b5b5090506132d891906132dc565b5090565b5b808211156132f55760008160009055506001016132dd565b5090565b600061330c613307846141b6565b614191565b90508281526020810184848401111561332857613327614685565b5b61333384828561443d565b509392505050565b600061334e613349846141e7565b614191565b90508281526020810184848401111561336a57613369614685565b5b61337584828561443d565b509392505050565b60008135905061338c81614ce6565b92915050565b60008083601f8401126133a8576133a761467b565b5b8235905067ffffffffffffffff8111156133c5576133c4614676565b5b6020830191508360208202830111156133e1576133e0614680565b5b9250929050565b6000813590506133f781614cfd565b92915050565b60008135905061340c81614d14565b92915050565b60008151905061342181614d14565b92915050565b600082601f83011261343c5761343b61467b565b5b813561344c8482602086016132f9565b91505092915050565b600082601f83011261346a5761346961467b565b5b813561347a84826020860161333b565b91505092915050565b60008135905061349281614d2b565b92915050565b6000602082840312156134ae576134ad61468f565b5b60006134bc8482850161337d565b91505092915050565b600080604083850312156134dc576134db61468f565b5b60006134ea8582860161337d565b92505060206134fb8582860161337d565b9150509250929050565b60008060006060848603121561351e5761351d61468f565b5b600061352c8682870161337d565b935050602061353d8682870161337d565b925050604061354e86828701613483565b9150509250925092565b600080600080608085870312156135725761357161468f565b5b60006135808782880161337d565b94505060206135918782880161337d565b93505060406135a287828801613483565b925050606085013567ffffffffffffffff8111156135c3576135c261468a565b5b6135cf87828801613427565b91505092959194509250565b600080604083850312156135f2576135f161468f565b5b60006136008582860161337d565b9250506020613611858286016133e8565b9150509250929050565b600080604083850312156136325761363161468f565b5b60006136408582860161337d565b925050602061365185828601613483565b9150509250929050565b600080602083850312156136725761367161468f565b5b600083013567ffffffffffffffff8111156136905761368f61468a565b5b61369c85828601613392565b92509250509250929050565b6000602082840312156136be576136bd61468f565b5b60006136cc848285016133e8565b91505092915050565b6000602082840312156136eb576136ea61468f565b5b60006136f9848285016133fd565b91505092915050565b6000602082840312156137185761371761468f565b5b600061372684828501613412565b91505092915050565b6000602082840312156137455761374461468f565b5b600082013567ffffffffffffffff8111156137635761376261468a565b5b61376f84828501613455565b91505092915050565b60006020828403121561378e5761378d61468f565b5b600061379c84828501613483565b91505092915050565b60006137b18383613d0c565b60208301905092915050565b6137c6816143c9565b82525050565b60006137d78261423d565b6137e1818561426b565b93506137ec83614218565b8060005b8381101561381d57815161380488826137a5565b975061380f8361425e565b9250506001810190506137f0565b5085935050505092915050565b613833816143db565b82525050565b600061384482614248565b61384e818561427c565b935061385e81856020860161444c565b61386781614694565b840191505092915050565b600061387d82614253565b6138878185614298565b935061389781856020860161444c565b6138a081614694565b840191505092915050565b60006138b682614253565b6138c081856142a9565b93506138d081856020860161444c565b80840191505092915050565b600081546138e98161447f565b6138f381866142a9565b9450600182166000811461390e576001811461391f57613952565b60ff19831686528186019350613952565b61392885614228565b60005b8381101561394a5781548189015260018201915060208101905061392b565b838801955050505b50505092915050565b6000613968601383614298565b9150613973826146a5565b602082019050919050565b600061398b602b83614298565b9150613996826146ce565b604082019050919050565b60006139ae603283614298565b91506139b98261471d565b604082019050919050565b60006139d1602683614298565b91506139dc8261476c565b604082019050919050565b60006139f4601c83614298565b91506139ff826147bb565b602082019050919050565b6000613a17601483614298565b9150613a22826147e4565b602082019050919050565b6000613a3a602483614298565b9150613a458261480d565b604082019050919050565b6000613a5d601983614298565b9150613a688261485c565b602082019050919050565b6000613a80602c83614298565b9150613a8b82614885565b604082019050919050565b6000613aa3603883614298565b9150613aae826148d4565b604082019050919050565b6000613ac6601083614298565b9150613ad182614923565b602082019050919050565b6000613ae9600f83614298565b9150613af48261494c565b602082019050919050565b6000613b0c602a83614298565b9150613b1782614975565b604082019050919050565b6000613b2f602983614298565b9150613b3a826149c4565b604082019050919050565b6000613b52602083614298565b9150613b5d82614a13565b602082019050919050565b6000613b75602c83614298565b9150613b8082614a3c565b604082019050919050565b6000613b98602083614298565b9150613ba382614a8b565b602082019050919050565b6000613bbb602983614298565b9150613bc682614ab4565b604082019050919050565b6000613bde603083614298565b9150613be982614b03565b604082019050919050565b6000613c01602183614298565b9150613c0c82614b52565b604082019050919050565b6000613c2460008361428d565b9150613c2f82614ba1565b600082019050919050565b6000613c47603183614298565b9150613c5282614ba4565b604082019050919050565b6000613c6a602c83614298565b9150613c7582614bf3565b604082019050919050565b6000613c8d601383614298565b9150613c9882614c42565b602082019050919050565b6000613cb0600a83614298565b9150613cbb82614c6b565b602082019050919050565b6000613cd3601883614298565b9150613cde82614c94565b602082019050919050565b6000613cf6601383614298565b9150613d0182614cbd565b602082019050919050565b613d1581614433565b82525050565b613d2481614433565b82525050565b6000613d3682866138dc565b9150613d4282856138ab565b9150613d4e82846138dc565b9150819050949350505050565b6000613d6682613c17565b9150819050919050565b6000602082019050613d8560008301846137bd565b92915050565b6000608082019050613da060008301876137bd565b613dad60208301866137bd565b613dba6040830185613d1b565b8181036060830152613dcc8184613839565b905095945050505050565b60006020820190508181036000830152613df181846137cc565b905092915050565b6000602082019050613e0e600083018461382a565b92915050565b60006020820190508181036000830152613e2e8184613872565b905092915050565b60006020820190508181036000830152613e4f8161395b565b9050919050565b60006020820190508181036000830152613e6f8161397e565b9050919050565b60006020820190508181036000830152613e8f816139a1565b9050919050565b60006020820190508181036000830152613eaf816139c4565b9050919050565b60006020820190508181036000830152613ecf816139e7565b9050919050565b60006020820190508181036000830152613eef81613a0a565b9050919050565b60006020820190508181036000830152613f0f81613a2d565b9050919050565b60006020820190508181036000830152613f2f81613a50565b9050919050565b60006020820190508181036000830152613f4f81613a73565b9050919050565b60006020820190508181036000830152613f6f81613a96565b9050919050565b60006020820190508181036000830152613f8f81613ab9565b9050919050565b60006020820190508181036000830152613faf81613adc565b9050919050565b60006020820190508181036000830152613fcf81613aff565b9050919050565b60006020820190508181036000830152613fef81613b22565b9050919050565b6000602082019050818103600083015261400f81613b45565b9050919050565b6000602082019050818103600083015261402f81613b68565b9050919050565b6000602082019050818103600083015261404f81613b8b565b9050919050565b6000602082019050818103600083015261406f81613bae565b9050919050565b6000602082019050818103600083015261408f81613bd1565b9050919050565b600060208201905081810360008301526140af81613bf4565b9050919050565b600060208201905081810360008301526140cf81613c3a565b9050919050565b600060208201905081810360008301526140ef81613c5d565b9050919050565b6000602082019050818103600083015261410f81613c80565b9050919050565b6000602082019050818103600083015261412f81613ca3565b9050919050565b6000602082019050818103600083015261414f81613cc6565b9050919050565b6000602082019050818103600083015261416f81613ce9565b9050919050565b600060208201905061418b6000830184613d1b565b92915050565b600061419b6141ac565b90506141a782826144b1565b919050565b6000604051905090565b600067ffffffffffffffff8211156141d1576141d0614647565b5b6141da82614694565b9050602081019050919050565b600067ffffffffffffffff82111561420257614201614647565b5b61420b82614694565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006142bf82614433565b91506142ca83614433565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142ff576142fe61455c565b5b828201905092915050565b600061431582614433565b915061432083614433565b9250826143305761432f61458b565b5b828204905092915050565b600061434682614433565b915061435183614433565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561438a5761438961455c565b5b828202905092915050565b60006143a082614433565b91506143ab83614433565b9250828210156143be576143bd61455c565b5b828203905092915050565b60006143d482614413565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561446a57808201518184015260208101905061444f565b83811115614479576000848401525b50505050565b6000600282049050600182168061449757607f821691505b602082108114156144ab576144aa6145ba565b5b50919050565b6144ba82614694565b810181811067ffffffffffffffff821117156144d9576144d8614647565b5b80604052505050565b60006144ed82614433565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156145205761451f61455c565b5b600182019050919050565b600061453682614433565b915061454183614433565b9250826145515761455061458b565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4d617820737570706c7920657863656564656400000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4661696c656420746f2073656e64204574686572000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f496e76616c6964207175616e7469747900000000000000000000000000000000600082015250565b7f4e6f742077686974656c69737465640000000000000000000000000000000000600082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d65746164617461203a2055524920717565727920666f72206e60008201527f6f6e6578697374656e7420746f6b656e00000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f4d696e74206c696d697420657863656564656400000000000000000000000000600082015250565b7f53616c6520636c6f736500000000000000000000000000000000000000000000600082015250565b7f4e6f7420656e6f756768207265736572766573206c6566740000000000000000600082015250565b7f496e636f7272656374204554482076616c756500000000000000000000000000600082015250565b614cef816143c9565b8114614cfa57600080fd5b50565b614d06816143db565b8114614d1157600080fd5b50565b614d1d816143e7565b8114614d2857600080fd5b50565b614d3481614433565b8114614d3f57600080fd5b5056fea2646970667358221220072b3c5d231ace419ed4a8b2e25110660e49e92837651b7df5248ce924d6e1e564736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
QuokkaEmpire.sol 119 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
contract QuokkaEmpire is ERC721Enumerable, Ownable {
using SafeMath for uint256;
using Strings for uint256;
using Address for address;
string public baseUri;
string public baseExtension;
uint256 public price = 0.069 ether;
uint256 public maxSupply = 9669 ;
uint256 public maxPreSaleSupply = 969;
uint256 public maxMint = 20;
uint256 public reserved = 200;
bool public preSaleOpen = false;
bool public saleOpen = false;
mapping(address => bool) public whitelist;
address private dev = 0xD03B3bF49F6434cB2Cb18C5DD5475Ec8A4eDa4bE;
constructor() ERC721("Quokka Empire", "QE") {
}
function _baseURI() internal view virtual override returns (string memory) {
return baseUri;
}
function setBaseUri(string memory _uri) public {
baseUri = _uri;
}
function mint(uint256 quantity) public payable {
require(quantity > 0, "Invalid quantity");
require(quantity <= maxMint, "Mint limit exceeded");
require(preSaleOpen || saleOpen, "Sale close");
if(_msgSender() != owner()) {
if(preSaleOpen && !saleOpen){
require(totalSupply().add(quantity) <= maxPreSaleSupply, "Max supply exceeded");
require(whitelist[_msgSender()], "Not whitelisted");
}else if(saleOpen){
require(totalSupply().add(quantity) <= maxSupply.sub(reserved), "Max supply exceeded");
}
require(price.mul(quantity) <= msg.value, "Incorrect ETH value");
}
for(uint256 i = 0; i < quantity; ++i) {
_safeMint(_msgSender(), totalSupply().add(1));
}
}
function reserve(address _to, uint256 _quantity) public onlyOwner {
require(_quantity > 0 && _quantity <= reserved, "Not enough reserves left");
require(totalSupply().add(_quantity) <= maxSupply, "Max supply exceeded");
for (uint256 i = 0; i < _quantity; i++) {
_safeMint(_to, totalSupply().add(1));
}
reserved = reserved.sub(_quantity);
}
function walletOfOwner(address _owner) public view returns (uint256[] memory) {
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256[](ownerTokenCount);
for(uint256 i; i < ownerTokenCount; ++i) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata : URI query for nonexistent token");
return bytes(baseUri).length > 0 ? string(abi.encodePacked(baseUri, tokenId.toString(), baseExtension)) : "";
}
function setPrice(uint256 _newPrice) public onlyOwner {
price = _newPrice;
}
function setBaseExtension(string memory _newBaseExtension) public onlyOwner {
baseExtension = _newBaseExtension;
}
function setWhitelist(address[] calldata newAddresses) public onlyOwner {
for (uint256 i = 0; i < newAddresses.length; i++)
whitelist[newAddresses[i]] = true;
}
function removeWhitelist(address[] calldata currentAddresses) public onlyOwner {
for (uint256 i = 0; i < currentAddresses.length; i++)
delete whitelist[currentAddresses[i]];
}
function setPreSaleOpen(bool _state) public onlyOwner {
preSaleOpen = _state;
}
function setSaleOpen(bool _state) public onlyOwner {
saleOpen = _state;
}
function withdraw() public payable onlyOwner {
transfer(dev, address(this).balance.div(10));
transfer(_msgSender(), address(this).balance);
}
function transfer(address _to, uint256 _value) private {
(bool sent, ) = payable(_to).call{value: _value}("");
require(sent, "Failed to send Ether");
}
}
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;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.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 {}
}
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;
}
}
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 162 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
balanceOf 0x70a08231 → uint256
baseExtension 0xc6682862 → string
baseUri 0x9abc8320 → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMint 0x7501f741 → uint256
maxPreSaleSupply 0xe0a59e2c → uint256
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
preSaleOpen 0xba11ecde → bool
price 0xa035b1fe → uint256
reserved 0xfe60d12c → uint256
saleOpen 0x99288dbb → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
whitelist 0x9b19251a → bool
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mint 0xa0712d68
uint256 quantity
removeWhitelist 0x23245216
address[] currentAddresses
renounceOwnership 0x715018a6
No parameters
reserve 0xcc47a40b
address _to
uint256 _quantity
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseExtension 0xda3ef23f
string _newBaseExtension
setBaseUri 0xa0bcfc7f
string _uri
setPreSaleOpen 0x9c2ade61
bool _state
setPrice 0x91b7f5ed
uint256 _newPrice
setSaleOpen 0xaf979f25
bool _state
setWhitelist 0xf4217648
address[] newAddresses
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address