Address Contract Verified
Address
0x25C65721E26fa5F3c97f129F4e24972482327BC9
Balance
0 ETH
Nonce
1
Code Size
18193 bytes
Creator
0x2F075618...6E1a at tx 0xe8fcc4c5...ac59ee
Indexed Transactions
0
Contract Bytecode
18193 bytes
0x6080604052600436106101e25760003560e01c806355f804b31161010257806395d89b4111610095578063b9da967d11610064578063b9da967d146106a2578063c87b56dd146106cd578063e985e9c51461070a578063f2fde38b14610747576101e2565b806395d89b41146105fa57806398d5fdca14610625578063a22cb46514610650578063b88d4fde14610679576101e2565b8063715018a6116100d1578063715018a6146105735780638c74bf0e1461058a5780638da5cb5b146105a657806391b7f5ed146105d1576101e2565b806355f804b3146104a55780636352211e146104ce5780636abcded11461050b57806370a0823114610536576101e2565b80632f745c591161017a57806345313d291161014957806345313d29146103eb5780634639edeb1461042857806349df728c1461043f5780634f6ccce714610468576101e2565b80632f745c59146103505780633ccfd60b1461038d57806340d7d28e1461039757806342842e0e146103c2576101e2565b8063095ea7b3116101b6578063095ea7b3146102b757806318160ddd146102e057806323b872dd1461030b5780632db1154414610334576101e2565b80628ca816146101e757806301ffc9a71461021257806306fdde031461024f578063081812fc1461027a575b600080fd5b3480156101f357600080fd5b506101fc610770565b60405161020991906137e5565b60405180910390f35b34801561021e57600080fd5b506102396004803603810190610234919061316b565b610787565b60405161024691906137e5565b60405180910390f35b34801561025b57600080fd5b50610264610801565b6040516102719190613800565b60405180910390f35b34801561028657600080fd5b506102a1600480360381019061029c919061323b565b610893565b6040516102ae9190613733565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d991906130fe565b610918565b005b3480156102ec57600080fd5b506102f5610a30565b6040516103029190613b02565b60405180910390f35b34801561031757600080fd5b50610332600480360381019061032d9190612fe8565b610a3d565b005b61034e6004803603810190610349919061323b565b610a9d565b005b34801561035c57600080fd5b50610377600480360381019061037291906130fe565b610c58565b6040516103849190613b02565b60405180910390f35b610395610cfd565b005b3480156103a357600080fd5b506103ac610e96565b6040516103b99190613800565b60405180910390f35b3480156103ce57600080fd5b506103e960048036038101906103e49190612fe8565b610ed3565b005b3480156103f757600080fd5b50610412600480360381019061040d9190612f7b565b610ef3565b60405161041f91906137c3565b60405180910390f35b34801561043457600080fd5b5061043d610fa1565b005b34801561044b57600080fd5b50610466600480360381019061046191906131c5565b611049565b005b34801561047457600080fd5b5061048f600480360381019061048a919061323b565b611218565b60405161049c9190613b02565b60405180910390f35b3480156104b157600080fd5b506104cc60048036038101906104c791906131f2565b611289565b005b3480156104da57600080fd5b506104f560048036038101906104f0919061323b565b61131f565b6040516105029190613733565b60405180910390f35b34801561051757600080fd5b506105206113d1565b60405161052d9190613b02565b60405180910390f35b34801561054257600080fd5b5061055d60048036038101906105589190612f7b565b6113db565b60405161056a9190613b02565b60405180910390f35b34801561057f57600080fd5b50610588611493565b005b6105a4600480360381019061059f919061323b565b61151b565b005b3480156105b257600080fd5b506105bb6116f6565b6040516105c89190613733565b60405180910390f35b3480156105dd57600080fd5b506105f860048036038101906105f3919061323b565b611720565b005b34801561060657600080fd5b5061060f6117a6565b60405161061c9190613800565b60405180910390f35b34801561063157600080fd5b5061063a611838565b6040516106479190613b02565b60405180910390f35b34801561065c57600080fd5b50610677600480360381019061067291906130be565b611842565b005b34801561068557600080fd5b506106a0600480360381019061069b919061303b565b6119c3565b005b3480156106ae57600080fd5b506106b7611a25565b6040516106c49190613800565b60405180910390f35b3480156106d957600080fd5b506106f460048036038101906106ef919061323b565b611a45565b6040516107019190613800565b60405180910390f35b34801561071657600080fd5b50610731600480360381019061072c9190612fa8565b611aec565b60405161073e91906137e5565b60405180910390f35b34801561075357600080fd5b5061076e60048036038101906107699190612f7b565b611b80565b005b6000601160009054906101000a900460ff16905090565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806107fa57506107f982611c78565b5b9050919050565b60606000805461081090613dfd565b80601f016020809104026020016040519081016040528092919081815260200182805461083c90613dfd565b80156108895780601f1061085e57610100808354040283529160200191610889565b820191906000526020600020905b81548152906001019060200180831161086c57829003601f168201915b5050505050905090565b600061089e82611d5a565b6108dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d490613a02565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006109238261131f565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610994576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098b90613a82565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166109b3611dc6565b73ffffffffffffffffffffffffffffffffffffffff1614806109e257506109e1816109dc611dc6565b611aec565b5b610a21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1890613982565b60405180910390fd5b610a2b8383611dce565b505050565b6000600880549050905090565b610a4e610a48611dc6565b82611e87565b610a8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8490613aa2565b60405180910390fd5b610a98838383611f65565b505050565b6000610aa7610a30565b9050601160009054906101000a900460ff1615610af9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af090613ae2565b60405180910390fd5b60008211610b3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3390613922565b60405180910390fd5b6127108282610b4b9190613c20565b1115610b8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8390613902565b60405180910390fd5b6032821115610bd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc790613942565b60405180910390fd5b81601054610bde9190613ca7565b341015610c20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1790613882565b60405180910390fd5b60005b82811015610c5357610c40338284610c3b9190613c20565b6121c1565b8080610c4b90613e60565b915050610c23565b505050565b6000610c63836113db565b8210610ca4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b90613822565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610d05611dc6565b73ffffffffffffffffffffffffffffffffffffffff16610d236116f6565b73ffffffffffffffffffffffffffffffffffffffff1614610d79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7090613a22565b60405180910390fd5b6000600a47610d889190613c76565b90506000600447610d999190613c76565b9050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050503373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610e91573d6000803e3d6000fd5b505050565b60606040518060400160405280601b81526020017f50726f6a656374206279204b656e6e79205363686163687465722e0000000000815250905090565b610eee838383604051806020016040528060008152506119c3565b505050565b60606000610f00836113db565b905060008167ffffffffffffffff811115610f1e57610f1d613fc5565b5b604051908082528060200260200182016040528015610f4c5781602001602082028036833780820191505090505b50905060005b82811015610f9657610f648582610c58565b828281518110610f7757610f76613f96565b5b6020026020010181815250508080610f8e90613e60565b915050610f52565b508092505050919050565b610fa9611dc6565b73ffffffffffffffffffffffffffffffffffffffff16610fc76116f6565b73ffffffffffffffffffffffffffffffffffffffff161461101d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101490613a22565b60405180910390fd5b601160009054906101000a900460ff1615601160006101000a81548160ff021916908315150217905550565b611051611dc6565b73ffffffffffffffffffffffffffffffffffffffff1661106f6116f6565b73ffffffffffffffffffffffffffffffffffffffff16146110c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bc90613a22565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110ff57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb338373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016111559190613733565b60206040518083038186803b15801561116d57600080fd5b505afa158015611181573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a59190613268565b6040518363ffffffff1660e01b81526004016111c292919061379a565b602060405180830381600087803b1580156111dc57600080fd5b505af11580156111f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611214919061313e565b5050565b6000611222610a30565b8210611263576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125a90613ac2565b60405180910390fd5b6008828154811061127757611276613f96565b5b90600052602060002001549050919050565b611291611dc6565b73ffffffffffffffffffffffffffffffffffffffff166112af6116f6565b73ffffffffffffffffffffffffffffffffffffffff1614611305576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fc90613a22565b60405180910390fd5b80600f908051906020019061131b929190612d50565b5050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113bf906139c2565b60405180910390fd5b80915050919050565b6000612710905090565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561144c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611443906139a2565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61149b611dc6565b73ffffffffffffffffffffffffffffffffffffffff166114b96116f6565b73ffffffffffffffffffffffffffffffffffffffff161461150f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150690613a22565b60405180910390fd5b61151960006121df565b565b6000611525610a30565b905061152f6116f6565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806115b55750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061160d5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806116655750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61166e57600080fd5b612710828261167d9190613c20565b11156116be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b590613902565b60405180910390fd5b60005b828110156116f1576116de3382846116d99190613c20565b6121c1565b80806116e990613e60565b9150506116c1565b505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611728611dc6565b73ffffffffffffffffffffffffffffffffffffffff166117466116f6565b73ffffffffffffffffffffffffffffffffffffffff161461179c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179390613a22565b60405180910390fd5b8060108190555050565b6060600180546117b590613dfd565b80601f01602080910402602001604051908101604052809291908181526020018280546117e190613dfd565b801561182e5780601f106118035761010080835404028352916020019161182e565b820191906000526020600020905b81548152906001019060200180831161181157829003601f168201915b5050505050905090565b6000601054905090565b61184a611dc6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118af906138e2565b60405180910390fd5b80600560006118c5611dc6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611972611dc6565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516119b791906137e5565b60405180910390a35050565b6119d46119ce611dc6565b83611e87565b611a13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0a90613aa2565b60405180910390fd5b611a1f848484846122a5565b50505050565b606060405180606001604052806040815260200161469c60409139905090565b6060611a5082611d5a565b611a8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8690613a62565b60405180910390fd5b6000611a99612301565b90506000815111611ab95760405180602001604052806000815250611ae4565b80611ac384612393565b604051602001611ad492919061370f565b6040516020818303038152906040525b915050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611b88611dc6565b73ffffffffffffffffffffffffffffffffffffffff16611ba66116f6565b73ffffffffffffffffffffffffffffffffffffffff1614611bfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf390613a22565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6390613862565b60405180910390fd5b611c75816121df565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611d4357507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611d535750611d52826124f4565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611e418361131f565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611e9282611d5a565b611ed1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec890613962565b60405180910390fd5b6000611edc8361131f565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611f4b57508373ffffffffffffffffffffffffffffffffffffffff16611f3384610893565b73ffffffffffffffffffffffffffffffffffffffff16145b80611f5c5750611f5b8185611aec565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611f858261131f565b73ffffffffffffffffffffffffffffffffffffffff1614611fdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd290613a42565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561204b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612042906138c2565b60405180910390fd5b61205683838361255e565b612061600082611dce565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546120b19190613d01565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546121089190613c20565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6121db828260405180602001604052806000815250612672565b5050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6122b0848484611f65565b6122bc848484846126cd565b6122fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f290613842565b60405180910390fd5b50505050565b6060600f805461231090613dfd565b80601f016020809104026020016040519081016040528092919081815260200182805461233c90613dfd565b80156123895780601f1061235e57610100808354040283529160200191612389565b820191906000526020600020905b81548152906001019060200180831161236c57829003601f168201915b5050505050905090565b606060008214156123db576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506124ef565b600082905060005b6000821461240d5780806123f690613e60565b915050600a826124069190613c76565b91506123e3565b60008167ffffffffffffffff81111561242957612428613fc5565b5b6040519080825280601f01601f19166020018201604052801561245b5781602001600182028036833780820191505090505b5090505b600085146124e8576001826124749190613d01565b9150600a856124839190613ea9565b603061248f9190613c20565b60f81b8183815181106124a5576124a4613f96565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856124e19190613c76565b945061245f565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612569838383612864565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156125ac576125a781612869565b6125eb565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146125ea576125e983826128b2565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561262e5761262981612a1f565b61266d565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461266c5761266b8282612af0565b5b5b505050565b61267c8383612b6f565b61268960008484846126cd565b6126c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126bf90613842565b60405180910390fd5b505050565b60006126ee8473ffffffffffffffffffffffffffffffffffffffff16612d3d565b15612857578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612717611dc6565b8786866040518563ffffffff1660e01b8152600401612739949392919061374e565b602060405180830381600087803b15801561275357600080fd5b505af192505050801561278457506040513d601f19601f820116820180604052508101906127819190613198565b60015b612807573d80600081146127b4576040519150601f19603f3d011682016040523d82523d6000602084013e6127b9565b606091505b506000815114156127ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127f690613842565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161491505061285c565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016128bf846113db565b6128c99190613d01565b90506000600760008481526020019081526020016000205490508181146129ae576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050612a339190613d01565b9050600060096000848152602001908152602001600020549050600060088381548110612a6357612a62613f96565b5b906000526020600020015490508060088381548110612a8557612a84613f96565b5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480612ad457612ad3613f67565b5b6001900381819060005260206000200160009055905550505050565b6000612afb836113db565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612bdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd6906139e2565b60405180910390fd5b612be881611d5a565b15612c28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1f906138a2565b60405180910390fd5b612c346000838361255e565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612c849190613c20565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b828054612d5c90613dfd565b90600052602060002090601f016020900481019282612d7e5760008555612dc5565b82601f10612d9757805160ff1916838001178555612dc5565b82800160010185558215612dc5579182015b82811115612dc4578251825591602001919060010190612da9565b5b509050612dd29190612dd6565b5090565b5b80821115612def576000816000905550600101612dd7565b5090565b6000612e06612e0184613b42565b613b1d565b905082815260208101848484011115612e2257612e21613ff9565b5b612e2d848285613dbb565b509392505050565b6000612e48612e4384613b73565b613b1d565b905082815260208101848484011115612e6457612e63613ff9565b5b612e6f848285613dbb565b509392505050565b600081359050612e8681614628565b92915050565b600081359050612e9b8161463f565b92915050565b600081519050612eb08161463f565b92915050565b600081359050612ec581614656565b92915050565b600081519050612eda81614656565b92915050565b600082601f830112612ef557612ef4613ff4565b5b8135612f05848260208601612df3565b91505092915050565b600081359050612f1d8161466d565b92915050565b600082601f830112612f3857612f37613ff4565b5b8135612f48848260208601612e35565b91505092915050565b600081359050612f6081614684565b92915050565b600081519050612f7581614684565b92915050565b600060208284031215612f9157612f90614003565b5b6000612f9f84828501612e77565b91505092915050565b60008060408385031215612fbf57612fbe614003565b5b6000612fcd85828601612e77565b9250506020612fde85828601612e77565b9150509250929050565b60008060006060848603121561300157613000614003565b5b600061300f86828701612e77565b935050602061302086828701612e77565b925050604061303186828701612f51565b9150509250925092565b6000806000806080858703121561305557613054614003565b5b600061306387828801612e77565b945050602061307487828801612e77565b935050604061308587828801612f51565b925050606085013567ffffffffffffffff8111156130a6576130a5613ffe565b5b6130b287828801612ee0565b91505092959194509250565b600080604083850312156130d5576130d4614003565b5b60006130e385828601612e77565b92505060206130f485828601612e8c565b9150509250929050565b6000806040838503121561311557613114614003565b5b600061312385828601612e77565b925050602061313485828601612f51565b9150509250929050565b60006020828403121561315457613153614003565b5b600061316284828501612ea1565b91505092915050565b60006020828403121561318157613180614003565b5b600061318f84828501612eb6565b91505092915050565b6000602082840312156131ae576131ad614003565b5b60006131bc84828501612ecb565b91505092915050565b6000602082840312156131db576131da614003565b5b60006131e984828501612f0e565b91505092915050565b60006020828403121561320857613207614003565b5b600082013567ffffffffffffffff81111561322657613225613ffe565b5b61323284828501612f23565b91505092915050565b60006020828403121561325157613250614003565b5b600061325f84828501612f51565b91505092915050565b60006020828403121561327e5761327d614003565b5b600061328c84828501612f66565b91505092915050565b60006132a183836136f1565b60208301905092915050565b6132b681613d35565b82525050565b60006132c782613bb4565b6132d18185613be2565b93506132dc83613ba4565b8060005b8381101561330d5781516132f48882613295565b97506132ff83613bd5565b9250506001810190506132e0565b5085935050505092915050565b61332381613d47565b82525050565b600061333482613bbf565b61333e8185613bf3565b935061334e818560208601613dca565b61335781614008565b840191505092915050565b600061336d82613bca565b6133778185613c04565b9350613387818560208601613dca565b61339081614008565b840191505092915050565b60006133a682613bca565b6133b08185613c15565b93506133c0818560208601613dca565b80840191505092915050565b60006133d9602b83613c04565b91506133e482614019565b604082019050919050565b60006133fc603283613c04565b915061340782614068565b604082019050919050565b600061341f602683613c04565b915061342a826140b7565b604082019050919050565b6000613442602a83613c04565b915061344d82614106565b604082019050919050565b6000613465601c83613c04565b915061347082614155565b602082019050919050565b6000613488602483613c04565b91506134938261417e565b604082019050919050565b60006134ab601983613c04565b91506134b6826141cd565b602082019050919050565b60006134ce601d83613c04565b91506134d9826141f6565b602082019050919050565b60006134f1601983613c04565b91506134fc8261421f565b602082019050919050565b6000613514602483613c04565b915061351f82614248565b604082019050919050565b6000613537602c83613c04565b915061354282614297565b604082019050919050565b600061355a603883613c04565b9150613565826142e6565b604082019050919050565b600061357d602a83613c04565b915061358882614335565b604082019050919050565b60006135a0602983613c04565b91506135ab82614384565b604082019050919050565b60006135c3602083613c04565b91506135ce826143d3565b602082019050919050565b60006135e6602c83613c04565b91506135f1826143fc565b604082019050919050565b6000613609602083613c04565b91506136148261444b565b602082019050919050565b600061362c602983613c04565b915061363782614474565b604082019050919050565b600061364f602f83613c04565b915061365a826144c3565b604082019050919050565b6000613672602183613c04565b915061367d82614512565b604082019050919050565b6000613695603183613c04565b91506136a082614561565b604082019050919050565b60006136b8602c83613c04565b91506136c3826145b0565b604082019050919050565b60006136db601383613c04565b91506136e6826145ff565b602082019050919050565b6136fa81613db1565b82525050565b61370981613db1565b82525050565b600061371b828561339b565b9150613727828461339b565b91508190509392505050565b600060208201905061374860008301846132ad565b92915050565b600060808201905061376360008301876132ad565b61377060208301866132ad565b61377d6040830185613700565b818103606083015261378f8184613329565b905095945050505050565b60006040820190506137af60008301856132ad565b6137bc6020830184613700565b9392505050565b600060208201905081810360008301526137dd81846132bc565b905092915050565b60006020820190506137fa600083018461331a565b92915050565b6000602082019050818103600083015261381a8184613362565b905092915050565b6000602082019050818103600083015261383b816133cc565b9050919050565b6000602082019050818103600083015261385b816133ef565b9050919050565b6000602082019050818103600083015261387b81613412565b9050919050565b6000602082019050818103600083015261389b81613435565b9050919050565b600060208201905081810360008301526138bb81613458565b9050919050565b600060208201905081810360008301526138db8161347b565b9050919050565b600060208201905081810360008301526138fb8161349e565b9050919050565b6000602082019050818103600083015261391b816134c1565b9050919050565b6000602082019050818103600083015261393b816134e4565b9050919050565b6000602082019050818103600083015261395b81613507565b9050919050565b6000602082019050818103600083015261397b8161352a565b9050919050565b6000602082019050818103600083015261399b8161354d565b9050919050565b600060208201905081810360008301526139bb81613570565b9050919050565b600060208201905081810360008301526139db81613593565b9050919050565b600060208201905081810360008301526139fb816135b6565b9050919050565b60006020820190508181036000830152613a1b816135d9565b9050919050565b60006020820190508181036000830152613a3b816135fc565b9050919050565b60006020820190508181036000830152613a5b8161361f565b9050919050565b60006020820190508181036000830152613a7b81613642565b9050919050565b60006020820190508181036000830152613a9b81613665565b9050919050565b60006020820190508181036000830152613abb81613688565b9050919050565b60006020820190508181036000830152613adb816136ab565b9050919050565b60006020820190508181036000830152613afb816136ce565b9050919050565b6000602082019050613b176000830184613700565b92915050565b6000613b27613b38565b9050613b338282613e2f565b919050565b6000604051905090565b600067ffffffffffffffff821115613b5d57613b5c613fc5565b5b613b6682614008565b9050602081019050919050565b600067ffffffffffffffff821115613b8e57613b8d613fc5565b5b613b9782614008565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613c2b82613db1565b9150613c3683613db1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c6b57613c6a613eda565b5b828201905092915050565b6000613c8182613db1565b9150613c8c83613db1565b925082613c9c57613c9b613f09565b5b828204905092915050565b6000613cb282613db1565b9150613cbd83613db1565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613cf657613cf5613eda565b5b828202905092915050565b6000613d0c82613db1565b9150613d1783613db1565b925082821015613d2a57613d29613eda565b5b828203905092915050565b6000613d4082613d91565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000613d8a82613d35565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613de8578082015181840152602081019050613dcd565b83811115613df7576000848401525b50505050565b60006002820490506001821680613e1557607f821691505b60208210811415613e2957613e28613f38565b5b50919050565b613e3882614008565b810181811067ffffffffffffffff82111715613e5757613e56613fc5565b5b80604052505050565b6000613e6b82613db1565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613e9e57613e9d613eda565b5b600182019050919050565b6000613eb482613db1565b9150613ebf83613db1565b925082613ecf57613ece613f09565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45746865722073656e74206973206e6f7420636f727265637420666f7220746f60008201527f6b656e2070726963652e00000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f45786365656473206d6178696d756d20746f6b656e20737570706c792e000000600082015250565b7f4d757374206d696e74206174206c656173742031204d75747400000000000000600082015250565b7f4c696d6974656420746f203530206d696e747320706572207472616e7361637460008201527f696f6e2e00000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f436f6e7472616374206973207061757365642e00000000000000000000000000600082015250565b61463181613d35565b811461463c57600080fd5b50565b61464881613d47565b811461465357600080fd5b50565b61465f81613d53565b811461466a57600080fd5b50565b61467681613d7f565b811461468157600080fd5b50565b61468d81613db1565b811461469857600080fd5b5056fe34363731323666626533383932633565623364633164303264383466313632306439373464643731616466323933376639323730336130356332666533383662a26469706673582212205eb06d1fd126025f46acdc22ce4de9e768899d19e95329f62a9442c46ac0dcaa64736f6c63430008070033
Verified Source Code Full Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
CryptoMutts.sol 131 lines
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; //@version 0.3.0 import "@openzeppelin/[email protected]/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/[email protected]/access/Ownable.sol"; import "@openzeppelin/[email protected]/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract CryptoMutts is ERC721Enumerable, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; //Team address tm0 = 0xDc3Ee5969611a47C4Bd4ef088a55E1ba61701827; //RvNhMn address tm1 = 0xA3BDaa505a72FC6B3e15E69Ac1577aEcd0E2736b; //T.O. address tm2 = 0xb2EB33Fcd965C6635015b1D9E623717AC283FB11; //K. string baseTokenURI; string constant PROVENANCE_HASH = "467126fbe3892c5eb3dc1d02d84f1620d974dd71adf2937f92703a05c2fe386b"; uint private constant MAX_TOKENS = 10**4; //10,000 Mutts uint private constant TXN_MINT_LIMIT = 50; //50 per txn uint private mintPrice = 30000000 gwei; //0.03 Ether bool private salePaused = true; constructor(string memory _baseTokenURI) ERC721("CryptoMutts", "CMUTT") { setBaseURI(_baseTokenURI); } function isSalePaused() public view returns (bool) { return salePaused; } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function getPrice() public view returns (uint) { return mintPrice; } function setPrice(uint _newPrice) public onlyOwner { mintPrice = _newPrice; } function walletOfTokenOwner(address _tokenOwner) public view returns(uint[] memory) { uint tokenCount = balanceOf(_tokenOwner); uint[] memory tokensId = new uint[](tokenCount); for(uint i; i < tokenCount; i++){ tokensId[i] = tokenOfOwnerByIndex(_tokenOwner, i); } return tokensId; } function getMaxTokens() public pure returns (uint) { return MAX_TOKENS; } function getProvenance() public pure returns (string memory) { return PROVENANCE_HASH; } function putANameOnIt() public pure returns (string memory) { return "Project by Kenny Schachter."; } function saleToggle() public onlyOwner { salePaused = !salePaused; } function publicMint(uint _amount) public payable { uint _supply = totalSupply(); require( !salePaused, "Contract is paused." ); require( _amount > 0, "Must mint at least 1 Mutt"); require( _supply + _amount <= MAX_TOKENS, "Exceeds maximum token supply." ); require( _amount <= TXN_MINT_LIMIT, "Limited to 50 mints per transaction."); require( msg.value >= mintPrice * _amount, "Ether sent is not correct for token price." ); for(uint i; i < _amount; i++){ _safeMint(msg.sender, _supply + i); } } function reservedMint(uint _amount) public payable { uint _supply = totalSupply(); require( msg.sender == owner() || msg.sender == tm0 || msg.sender == tm1 //Assurance || msg.sender == tm2 ); require( _supply + _amount <= MAX_TOKENS, "Exceeds maximum token supply."); for(uint i; i < _amount; i++){ _safeMint(msg.sender, _supply + i); } } /** * Payout with withdrawal pattern */ function withdraw() public payable onlyOwner { uint tenthCut = address(this).balance / 10; uint quarterCut = address(this).balance / 4; payable(tm0).send(tenthCut); //RvNhMn payable(tm1).send(quarterCut); //T.O payable(msg.sender).transfer(address(this).balance); //Remainder to owner } /** * Recover any ERC20 tokens sent to contract */ function withdrawTokens(IERC20 _token) public onlyOwner { require(address(_token) != address(0)); _token.transfer(msg.sender, _token.balanceOf(address(this))); } }
IERC20.sol 81 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
Address.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Counters.sol 42 lines
// SPDX-License-Identifier: MIT
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;
}
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 162 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
getMaxTokens 0x6abcded1 → uint256
getPrice 0x98d5fdca → uint256
getProvenance 0xb9da967d → string
isApprovedForAll 0xe985e9c5 → bool
isSalePaused 0x008ca816 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
putANameOnIt 0x40d7d28e → string
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfTokenOwner 0x45313d29 → uint256[]
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
publicMint 0x2db11544
uint256 _amount
renounceOwnership 0x715018a6
No parameters
reservedMint 0x8c74bf0e
uint256 _amount
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
saleToggle 0x4639edeb
No parameters
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string baseURI
setPrice 0x91b7f5ed
uint256 _newPrice
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
withdrawTokens 0x49df728c
address _token
Recent Transactions
No transactions found for this address