Address Contract Partially Verified
Address
0x8a93bc8Ed29da1b090265137a9d201EbF1154626
Balance
0 ETH
Nonce
1
Code Size
19338 bytes
Creator
0xeecE4544...718B at tx 0xa4e693de...1b291b
Indexed Transactions
0 (1 on-chain, 0.9% indexed)
Contract Bytecode
19338 bytes
0x60806040526004361061023b5760003560e01c806370a082311161012e578063c87b56dd116100ab578063dab5f3401161006f578063dab5f3401461082e578063e4e5de3414610857578063e97925b91461086e578063e985e9c5146108ab578063f425f560146108e85761023b565b8063c87b56dd1461077c578063d1b229bf146107b9578063d6065b4e146107d5578063d65ae67714610800578063d9e82c65146108175761023b565b806395d89b41116100f257806395d89b41146106ba578063a22cb465146106e5578063b3ab66b01461070e578063b5c01e451461072a578063b88d4fde146107535761023b565b806370a08231146105c3578063791a2519146106005780637bc36e04146106295780637dc0bf3f146106525780638da5cb5b1461068f5761023b565b80632fbba115116101bc5780634f6ccce7116101805780634f6ccce7146104c55780635508e19214610502578063612c8a5f1461051e5780636352211e1461055b5780636df1376e146105985761023b565b80632fbba1151461040a5780633ccfd60b1461043357806342842e0e1461044a57806342966c68146104735780634a44f3791461049c5761023b565b8063095ea7b311610203578063095ea7b3146103135780630a7a1c381461033c57806318160ddd1461037957806323b872dd146103a45780632f745c59146103cd5761023b565b806301d7dd2b1461024057806301ffc9a714610257578063057b6e4e1461029457806306fdde03146102ab578063081812fc146102d6575b600080fd5b34801561024c57600080fd5b50610255610913565b005b34801561026357600080fd5b5061027e6004803603810190610279919061339a565b61098a565b60405161028b91906133e2565b60405180910390f35b3480156102a057600080fd5b506102a961099c565b005b3480156102b757600080fd5b506102c0610a13565b6040516102cd9190613496565b60405180910390f35b3480156102e257600080fd5b506102fd60048036038101906102f891906134ee565b610aa5565b60405161030a919061355c565b60405180910390f35b34801561031f57600080fd5b5061033a600480360381019061033591906135a3565b610b2a565b005b34801561034857600080fd5b50610363600480360381019061035e91906135e3565b610c42565b604051610370919061361f565b60405180910390f35b34801561038557600080fd5b5061038e610c5a565b60405161039b919061361f565b60405180910390f35b3480156103b057600080fd5b506103cb60048036038101906103c6919061363a565b610c67565b005b3480156103d957600080fd5b506103f460048036038101906103ef91906135a3565b610cc7565b604051610401919061361f565b60405180910390f35b34801561041657600080fd5b50610431600480360381019061042c91906134ee565b610d6c565b005b34801561043f57600080fd5b50610448610e21565b005b34801561045657600080fd5b50610471600480360381019061046c919061363a565b610eec565b005b34801561047f57600080fd5b5061049a600480360381019061049591906134ee565b610f0c565b005b3480156104a857600080fd5b506104c360048036038101906104be91906137c2565b610f58565b005b3480156104d157600080fd5b506104ec60048036038101906104e791906134ee565b610fcc565b6040516104f9919061361f565b60405180910390f35b61051c6004803603810190610517919061386b565b61103d565b005b34801561052a57600080fd5b50610545600480360381019061054091906135e3565b611321565b60405161055291906133e2565b60405180910390f35b34801561056757600080fd5b50610582600480360381019061057d91906134ee565b611341565b60405161058f919061355c565b60405180910390f35b3480156105a457600080fd5b506105ad6113f3565b6040516105ba919061361f565b60405180910390f35b3480156105cf57600080fd5b506105ea60048036038101906105e591906135e3565b6113f9565b6040516105f7919061361f565b60405180910390f35b34801561060c57600080fd5b50610627600480360381019061062291906134ee565b6114b1565b005b34801561063557600080fd5b50610650600480360381019061064b91906134ee565b61151c565b005b34801561065e57600080fd5b50610679600480360381019061067491906134ee565b611587565b60405161068691906133e2565b60405180910390f35b34801561069b57600080fd5b506106a46115a7565b6040516106b1919061355c565b60405180910390f35b3480156106c657600080fd5b506106cf6115cd565b6040516106dc9190613496565b60405180910390f35b3480156106f157600080fd5b5061070c6004803603810190610707919061391f565b61165f565b005b610728600480360381019061072391906134ee565b6117e0565b005b34801561073657600080fd5b50610751600480360381019061074c91906134ee565b6118b0565b005b34801561075f57600080fd5b5061077a60048036038101906107759190613a00565b61191b565b005b34801561078857600080fd5b506107a3600480360381019061079e91906134ee565b61197d565b6040516107b09190613496565b60405180910390f35b6107d360048036038101906107ce919061386b565b61198f565b005b3480156107e157600080fd5b506107ea611c27565b6040516107f7919061361f565b60405180910390f35b34801561080c57600080fd5b50610815611c2d565b005b34801561082357600080fd5b5061082c611cea565b005b34801561083a57600080fd5b5061085560048036038101906108509190613ab9565b611d61565b005b34801561086357600080fd5b5061086c611dcc565b005b34801561087a57600080fd5b5061089560048036038101906108909190613ae6565b611e43565b6040516108a2919061361f565b60405180910390f35b3480156108b757600080fd5b506108d260048036038101906108cd9190613b5a565b611eb3565b6040516108df91906133e2565b60405180910390f35b3480156108f457600080fd5b506108fd611f47565b60405161090a919061361f565b60405180910390f35b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461096d57600080fd5b6001600c60016101000a81548160ff021916908315150217905550565b600061099582612079565b9050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109f657600080fd5b6000600c60016101000a81548160ff021916908315150217905550565b606060008054610a2290613bc9565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4e90613bc9565b8015610a9b5780601f10610a7057610100808354040283529160200191610a9b565b820191906000526020600020905b815481529060010190602001808311610a7e57829003601f168201915b5050505050905090565b6000610ab0826120f3565b610aef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae690613c6d565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610b3582611341565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ba6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9d90613cff565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610bc561215f565b73ffffffffffffffffffffffffffffffffffffffff161480610bf45750610bf381610bee61215f565b611eb3565b5b610c33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2a90613d91565b60405180910390fd5b610c3d8383612167565b505050565b600e6020528060005260406000206000915090505481565b6000600880549050905090565b610c78610c7261215f565b82612220565b610cb7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cae90613e23565b60405180910390fd5b610cc28383836122fe565b505050565b6000610cd2836113f9565b8210610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a90613eb5565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dad61215f565b73ffffffffffffffffffffffffffffffffffffffff1614610dcd57600080fd5b806000108015610ddf57506101f48111155b610de857600080fd5b610df2338261255a565b6001600d600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e7b57600080fd5b6000479050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610ee8573d6000803e3d6000fd5b5050565b610f078383836040518060200160405280600081525061191b565b505050565b610f1581611341565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f4c57600080fd5b610f5581612578565b50565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fb257600080fd5b80600b9080519060200190610fc892919061328b565b5050565b6000610fd6610c5a565b8210611017576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100e90613f47565b60405180910390fd5b6008828154811061102b5761102a613f67565b5b90600052602060002001549050919050565b600c60009054906101000a900460ff1661108c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108390613fe2565b60405180910390fd5b600061109a86868686611e43565b116110da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d19061404e565b60405180910390fd5b6001600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061115c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611153906140ba565b60405180910390fd5b60105434146111a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119790614126565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff166111bf61215f565b73ffffffffffffffffffffffffffffffffffffffff16146111df57600080fd5b8060001080156111f157506101f48111155b611230576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122790614192565b60405180910390fd5b61124161123b61215f565b8261255a565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611291906141e1565b91905055506001600d600083815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050505050565b600f6020528060005260406000206000915054906101000a900460ff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e19061429c565b60405180910390fd5b80915050919050565b60115481565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561146a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114619061432e565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166114f261215f565b73ffffffffffffffffffffffffffffffffffffffff161461151257600080fd5b8060118190555050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661155d61215f565b73ffffffffffffffffffffffffffffffffffffffff161461157d57600080fd5b8060108190555050565b600d6020528060005260406000206000915054906101000a900460ff1681565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600180546115dc90613bc9565b80601f016020809104026020016040519081016040528092919081815260200182805461160890613bc9565b80156116555780601f1061162a57610100808354040283529160200191611655565b820191906000526020600020905b81548152906001019060200180831161163857829003601f168201915b5050505050905090565b61166761215f565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cc9061439a565b60405180910390fd5b80600560006116e261215f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661178f61215f565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516117d491906133e2565b60405180910390a35050565b60115434146117ee57600080fd5b600c60019054906101000a900460ff1661180757600080fd5b80600010801561181957506101f48111155b61182257600080fd5b61182c338261255a565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061187c906141e1565b91905055506001600d600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118f161215f565b73ffffffffffffffffffffffffffffffffffffffff161461191157600080fd5b8060128190555050565b61192c61192661215f565b83612220565b61196b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161196290613e23565b60405180910390fd5b61197784848484612584565b50505050565b6060611988826125e0565b9050919050565b600c60009054906101000a900460ff166119de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d590613fe2565b60405180910390fd5b60006119ec86868686611e43565b11611a2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a239061404e565b60405180910390fd5b60125484611a3a91906143ba565b600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611aba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab190614460565b60405180910390fd5b6010543414611afe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af590614126565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16611b1d61215f565b73ffffffffffffffffffffffffffffffffffffffff1614611b3d57600080fd5b806000108015611b4f57506101f48111155b611b8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8590614192565b60405180910390fd5b611b9f611b9961215f565b8261255a565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611bef906141e1565b91905055506001600d600083815260200190815260200160002060006101000a81548160ff0219169083151502179055505050505050565b60105481565b73e35b827177398d8d2fba304d9cf53bc8fc1573b773ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c7957600080fd5b6000479050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611ce6573d6000803e3d6000fd5b5050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d4457600080fd5b6000600c60006101000a81548160ff021916908315150217905550565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611da261215f565b73ffffffffffffffffffffffffffffffffffffffff1614611dc257600080fd5b8060158190555050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e2657600080fd5b6001600c60006101000a81548160ff021916908315150217905550565b6000611e99611e528686612687565b848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506126ba565b15611ea657839050611eab565b600090505b949350505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60125481565b600080823b905060008111915050919050565b611f6b838383612074565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611fae57611fa9816126d1565b611fed565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611fec57611feb838261271a565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120305761202b81612887565b61206f565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461206e5761206d8282612958565b5b5b505050565b505050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806120ec57506120eb826129d7565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166121da83611341565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061222b826120f3565b61226a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612261906144f2565b60405180910390fd5b600061227583611341565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806122e457508373ffffffffffffffffffffffffffffffffffffffff166122cc84610aa5565b73ffffffffffffffffffffffffffffffffffffffff16145b806122f557506122f48185611eb3565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661231e82611341565b73ffffffffffffffffffffffffffffffffffffffff1614612374576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236b90614584565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156123e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123db90614616565b60405180910390fd5b6123ef838383612ab9565b6123fa600082612167565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461244a9190614636565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546124a1919061466a565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b612574828260405180602001604052806000815250612ac9565b5050565b61258181612b24565b50565b61258f8484846122fe565b61259b84848484612c35565b6125da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d190614732565b60405180910390fd5b50505050565b60606125eb826120f3565b61262a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612621906147c4565b60405180910390fd5b6000612634612dbd565b90506000815111612654576040518060200160405280600081525061267f565b8061265e84612e4f565b60405160200161266f929190614820565b6040516020818303038152906040525b915050919050565b6000828260405160200161269c9291906148ad565b60405160208183030381529060405280519060200120905092915050565b60006126c98260155485612fb0565b905092915050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612727846113f9565b6127319190614636565b9050600060076000848152602001908152602001600020549050818114612816576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b6000600160088054905061289b9190614636565b90506000600960008481526020019081526020016000205490506000600883815481106128cb576128ca613f67565b5b9060005260206000200154905080600883815481106128ed576128ec613f67565b5b90600052602060002001819055508160096000838152602001908152602001600020819055506009600085815260200190815260200160002060009055600880548061293c5761293b6148d9565b5b6001900381819060005260206000200160009055905550505050565b6000612963836113f9565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612aa257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612ab25750612ab182612fc7565b5b9050919050565b612ac4838383611f60565b505050565b612ad38383613031565b612ae06000848484612c35565b612b1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b1690614732565b60405180910390fd5b505050565b6000612b2f82611341565b9050612b3d81600084612ab9565b612b48600083612167565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612b989190614636565b925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b6000612c568473ffffffffffffffffffffffffffffffffffffffff16611f4d565b15612db0578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612c7f61215f565b8786866040518563ffffffff1660e01b8152600401612ca1949392919061495d565b6020604051808303816000875af1925050508015612cdd57506040513d601f19601f82011682018060405250810190612cda91906149be565b60015b612d60573d8060008114612d0d576040519150601f19603f3d011682016040523d82523d6000602084013e612d12565b606091505b50600081511415612d58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d4f90614732565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612db5565b600190505b949350505050565b6060600b8054612dcc90613bc9565b80601f0160208091040260200160405190810160405280929190818152602001828054612df890613bc9565b8015612e455780601f10612e1a57610100808354040283529160200191612e45565b820191906000526020600020905b815481529060010190602001808311612e2857829003601f168201915b5050505050905090565b60606000821415612e97576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612fab565b600082905060005b60008214612ec9578080612eb2906141e1565b915050600a82612ec29190614a1a565b9150612e9f565b60008167ffffffffffffffff811115612ee557612ee4613697565b5b6040519080825280601f01601f191660200182016040528015612f175781602001600182028036833780820191505090505b5090505b60008514612fa457600182612f309190614636565b9150600a85612f3f9190614a4b565b6030612f4b919061466a565b60f81b818381518110612f6157612f60613f67565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612f9d9190614a1a565b9450612f1b565b8093505050505b919050565b600082612fbd85846131ff565b1490509392505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156130a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161309890614ac8565b60405180910390fd5b6130aa816120f3565b156130ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130e190614b34565b60405180910390fd5b6130f660008383612ab9565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613146919061466a565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b60008082905060005b845181101561326957600085828151811061322657613225613f67565b5b60200260200101519050808311613248576132418382613274565b9250613255565b6132528184613274565b92505b508080613261906141e1565b915050613208565b508091505092915050565b600082600052816020526040600020905092915050565b82805461329790613bc9565b90600052602060002090601f0160209004810192826132b95760008555613300565b82601f106132d257805160ff1916838001178555613300565b82800160010185558215613300579182015b828111156132ff5782518255916020019190600101906132e4565b5b50905061330d9190613311565b5090565b5b8082111561332a576000816000905550600101613312565b5090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61337781613342565b811461338257600080fd5b50565b6000813590506133948161336e565b92915050565b6000602082840312156133b0576133af613338565b5b60006133be84828501613385565b91505092915050565b60008115159050919050565b6133dc816133c7565b82525050565b60006020820190506133f760008301846133d3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561343757808201518184015260208101905061341c565b83811115613446576000848401525b50505050565b6000601f19601f8301169050919050565b6000613468826133fd565b6134728185613408565b9350613482818560208601613419565b61348b8161344c565b840191505092915050565b600060208201905081810360008301526134b0818461345d565b905092915050565b6000819050919050565b6134cb816134b8565b81146134d657600080fd5b50565b6000813590506134e8816134c2565b92915050565b60006020828403121561350457613503613338565b5b6000613512848285016134d9565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006135468261351b565b9050919050565b6135568161353b565b82525050565b6000602082019050613571600083018461354d565b92915050565b6135808161353b565b811461358b57600080fd5b50565b60008135905061359d81613577565b92915050565b600080604083850312156135ba576135b9613338565b5b60006135c88582860161358e565b92505060206135d9858286016134d9565b9150509250929050565b6000602082840312156135f9576135f8613338565b5b60006136078482850161358e565b91505092915050565b613619816134b8565b82525050565b60006020820190506136346000830184613610565b92915050565b60008060006060848603121561365357613652613338565b5b60006136618682870161358e565b93505060206136728682870161358e565b9250506040613683868287016134d9565b9150509250925092565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6136cf8261344c565b810181811067ffffffffffffffff821117156136ee576136ed613697565b5b80604052505050565b600061370161332e565b905061370d82826136c6565b919050565b600067ffffffffffffffff82111561372d5761372c613697565b5b6137368261344c565b9050602081019050919050565b82818337600083830152505050565b600061376561376084613712565b6136f7565b90508281526020810184848401111561378157613780613692565b5b61378c848285613743565b509392505050565b600082601f8301126137a9576137a861368d565b5b81356137b9848260208601613752565b91505092915050565b6000602082840312156137d8576137d7613338565b5b600082013567ffffffffffffffff8111156137f6576137f561333d565b5b61380284828501613794565b91505092915050565b600080fd5b600080fd5b60008083601f84011261382b5761382a61368d565b5b8235905067ffffffffffffffff8111156138485761384761380b565b5b60208301915083602082028301111561386457613863613810565b5b9250929050565b60008060008060006080868803121561388757613886613338565b5b60006138958882890161358e565b95505060206138a6888289016134d9565b945050604086013567ffffffffffffffff8111156138c7576138c661333d565b5b6138d388828901613815565b935093505060606138e6888289016134d9565b9150509295509295909350565b6138fc816133c7565b811461390757600080fd5b50565b600081359050613919816138f3565b92915050565b6000806040838503121561393657613935613338565b5b60006139448582860161358e565b92505060206139558582860161390a565b9150509250929050565b600067ffffffffffffffff82111561397a57613979613697565b5b6139838261344c565b9050602081019050919050565b60006139a361399e8461395f565b6136f7565b9050828152602081018484840111156139bf576139be613692565b5b6139ca848285613743565b509392505050565b600082601f8301126139e7576139e661368d565b5b81356139f7848260208601613990565b91505092915050565b60008060008060808587031215613a1a57613a19613338565b5b6000613a288782880161358e565b9450506020613a398782880161358e565b9350506040613a4a878288016134d9565b925050606085013567ffffffffffffffff811115613a6b57613a6a61333d565b5b613a77878288016139d2565b91505092959194509250565b6000819050919050565b613a9681613a83565b8114613aa157600080fd5b50565b600081359050613ab381613a8d565b92915050565b600060208284031215613acf57613ace613338565b5b6000613add84828501613aa4565b91505092915050565b60008060008060608587031215613b0057613aff613338565b5b6000613b0e8782880161358e565b9450506020613b1f878288016134d9565b935050604085013567ffffffffffffffff811115613b4057613b3f61333d565b5b613b4c87828801613815565b925092505092959194509250565b60008060408385031215613b7157613b70613338565b5b6000613b7f8582860161358e565b9250506020613b908582860161358e565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613be157607f821691505b60208210811415613bf557613bf4613b9a565b5b50919050565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b6000613c57602c83613408565b9150613c6282613bfb565b604082019050919050565b60006020820190508181036000830152613c8681613c4a565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000613ce9602183613408565b9150613cf482613c8d565b604082019050919050565b60006020820190508181036000830152613d1881613cdc565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b6000613d7b603883613408565b9150613d8682613d1f565b604082019050919050565b60006020820190508181036000830152613daa81613d6e565b9050919050565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b6000613e0d603183613408565b9150613e1882613db1565b604082019050919050565b60006020820190508181036000830152613e3c81613e00565b9050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b6000613e9f602b83613408565b9150613eaa82613e43565b604082019050919050565b60006020820190508181036000830152613ece81613e92565b9050919050565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b6000613f31602c83613408565b9150613f3c82613ed5565b604082019050919050565b60006020820190508181036000830152613f6081613f24565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f707269766174652073616c65206e6f7420737461727465640000000000000000600082015250565b6000613fcc601883613408565b9150613fd782613f96565b602082019050919050565b60006020820190508181036000830152613ffb81613fbf565b9050919050565b7f6163636f756e74206973206e6f7420696e20616c6c6f776c6973740000000000600082015250565b6000614038601b83613408565b915061404382614002565b602082019050919050565b600060208201905081810360008301526140678161402b565b9050919050565b7f6d696e7420616d6f756e74206f76657200000000000000000000000000000000600082015250565b60006140a4601083613408565b91506140af8261406e565b602082019050919050565b600060208201905081810360008301526140d381614097565b9050919050565b7f696e76616c6964207472616e73616374696f6e20657468207072696365000000600082015250565b6000614110601d83613408565b915061411b826140da565b602082019050919050565b6000602082019050818103600083015261413f81614103565b9050919050565b7f696e76616c6964206e6674206964000000000000000000000000000000000000600082015250565b600061417c600e83613408565b915061418782614146565b602082019050919050565b600060208201905081810360008301526141ab8161416f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006141ec826134b8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561421f5761421e6141b2565b5b600182019050919050565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b6000614286602983613408565b91506142918261422a565b604082019050919050565b600060208201905081810360008301526142b581614279565b9050919050565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b6000614318602a83613408565b9150614323826142bc565b604082019050919050565b600060208201905081810360008301526143478161430b565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000614384601983613408565b915061438f8261434e565b602082019050919050565b600060208201905081810360008301526143b381614377565b9050919050565b60006143c5826134b8565b91506143d0836134b8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614409576144086141b2565b5b828202905092915050565b7f6d61676e696669636174696f6e20616d6f756e74206f76657200000000000000600082015250565b600061444a601983613408565b915061445582614414565b602082019050919050565b600060208201905081810360008301526144798161443d565b9050919050565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b60006144dc602c83613408565b91506144e782614480565b604082019050919050565b6000602082019050818103600083015261450b816144cf565b9050919050565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b600061456e602983613408565b915061457982614512565b604082019050919050565b6000602082019050818103600083015261459d81614561565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000614600602483613408565b915061460b826145a4565b604082019050919050565b6000602082019050818103600083015261462f816145f3565b9050919050565b6000614641826134b8565b915061464c836134b8565b92508282101561465f5761465e6141b2565b5b828203905092915050565b6000614675826134b8565b9150614680836134b8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156146b5576146b46141b2565b5b828201905092915050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b600061471c603283613408565b9150614727826146c0565b604082019050919050565b6000602082019050818103600083015261474b8161470f565b9050919050565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b60006147ae602f83613408565b91506147b982614752565b604082019050919050565b600060208201905081810360008301526147dd816147a1565b9050919050565b600081905092915050565b60006147fa826133fd565b61480481856147e4565b9350614814818560208601613419565b80840191505092915050565b600061482c82856147ef565b915061483882846147ef565b91508190509392505050565b60008160601b9050919050565b600061485c82614844565b9050919050565b600061486e82614851565b9050919050565b6148866148818261353b565b614863565b82525050565b6000819050919050565b6148a76148a2826134b8565b61488c565b82525050565b60006148b98285614875565b6014820191506148c98284614896565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600081519050919050565b600082825260208201905092915050565b600061492f82614908565b6149398185614913565b9350614949818560208601613419565b6149528161344c565b840191505092915050565b6000608082019050614972600083018761354d565b61497f602083018661354d565b61498c6040830185613610565b818103606083015261499e8184614924565b905095945050505050565b6000815190506149b88161336e565b92915050565b6000602082840312156149d4576149d3613338565b5b60006149e2848285016149a9565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614a25826134b8565b9150614a30836134b8565b925082614a4057614a3f6149eb565b5b828204905092915050565b6000614a56826134b8565b9150614a61836134b8565b925082614a7157614a706149eb565b5b828206905092915050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000614ab2602083613408565b9150614abd82614a7c565b602082019050919050565b60006020820190508181036000830152614ae181614aa5565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b6000614b1e601c83613408565b9150614b2982614ae8565b602082019050919050565b60006020820190508181036000830152614b4d81614b11565b905091905056fea264697066735822122070ecae617c17973101a442bd506861d6408820073a731cbe7f0f5f282ce09fee64736f6c634300080a0033
Verified Source Code Partial Match
Compiler: v0.8.10+commit.fc410830
EVM: london
Optimization: No
metaanikpp.sol 205 lines
// SPDX-License-Identifier: NONE
pragma solidity >=0.8.10 <=0.8.10;
import "./OpenzeppelinERC721.sol";
import "./OpenZeppelinMerkleProof.sol";
contract METAANIxKPP is ERC721Enumerable {
address public owner;
string ipfs_base = "ipfs://QmSgK4i9oEE8vtS7JvCGXsepeDYx6s7q4qse254iUU8Ds8/";
bool private_mint_started = false;
bool public_mint_started = false;
mapping(uint => bool) public minted;
mapping( address => uint ) public addressMintedMap;
mapping( address => bool ) public privatesale1done;
uint public privatesaleprice = 0.075 ether;
uint public publicsaleprice = 0.3 ether;
uint public magnification = 0;
address metawallet = 0x60a89BB4C35A62DE53e4E1852E2d4037a008aC5b;
address metaani = 0xeecE4544101f7C7198157c74A1cBfE12aa86718B;
bytes32 allowListRoot = 0x493c228601905ea40eec37ae8423c901976d08e0ea1f9fa6fdc0924ea7633f58;
function setRoot(bytes32 _merkleroot) public {
require( _msgSender() == owner );
allowListRoot = _merkleroot;
}
function setPrivateSalePrice(uint _price) public {
require(_msgSender() == owner);
privatesaleprice = _price;
}
function setPublicSalePrice(uint _price) public {
require(_msgSender() == owner);
publicsaleprice = _price;
}
function setMagnification(uint _magnification) public {
require(_msgSender() == owner);
magnification = _magnification;
}
function checkredeem(address account, uint256 amount, bytes32[] calldata proof) public view returns ( uint ) {
if (_verify(_leaf(account, amount), proof)){
return amount;
} else {
return 0;
}
}
function _leaf(address account, uint256 amount)
internal pure returns (bytes32)
{
return keccak256(abi.encodePacked(account , amount));
}
function _verify(bytes32 leaf, bytes32[] memory proof)
internal view returns (bool)
{
return MerkleProof.verify(proof, allowListRoot, leaf);
}
function privateSaleMint1(address account, uint256 amount, bytes32[] calldata proof , uint _nftid) public payable {
require( private_mint_started , "private sale not started");
require(checkredeem( account , amount , proof ) > 0 , "account is not in allowlist");
require(addressMintedMap[account] < 1 , "mint amount over" );
require( msg.value == privatesaleprice , "invalid transaction eth price");
require( _msgSender() == account);
require( 0 < _nftid && _nftid <= 500 , "invalid nft id" );
_safeMint( _msgSender() , _nftid);
addressMintedMap[account]++;
minted[_nftid] = true;
privatesale1done[account] = true;
}
function privateSaleMint2(address account, uint256 amount, bytes32[] calldata proof , uint _nftid) public payable {
require( private_mint_started , "private sale not started");
require(checkredeem( account , amount , proof ) > 0 , "account is not in allowlist");
require(addressMintedMap[account] < amount * magnification , "magnification amount over" );
require( msg.value == privatesaleprice , "invalid transaction eth price");
require( _msgSender() == account);
require( 0 < _nftid && _nftid <= 500 , "invalid nft id" );
_safeMint( _msgSender() , _nftid);
addressMintedMap[account]++;
minted[_nftid] = true;
}
function publicSaleMint(uint256 _nftid) public payable {
require(msg.value == publicsaleprice );
require( public_mint_started );
require( 0 < _nftid && _nftid <= 500);
_safeMint( msg.sender , _nftid);
addressMintedMap[msg.sender]++;
minted[_nftid] = true;
}
function teamMint(uint256 _nftid) public {
require(_msgSender() == owner );
require( 0 < _nftid && _nftid <= 500);
_safeMint( msg.sender , _nftid);
minted[_nftid] = true;
}
function privatemintStart() public {
require(msg.sender == owner);
private_mint_started = true;
}
function privatemintStop() public {
require(msg.sender == owner);
private_mint_started = false;
}
function publicmintStart() public {
require(msg.sender == owner);
public_mint_started = true;
}
function publicmintStop() public {
require(msg.sender == owner);
public_mint_started = false;
}
function withdraw() public {
require(msg.sender == metawallet);
uint balance = address(this).balance;
payable(metawallet).transfer(balance);
}
function withdrawSpare() public {
require(msg.sender == 0xE35B827177398D8d2FBA304d9cF53bc8fC1573B7);
uint balance = address(this).balance;
payable(metaani).transfer(balance);
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function _burn(uint256 tokenId) internal override(ERC721) {
super._burn(tokenId);
}
function burn(uint256 _id) public {
require( msg.sender == ownerOf(_id));
_burn(_id);
}
function _baseURI() internal view override returns (string memory) {
return ipfs_base;
}
function setbaseURI(string memory _ipfs_base) public {
require(msg.sender == metawallet );
ipfs_base = _ipfs_base;
}
function tokenURI(uint256 tokenId)
public
view
override(ERC721)
returns (string memory)
{
return super.tokenURI(tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
constructor() ERC721("Metaani x Kyary Pamyu Pamyu" , "METKPP" ) {
owner = msg.sender;
//MetaaniKPP
_safeMint( msg.sender , 1);
minted[1] = true;
_safeMint( msg.sender , 2);
minted[2] = true;
_safeMint( msg.sender , 3);
minted[3] = true;
}
}
OpenzeppelinERC721.sol 1145 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);
}
/**
* @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;
}
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
/**
* @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);
}
/**
* @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);
}
/**
* @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;
// solhint-disable-next-line no-inline-assembly
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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/*
* @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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @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;
}
}
/**
* @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}. Empty by default, can be overriden
* in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
_mint(to, tokenId);
require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
private returns (bool)
{
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
// solhint-disable-next-line no-inline-assembly
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` 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 { }
}
/**
* @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);
}
/**
* @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();
}
}
/**
* @dev ERC721 token with storage based token URI management.
*/
abstract contract ERC721URIStorage is ERC721 {
using Strings for uint256;
// Optional mapping for token URIs
mapping (uint256 => string) private _tokenURIs;
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
/**
* @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 override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
OpenZeppelinMerkleProof.sol 65 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
Read Contract
addressMintedMap 0x0a7a1c38 → uint256
balanceOf 0x70a08231 → uint256
checkredeem 0xe97925b9 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
magnification 0xf425f560 → uint256
minted 0x7dc0bf3f → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
privatesale1done 0x612c8a5f → bool
privatesaleprice 0xd6065b4e → uint256
publicsaleprice 0x6df1376e → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 _id
privateSaleMint1 0x5508e192
address account
uint256 amount
bytes32[] proof
uint256 _nftid
privateSaleMint2 0xd1b229bf
address account
uint256 amount
bytes32[] proof
uint256 _nftid
privatemintStart 0xe4e5de34
No parameters
privatemintStop 0xd9e82c65
No parameters
publicSaleMint 0xb3ab66b0
uint256 _nftid
publicmintStart 0x01d7dd2b
No parameters
publicmintStop 0x057b6e4e
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
setMagnification 0xb5c01e45
uint256 _magnification
setPrivateSalePrice 0x7bc36e04
uint256 _price
setPublicSalePrice 0x791a2519
uint256 _price
setRoot 0xdab5f340
bytes32 _merkleroot
setbaseURI 0x4a44f379
string _ipfs_base
teamMint 0x2fbba115
uint256 _nftid
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
withdraw 0x3ccfd60b
No parameters
withdrawSpare 0xd65ae677
No parameters
Recent Transactions
This address has 1 on-chain transactions, but only 0.9% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →