Address Contract Partially Verified
Address
0x0632aDCab8F12edD3b06F99Dc6078FE1FEDD32B0
Balance
0 ETH
Nonce
1
Code Size
19746 bytes
Creator
0x81B91A4E...033C at tx 0x04681013...81ca88
Indexed Transactions
0
Contract Bytecode
19746 bytes
0x6080604052600436106101f95760003560e01c806370a082311161010d578063a22cb465116100a0578063d547cfb71161006f578063d547cfb7146106f0578063d9279b601461071b578063e3e1e8ef14610737578063e985e9c514610753578063f2fde38b14610790576101f9565b8063a22cb46514610636578063b88d4fde1461065f578063c7ba754814610688578063c87b56dd146106b3576101f9565b80638c7ea24b116100dc5780638c7ea24b1461058c5780638da5cb5b146105b557806395d89b41146105e0578063a035b1fe1461060b576101f9565b806370a0823114610505578063715018a6146105425780637cb6475914610559578063853828b614610582576101f9565b80632e49d78b1161019057806340c10f191161015f57806340c10f191461043157806342842e0e1461044d57806349df728c1461047657806355f804b31461049f5780636352211e146104c8576101f9565b80632e49d78b146103895780632eb4a7ab146103b257806332cb6b0c146103dd5780633ae84a8214610408576101f9565b806318160ddd116101cc57806318160ddd146102cc578063200d2ed2146102f757806323b872dd146103225780632a55205a1461034b576101f9565b806301ffc9a7146101fe57806306fdde031461023b578063081812fc14610266578063095ea7b3146102a3575b600080fd5b34801561020a57600080fd5b5061022560048036038101906102209190613b08565b6107b9565b6040516102329190614188565b60405180910390f35b34801561024757600080fd5b506102506107cb565b60405161025d91906141d9565b60405180910390f35b34801561027257600080fd5b5061028d60048036038101906102889190613c32565b61085d565b60405161029a91906140f8565b60405180910390f35b3480156102af57600080fd5b506102ca60048036038101906102c59190613a6e565b6108d9565b005b3480156102d857600080fd5b506102e16109e4565b6040516102ee91906143d6565b60405180910390f35b34801561030357600080fd5b5061030c6109fb565b60405161031991906141be565b60405180910390f35b34801561032e57600080fd5b5061034960048036038101906103449190613958565b610a0e565b005b34801561035757600080fd5b50610372600480360381019061036d9190613cec565b610a1e565b60405161038092919061415f565b60405180910390f35b34801561039557600080fd5b506103b060048036038101906103ab9190613b8f565b610ade565b005b3480156103be57600080fd5b506103c7610bbe565b6040516103d491906141a3565b60405180910390f35b3480156103e957600080fd5b506103f2610bc4565b6040516103ff91906143f1565b60405180910390f35b34801561041457600080fd5b5061042f600480360381019061042a9190613c05565b610bca565b005b61044b60048036038101906104469190613a6e565b610c82565b005b34801561045957600080fd5b50610474600480360381019061046f9190613958565b610eda565b005b34801561048257600080fd5b5061049d60048036038101906104989190613b62565b610efa565b005b3480156104ab57600080fd5b506104c660048036038101906104c19190613bbc565b611012565b005b3480156104d457600080fd5b506104ef60048036038101906104ea9190613c32565b6110a8565b6040516104fc91906140f8565b60405180910390f35b34801561051157600080fd5b5061052c600480360381019061052791906138eb565b6110be565b60405161053991906143d6565b60405180910390f35b34801561054e57600080fd5b5061055761118e565b005b34801561056557600080fd5b50610580600480360381019061057b9190613adb565b611216565b005b61058a61129c565b005b34801561059857600080fd5b506105b360048036038101906105ae9190613a6e565b61141d565b005b3480156105c157600080fd5b506105ca6114a7565b6040516105d791906140f8565b60405180910390f35b3480156105ec57600080fd5b506105f56114d1565b60405161060291906141d9565b60405180910390f35b34801561061757600080fd5b50610620611563565b60405161062d91906143bb565b60405180910390f35b34801561064257600080fd5b5061065d60048036038101906106589190613a2e565b611585565b005b34801561066b57600080fd5b50610686600480360381019061068191906139ab565b6116fd565b005b34801561069457600080fd5b5061069d611779565b6040516106aa91906143f1565b60405180910390f35b3480156106bf57600080fd5b506106da60048036038101906106d59190613c32565b61177e565b6040516106e791906141d9565b60405180910390f35b3480156106fc57600080fd5b5061070561181d565b60405161071291906141d9565b60405180910390f35b61073560048036038101906107309190613c32565b6118ab565b005b610751600480360381019061074c9190613c8c565b611a6c565b005b34801561075f57600080fd5b5061077a60048036038101906107759190613918565b611d7e565b6040516107879190614188565b60405180910390f35b34801561079c57600080fd5b506107b760048036038101906107b291906138eb565b611e12565b005b60006107c482611f0a565b9050919050565b6060600280546107da9061471d565b80601f01602080910402602001604051908101604052809291908181526020018280546108069061471d565b80156108535780601f1061082857610100808354040283529160200191610853565b820191906000526020600020905b81548152906001019060200180831161083657829003601f168201915b5050505050905090565b600061086882611f84565b61089e576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006108e4826110a8565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561094c576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1661096b611fd2565b73ffffffffffffffffffffffffffffffffffffffff161415801561099d575061099b81610996611fd2565b611d7e565b155b156109d4576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109df838383611fda565b505050565b60006109ee61208c565b6001546000540303905090565b600b60009054906101000a900460ff1681565b610a19838383612091565b505050565b6000806000600a6040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900462ffffff1662ffffff1662ffffff1681525050905080600001519250612710816020015162ffffff1685610aca9190614568565b610ad49190614537565b9150509250929050565b610ae6611fd2565b73ffffffffffffffffffffffffffffffffffffffff16610b046114a7565b73ffffffffffffffffffffffffffffffffffffffff1614610b5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b519061431b565b60405180910390fd5b80600b60006101000a81548160ff02191690836003811115610b7f57610b7e61487c565b5b02179055507f504eaf1c308a9514233b8d6364a1d4d333824d8ab51add90e420d54b18ba785b81604051610bb391906141be565b60405180910390a150565b600c5481565b61138881565b610bd2611fd2565b73ffffffffffffffffffffffffffffffffffffffff16610bf06114a7565b73ffffffffffffffffffffffffffffffffffffffff1614610c46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3d9061431b565b60405180910390fd5b80600e60006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555050565b8181600567ffffffffffffffff1681600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610cdb91906144e1565b1115610d1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d13906141fb565b60405180910390fd5b8261138867ffffffffffffffff16610d32612547565b82610d3d91906144e1565b1115610d7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d759061425b565b60405180910390fd5b83600e60009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681610dbb9190614568565b3414610dfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df3906142fb565b60405180910390fd5b60026003811115610e1057610e0f61487c565b5b600b60009054906101000a900460ff166003811115610e3257610e3161487c565b5b14610e72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e69906142bb565b60405180910390fd5b84600f60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ec191906144e1565b92505081905550610ed2868661255a565b505050505050565b610ef5838383604051806020016040528060008152506116fd565b505050565b610f02611fd2565b73ffffffffffffffffffffffffffffffffffffffff16610f206114a7565b73ffffffffffffffffffffffffffffffffffffffff1614610f76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6d9061431b565b60405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610fb191906140f8565b60206040518083038186803b158015610fc957600080fd5b505afa158015610fdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110019190613c5f565b905061100e823383612578565b5050565b61101a611fd2565b73ffffffffffffffffffffffffffffffffffffffff166110386114a7565b73ffffffffffffffffffffffffffffffffffffffff161461108e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110859061431b565b60405180910390fd5b80600d90805190602001906110a49291906135e8565b5050565b60006110b3826125fe565b600001519050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611126576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900467ffffffffffffffff1667ffffffffffffffff169050919050565b611196611fd2565b73ffffffffffffffffffffffffffffffffffffffff166111b46114a7565b73ffffffffffffffffffffffffffffffffffffffff161461120a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112019061431b565b60405180910390fd5b611214600061288d565b565b61121e611fd2565b73ffffffffffffffffffffffffffffffffffffffff1661123c6114a7565b73ffffffffffffffffffffffffffffffffffffffff1614611292576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112899061431b565b60405180910390fd5b80600c8190555050565b6112a4611fd2565b73ffffffffffffffffffffffffffffffffffffffff166112c26114a7565b73ffffffffffffffffffffffffffffffffffffffff1614611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061431b565b60405180910390fd5b6002600854141561135e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113559061439b565b60405180910390fd5b600260088190555060003373ffffffffffffffffffffffffffffffffffffffff164760405161138c906140e3565b60006040518083038185875af1925050503d80600081146113c9576040519150601f19603f3d011682016040523d82523d6000602084013e6113ce565b606091505b5050905080611412576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114099061433b565b60405180910390fd5b506001600881905550565b611425611fd2565b73ffffffffffffffffffffffffffffffffffffffff166114436114a7565b73ffffffffffffffffffffffffffffffffffffffff1614611499576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114909061431b565b60405180910390fd5b6114a38282612953565b5050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600380546114e09061471d565b80601f016020809104026020016040519081016040528092919081815260200182805461150c9061471d565b80156115595780601f1061152e57610100808354040283529160200191611559565b820191906000526020600020905b81548152906001019060200180831161153c57829003601f168201915b5050505050905090565b600e60009054906101000a90046fffffffffffffffffffffffffffffffff1681565b61158d611fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115f2576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600760006115ff611fd2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff166116ac611fd2565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516116f19190614188565b60405180910390a35050565b611708848484612091565b6117278373ffffffffffffffffffffffffffffffffffffffff16612a3d565b801561173c575061173a84848484612a60565b155b15611773576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b600581565b606061178982611f84565b6117bf576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006117c9612bc0565b90506000815114156117ea5760405180602001604052806000815250611815565b806117f484612c52565b6040516020016118059291906140bf565b6040516020818303038152906040525b915050919050565b600d805461182a9061471d565b80601f01602080910402602001604051908101604052809291908181526020018280546118569061471d565b80156118a35780601f10611878576101008083540402835291602001916118a3565b820191906000526020600020905b81548152906001019060200180831161188657829003601f168201915b505050505081565b600260085414156118f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e89061439b565b60405180910390fd5b6002600881905550611901611fd2565b73ffffffffffffffffffffffffffffffffffffffff1661191f6114a7565b73ffffffffffffffffffffffffffffffffffffffff1614611975576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161196c9061431b565b60405180910390fd5b8061138867ffffffffffffffff1661198b612547565b8261199691906144e1565b11156119d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ce9061425b565b60405180910390fd5b81600e60009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681611a149190614568565b3414611a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4c906142fb565b60405180910390fd5b611a5f338461255a565b5050600160088190555050565b3383600567ffffffffffffffff1681600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac591906144e1565b1115611b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afd906141fb565b60405180910390fd5b8461138867ffffffffffffffff16611b1c612547565b82611b2791906144e1565b1115611b68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5f9061425b565b60405180910390fd5b85600e60009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681611ba59190614568565b3414611be6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdd906142fb565b60405180910390fd5b60016003811115611bfa57611bf961487c565b5b600b60009054906101000a900460ff166003811115611c1c57611c1b61487c565b5b14611c5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c539061427b565b60405180910390fd5b600033604051602001611c6f919061408d565b604051602081830303815290604052805190602001209050611cd5878780806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600c5483612db3565b611d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0b906142db565b60405180910390fd5b87600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611d6391906144e1565b92505081905550611d74338961255a565b5050505050505050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611e1a611fd2565b73ffffffffffffffffffffffffffffffffffffffff16611e386114a7565b73ffffffffffffffffffffffffffffffffffffffff1614611e8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e859061431b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611efe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef59061423b565b60405180910390fd5b611f078161288d565b50565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611f7d5750611f7c82612dca565b5b9050919050565b600081611f8f61208c565b11158015611f9e575060005482105b8015611fcb575060046000838152602001908152602001600020600001601c9054906101000a900460ff16155b9050919050565b600033905090565b826006600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600090565b600061209c826125fe565b90508373ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614612107576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008473ffffffffffffffffffffffffffffffffffffffff16612128611fd2565b73ffffffffffffffffffffffffffffffffffffffff161480612157575061215685612151611fd2565b611d7e565b5b8061219c5750612165611fd2565b73ffffffffffffffffffffffffffffffffffffffff166121848461085d565b73ffffffffffffffffffffffffffffffffffffffff16145b9050806121d5576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561223c576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6122498585856001612eac565b61225560008487611fda565b6001600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160392506101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506001600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506000600460008581526020019081526020016000209050848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550428160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060006001850190506000600460008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156124d55760005482146124d457878160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084602001518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b5b505050828473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46125408585856001612eb2565b5050505050565b600061255161208c565b60005403905090565b612574828260405180602001604052806000815250612eb8565b5050565b6125f98363a9059cbb60e01b848460405160240161259792919061415f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612eca565b505050565b61260661366e565b60008290508061261461208c565b11158015612623575060005481105b15612856576000600460008381526020019081526020016000206040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601c9054906101000a900460ff1615151515815250509050806040015161285457600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614612738578092505050612888565b5b60011561285357818060019003925050600460008381526020019081526020016000206040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601c9054906101000a900460ff1615151515815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff161461284e578092505050612888565b612739565b5b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612710811115612998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161298f9061421b565b60405180910390fd5b60405180604001604052808373ffffffffffffffffffffffffffffffffffffffff1681526020018262ffffff16815250600a60008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548162ffffff021916908362ffffff1602179055509050505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612a86611fd2565b8786866040518563ffffffff1660e01b8152600401612aa89493929190614113565b602060405180830381600087803b158015612ac257600080fd5b505af1925050508015612af357506040513d601f19601f82011682018060405250810190612af09190613b35565b60015b612b6d573d8060008114612b23576040519150601f19603f3d011682016040523d82523d6000602084013e612b28565b606091505b50600081511415612b65576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b6060600d8054612bcf9061471d565b80601f0160208091040260200160405190810160405280929190818152602001828054612bfb9061471d565b8015612c485780601f10612c1d57610100808354040283529160200191612c48565b820191906000526020600020905b815481529060010190602001808311612c2b57829003601f168201915b5050505050905090565b60606000821415612c9a576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612dae565b600082905060005b60008214612ccc578080612cb590614780565b915050600a82612cc59190614537565b9150612ca2565b60008167ffffffffffffffff811115612ce857612ce7614909565b5b6040519080825280601f01601f191660200182016040528015612d1a5781602001600182028036833780820191505090505b5090505b60008514612da757600182612d3391906145c2565b9150600a85612d4291906147ed565b6030612d4e91906144e1565b60f81b818381518110612d6457612d636148da565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612da09190614537565b9450612d1e565b8093505050505b919050565b600082612dc08584612f91565b1490509392505050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612e9557507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612ea55750612ea482613006565b5b9050919050565b50505050565b50505050565b612ec58383836001613070565b505050565b6000612f2c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661343e9092919063ffffffff16565b9050600081511115612f8c5780806020019051810190612f4c9190613aae565b612f8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f829061437b565b60405180910390fd5b5b505050565b60008082905060005b8451811015612ffb576000858281518110612fb857612fb76148da565b5b60200260200101519050808311612fda57612fd38382613456565b9250612fe7565b612fe48184613456565b92505b508080612ff390614780565b915050612f9a565b508091505092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600080549050600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156130dd576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000841415613118576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6131256000868387612eac565b83600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555083600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160088282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550846004600083815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550426004600083815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506000819050600085820190508380156132ef57506132ee8773ffffffffffffffffffffffffffffffffffffffff16612a3d565b5b156133b5575b818773ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46133646000888480600101955088612a60565b61339a576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808214156132f55782600054146133b057600080fd5b613421565b5b818060010192508773ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4808214156133b6575b8160008190555050506134376000868387612eb2565b5050505050565b606061344d848460008561346d565b90509392505050565b600082600052816020526040600020905092915050565b6060824710156134b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134a99061429b565b60405180910390fd5b6134bb85612a3d565b6134fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134f19061435b565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161352391906140a8565b60006040518083038185875af1925050503d8060008114613560576040519150601f19603f3d011682016040523d82523d6000602084013e613565565b606091505b5091509150613575828286613581565b92505050949350505050565b60608315613591578290506135e1565b6000835111156135a45782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135d891906141d9565b60405180910390fd5b9392505050565b8280546135f49061471d565b90600052602060002090601f016020900481019282613616576000855561365d565b82601f1061362f57805160ff191683800117855561365d565b8280016001018555821561365d579182015b8281111561365c578251825591602001919060010190613641565b5b50905061366a91906136b1565b5090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff1681526020016000151581525090565b5b808211156136ca5760008160009055506001016136b2565b5090565b60006136e16136dc84614431565b61440c565b9050828152602081018484840111156136fd576136fc614947565b5b6137088482856146db565b509392505050565b600061372361371e84614462565b61440c565b90508281526020810184848401111561373f5761373e614947565b5b61374a8482856146db565b509392505050565b60008135905061376181614c3b565b92915050565b60008083601f84011261377d5761377c61493d565b5b8235905067ffffffffffffffff81111561379a57613799614938565b5b6020830191508360208202830111156137b6576137b5614942565b5b9250929050565b6000813590506137cc81614c52565b92915050565b6000815190506137e181614c52565b92915050565b6000813590506137f681614c69565b92915050565b60008135905061380b81614c80565b92915050565b60008151905061382081614c80565b92915050565b600082601f83011261383b5761383a61493d565b5b813561384b8482602086016136ce565b91505092915050565b60008135905061386381614c97565b92915050565b60008135905061387881614cae565b92915050565b600082601f8301126138935761389261493d565b5b81356138a3848260208601613710565b91505092915050565b6000813590506138bb81614cbe565b92915050565b6000813590506138d081614cd5565b92915050565b6000815190506138e581614cd5565b92915050565b60006020828403121561390157613900614951565b5b600061390f84828501613752565b91505092915050565b6000806040838503121561392f5761392e614951565b5b600061393d85828601613752565b925050602061394e85828601613752565b9150509250929050565b60008060006060848603121561397157613970614951565b5b600061397f86828701613752565b935050602061399086828701613752565b92505060406139a1868287016138c1565b9150509250925092565b600080600080608085870312156139c5576139c4614951565b5b60006139d387828801613752565b94505060206139e487828801613752565b93505060406139f5878288016138c1565b925050606085013567ffffffffffffffff811115613a1657613a1561494c565b5b613a2287828801613826565b91505092959194509250565b60008060408385031215613a4557613a44614951565b5b6000613a5385828601613752565b9250506020613a64858286016137bd565b9150509250929050565b60008060408385031215613a8557613a84614951565b5b6000613a9385828601613752565b9250506020613aa4858286016138c1565b9150509250929050565b600060208284031215613ac457613ac3614951565b5b6000613ad2848285016137d2565b91505092915050565b600060208284031215613af157613af0614951565b5b6000613aff848285016137e7565b91505092915050565b600060208284031215613b1e57613b1d614951565b5b6000613b2c848285016137fc565b91505092915050565b600060208284031215613b4b57613b4a614951565b5b6000613b5984828501613811565b91505092915050565b600060208284031215613b7857613b77614951565b5b6000613b8684828501613854565b91505092915050565b600060208284031215613ba557613ba4614951565b5b6000613bb384828501613869565b91505092915050565b600060208284031215613bd257613bd1614951565b5b600082013567ffffffffffffffff811115613bf057613bef61494c565b5b613bfc8482850161387e565b91505092915050565b600060208284031215613c1b57613c1a614951565b5b6000613c29848285016138ac565b91505092915050565b600060208284031215613c4857613c47614951565b5b6000613c56848285016138c1565b91505092915050565b600060208284031215613c7557613c74614951565b5b6000613c83848285016138d6565b91505092915050565b600080600060408486031215613ca557613ca4614951565b5b6000613cb3868287016138c1565b935050602084013567ffffffffffffffff811115613cd457613cd361494c565b5b613ce086828701613767565b92509250509250925092565b60008060408385031215613d0357613d02614951565b5b6000613d11858286016138c1565b9250506020613d22858286016138c1565b9150509250929050565b613d35816145f6565b82525050565b613d4c613d47826145f6565b6147c9565b82525050565b613d5b81614608565b82525050565b613d6a81614614565b82525050565b6000613d7b82614493565b613d8581856144a9565b9350613d958185602086016146ea565b613d9e81614956565b840191505092915050565b6000613db482614493565b613dbe81856144ba565b9350613dce8185602086016146ea565b80840191505092915050565b613de3816146c9565b82525050565b6000613df48261449e565b613dfe81856144c5565b9350613e0e8185602086016146ea565b613e1781614956565b840191505092915050565b6000613e2d8261449e565b613e3781856144d6565b9350613e478185602086016146ea565b80840191505092915050565b6000613e606011836144c5565b9150613e6b82614974565b602082019050919050565b6000613e83601a836144c5565b9150613e8e8261499d565b602082019050919050565b6000613ea66026836144c5565b9150613eb1826149c6565b604082019050919050565b6000613ec96013836144c5565b9150613ed482614a15565b602082019050919050565b6000613eec6012836144c5565b9150613ef782614a3e565b602082019050919050565b6000613f0f6026836144c5565b9150613f1a82614a67565b604082019050919050565b6000613f32600f836144c5565b9150613f3d82614ab6565b602082019050919050565b6000613f556013836144c5565b9150613f6082614adf565b602082019050919050565b6000613f78600e836144c5565b9150613f8382614b08565b602082019050919050565b6000613f9b6020836144c5565b9150613fa682614b31565b602082019050919050565b6000613fbe6015836144c5565b9150613fc982614b5a565b602082019050919050565b6000613fe16000836144ba565b9150613fec82614b83565b600082019050919050565b6000614004601d836144c5565b915061400f82614b86565b602082019050919050565b6000614027602a836144c5565b915061403282614baf565b604082019050919050565b600061404a601f836144c5565b915061405582614bfe565b602082019050919050565b6140698161466f565b82525050565b614078816146ab565b82525050565b614087816146b5565b82525050565b60006140998284613d3b565b60148201915081905092915050565b60006140b48284613da9565b915081905092915050565b60006140cb8285613e22565b91506140d78284613e22565b91508190509392505050565b60006140ee82613fd4565b9150819050919050565b600060208201905061410d6000830184613d2c565b92915050565b60006080820190506141286000830187613d2c565b6141356020830186613d2c565b614142604083018561406f565b81810360608301526141548184613d70565b905095945050505050565b60006040820190506141746000830185613d2c565b614181602083018461406f565b9392505050565b600060208201905061419d6000830184613d52565b92915050565b60006020820190506141b86000830184613d61565b92915050565b60006020820190506141d36000830184613dda565b92915050565b600060208201905081810360008301526141f38184613de9565b905092915050565b6000602082019050818103600083015261421481613e53565b9050919050565b6000602082019050818103600083015261423481613e76565b9050919050565b6000602082019050818103600083015261425481613e99565b9050919050565b6000602082019050818103600083015261427481613ebc565b9050919050565b6000602082019050818103600083015261429481613edf565b9050919050565b600060208201905081810360008301526142b481613f02565b9050919050565b600060208201905081810360008301526142d481613f25565b9050919050565b600060208201905081810360008301526142f481613f48565b9050919050565b6000602082019050818103600083015261431481613f6b565b9050919050565b6000602082019050818103600083015261433481613f8e565b9050919050565b6000602082019050818103600083015261435481613fb1565b9050919050565b6000602082019050818103600083015261437481613ff7565b9050919050565b600060208201905081810360008301526143948161401a565b9050919050565b600060208201905081810360008301526143b48161403d565b9050919050565b60006020820190506143d06000830184614060565b92915050565b60006020820190506143eb600083018461406f565b92915050565b6000602082019050614406600083018461407e565b92915050565b6000614416614427565b9050614422828261474f565b919050565b6000604051905090565b600067ffffffffffffffff82111561444c5761444b614909565b5b61445582614956565b9050602081019050919050565b600067ffffffffffffffff82111561447d5761447c614909565b5b61448682614956565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006144ec826146ab565b91506144f7836146ab565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561452c5761452b61481e565b5b828201905092915050565b6000614542826146ab565b915061454d836146ab565b92508261455d5761455c61484d565b5b828204905092915050565b6000614573826146ab565b915061457e836146ab565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156145b7576145b661481e565b5b828202905092915050565b60006145cd826146ab565b91506145d8836146ab565b9250828210156145eb576145ea61481e565b5b828203905092915050565b60006146018261468b565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000614655826145f6565b9050919050565b600081905061466a82614c27565b919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b60006146d48261465c565b9050919050565b82818337600083830152505050565b60005b838110156147085780820151818401526020810190506146ed565b83811115614717576000848401525b50505050565b6000600282049050600182168061473557607f821691505b60208210811415614749576147486148ab565b5b50919050565b61475882614956565b810181811067ffffffffffffffff8211171561477757614776614909565b5b80604052505050565b600061478b826146ab565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156147be576147bd61481e565b5b600182019050919050565b60006147d4826147db565b9050919050565b60006147e682614967565b9050919050565b60006147f8826146ab565b9150614803836146ab565b9250826148135761481261484d565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f4d617820616d6f756e74206d696e746564000000000000000000000000000000600082015250565b7f45524332393831526f79616c746965733a20546f6f2068696768000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f436f6c6c656374696f6e20736f6c64206f757400000000000000000000000000600082015250565b7f50726573616c65206e6f74206163746976650000000000000000000000000000600082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f53616c65206e6f74206163746976650000000000000000000000000000000000600082015250565b7f4e6f7420696e2070726573616c65206c69737400000000000000000000000000600082015250565b7f4e6f7420656e6f75676820455448000000000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f556e7375636365737366756c2077697468647261770000000000000000000000600082015250565b50565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60048110614c3857614c3761487c565b5b50565b614c44816145f6565b8114614c4f57600080fd5b50565b614c5b81614608565b8114614c6657600080fd5b50565b614c7281614614565b8114614c7d57600080fd5b50565b614c898161461e565b8114614c9457600080fd5b50565b614ca08161464a565b8114614cab57600080fd5b50565b60048110614cbb57600080fd5b50565b614cc78161466f565b8114614cd257600080fd5b50565b614cde816146ab565b8114614ce957600080fd5b5056fea2646970667358221220da5a5f4f6d3fc44ef4f933f3cfa50bc504085fb4d1ee99f4240af876f72aeb7564736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
Surge.sol 1882 lines
// File: contracts/src/IERC2981Royalties.sol
pragma solidity ^0.8.1;
/// @title IERC2981Royalties
/// @dev Interface for the ERC2981 - Token Royalty standard
interface IERC2981Royalties {
/// @notice Called with the sale price to determine how much royalty
// is owed and to whom.
/// @param _tokenId - the NFT asset queried for royalty information
/// @param _value - the sale price of the NFT asset specified by _tokenId
/// @return _receiver - address of who should be sent the royalty payment
/// @return _royaltyAmount - the royalty payment amount for value sale price
function royaltyInfo(uint256 _tokenId, uint256 _value)
external
view
returns (address _receiver, uint256 _royaltyAmount);
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
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);
}
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
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);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev 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 {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}
// File: contracts/src/ERC2981Base.sol
pragma solidity ^0.8.1;
/// @dev This is a contract used to add ERC2981 support to ERC721 and 1155
abstract contract ERC2981Base is ERC165, IERC2981Royalties {
struct RoyaltyInfo {
address recipient;
uint24 amount;
}
/// @inheritdoc ERC165
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override
returns (bool)
{
return
interfaceId == type(IERC2981Royalties).interfaceId ||
super.supportsInterface(interfaceId);
}
}
// File: contracts/src/ERC2981ContractWideRoyalties.sol
pragma solidity ^0.8.1;
/// @dev This is a contract used to add ERC2981 support to ERC721 and 1155
/// @dev This implementation has the same royalties for each and every tokens
abstract contract ERC2981ContractWideRoyalties is ERC2981Base {
RoyaltyInfo private _royalties;
/// @dev Sets token royalties
/// @param recipient recipient of the royalties
/// @param value percentage (using 2 decimals - 10000 = 100, 0 = 0)
function _setRoyalties(address recipient, uint256 value) internal {
require(value <= 10000, "ERC2981Royalties: Too high");
_royalties = RoyaltyInfo(recipient, uint24(value));
}
/// @inheritdoc IERC2981Royalties
function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
{
RoyaltyInfo memory royalties = _royalties;
receiver = royalties.recipient;
royaltyAmount = (value * royalties.amount) / 10000;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @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);
}
// File: erc721a/contracts/ERC721A.sol
// Creator: Chiru Labs
pragma solidity ^0.8.4;
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
uint64 aux;
}
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) internal _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// 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;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* To change the starting tokenId, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
*/
function totalSupply() public view returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex - _startTokenId() times
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view returns (uint256) {
// Counter underflow is impossible as _currentIndex does not decrement,
// and it is initialized to _startTokenId()
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @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 override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberMinted);
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberBurned);
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return _addressData[owner].aux;
}
/**
* Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal {
_addressData[owner].aux = aux;
}
/**
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr && curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return _ownershipOf(tokenId).addr;
}
/**
* @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) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
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 override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
if (operator == _msgSender()) revert ApproveToCaller();
_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 {
_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 {
_transfer(from, to, tokenId);
if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, '');
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_mint(to, quantity, _data, true);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId]...
// [truncated — 66180 bytes total]
Read Contract
MAX_PER_USER 0xc7ba7548 → uint64
MAX_SUPPLY 0x32cb6b0c → uint64
balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
merkleRoot 0x2eb4a7ab → bytes32
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
price 0xa035b1fe → uint128
royaltyInfo 0x2a55205a → address, uint256
status 0x200d2ed2 → uint8
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
batchMinting 0xd9279b60
uint256 _amountOfTokens
mint 0x40c10f19
address to
uint256 _amountOfTokens
presaleMint 0xe3e1e8ef
uint256 _amountOfTokens
bytes32[] _merkleProof
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _baseTokenURI
setMerkleRoot 0x7cb64759
bytes32 _merkleRoot
setPrice 0x3ae84a82
uint128 _price
setRoyalties 0x8c7ea24b
address recipient
uint256 value
setStatus 0x2e49d78b
uint8 _status
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdrawAll 0x853828b6
No parameters
withdrawTokens 0x49df728c
address token
Recent Transactions
No transactions found for this address