Address Contract Verified
Address
0x1522C79D2044BBC06f4368c07b88A32e9Cd64BD1
Balance
0 ETH
Nonce
1
Code Size
17247 bytes
Creator
0x331C2Bde...96dB at tx 0x2544bba8...4be918
Indexed Transactions
0
Contract Bytecode
17247 bytes
0x6080604052600436106101d85760003560e01c8063649e705f11610102578063aeaa8dba11610095578063cce29ea711610064578063cce29ea7146106e8578063d4b2c67d14610713578063e985e9c51461073c578063f2fde38b14610779576101d8565b8063aeaa8dba1461062e578063b88d4fde14610657578063c87b56dd14610680578063ca0dcf16146106bd576101d8565b806386bd9121116100d157806386bd9121146105725780638da5cb5b146105af57806395d89b41146105da578063a22cb46514610605576101d8565b8063649e705f146104a457806370a08231146104e1578063715018a61461051e57806377fa932214610535576101d8565b806321f127c41161017a57806340d097c31161014957806340d097c3146103d157806342842e0e146104015780635ad0b6791461042a5780636352211e14610467576101d8565b806321f127c41461032857806323b872dd146103535780632a55205a1461037c5780633ccfd60b146103ba576101d8565b8063081812fc116101b6578063081812fc14610270578063095ea7b3146102ad5780630f3c55a0146102d657806321b88e04146102ff576101d8565b806301ffc9a7146101dd57806306d65af31461021a57806306fdde0314610245575b600080fd5b3480156101e957600080fd5b5061020460048036038101906101ff91906128fd565b6107a2565b6040516102119190612945565b60405180910390f35b34801561022657600080fd5b5061022f6107b4565b60405161023c9190612979565b60405180910390f35b34801561025157600080fd5b5061025a6107ba565b6040516102679190612a24565b60405180910390f35b34801561027c57600080fd5b5061029760048036038101906102929190612a72565b61084c565b6040516102a49190612ae0565b60405180910390f35b3480156102b957600080fd5b506102d460048036038101906102cf9190612b27565b610892565b005b3480156102e257600080fd5b506102fd60048036038101906102f89190612caf565b6109a9565b005b34801561030b57600080fd5b5061032660048036038101906103219190612d31565b610a40565b005b34801561033457600080fd5b5061033d610adc565b60405161034a9190612d8a565b60405180910390f35b34801561035f57600080fd5b5061037a60048036038101906103759190612da5565b610ae2565b005b34801561038857600080fd5b506103a3600480360381019061039e9190612df8565b610b42565b6040516103b1929190612e38565b60405180910390f35b3480156103c657600080fd5b506103cf610d2c565b005b6103eb60048036038101906103e69190612e61565b610d5e565b6040516103f89190612979565b60405180910390f35b34801561040d57600080fd5b5061042860048036038101906104239190612da5565b610fa1565b005b34801561043657600080fd5b50610451600480360381019061044c9190612a72565b610fc1565b60405161045e9190612e9d565b60405180910390f35b34801561047357600080fd5b5061048e60048036038101906104899190612a72565b610ff8565b60405161049b9190612ae0565b60405180910390f35b3480156104b057600080fd5b506104cb60048036038101906104c69190612a72565b6110a9565b6040516104d89190612e9d565b60405180910390f35b3480156104ed57600080fd5b5061050860048036038101906105039190612e61565b61112a565b6040516105159190612979565b60405180910390f35b34801561052a57600080fd5b506105336111e1565b005b34801561054157600080fd5b5061055c60048036038101906105579190612e61565b6111f5565b6040516105699190612945565b60405180910390f35b34801561057e57600080fd5b5061059960048036038101906105949190612e61565b611215565b6040516105a69190612945565b60405180910390f35b3480156105bb57600080fd5b506105c461127c565b6040516105d19190612ae0565b60405180910390f35b3480156105e657600080fd5b506105ef6112a6565b6040516105fc9190612a24565b60405180910390f35b34801561061157600080fd5b5061062c60048036038101906106279190612ee4565b611338565b005b34801561063a57600080fd5b5061065560048036038101906106509190612fd6565b61134e565b005b34801561066357600080fd5b5061067e600480360381019061067991906130b9565b61141e565b005b34801561068c57600080fd5b506106a760048036038101906106a29190612a72565b611480565b6040516106b49190612a24565b60405180910390f35b3480156106c957600080fd5b506106d2611492565b6040516106df9190612979565b60405180910390f35b3480156106f457600080fd5b506106fd611498565b60405161070a9190612979565b60405180910390f35b34801561071f57600080fd5b5061073a60048036038101906107359190612df8565b61149e565b005b34801561074857600080fd5b50610763600480360381019061075e919061313c565b61153e565b6040516107709190612945565b60405180910390f35b34801561078557600080fd5b506107a0600480360381019061079b9190612e61565b6115d2565b005b60006107ad82611655565b9050919050565b602e5481565b6060600080546107c9906131ab565b80601f01602080910402602001604051908101604052809291908181526020018280546107f5906131ab565b80156108425780601f1061081757610100808354040283529160200191610842565b820191906000526020600020905b81548152906001019060200180831161082557829003601f168201915b5050505050905090565b6000610857826116cf565b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061089d82610ff8565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361090d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109049061324e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1661092c61171a565b73ffffffffffffffffffffffffffffffffffffffff16148061095b575061095a8161095561171a565b61153e565b5b61099a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610991906132e0565b60405180910390fd5b6109a48383611722565b505050565b6109b16117db565b60005b8151811015610a3c576001602d60008484815181106109d6576109d5613300565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506109b4565b5050565b610a486117db565b6000602e541480610a5a575042602e54115b610a99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a90906133a1565b60405180910390fd5b60005b8160ff16811015610ad7576000610ab3600a611859565b9050610abf600a611867565b610ac9848261187d565b508080600101915050610a9c565b505050565b602b5481565b610af3610aed61171a565b8261189b565b610b32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2990613433565b60405180910390fd5b610b3d838383611930565b505050565b6000806000600760008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610cd75760066040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b6000610ce1611b96565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610d0d9190613482565b610d1791906134f3565b90508160000151819350935050509250929050565b610d5c47610d3861127c565b73ffffffffffffffffffffffffffffffffffffffff16611ba090919063ffffffff16565b565b6000816000602e5403610da6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9d90613570565b60405180910390fd5b42602e5410610dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de1906135dc565b60405180910390fd5b42602f541080610dff5750610dfe81611215565b5b610e3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e359061366e565b60405180910390fd5b6103e8610e4b600a611859565b10610e8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e82906136da565b60405180910390fd5b602c54341015610ed0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec790613746565b60405180910390fd5b610eda600a611859565b9150610ee6600a611867565b602d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f91576000602d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b610f9b838361187d565b50919050565b610fbc8383836040518060200160405280600081525061141e565b505050565b6000600f600b836103e88110610fda57610fd9613300565b5b602091828204019190069054906101000a900460ff16169050919050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611097906137b2565b60405180910390fd5b80915050919050565b6000816103e881106110f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e79061381e565b60405180910390fd5b6004600b846103e8811061110757611106613300565b5b602091828204019190069054906101000a900460ff1660ff16901c915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361119a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611191906138b0565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6111e96117db565b6111f36000611c94565b565b602d6020528060005260406000206000915054906101000a900460ff1681565b6000602d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156112725760019050611277565b600090505b919050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546112b5906131ab565b80601f01602080910402602001604051908101604052809291908181526020018280546112e1906131ab565b801561132e5780601f106113035761010080835404028352916020019161132e565b820191906000526020600020905b81548152906001019060200180831161131157829003601f168201915b5050505050905090565b61134a61134361171a565b8383611d5a565b5050565b6113566117db565b602b5460028260405160200161136c919061397c565b60405160208183030381529060405260405161138891906139df565b602060405180830381855afa1580156113a5573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906113c89190613a22565b14611408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ff90613a9b565b60405180910390fd5b80600b906103e861141a9291906127d9565b5050565b61142f61142961171a565b8361189b565b61146e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146590613433565b60405180910390fd5b61147a84848484611ec6565b50505050565b606061148b82611f22565b9050919050565b602c5481565b602f5481565b6114a66117db565b428210156114e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e090613b2d565b60405180910390fd5b8181101561152c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152390613bbf565b60405180910390fd5b81602e8190555080602f819055505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6115da6117db565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164090613c51565b60405180910390fd5b61165281611c94565b50565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806116c857506116c782612034565b5b9050919050565b6116d881612116565b611717576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170e906137b2565b60405180910390fd5b50565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661179583610ff8565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6117e361171a565b73ffffffffffffffffffffffffffffffffffffffff1661180161127c565b73ffffffffffffffffffffffffffffffffffffffff1614611857576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184e90613cbd565b60405180910390fd5b565b600081600001549050919050565b6001816000016000828254019250508190555050565b611897828260405180602001604052806000815250612182565b5050565b6000806118a783610ff8565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806118e957506118e8818561153e565b5b8061192757508373ffffffffffffffffffffffffffffffffffffffff1661190f8461084c565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661195082610ff8565b73ffffffffffffffffffffffffffffffffffffffff16146119a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199d90613d4f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611a15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0c90613de1565b60405180910390fd5b611a208383836121dd565b611a2b600082611722565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611a7b9190613e01565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611ad29190613e35565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611b918383836121e2565b505050565b6000612710905090565b80471015611be3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bda90613eb5565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff1682604051611c0990613efb565b60006040518083038185875af1925050503d8060008114611c46576040519150601f19603f3d011682016040523d82523d6000602084013e611c4b565b606091505b5050905080611c8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8690613f82565b60405180910390fd5b505050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611dc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbf90613fee565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611eb99190612945565b60405180910390a3505050565b611ed1848484611930565b611edd848484846121e7565b611f1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f1390614080565b60405180910390fd5b50505050565b6060611f2d826116cf565b6000600860008481526020019081526020016000208054611f4d906131ab565b80601f0160208091040260200160405190810160405280929190818152602001828054611f79906131ab565b8015611fc65780601f10611f9b57610100808354040283529160200191611fc6565b820191906000526020600020905b815481529060010190602001808311611fa957829003601f168201915b505050505090506000611fd761236e565b90506000815103611fec57819250505061202f565b6000825111156120215780826040516020016120099291906140dc565b6040516020818303038152906040529250505061202f565b61202a846123ab565b925050505b919050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806120ff57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061210f575061210e82612413565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b61218c838361247d565b61219960008484846121e7565b6121d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121cf90614080565b60405180910390fd5b505050565b505050565b505050565b60006122088473ffffffffffffffffffffffffffffffffffffffff16612656565b15612361578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261223161171a565b8786866040518563ffffffff1660e01b8152600401612253949392919061414a565b6020604051808303816000875af192505050801561228f57506040513d601f19601f8201168201806040525081019061228c91906141ab565b60015b612311573d80600081146122bf576040519150601f19603f3d011682016040523d82523d6000602084013e6122c4565b606091505b506000815103612309576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161230090614080565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612366565b600190505b949350505050565b60606040518060400160405280601e81526020017f687474703a2f2f6d696e742e696e7372742e66696e616e63652f6e66742f0000815250905090565b60606123b6826116cf565b60006123c061236e565b905060008151116123e0576040518060200160405280600081525061240b565b806123ea84612679565b6040516020016123fb9291906140dc565b6040516020818303038152906040525b915050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036124ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124e390614224565b60405180910390fd5b6124f581612116565b15612535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252c90614290565b60405180910390fd5b612541600083836121dd565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546125919190613e35565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612652600083836121e2565b5050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6060600082036126c0576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506127d4565b600082905060005b600082146126f25780806126db906142b0565b915050600a826126eb91906134f3565b91506126c8565b60008167ffffffffffffffff81111561270e5761270d612b6c565b5b6040519080825280601f01601f1916602001820160405280156127405781602001600182028036833780820191505090505b5090505b600085146127cd576001826127599190613e01565b9150600a8561276891906142f8565b60306127749190613e35565b60f81b81838151811061278a57612789613300565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856127c691906134f3565b9450612744565b8093505050505b919050565b826103e8601f016020900481019282156128635791602002820160005b8382111561283457835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026127f6565b80156128615782816101000a81549060ff0219169055600101602081600001049283019260010302612834565b505b5090506128709190612874565b5090565b5b8082111561288d576000816000905550600101612875565b5090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6128da816128a5565b81146128e557600080fd5b50565b6000813590506128f7816128d1565b92915050565b6000602082840312156129135761291261289b565b5b6000612921848285016128e8565b91505092915050565b60008115159050919050565b61293f8161292a565b82525050565b600060208201905061295a6000830184612936565b92915050565b6000819050919050565b61297381612960565b82525050565b600060208201905061298e600083018461296a565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129ce5780820151818401526020810190506129b3565b60008484015250505050565b6000601f19601f8301169050919050565b60006129f682612994565b612a00818561299f565b9350612a108185602086016129b0565b612a19816129da565b840191505092915050565b60006020820190508181036000830152612a3e81846129eb565b905092915050565b612a4f81612960565b8114612a5a57600080fd5b50565b600081359050612a6c81612a46565b92915050565b600060208284031215612a8857612a8761289b565b5b6000612a9684828501612a5d565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612aca82612a9f565b9050919050565b612ada81612abf565b82525050565b6000602082019050612af56000830184612ad1565b92915050565b612b0481612abf565b8114612b0f57600080fd5b50565b600081359050612b2181612afb565b92915050565b60008060408385031215612b3e57612b3d61289b565b5b6000612b4c85828601612b12565b9250506020612b5d85828601612a5d565b9150509250929050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612ba4826129da565b810181811067ffffffffffffffff82111715612bc357612bc2612b6c565b5b80604052505050565b6000612bd6612891565b9050612be28282612b9b565b919050565b600067ffffffffffffffff821115612c0257612c01612b6c565b5b602082029050602081019050919050565b600080fd5b6000612c2b612c2684612be7565b612bcc565b90508083825260208201905060208402830185811115612c4e57612c4d612c13565b5b835b81811015612c775780612c638882612b12565b845260208401935050602081019050612c50565b5050509392505050565b600082601f830112612c9657612c95612b67565b5b8135612ca6848260208601612c18565b91505092915050565b600060208284031215612cc557612cc461289b565b5b600082013567ffffffffffffffff811115612ce357612ce26128a0565b5b612cef84828501612c81565b91505092915050565b600060ff82169050919050565b612d0e81612cf8565b8114612d1957600080fd5b50565b600081359050612d2b81612d05565b92915050565b60008060408385031215612d4857612d4761289b565b5b6000612d5685828601612b12565b9250506020612d6785828601612d1c565b9150509250929050565b6000819050919050565b612d8481612d71565b82525050565b6000602082019050612d9f6000830184612d7b565b92915050565b600080600060608486031215612dbe57612dbd61289b565b5b6000612dcc86828701612b12565b9350506020612ddd86828701612b12565b9250506040612dee86828701612a5d565b9150509250925092565b60008060408385031215612e0f57612e0e61289b565b5b6000612e1d85828601612a5d565b9250506020612e2e85828601612a5d565b9150509250929050565b6000604082019050612e4d6000830185612ad1565b612e5a602083018461296a565b9392505050565b600060208284031215612e7757612e7661289b565b5b6000612e8584828501612b12565b91505092915050565b612e9781612cf8565b82525050565b6000602082019050612eb26000830184612e8e565b92915050565b612ec18161292a565b8114612ecc57600080fd5b50565b600081359050612ede81612eb8565b92915050565b60008060408385031215612efb57612efa61289b565b5b6000612f0985828601612b12565b9250506020612f1a85828601612ecf565b9150509250929050565b600067ffffffffffffffff821115612f3f57612f3e612b6c565b5b602082029050919050565b6000612f5d612f5884612f24565b612bcc565b90508060208402830185811115612f7757612f76612c13565b5b835b81811015612fa05780612f8c8882612d1c565b845260208401935050602081019050612f79565b5050509392505050565b600082601f830112612fbf57612fbe612b67565b5b6103e8612fcd848285612f4a565b91505092915050565b6000617d008284031215612fed57612fec61289b565b5b6000612ffb84828501612faa565b91505092915050565b600080fd5b600067ffffffffffffffff82111561302457613023612b6c565b5b61302d826129da565b9050602081019050919050565b82818337600083830152505050565b600061305c61305784613009565b612bcc565b90508281526020810184848401111561307857613077613004565b5b61308384828561303a565b509392505050565b600082601f8301126130a05761309f612b67565b5b81356130b0848260208601613049565b91505092915050565b600080600080608085870312156130d3576130d261289b565b5b60006130e187828801612b12565b94505060206130f287828801612b12565b935050604061310387828801612a5d565b925050606085013567ffffffffffffffff811115613124576131236128a0565b5b6131308782880161308b565b91505092959194509250565b600080604083850312156131535761315261289b565b5b600061316185828601612b12565b925050602061317285828601612b12565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806131c357607f821691505b6020821081036131d6576131d561317c565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b600061323860218361299f565b9150613243826131dc565b604082019050919050565b600060208201905081810360008301526132678161322b565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000602082015250565b60006132ca603e8361299f565b91506132d58261326e565b604082019050919050565b600060208201905081810360008301526132f9816132bd565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f5072652d73616c652068617320616c726561647920737461727465642c20636160008201527f6e27742067697665206177617900000000000000000000000000000000000000602082015250565b600061338b602d8361299f565b91506133968261332f565b604082019050919050565b600060208201905081810360008301526133ba8161337e565b9050919050565b7f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560008201527f72206e6f7220617070726f766564000000000000000000000000000000000000602082015250565b600061341d602e8361299f565b9150613428826133c1565b604082019050919050565b6000602082019050818103600083015261344c81613410565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061348d82612960565b915061349883612960565b92508282026134a681612960565b915082820484148315176134bd576134bc613453565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006134fe82612960565b915061350983612960565b925082613519576135186134c4565b5b828204905092915050565b7f5072652d73616c65206973206e6f7420696e697469616c697a65642079657400600082015250565b600061355a601f8361299f565b915061356582613524565b602082019050919050565b600060208201905081810360008301526135898161354d565b9050919050565b7f5072652d73616c652068617665206e6f74207374617274656420796574000000600082015250565b60006135c6601d8361299f565b91506135d182613590565b602082019050919050565b600060208201905081810360008301526135f5816135b9565b9050919050565b7f5072652d73616c6520617661696c61626c65206f6e6c7920666f72207768697460008201527f656c697374656420616464726573736573000000000000000000000000000000602082015250565b600061365860318361299f565b9150613663826135fc565b604082019050919050565b600060208201905081810360008301526136878161364b565b9050919050565b7f57652061726520736f6c64206f75740000000000000000000000000000000000600082015250565b60006136c4600f8361299f565b91506136cf8261368e565b602082019050919050565b600060208201905081810360008301526136f3816136b7565b9050919050565b7f4e6f7420656e6f756768204554482073656e743a20636865636b207072696365600082015250565b600061373060208361299f565b915061373b826136fa565b602082019050919050565b6000602082019050818103600083015261375f81613723565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b600061379c60188361299f565b91506137a782613766565b602082019050919050565b600060208201905081810360008301526137cb8161378f565b9050919050565b7f546f6b656e204944206973206f7574206f662072616e67650000000000000000600082015250565b600061380860188361299f565b9150613813826137d2565b602082019050919050565b60006020820190508181036000830152613837816137fb565b9050919050565b7f4552433732313a2061646472657373207a65726f206973206e6f74206120766160008201527f6c6964206f776e65720000000000000000000000000000000000000000000000602082015250565b600061389a60298361299f565b91506138a58261383e565b604082019050919050565b600060208201905081810360008301526138c98161388d565b9050919050565b60006103e89050919050565b600081905092915050565b6000819050919050565b6138fa81612cf8565b82525050565b600061390c83836138f1565b60208301905092915050565b6000602082019050919050565b61392e816138d0565b61393881846138dc565b9250613943826138e7565b8060005b8381101561397457815161395b8782613900565b965061396683613918565b925050600181019050613947565b505050505050565b60006139888284613925565b617d008201915081905092915050565b600081519050919050565b600081905092915050565b60006139b982613998565b6139c381856139a3565b93506139d38185602086016129b0565b80840191505092915050565b60006139eb82846139ae565b915081905092915050565b6139ff81612d71565b8114613a0a57600080fd5b50565b600081519050613a1c816139f6565b92915050565b600060208284031215613a3857613a3761289b565b5b6000613a4684828501613a0d565b91505092915050565b7f546965727320646f6573206e6f74206d61746368000000000000000000000000600082015250565b6000613a8560148361299f565b9150613a9082613a4f565b602082019050919050565b60006020820190508181036000830152613ab481613a78565b9050919050565b7f5072652d73616c652073746172742074696d6520697320696e2074686520706160008201527f7374000000000000000000000000000000000000000000000000000000000000602082015250565b6000613b1760228361299f565b9150613b2282613abb565b604082019050919050565b60006020820190508181036000830152613b4681613b0a565b9050919050565b7f5072652d73616c6520656e642074696d652073686f756c64206265206772656160008201527f746572207468656e2073746172742074696d6500000000000000000000000000602082015250565b6000613ba960338361299f565b9150613bb482613b4d565b604082019050919050565b60006020820190508181036000830152613bd881613b9c565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613c3b60268361299f565b9150613c4682613bdf565b604082019050919050565b60006020820190508181036000830152613c6a81613c2e565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613ca760208361299f565b9150613cb282613c71565b602082019050919050565b60006020820190508181036000830152613cd681613c9a565b9050919050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b6000613d3960258361299f565b9150613d4482613cdd565b604082019050919050565b60006020820190508181036000830152613d6881613d2c565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613dcb60248361299f565b9150613dd682613d6f565b604082019050919050565b60006020820190508181036000830152613dfa81613dbe565b9050919050565b6000613e0c82612960565b9150613e1783612960565b9250828203905081811115613e2f57613e2e613453565b5b92915050565b6000613e4082612960565b9150613e4b83612960565b9250828201905080821115613e6357613e62613453565b5b92915050565b7f416464726573733a20696e73756666696369656e742062616c616e6365000000600082015250565b6000613e9f601d8361299f565b9150613eaa82613e69565b602082019050919050565b60006020820190508181036000830152613ece81613e92565b9050919050565b50565b6000613ee56000836139a3565b9150613ef082613ed5565b600082019050919050565b6000613f0682613ed8565b9150819050919050565b7f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260008201527f6563697069656e74206d61792068617665207265766572746564000000000000602082015250565b6000613f6c603a8361299f565b9150613f7782613f10565b604082019050919050565b60006020820190508181036000830152613f9b81613f5f565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000613fd860198361299f565b9150613fe382613fa2565b602082019050919050565b6000602082019050818103600083015261400781613fcb565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b600061406a60328361299f565b91506140758261400e565b604082019050919050565b600060208201905081810360008301526140998161405d565b9050919050565b600081905092915050565b60006140b682612994565b6140c081856140a0565b93506140d08185602086016129b0565b80840191505092915050565b60006140e882856140ab565b91506140f482846140ab565b91508190509392505050565b600082825260208201905092915050565b600061411c82613998565b6141268185614100565b93506141368185602086016129b0565b61413f816129da565b840191505092915050565b600060808201905061415f6000830187612ad1565b61416c6020830186612ad1565b614179604083018561296a565b818103606083015261418b8184614111565b905095945050505050565b6000815190506141a5816128d1565b92915050565b6000602082840312156141c1576141c061289b565b5b60006141cf84828501614196565b91505092915050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b600061420e60208361299f565b9150614219826141d8565b602082019050919050565b6000602082019050818103600083015261423d81614201565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b600061427a601c8361299f565b915061428582614244565b602082019050919050565b600060208201905081810360008301526142a98161426d565b9050919050565b60006142bb82612960565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036142ed576142ec613453565b5b600182019050919050565b600061430382612960565b915061430e83612960565b92508261431e5761431d6134c4565b5b82820690509291505056fea26469706673582212207c6e2234d569f89c9e2f97b3d5a4c3a369e540291163f741ae4401ca89b0cb5b64736f6c63430008110033
Verified Source Code Full Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: No
ERC721URIStorage.sol 62 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
/**
* @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) {
_requireMinted(tokenId);
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 See {ERC721-_burn}. This override additionally checks to see if a
* token-specific URI was set for the token, and if so, it deletes the token URI from
* the storage mapping.
*/
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
IERC2981.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
ERC2981.sol 111 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* 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 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 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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}
nft.sol 204 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract NFT is ERC721, ERC2981, ERC721URIStorage, Ownable {
using Address for address payable;
using Counters for Counters.Counter;
Counters.Counter private tokenIdCounter;
// Hash of tiers sequence used as proof that sequence was pre-generated
// before smart contract was deployed and was not manipulated.
uint8[1000] private tiers;
bytes32 public tiersProof;
// NFT mint rate
uint256 public mintRate;
// Whitelisted addresses that can participate in pre-sale
mapping(address => bool) public preSaleWhitelist;
uint256 public preSaleStartTime;
uint256 public preSaleEndTime;
constructor(bytes32 _tiersProof, uint256 _mintRate)
ERC721("Insrt.finance", "INSRT")
{
tiersProof = _tiersProof;
mintRate = _mintRate;
// Set royalty to 15%
_setDefaultRoyalty(msg.sender, 1500);
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, ERC2981)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
// tiers management
// -----
// Reveal tiers for minted NFTs
function setTiers(uint8[1000] memory _tiers) public onlyOwner {
require(
sha256(abi.encodePacked(_tiers)) == tiersProof,
"Tiers does not match"
);
tiers = _tiers;
}
// Pre-Sale management methods
// -----
// Verify if provided address is whitelisted
function isPreSaleWhitelisted(address _addr) public view returns (bool) {
if (preSaleWhitelist[_addr]) {
return true;
} else {
return false;
}
}
// Allow owner to add addresses to the whitelist
function addManyToPreSaleWhitelist(address[] memory _addrs)
public
onlyOwner
{
unchecked {
for (uint256 i; i < _addrs.length; i++) {
preSaleWhitelist[_addrs[i]] = true;
}
}
}
// Start pre-sale where only whitelisted addresses can participate
function setPreSaleTime(uint256 _preSaleStartTime, uint256 _preSaleEndTime)
public
onlyOwner
{
require(
_preSaleStartTime >= block.timestamp,
"Pre-sale start time is in the past"
);
require(
_preSaleEndTime >= _preSaleStartTime,
"Pre-sale end time should be greater then start time"
);
preSaleStartTime = _preSaleStartTime;
preSaleEndTime = _preSaleEndTime;
}
// Minting methods
// -----
modifier mintAllowed(address _addr) {
require(preSaleStartTime != 0, "Pre-sale is not initialized yet");
require(
preSaleStartTime < block.timestamp,
"Pre-sale have not started yet"
);
require(
preSaleEndTime < block.timestamp || isPreSaleWhitelisted(_addr),
"Pre-sale available only for whitelisted addresses"
);
require(tokenIdCounter.current() < 1000, "We are sold out");
_;
}
function safeMint(address to)
public
payable
mintAllowed(to)
returns (uint256 tokenId)
{
require(msg.value >= mintRate, "Not enough ETH sent: check price");
tokenId = tokenIdCounter.current();
tokenIdCounter.increment();
// Allow one NFT per whitelisted address
if (preSaleWhitelist[to]) {
preSaleWhitelist[to] = false;
}
_safeMint(to, tokenId);
}
function withdraw() public {
payable(owner()).sendValue(address(this).balance);
}
// Other methods
// -----
// Give away X number of tokens. Will be available only before pre-sale
function giveAway(address _addr, uint8 limit) public onlyOwner {
require(
preSaleStartTime == 0 || preSaleStartTime > block.timestamp,
"Pre-sale has already started, can't give away"
);
unchecked {
for (uint256 i; i < limit; i++) {
uint256 tokenId = tokenIdCounter.current();
tokenIdCounter.increment();
_safeMint(_addr, tokenId);
}
}
}
// ERC721 methods required by OpenZeppelin
// -----
modifier validTokenId(uint256 _tokenId) {
require(_tokenId < tiers.length, "Token ID is out of range");
_;
}
function _baseURI() internal pure override returns (string memory) {
return "http://mint.insrt.finance/nft/";
}
function _burn(uint256 _tokenId)
internal
override(ERC721, ERC721URIStorage)
{
super._burn(_tokenId);
_resetTokenRoyalty(_tokenId);
}
function tokenURI(uint256 _tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(_tokenId);
}
function tokenTier(uint256 _tokenId)
public
view
validTokenId(_tokenId)
returns (uint8)
{
return tiers[_tokenId] >> 4;
}
function tokenVariation(uint256 _tokenId) public view returns (uint8) {
return tiers[_tokenId] & 15;
}
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @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);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721.sol 454 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)
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: address zero is not a valid owner");
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: invalid token ID");
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) {
_requireMinted(tokenId);
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 overridden 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 token owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_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: caller is not token 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: caller is not token 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) {
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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);
_afterTokenTransfer(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);
_afterTokenTransfer(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 from incorrect owner");
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);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @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 {
/// @solidity memory-safe-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` 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 {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
Read Contract
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isPreSaleWhitelisted 0x86bd9121 → bool
mintRate 0xca0dcf16 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
preSaleEndTime 0xcce29ea7 → uint256
preSaleStartTime 0x06d65af3 → uint256
preSaleWhitelist 0x77fa9322 → bool
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tiersProof 0x21f127c4 → bytes32
tokenTier 0x649e705f → uint8
tokenURI 0xc87b56dd → string
tokenVariation 0x5ad0b679 → uint8
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
addManyToPreSaleWhitelist 0x0f3c55a0
address[] _addrs
approve 0x095ea7b3
address to
uint256 tokenId
giveAway 0x21b88e04
address _addr
uint8 limit
renounceOwnership 0x715018a6
No parameters
safeMint 0x40d097c3
address to
returns: uint256
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setPreSaleTime 0xd4b2c67d
uint256 _preSaleStartTime
uint256 _preSaleEndTime
setTiers 0xaeaa8dba
uint8[1000] _tiers
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address