Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x48B01BF21c2b264df0Ee8Fb9b3B5D5A77885A0e7
Balance 0 ETH
Nonce 1
Code Size 17357 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

17357 bytes
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c806370a082311161010457806395d89b41116100a2578063c87b56dd11610071578063c87b56dd14610567578063d547741f14610597578063e985e9c5146105b3578063f2fde38b146105e3576101da565b806395d89b41146104f3578063a217fddf14610511578063a22cb4651461052f578063b88d4fde1461054b576101da565b8063750521f5116100de578063750521f51461046b5780637ecc2b56146104875780638da5cb5b146104a557806391d14854146104c3576101da565b806370a0823114610415578063715018a614610445578063729ad39e1461044f576101da565b8063248a9ca31161017c57806342842e0e1161014b57806342842e0e14610369578063438b6300146103855780634f6ccce7146103b55780636352211e146103e5576101da565b8063248a9ca3146102d15780632f2ff15d146103015780632f745c591461031d57806336568abe1461034d576101da565b8063095ea7b3116101b8578063095ea7b31461025d57806318160ddd146102795780631e0fbfa21461029757806323b872dd146102b5576101da565b806301ffc9a7146101df57806306fdde031461020f578063081812fc1461022d575b600080fd5b6101f960048036038101906101f49190612e03565b6105ff565b604051610206919061349b565b60405180910390f35b610217610611565b60405161022491906134d1565b60405180910390f35b61024760048036038101906102429190612ea6565b6106a3565b6040516102549190613412565b60405180910390f35b61027760048036038101906102729190612d0d565b610730565b005b610281610848565b60405161028e9190613793565b60405180910390f35b61029f610852565b6040516102ac91906134b6565b60405180910390f35b6102cf60048036038101906102ca9190612bf7565b610876565b005b6102eb60048036038101906102e69190612d96565b6108d6565b6040516102f891906134b6565b60405180910390f35b61031b60048036038101906103169190612dc3565b6108f6565b005b61033760048036038101906103329190612d0d565b61091f565b6040516103449190613793565b60405180910390f35b61036760048036038101906103629190612dc3565b6109ec565b005b610383600480360381019061037e9190612bf7565b610a6f565b005b61039f600480360381019061039a9190612b8a565b610a8f565b6040516103ac9190613479565b60405180910390f35b6103cf60048036038101906103ca9190612ea6565b610b4e565b6040516103dc9190613793565b60405180910390f35b6103ff60048036038101906103fa9190612ea6565b610bb5565b60405161040c9190613412565b60405180910390f35b61042f600480360381019061042a9190612b8a565b610c6f565b60405161043c9190613793565b60405180910390f35b61044d610d2a565b005b61046960048036038101906104649190612d4d565b610db2565b005b61048560048036038101906104809190612e5d565b610e84565b005b61048f610ed1565b60405161049c9190613793565b60405180910390f35b6104ad610f0b565b6040516104ba9190613412565b60405180910390f35b6104dd60048036038101906104d89190612dc3565b610f35565b6040516104ea919061349b565b60405180910390f35b6104fb610fa0565b60405161050891906134d1565b60405180910390f35b610519611032565b60405161052691906134b6565b60405180910390f35b61054960048036038101906105449190612ccd565b611039565b005b61056560048036038101906105609190612c4a565b6111ba565b005b610581600480360381019061057c9190612ea6565b61121c565b60405161058e91906134d1565b60405180910390f35b6105b160048036038101906105ac9190612dc3565b6112f8565b005b6105cd60048036038101906105c89190612bb7565b611321565b6040516105da919061349b565b60405180910390f35b6105fd60048036038101906105f89190612b8a565b6113b5565b005b600061060a826114ad565b9050919050565b60606000805461062090613ab9565b80601f016020809104026020016040519081016040528092919081815260200182805461064c90613ab9565b80156106995780601f1061066e57610100808354040283529160200191610699565b820191906000526020600020905b81548152906001019060200180831161067c57829003601f168201915b5050505050905090565b60006106ae82611527565b6106ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e490613693565b60405180910390fd5b600660008361ffff1661ffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061073b82610bb5565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a390613713565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166107cb61159b565b73ffffffffffffffffffffffffffffffffffffffff1614806107fa57506107f9816107f461159b565b611321565b5b610839576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083090613613565b60405180910390fd5b61084383836115a3565b505050565b6000600254905090565b7f3a2f235c9daaf33349d300aadff2f15078a89df81bcfdd45ba11c8f816bddc6f81565b61088761088161159b565b82611664565b6108c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108bd90613733565b60405180910390fd5b6108d183838361174a565b505050565b600060086000838152602001908152602001600020600101549050919050565b6108ff826108d6565b6109108161090b61159b565b61190c565b61091a83836119a9565b505050565b600061092a83610c6f565b821061096b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096290613513565b60405180910390fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106109bc576109bb613c80565b5b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff16905092915050565b6109f461159b565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5890613773565b60405180910390fd5b610a6b8282611a8a565b5050565b610a8a838383604051806020016040528060008152506111ba565b505050565b6060600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610b4257602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411610b095790505b50505050509050919050565b600080600183610b5e91906138dd565b9050610b6981611527565b610ba8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9f90613753565b60405180910390fd5b8061ffff16915050919050565b600080600360008461ffff1661ffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5d90613653565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ce0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd790613633565b60405180910390fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b610d3261159b565b73ffffffffffffffffffffffffffffffffffffffff16610d50610f0b565b73ffffffffffffffffffffffffffffffffffffffff1614610da6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9d906136b3565b60405180910390fd5b610db06000611b6c565b565b7f3a2f235c9daaf33349d300aadff2f15078a89df81bcfdd45ba11c8f816bddc6f610de481610ddf61159b565b61190c565b8151610dee610ed1565b1015610e2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2690613593565b60405180910390fd5b60005b8251811015610e7f576000610e45611c32565b9050610e6b848381518110610e5d57610e5c613c80565b5b602002602001015182611d0d565b508080610e7790613b1c565b915050610e32565b505050565b7f3a2f235c9daaf33349d300aadff2f15078a89df81bcfdd45ba11c8f816bddc6f610eb681610eb161159b565b61190c565b81600a9080519060200190610ecc9291906128eb565b505050565b6000610edb610848565b7f000000000000000000000000000000000000000000000000000000000000004b610f06919061398d565b905090565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006008600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b606060018054610faf90613ab9565b80601f0160208091040260200160405190810160405280929190818152602001828054610fdb90613ab9565b80156110285780601f10610ffd57610100808354040283529160200191611028565b820191906000526020600020905b81548152906001019060200180831161100b57829003601f168201915b5050505050905090565b6000801b81565b61104161159b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a6906135d3565b60405180910390fd5b80600760006110bc61159b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661116961159b565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111ae919061349b565b60405180910390a35050565b6111cb6111c561159b565b83611664565b61120a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120190613733565b60405180910390fd5b61121684848484611e90565b50505050565b606061122782611527565b611266576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125d906136f3565b60405180910390fd5b600a805461127390613ab9565b80601f016020809104026020016040519081016040528092919081815260200182805461129f90613ab9565b80156112ec5780601f106112c1576101008083540402835291602001916112ec565b820191906000526020600020905b8154815290600101906020018083116112cf57829003601f168201915b50505050509050919050565b611301826108d6565b6113128161130d61159b565b61190c565b61131c8383611a8a565b505050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6113bd61159b565b73ffffffffffffffffffffffffffffffffffffffff166113db610f0b565b73ffffffffffffffffffffffffffffffffffffffff1614611431576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611428906136b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156114a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149890613553565b60405180910390fd5b6114aa81611b6c565b50565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611520575061151f82611ef0565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff16600360008461ffff1661ffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b81600660008361ffff1661ffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661161e83610bb5565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061166f82611527565b6116ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a5906135f3565b60405180910390fd5b60006116bd8361ffff16610bb5565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061173057508373ffffffffffffffffffffffffffffffffffffffff166117188461ffff166106a3565b73ffffffffffffffffffffffffffffffffffffffff16145b8061174157506117408185611321565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661176e8261ffff16610bb5565b73ffffffffffffffffffffffffffffffffffffffff16146117c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bb906136d3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611834576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182b906135b3565b60405180910390fd5b61183f83838361203a565b61184e60008261ffff166115a3565b81600360008361ffff1661ffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508061ffff168273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6119168282610f35565b6119a55761193b8173ffffffffffffffffffffffffffffffffffffffff166014612146565b6119498360001c6020612146565b60405160200161195a9291906133d8565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199c91906134d1565b60405180910390fd5b5050565b6119b38282610f35565b611a865760016008600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611a2b61159b565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b611a948282610f35565b15611b685760006008600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611b0d61159b565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080611c3d610ed1565b9050600081611c4b83612382565b611c559190613b93565b90506000600b8281548110611c6d57611c6c613c80565b5b90600052602060002001549050600080821415611c8a5782611c8c565b815b90506000600185611c9d919061398d565b90506000600b8281548110611cb557611cb4613c80565b5b906000526020600020015490506000811415611cd15781611cd3565b805b600b8681548110611ce757611ce6613c80565b5b9060005260206000200181905550600183611d0291906138dd565b965050505050505090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7490613673565b60405180910390fd5b611d8681611527565b15611dc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbd90613573565b60405180910390fd5b611dd26000838361203a565b81600360008361ffff1661ffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508061ffff168273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b611e9b84848461174a565b611eab84848461ffff16846123bb565b611eea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee190613533565b60405180910390fd5b50505050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611fbb57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061202357507f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612033575061203282612552565b5b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561208a5760016002600082825461208291906138dd565b925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156120f35750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156121035761210283826125bc565b5b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146121415761214082826127f3565b5b505050565b6060600060028360026121599190613933565b61216391906138dd565b67ffffffffffffffff81111561217c5761217b613caf565b5b6040519080825280601f01601f1916602001820160405280156121ae5781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106121e6576121e5613c80565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061224a57612249613c80565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261228a9190613933565b61229491906138dd565b90505b6001811115612334577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106122d6576122d5613c80565b5b1a60f81b8282815181106122ed576122ec613c80565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061232d90613a8f565b9050612297565b5060008414612378576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236f906134f3565b60405180910390fd5b8091505092915050565b6000333a428460405160200161239b949392919061338a565b6040516020818303038152906040528051906020012060001c9050919050565b60006123dc8473ffffffffffffffffffffffffffffffffffffffff166128d8565b15612545578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261240561159b565b8786866040518563ffffffff1660e01b8152600401612427949392919061342d565b602060405180830381600087803b15801561244157600080fd5b505af192505050801561247257506040513d601f19601f8201168201806040525081019061246f9190612e30565b60015b6124f5573d80600081146124a2576040519150601f19603f3d011682016040523d82523d6000602084013e6124a7565b606091505b506000815114156124ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124e490613533565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161491505061254a565b600190505b949350505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600060016125c984610c6f565b6125d3919061398d565b90506000600460008461ffff1661ffff16815260200190815260200160002060009054906101000a900461ffff169050818161ffff1614612744576000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061266157612660613c80565b5b90600052602060002090601091828204019190066002029054906101000a900461ffff16905080600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208361ffff16815481106126dd576126dc613c80565b5b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555081600460008361ffff1661ffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff160217905550505b600460008461ffff1661ffff16815260200190815260200160002060006101000a81549061ffff0219169055600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806127bf576127be613c51565b5b60019003818190600052602060002090601091828204019190066002026101000a81549061ffff0219169055905550505050565b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150506001900390600052602060002090601091828204019190066002029091909190916101000a81548161ffff021916908361ffff160217905550600061288583610c6f565b905060018111156128d35760018161289d919061398d565b600460008461ffff1661ffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff1602179055505b505050565b600080823b905060008111915050919050565b8280546128f790613ab9565b90600052602060002090601f0160209004810192826129195760008555612960565b82601f1061293257805160ff1916838001178555612960565b82800160010185558215612960579182015b8281111561295f578251825591602001919060010190612944565b5b50905061296d9190612971565b5090565b5b8082111561298a576000816000905550600101612972565b5090565b60006129a161299c846137d3565b6137ae565b905080838252602082019050828560208602820111156129c4576129c3613ce3565b5b60005b858110156129f457816129da8882612a82565b8452602084019350602083019250506001810190506129c7565b5050509392505050565b6000612a11612a0c846137ff565b6137ae565b905082815260208101848484011115612a2d57612a2c613ce8565b5b612a38848285613a4d565b509392505050565b6000612a53612a4e84613830565b6137ae565b905082815260208101848484011115612a6f57612a6e613ce8565b5b612a7a848285613a4d565b509392505050565b600081359050612a9181614324565b92915050565b600082601f830112612aac57612aab613cde565b5b8135612abc84826020860161298e565b91505092915050565b600081359050612ad48161433b565b92915050565b600081359050612ae981614352565b92915050565b600081359050612afe81614369565b92915050565b600081519050612b1381614369565b92915050565b600082601f830112612b2e57612b2d613cde565b5b8135612b3e8482602086016129fe565b91505092915050565b600082601f830112612b5c57612b5b613cde565b5b8135612b6c848260208601612a40565b91505092915050565b600081359050612b8481614380565b92915050565b600060208284031215612ba057612b9f613cf2565b5b6000612bae84828501612a82565b91505092915050565b60008060408385031215612bce57612bcd613cf2565b5b6000612bdc85828601612a82565b9250506020612bed85828601612a82565b9150509250929050565b600080600060608486031215612c1057612c0f613cf2565b5b6000612c1e86828701612a82565b9350506020612c2f86828701612a82565b9250506040612c4086828701612b75565b9150509250925092565b60008060008060808587031215612c6457612c63613cf2565b5b6000612c7287828801612a82565b9450506020612c8387828801612a82565b9350506040612c9487828801612b75565b925050606085013567ffffffffffffffff811115612cb557612cb4613ced565b5b612cc187828801612b19565b91505092959194509250565b60008060408385031215612ce457612ce3613cf2565b5b6000612cf285828601612a82565b9250506020612d0385828601612ac5565b9150509250929050565b60008060408385031215612d2457612d23613cf2565b5b6000612d3285828601612a82565b9250506020612d4385828601612b75565b9150509250929050565b600060208284031215612d6357612d62613cf2565b5b600082013567ffffffffffffffff811115612d8157612d80613ced565b5b612d8d84828501612a97565b91505092915050565b600060208284031215612dac57612dab613cf2565b5b6000612dba84828501612ada565b91505092915050565b60008060408385031215612dda57612dd9613cf2565b5b6000612de885828601612ada565b9250506020612df985828601612a82565b9150509250929050565b600060208284031215612e1957612e18613cf2565b5b6000612e2784828501612aef565b91505092915050565b600060208284031215612e4657612e45613cf2565b5b6000612e5484828501612b04565b91505092915050565b600060208284031215612e7357612e72613cf2565b5b600082013567ffffffffffffffff811115612e9157612e90613ced565b5b612e9d84828501612b47565b91505092915050565b600060208284031215612ebc57612ebb613cf2565b5b6000612eca84828501612b75565b91505092915050565b6000612edf8383613355565b60208301905092915050565b612ef4816139c1565b82525050565b612f0b612f06826139c1565b613b65565b82525050565b6000612f1c82613871565b612f26818561389f565b9350612f3183613861565b8060005b83811015612f62578151612f498882612ed3565b9750612f5483613892565b925050600181019050612f35565b5085935050505092915050565b612f78816139d3565b82525050565b612f87816139df565b82525050565b6000612f988261387c565b612fa281856138b0565b9350612fb2818560208601613a5c565b612fbb81613cf7565b840191505092915050565b6000612fd182613887565b612fdb81856138c1565b9350612feb818560208601613a5c565b612ff481613cf7565b840191505092915050565b600061300a82613887565b61301481856138d2565b9350613024818560208601613a5c565b80840191505092915050565b600061303d6020836138c1565b915061304882613d15565b602082019050919050565b6000613060602b836138c1565b915061306b82613d3e565b604082019050919050565b60006130836032836138c1565b915061308e82613d8d565b604082019050919050565b60006130a66026836138c1565b91506130b182613ddc565b604082019050919050565b60006130c9601c836138c1565b91506130d482613e2b565b602082019050919050565b60006130ec6034836138c1565b91506130f782613e54565b604082019050919050565b600061310f6024836138c1565b915061311a82613ea3565b604082019050919050565b60006131326019836138c1565b915061313d82613ef2565b602082019050919050565b6000613155602c836138c1565b915061316082613f1b565b604082019050919050565b60006131786038836138c1565b915061318382613f6a565b604082019050919050565b600061319b602a836138c1565b91506131a682613fb9565b604082019050919050565b60006131be6029836138c1565b91506131c982614008565b604082019050919050565b60006131e16020836138c1565b91506131ec82614057565b602082019050919050565b6000613204602c836138c1565b915061320f82614080565b604082019050919050565b60006132276020836138c1565b9150613232826140cf565b602082019050919050565b600061324a6029836138c1565b9150613255826140f8565b604082019050919050565b600061326d602f836138c1565b915061327882614147565b604082019050919050565b60006132906021836138c1565b915061329b82614196565b604082019050919050565b60006132b36031836138c1565b91506132be826141e5565b604082019050919050565b60006132d6602c836138c1565b91506132e182614234565b604082019050919050565b60006132f96017836138d2565b915061330482614283565b601782019050919050565b600061331c6011836138d2565b9150613327826142ac565b601182019050919050565b600061333f602f836138c1565b915061334a826142d5565b604082019050919050565b61335e81613a15565b82525050565b61336d81613a43565b82525050565b61338461337f82613a43565b613b89565b82525050565b60006133968287612efa565b6014820191506133a68286613373565b6020820191506133b68285613373565b6020820191506133c68284613373565b60208201915081905095945050505050565b60006133e3826132ec565b91506133ef8285612fff565b91506133fa8261330f565b91506134068284612fff565b91508190509392505050565b60006020820190506134276000830184612eeb565b92915050565b60006080820190506134426000830187612eeb565b61344f6020830186612eeb565b61345c6040830185613364565b818103606083015261346e8184612f8d565b905095945050505050565b600060208201905081810360008301526134938184612f11565b905092915050565b60006020820190506134b06000830184612f6f565b92915050565b60006020820190506134cb6000830184612f7e565b92915050565b600060208201905081810360008301526134eb8184612fc6565b905092915050565b6000602082019050818103600083015261350c81613030565b9050919050565b6000602082019050818103600083015261352c81613053565b9050919050565b6000602082019050818103600083015261354c81613076565b9050919050565b6000602082019050818103600083015261356c81613099565b9050919050565b6000602082019050818103600083015261358c816130bc565b9050919050565b600060208201905081810360008301526135ac816130df565b9050919050565b600060208201905081810360008301526135cc81613102565b9050919050565b600060208201905081810360008301526135ec81613125565b9050919050565b6000602082019050818103600083015261360c81613148565b9050919050565b6000602082019050818103600083015261362c8161316b565b9050919050565b6000602082019050818103600083015261364c8161318e565b9050919050565b6000602082019050818103600083015261366c816131b1565b9050919050565b6000602082019050818103600083015261368c816131d4565b9050919050565b600060208201905081810360008301526136ac816131f7565b9050919050565b600060208201905081810360008301526136cc8161321a565b9050919050565b600060208201905081810360008301526136ec8161323d565b9050919050565b6000602082019050818103600083015261370c81613260565b9050919050565b6000602082019050818103600083015261372c81613283565b9050919050565b6000602082019050818103600083015261374c816132a6565b9050919050565b6000602082019050818103600083015261376c816132c9565b9050919050565b6000602082019050818103600083015261378c81613332565b9050919050565b60006020820190506137a86000830184613364565b92915050565b60006137b86137c9565b90506137c48282613aeb565b919050565b6000604051905090565b600067ffffffffffffffff8211156137ee576137ed613caf565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561381a57613819613caf565b5b61382382613cf7565b9050602081019050919050565b600067ffffffffffffffff82111561384b5761384a613caf565b5b61385482613cf7565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b60006138e882613a43565b91506138f383613a43565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561392857613927613bc4565b5b828201905092915050565b600061393e82613a43565b915061394983613a43565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561398257613981613bc4565b5b828202905092915050565b600061399882613a43565b91506139a383613a43565b9250828210156139b6576139b5613bc4565b5b828203905092915050565b60006139cc82613a23565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613a7a578082015181840152602081019050613a5f565b83811115613a89576000848401525b50505050565b6000613a9a82613a43565b91506000821415613aae57613aad613bc4565b5b600182039050919050565b60006002820490506001821680613ad157607f821691505b60208210811415613ae557613ae4613c22565b5b50919050565b613af482613cf7565b810181811067ffffffffffffffff82111715613b1357613b12613caf565b5b80604052505050565b6000613b2782613a43565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613b5a57613b59613bc4565b5b600182019050919050565b6000613b7082613b77565b9050919050565b6000613b8282613d08565b9050919050565b6000819050919050565b6000613b9e82613a43565b9150613ba983613a43565b925082613bb957613bb8613bf3565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f41697264726f703a204d6f72652077616c6c6574732070726f7669646564207460008201527f68616e20617661696c61626c6520737570706c79000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b61432d816139c1565b811461433857600080fd5b50565b614344816139d3565b811461434f57600080fd5b50565b61435b816139df565b811461436657600080fd5b50565b614372816139e9565b811461437d57600080fd5b50565b61438981613a43565b811461439457600080fd5b5056fea264697066735822122059d750b3d8c149512eb4323d1c9b001340c29365c64ecf0d8a456dfdb253152864736f6c63430008070033

Verified Source Code Full Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: No
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);
    }
}
IERC721.sol 5 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../token/ERC721/IERC721.sol";
ERC721Lean.sol 500 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
import "@openzeppelin/contracts/interfaces/IERC721Receiver.sol";
import "@openzeppelin/contracts/interfaces/IERC721Metadata.sol";
import "@openzeppelin/contracts/interfaces/IERC721Enumerable.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata and Enumerable extensions. Gas-optimized for ordered token ID collections.
 */
contract ERC721Lean is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Token counter
    uint256 private _tokenCounter;

    // Mapping from token ID to owner address
    mapping(uint16 => address) private _owners;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint16 => uint16) private _ownedTokensIndex;
    
    // Mapping from owner to list of owned token IDs
    mapping(address => uint16[]) private _ownedTokens;

    // Mapping from token ID to approved address
    mapping(uint16 => 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 ||
            interfaceId == type(IERC721Enumerable).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 _ownedTokens[owner].length;
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[uint16(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(uint16(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 = 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(uint16(tokenId)), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[uint16(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(), uint16(tokenId)), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, uint16(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(), uint16(tokenId)), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, uint16(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,
        uint16 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(uint16 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, uint16 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = 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, uint16 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,
        uint16 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, uint16 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");
        
        _beforeTokenTransfer(address(0), to, tokenId);

        _owners[uint16(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(uint16 tokenId) internal virtual {
        address owner = ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        delete _owners[uint16(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,
        uint16 tokenId
    ) internal virtual {
        require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _owners[uint16(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[uint16(tokenId)] = to;
        emit Approval(ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < 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 _tokenCounter;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        uint16 tokenId = uint16(index + 1);
        require(_exists(tokenId), "ERC721Enumerable: global index out of bounds");
        return tokenId;
    }

    /**
     * @dev Returns all the owned tokens by owner address.
     */
    function walletOfOwner(address owner) public view returns (uint16[] memory) {
        return _ownedTokens[owner];
    }

    /**
     * @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,
        uint16 tokenId
    ) internal virtual {

        if (from == address(0)) {
            _tokenCounter += 1;
        }

        if (from != to && from != address(0)) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        
        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, uint16 tokenId) private {
        _ownedTokens[to].push(tokenId);
        uint256 balance = balanceOf(to);
        if (balance > 1) {
            _ownedTokensIndex[tokenId] = uint16(balance - 1);
        }
    }

    /**
     * @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, uint16 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 = balanceOf(from) - 1;
        uint16 tokenIndex = _ownedTokensIndex[uint16(tokenId)];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint16 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[uint16(tokenId)];
        _ownedTokens[from].pop();
    }
}
GremlinsAirdrop.sol 109 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

/// @author jpegmint.xyz

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "../token/ERC721/ERC721Lean.sol";

contract GremlinsAirdrop is ERC721Lean, AccessControl, Ownable {

    /// Variables ///
    string internal _metadataURI;
	uint256[] private _tokenIdTracker;
    uint256 internal immutable _tokenMaxSupply;

    /// Roles ///
    bytes32 public constant AIRDROP_ROLE = keccak256("AIRDROP_ROLE");

    /// Constructor ///
    constructor(string memory name, string memory symbol, uint256 tokenMaxSupply)
    ERC721Lean(name, symbol) {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(AIRDROP_ROLE, msg.sender);
        _tokenMaxSupply = tokenMaxSupply;
        _tokenIdTracker = new uint256[](tokenMaxSupply);
    }

    //================================================================================
    // MINTING
    //================================================================================

    /**
     * @dev Airdrops tokens to specified wallet addresses. Batching supported.
     */
    function airdrop(address[] memory wallets) external onlyRole(AIRDROP_ROLE) {
        require(availableSupply() >= wallets.length, "Airdrop: More wallets provided than available supply");
        for (uint256 i = 0; i < wallets.length; i++) {
            uint16 tokenId = uint16(_generateTokenId());
            _mint(wallets[i], tokenId);
        }
    }

    /**
     * @dev Generate random tokenIds using Meebits random ID strategy.
     */
    function _generateTokenId() private returns (uint256) {
        uint256 remainingQty = availableSupply();
        uint256 randomIndex = _generateRandomNum(remainingQty) % remainingQty;

        // If array value exists, use, otherwise use generated random value.
        uint256 existingValue = _tokenIdTracker[randomIndex];
        uint256 tokenId = existingValue != 0 ? existingValue : randomIndex;

        // Keep track of seen indexes for black magic.
        uint256 endIndex = remainingQty - 1;
        uint256 endValue = _tokenIdTracker[endIndex];
        _tokenIdTracker[randomIndex] = endValue != 0 ? endValue : endIndex;

        return tokenId + 1; // Start tokens at #1
    }

    /**
     * @dev Generate pseudorandom number via various transaction properties.
     */
    function _generateRandomNum(uint256 seed) internal view virtual returns (uint256) {
        return uint256(keccak256(abi.encodePacked(msg.sender, tx.gasprice, block.timestamp, seed)));
    }

    /**
     * @dev Helper function to pair with total supply.
     */
    function availableSupply() public view returns (uint256) {
        return _tokenMaxSupply - totalSupply();
    }

    //================================================================================
    // METADATA
    //================================================================================

    /**
     * @dev Same TokenURI for all existing tokens.
     */
    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(uint16(tokenId)), "ERC721Metadata: URI query for nonexistent token");
        return _metadataURI;
    }

    /**
     * @dev Store and update new base uri.
     */
    function setMetadataURI(string memory newURI) external onlyRole(AIRDROP_ROLE) {
        _metadataURI = newURI;
    }

    //================================================================================
    // OTHER FUNCTIONS
    //================================================================================

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721Lean, AccessControl)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}
AccessControl.sol 210 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}
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;
}
IAccessControl.sol 87 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}
IERC721Metadata.sol 5 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../token/ERC721/extensions/IERC721Metadata.sol";
IERC721Receiver.sol 5 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../token/ERC721/IERC721Receiver.sol";
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);
}
IERC721Enumerable.sol 5 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../token/ERC721/extensions/IERC721Enumerable.sol";
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);
}
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

AIRDROP_ROLE 0x1e0fbfa2 → bytes32
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
availableSupply 0x7ecc2b56 → uint256
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
getRoleAdmin 0x248a9ca3 → bytes32
hasRole 0x91d14854 → bool
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint16[]

Write Contract 12 functions

These functions modify contract state and require a wallet transaction to execute.

airdrop 0x729ad39e
address[] wallets
approve 0x095ea7b3
address to
uint256 tokenId
grantRole 0x2f2ff15d
bytes32 role
address account
renounceOwnership 0x715018a6
No parameters
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setMetadataURI 0x750521f5
string newURI
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address