Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xa54E6b99f58b6165228abcdc681e9a16bceFdBe1
Balance 0 ETH
Nonce 1
Code Size 18571 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

18571 bytes
0x6080604052600436106101f85760003560e01c80636352211e1161010d578063a22cb465116100a0578063c87b56dd1161006f578063c87b56dd1461070d578063d547cfb71461074a578063d5abeb0114610775578063e985e9c5146107a0578063f2fde38b146107dd576101f8565b8063a22cb46514610667578063b423fe6714610690578063b6c693e5146106b9578063b88d4fde146106e4576101f8565b80638da5cb5b116100dc5780638da5cb5b146105cc57806395d89b41146105f7578063a0712d6814610622578063a0bcfc7f1461063e576101f8565b80636352211e1461051057806370a082311461054d578063715018a61461058a57806381a7deae146105a1576101f8565b806323b872dd1161019057806342842e0e1161015f57806342842e0e1461042d57806344a0d68a14610456578063464bd6401461047f5780634f6ccce7146104aa5780635e326b92146104e7576101f8565b806323b872dd146103755780632bf043041461039e5780632f745c59146103c757806332dee40b14610404576101f8565b8063095ea7b3116101cc578063095ea7b3146102cb57806313faede6146102f457806318160ddd1461031f5780632154dc391461034a576101f8565b8062b6849f146101fd57806301ffc9a71461022657806306fdde0314610263578063081812fc1461028e575b600080fd5b34801561020957600080fd5b50610224600480360381019061021f91906131ba565b610806565b005b34801561023257600080fd5b5061024d60048036038101906102489190613234565b61096e565b60405161025a919061386c565b60405180910390f35b34801561026f57600080fd5b506102786109e8565b6040516102859190613887565b60405180910390f35b34801561029a57600080fd5b506102b560048036038101906102b091906132d7565b610a7a565b6040516102c29190613805565b60405180910390f35b3480156102d757600080fd5b506102f260048036038101906102ed919061317a565b610aff565b005b34801561030057600080fd5b50610309610c17565b6040516103169190613be9565b60405180910390f35b34801561032b57600080fd5b50610334610c1d565b6040516103419190613be9565b60405180910390f35b34801561035657600080fd5b5061035f610c2a565b60405161036c9190613be9565b60405180910390f35b34801561038157600080fd5b5061039c60048036038101906103979190613064565b610c7d565b005b3480156103aa57600080fd5b506103c560048036038101906103c091906131ba565b610cdd565b005b3480156103d357600080fd5b506103ee60048036038101906103e9919061317a565b610deb565b6040516103fb9190613be9565b60405180910390f35b34801561041057600080fd5b5061042b60048036038101906104269190612ff7565b610e90565b005b34801561043957600080fd5b50610454600480360381019061044f9190613064565b610f99565b005b34801561046257600080fd5b5061047d600480360381019061047891906132d7565b610fb9565b005b34801561048b57600080fd5b5061049461103f565b6040516104a1919061386c565b60405180910390f35b3480156104b657600080fd5b506104d160048036038101906104cc91906132d7565b611052565b6040516104de9190613be9565b60405180910390f35b3480156104f357600080fd5b5061050e60048036038101906105099190613207565b6110c3565b005b34801561051c57600080fd5b50610537600480360381019061053291906132d7565b61118d565b6040516105449190613805565b60405180910390f35b34801561055957600080fd5b50610574600480360381019061056f9190612fca565b61123f565b6040516105819190613be9565b60405180910390f35b34801561059657600080fd5b5061059f6112f7565b005b3480156105ad57600080fd5b506105b661137f565b6040516105c39190613be9565b60405180910390f35b3480156105d857600080fd5b506105e1611385565b6040516105ee9190613805565b60405180910390f35b34801561060357600080fd5b5061060c6113ae565b6040516106199190613887565b60405180910390f35b61063c600480360381019061063791906132d7565b611440565b005b34801561064a57600080fd5b506106656004803603810190610660919061328e565b6117b6565b005b34801561067357600080fd5b5061068e6004803603810190610689919061313a565b61184c565b005b34801561069c57600080fd5b506106b760048036038101906106b29190613207565b6119cd565b005b3480156106c557600080fd5b506106ce611a97565b6040516106db919061386c565b60405180910390f35b3480156106f057600080fd5b5061070b600480360381019061070691906130b7565b611aaa565b005b34801561071957600080fd5b50610734600480360381019061072f91906132d7565b611b0c565b6040516107419190613887565b60405180910390f35b34801561075657600080fd5b5061075f611b88565b60405161076c9190613887565b60405180910390f35b34801561078157600080fd5b5061078a611c16565b6040516107979190613be9565b60405180910390f35b3480156107ac57600080fd5b506107c760048036038101906107c29190613024565b611c1c565b6040516107d4919061386c565b60405180910390f35b3480156107e957600080fd5b5061080460048036038101906107ff9190612fca565b611cb0565b005b61080e611da8565b73ffffffffffffffffffffffffffffffffffffffff1661082c611385565b73ffffffffffffffffffffffffffffffffffffffff1614610882576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087990613ac9565b60405180910390fd5b60005b82829050811015610969576000600161089c610c1d565b6108a69190613ce3565b9050600b548111156108ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e490613bc9565b60405180910390fd5b61091e84848481811061090357610902614059565b5b90506020020160208101906109189190612fca565b82611db0565b7ff00d28232b285f24f2e38415deb2ceb31069e70d4505838b3911b4f02058502e8160405161094d9190613be9565b60405180910390a150808061096190613f23565b915050610885565b505050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806109e157506109e082611f7e565b5b9050919050565b6060600180546109f790613ec0565b80601f0160208091040260200160405190810160405280929190818152602001828054610a2390613ec0565b8015610a705780601f10610a4557610100808354040283529160200191610a70565b820191906000526020600020905b815481529060010190602001808311610a5357829003601f168201915b5050505050905090565b6000610a8582612060565b610ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abb90613a89565b60405180910390fd5b6005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610b0a8261118d565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7290613b29565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b9a611da8565b73ffffffffffffffffffffffffffffffffffffffff161480610bc95750610bc881610bc3611da8565b611c1c565b5b610c08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bff906139e9565b60405180910390fd5b610c1283836120cc565b505050565b600d5481565b6000600980549050905090565b6000801515601060009054906101000a900460ff1615151415610c755760011515601060019054906101000a900460ff1615151415610c6c5760049050610c7a565b60009050610c7a565b600290505b90565b610c8e610c88611da8565b82612185565b610ccd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc490613b69565b60405180910390fd5b610cd8838383612263565b505050565b610ce5611da8565b73ffffffffffffffffffffffffffffffffffffffff16610d03611385565b73ffffffffffffffffffffffffffffffffffffffff1614610d59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5090613ac9565b60405180910390fd5b60005b82829050811015610de657600260116000858585818110610d8057610d7f614059565b5b9050602002016020810190610d959190612fca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080610dde90613f23565b915050610d5c565b505050565b6000610df68361123f565b8210610e37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2e906138a9565b60405180910390fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610e98611da8565b73ffffffffffffffffffffffffffffffffffffffff16610eb6611385565b73ffffffffffffffffffffffffffffffffffffffff1614610f0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0390613ac9565b60405180910390fd5b60004711610f4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f46906139a9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610f95573d6000803e3d6000fd5b5050565b610fb483838360405180602001604052806000815250611aaa565b505050565b610fc1611da8565b73ffffffffffffffffffffffffffffffffffffffff16610fdf611385565b73ffffffffffffffffffffffffffffffffffffffff1614611035576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102c90613ac9565b60405180910390fd5b80600d8190555050565b601060009054906101000a900460ff1681565b600061105c610c1d565b821061109d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109490613b89565b60405180910390fd5b600982815481106110b1576110b0614059565b5b90600052602060002001549050919050565b6110cb611da8565b73ffffffffffffffffffffffffffffffffffffffff166110e9611385565b73ffffffffffffffffffffffffffffffffffffffff161461113f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113690613ac9565b60405180910390fd5b601060019054906101000a900460ff1615611170576000601060016101000a81548160ff0219169083151502179055505b80601060006101000a81548160ff02191690831515021790555050565b6000806003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611236576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122d90613a49565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a790613a29565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6112ff611da8565b73ffffffffffffffffffffffffffffffffffffffff1661131d611385565b73ffffffffffffffffffffffffffffffffffffffff1614611373576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136a90613ac9565b60405180910390fd5b61137d60006124bf565b565b600c5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600280546113bd90613ec0565b80601f01602080910402602001604051908101604052809291908181526020018280546113e990613ec0565b80156114365780601f1061140b57610100808354040283529160200191611436565b820191906000526020600020905b81548152906001019060200180831161141957829003601f168201915b5050505050905090565b600d548161144e9190613d6a565b341461148f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148690613ba9565b60405180910390fd5b600b548161149b610c1d565b6114a59190613ce3565b11156114e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dd90613bc9565b60405180910390fd5b60011515601060019054906101000a900460ff161515141561155757600081118015611513575060048111155b611552576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154990613a09565b60405180910390fd5b61173a565b601060009054906101000a900460ff166115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d90613b49565b60405180910390fd5b6000811180156115b7575060028111155b6115f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ed90613929565b60405180910390fd5b80601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611678576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166f90613989565b60405180910390fd5b600c5481600e546116899190613ce3565b11156116ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c190613aa9565b60405180910390fd5b80601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117199190613dc4565b9250508190555080600e60008282546117329190613ce3565b925050819055505b60005b818110156117b25760006001611751610c1d565b61175b9190613ce3565b90506117673382611db0565b7ff00d28232b285f24f2e38415deb2ceb31069e70d4505838b3911b4f02058502e816040516117969190613be9565b60405180910390a15080806117aa90613f23565b91505061173d565b5050565b6117be611da8565b73ffffffffffffffffffffffffffffffffffffffff166117dc611385565b73ffffffffffffffffffffffffffffffffffffffff1614611832576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182990613ac9565b60405180910390fd5b80600f9080519060200190611848929190612d73565b5050565b611854611da8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118b990613969565b60405180910390fd5b80600660006118cf611da8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661197c611da8565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516119c1919061386c565b60405180910390a35050565b6119d5611da8565b73ffffffffffffffffffffffffffffffffffffffff166119f3611385565b73ffffffffffffffffffffffffffffffffffffffff1614611a49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4090613ac9565b60405180910390fd5b601060009054906101000a900460ff1615611a7a576000601060006101000a81548160ff0219169083151502179055505b80601060016101000a81548160ff02191690831515021790555050565b601060019054906101000a900460ff1681565b611abb611ab5611da8565b83612185565b611afa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af190613b69565b60405180910390fd5b611b0684848484612583565b50505050565b6060611b1782612060565b611b56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4d90613b09565b60405180910390fd5b600f611b61836125df565b604051602001611b729291906137e1565b6040516020818303038152906040529050919050565b600f8054611b9590613ec0565b80601f0160208091040260200160405190810160405280929190818152602001828054611bc190613ec0565b8015611c0e5780601f10611be357610100808354040283529160200191611c0e565b820191906000526020600020905b815481529060010190602001808311611bf157829003601f168201915b505050505081565b600b5481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611cb8611da8565b73ffffffffffffffffffffffffffffffffffffffff16611cd6611385565b73ffffffffffffffffffffffffffffffffffffffff1614611d2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d2390613ac9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d93906138e9565b60405180910390fd5b611da5816124bf565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1790613a69565b60405180910390fd5b611e2981612060565b15611e69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6090613909565b60405180910390fd5b611e7560008383612740565b6001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611ec59190613ce3565b92505081905550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061204957507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612059575061205882612854565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661213f8361118d565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061219082612060565b6121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c6906139c9565b60405180910390fd5b60006121da8361118d565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061224957508373ffffffffffffffffffffffffffffffffffffffff1661223184610a7a565b73ffffffffffffffffffffffffffffffffffffffff16145b8061225a57506122598185611c1c565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166122838261118d565b73ffffffffffffffffffffffffffffffffffffffff16146122d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122d090613ae9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234090613949565b60405180910390fd5b612354838383612740565b61235f6000826120cc565b6001600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546123af9190613dc4565b925050819055506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546124069190613ce3565b92505081905550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b61258e848484612263565b61259a848484846128be565b6125d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d0906138c9565b60405180910390fd5b50505050565b60606000821415612627576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061273b565b600082905060005b6000821461265957808061264290613f23565b915050600a826126529190613d39565b915061262f565b60008167ffffffffffffffff81111561267557612674614088565b5b6040519080825280601f01601f1916602001820160405280156126a75781602001600182028036833780820191505090505b5090505b60008514612734576001826126c09190613dc4565b9150600a856126cf9190613f6c565b60306126db9190613ce3565b60f81b8183815181106126f1576126f0614059565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561272d9190613d39565b94506126ab565b8093505050505b919050565b61274b838383612a55565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561278e5761278981612a5a565b6127cd565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146127cc576127cb8382612aa3565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156128105761280b81612c10565b61284f565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461284e5761284d8282612ce1565b5b5b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60006128df8473ffffffffffffffffffffffffffffffffffffffff16612d60565b15612a48578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612908611da8565b8786866040518563ffffffff1660e01b815260040161292a9493929190613820565b602060405180830381600087803b15801561294457600080fd5b505af192505050801561297557506040513d601f19601f820116820180604052508101906129729190613261565b60015b6129f8573d80600081146129a5576040519150601f19603f3d011682016040523d82523d6000602084013e6129aa565b606091505b506000815114156129f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e7906138c9565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612a4d565b600190505b949350505050565b505050565b600980549050600a600083815260200190815260200160002081905550600981908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612ab08461123f565b612aba9190613dc4565b9050600060086000848152602001908152602001600020549050818114612b9f576000600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816008600083815260200190815260200160002081905550505b6008600084815260200190815260200160002060009055600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600980549050612c249190613dc4565b90506000600a6000848152602001908152602001600020549050600060098381548110612c5457612c53614059565b5b906000526020600020015490508060098381548110612c7657612c75614059565b5b906000526020600020018190555081600a600083815260200190815260200160002081905550600a6000858152602001908152602001600020600090556009805480612cc557612cc461402a565b5b6001900381819060005260206000200160009055905550505050565b6000612cec8361123f565b905081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806008600084815260200190815260200160002081905550505050565b600080823b905060008111915050919050565b828054612d7f90613ec0565b90600052602060002090601f016020900481019282612da15760008555612de8565b82601f10612dba57805160ff1916838001178555612de8565b82800160010185558215612de8579182015b82811115612de7578251825591602001919060010190612dcc565b5b509050612df59190612df9565b5090565b5b80821115612e12576000816000905550600101612dfa565b5090565b6000612e29612e2484613c29565b613c04565b905082815260208101848484011115612e4557612e446140c6565b5b612e50848285613e7e565b509392505050565b6000612e6b612e6684613c5a565b613c04565b905082815260208101848484011115612e8757612e866140c6565b5b612e92848285613e7e565b509392505050565b600081359050612ea9816147e2565b92915050565b600081359050612ebe816147f9565b92915050565b60008083601f840112612eda57612ed96140bc565b5b8235905067ffffffffffffffff811115612ef757612ef66140b7565b5b602083019150836020820283011115612f1357612f126140c1565b5b9250929050565b600081359050612f2981614810565b92915050565b600081359050612f3e81614827565b92915050565b600081519050612f5381614827565b92915050565b600082601f830112612f6e57612f6d6140bc565b5b8135612f7e848260208601612e16565b91505092915050565b600082601f830112612f9c57612f9b6140bc565b5b8135612fac848260208601612e58565b91505092915050565b600081359050612fc48161483e565b92915050565b600060208284031215612fe057612fdf6140d0565b5b6000612fee84828501612e9a565b91505092915050565b60006020828403121561300d5761300c6140d0565b5b600061301b84828501612eaf565b91505092915050565b6000806040838503121561303b5761303a6140d0565b5b600061304985828601612e9a565b925050602061305a85828601612e9a565b9150509250929050565b60008060006060848603121561307d5761307c6140d0565b5b600061308b86828701612e9a565b935050602061309c86828701612e9a565b92505060406130ad86828701612fb5565b9150509250925092565b600080600080608085870312156130d1576130d06140d0565b5b60006130df87828801612e9a565b94505060206130f087828801612e9a565b935050604061310187828801612fb5565b925050606085013567ffffffffffffffff811115613122576131216140cb565b5b61312e87828801612f59565b91505092959194509250565b60008060408385031215613151576131506140d0565b5b600061315f85828601612e9a565b925050602061317085828601612f1a565b9150509250929050565b60008060408385031215613191576131906140d0565b5b600061319f85828601612e9a565b92505060206131b085828601612fb5565b9150509250929050565b600080602083850312156131d1576131d06140d0565b5b600083013567ffffffffffffffff8111156131ef576131ee6140cb565b5b6131fb85828601612ec4565b92509250509250929050565b60006020828403121561321d5761321c6140d0565b5b600061322b84828501612f1a565b91505092915050565b60006020828403121561324a576132496140d0565b5b600061325884828501612f2f565b91505092915050565b600060208284031215613277576132766140d0565b5b600061328584828501612f44565b91505092915050565b6000602082840312156132a4576132a36140d0565b5b600082013567ffffffffffffffff8111156132c2576132c16140cb565b5b6132ce84828501612f87565b91505092915050565b6000602082840312156132ed576132ec6140d0565b5b60006132fb84828501612fb5565b91505092915050565b61330d81613df8565b82525050565b61331c81613e1c565b82525050565b600061332d82613ca0565b6133378185613cb6565b9350613347818560208601613e8d565b613350816140d5565b840191505092915050565b600061336682613cab565b6133708185613cc7565b9350613380818560208601613e8d565b613389816140d5565b840191505092915050565b600061339f82613cab565b6133a98185613cd8565b93506133b9818560208601613e8d565b80840191505092915050565b600081546133d281613ec0565b6133dc8186613cd8565b945060018216600081146133f757600181146134085761343b565b60ff1983168652818601935061343b565b61341185613c8b565b60005b8381101561343357815481890152600182019150602081019050613414565b838801955050505b50505092915050565b6000613451602b83613cc7565b915061345c826140e6565b604082019050919050565b6000613474603283613cc7565b915061347f82614135565b604082019050919050565b6000613497602683613cc7565b91506134a282614184565b604082019050919050565b60006134ba601c83613cc7565b91506134c5826141d3565b602082019050919050565b60006134dd602583613cc7565b91506134e8826141fc565b604082019050919050565b6000613500602483613cc7565b915061350b8261424b565b604082019050919050565b6000613523601983613cc7565b915061352e8261429a565b602082019050919050565b6000613546604e83613cc7565b9150613551826142c3565b606082019050919050565b6000613569601483613cc7565b915061357482614338565b602082019050919050565b600061358c602c83613cc7565b915061359782614361565b604082019050919050565b60006135af603883613cc7565b91506135ba826143b0565b604082019050919050565b60006135d2602a83613cc7565b91506135dd826143ff565b604082019050919050565b60006135f5602a83613cc7565b91506136008261444e565b604082019050919050565b6000613618602983613cc7565b91506136238261449d565b604082019050919050565b600061363b602083613cc7565b9150613646826144ec565b602082019050919050565b600061365e602c83613cc7565b915061366982614515565b604082019050919050565b6000613681603e83613cc7565b915061368c82614564565b604082019050919050565b60006136a4602083613cc7565b91506136af826145b3565b602082019050919050565b60006136c7602983613cc7565b91506136d2826145dc565b604082019050919050565b60006136ea602f83613cc7565b91506136f58261462b565b604082019050919050565b600061370d602183613cc7565b91506137188261467a565b604082019050919050565b6000613730601983613cc7565b915061373b826146c9565b602082019050919050565b6000613753603183613cc7565b915061375e826146f2565b604082019050919050565b6000613776602c83613cc7565b915061378182614741565b604082019050919050565b6000613799601883613cc7565b91506137a482614790565b602082019050919050565b60006137bc601b83613cc7565b91506137c7826147b9565b602082019050919050565b6137db81613e74565b82525050565b60006137ed82856133c5565b91506137f98284613394565b91508190509392505050565b600060208201905061381a6000830184613304565b92915050565b60006080820190506138356000830187613304565b6138426020830186613304565b61384f60408301856137d2565b81810360608301526138618184613322565b905095945050505050565b60006020820190506138816000830184613313565b92915050565b600060208201905081810360008301526138a1818461335b565b905092915050565b600060208201905081810360008301526138c281613444565b9050919050565b600060208201905081810360008301526138e281613467565b9050919050565b600060208201905081810360008301526139028161348a565b9050919050565b60006020820190508181036000830152613922816134ad565b9050919050565b60006020820190508181036000830152613942816134d0565b9050919050565b60006020820190508181036000830152613962816134f3565b9050919050565b6000602082019050818103600083015261398281613516565b9050919050565b600060208201905081810360008301526139a281613539565b9050919050565b600060208201905081810360008301526139c28161355c565b9050919050565b600060208201905081810360008301526139e28161357f565b9050919050565b60006020820190508181036000830152613a02816135a2565b9050919050565b60006020820190508181036000830152613a22816135c5565b9050919050565b60006020820190508181036000830152613a42816135e8565b9050919050565b60006020820190508181036000830152613a628161360b565b9050919050565b60006020820190508181036000830152613a828161362e565b9050919050565b60006020820190508181036000830152613aa281613651565b9050919050565b60006020820190508181036000830152613ac281613674565b9050919050565b60006020820190508181036000830152613ae281613697565b9050919050565b60006020820190508181036000830152613b02816136ba565b9050919050565b60006020820190508181036000830152613b22816136dd565b9050919050565b60006020820190508181036000830152613b4281613700565b9050919050565b60006020820190508181036000830152613b6281613723565b9050919050565b60006020820190508181036000830152613b8281613746565b9050919050565b60006020820190508181036000830152613ba281613769565b9050919050565b60006020820190508181036000830152613bc28161378c565b9050919050565b60006020820190508181036000830152613be2816137af565b9050919050565b6000602082019050613bfe60008301846137d2565b92915050565b6000613c0e613c1f565b9050613c1a8282613ef2565b919050565b6000604051905090565b600067ffffffffffffffff821115613c4457613c43614088565b5b613c4d826140d5565b9050602081019050919050565b600067ffffffffffffffff821115613c7557613c74614088565b5b613c7e826140d5565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613cee82613e74565b9150613cf983613e74565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613d2e57613d2d613f9d565b5b828201905092915050565b6000613d4482613e74565b9150613d4f83613e74565b925082613d5f57613d5e613fcc565b5b828204905092915050565b6000613d7582613e74565b9150613d8083613e74565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613db957613db8613f9d565b5b828202905092915050565b6000613dcf82613e74565b9150613dda83613e74565b925082821015613ded57613dec613f9d565b5b828203905092915050565b6000613e0382613e54565b9050919050565b6000613e1582613e54565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613eab578082015181840152602081019050613e90565b83811115613eba576000848401525b50505050565b60006002820490506001821680613ed857607f821691505b60208210811415613eec57613eeb613ffb565b5b50919050565b613efb826140d5565b810181811067ffffffffffffffff82111715613f1a57613f19614088565b5b80604052505050565b6000613f2e82613e74565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613f6157613f60613f9d565b5b600182019050919050565b6000613f7782613e74565b9150613f8283613e74565b925082613f9257613f91613fcc565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4d6178696d756d206f662032206d696e747320616c6c6f77656420706572207760008201527f616c6c6574000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f41646472657373206973206e6f74206f6e2077686974656c697374206f72206d60008201527f6178696d756d206f662032206d696e747320706572206164647265737320686160208201527f73206265656e2072656163686564000000000000000000000000000000000000604082015250565b7f4e6f2066756e647320746f207769746864726177000000000000000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4d6178696d756d206f662034206d696e747320616c6c6f77656420706572207460008201527f72616e73616374696f6e00000000000000000000000000000000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4d696e74696e672074686174206d616e7920776f756c6420657863656564207460008201527f6865207072652073616c65206d696e74696e6720616c6c6f636174696f6e0000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f49742773206e6f742074696d6520746f206d696e742079657400000000000000600082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f496e636f72726563742066756e647320737570706c6965640000000000000000600082015250565b7f416c6c20746f6b656e732068617665206265656e206d696e7465640000000000600082015250565b6147eb81613df8565b81146147f657600080fd5b50565b61480281613e0a565b811461480d57600080fd5b50565b61481981613e1c565b811461482457600080fd5b50565b61483081613e28565b811461483b57600080fd5b50565b61484781613e74565b811461485257600080fd5b5056fea2646970667358221220ee8ceba3cbfaf53f92f6f4f4a31454604910ca38eae5534f15e422f14b5bbca764736f6c63430008070033

Verified Source Code Full Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: No
contract.sol 201 lines
// Made with love (and lots of sweets)

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
 * @dev Modifier 'onlyOwner' becomes available, where owner is the contract deployer
 */
import "@openzeppelin/contracts/access/Ownable.sol";
/**
 * @dev ERC721 token standard
 */
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";

contract Sherbet is Ownable, ERC721Enumerable { 
    uint256 public maxSupply = 7777;
    uint256 public maxPreSaleMintTotal = 6000;
    uint256 public cost = 0.077 ether; 
    
    uint256 private preSaleMints;
    string public baseTokenURI;
    
    bool public preSaleStatus = false;
    bool public publicSaleStatus = false;
    
    constructor(
        string memory _name,
        string memory _symbol,  
        string memory _uri
        
    ) ERC721(_name, _symbol) {
        baseTokenURI = _uri;
    }
    
    // --- EVENTS ---
    event TokenMinted(uint256 tokenId);
    
    // --- MAPPINGS ---
    mapping(address => uint) whitelist;
        
    // --- PUBLIC ---
    /**
     * @dev Mint tokens through pre or public sale
     * @param _number - number of tokens to mint
     */
    function mint(
        uint256 _number
    ) external payable {
        
        require(
            msg.value == _number * cost, // mint cost
            "Incorrect funds supplied"
        );
        require(
            totalSupply() + _number <= maxSupply, "All tokens have been minted"
        );
        
        if (publicSaleStatus == true) {
            require(
                _number > 0 && _number <= 4, // mint limit per tx
                "Maximum of 4 mints allowed per transaction"
            );
        } else {
            require(
                preSaleStatus, // checks pre sale is live
                "It's not time to mint yet"
            ); 
            require(
                _number > 0 && _number <=2, 
                "Maximum of 2 mints allowed per wallet"
            );
            require(
                whitelist[msg.sender] >= _number, // checks if white listed & mint limit per address is obeyed
                "Address is not on whitelist or maximum of 2 mints per address has been reached"
            ); 
            require(
                preSaleMints + _number <= maxPreSaleMintTotal, // ensures pre sale total mint limit is obeyed
                "Minting that many would exceed the pre sale minting allocation"
            ); 
            whitelist[msg.sender] -= _number; // reduces caller's minting allownace by the number of tokens they minted
            preSaleMints += _number; 
        }
        
        for (uint256 i = 0; i < _number; i++) {
            uint tokenId = totalSupply() + 1;
            _mint(msg.sender, tokenId);
            emit TokenMinted(tokenId);
        }
    }
    
    // --- VIEW ---
    /**
     * @dev Returns tokenURI, which is comprised of the baseURI concatenated with the tokenId
     */
    function tokenURI(uint256 _tokenId) public view override returns(string memory) {
        require(
            _exists(_tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );
        return string(abi.encodePacked(baseTokenURI, Strings.toString(_tokenId)));
    }
    /**
     * @dev Returns uint of how many tokens can be minted currently. Depends on status of pre and public sale
     */
    function maxMintable() public view returns(uint) {
        if (preSaleStatus == false) {
            if (publicSaleStatus == true) {
                return 4; // public sale
            }
            return 0; // both false
        }
        return 2; // pre sale
    }
    
    // --- ONLY OWNER ---
    /**
     * @dev Withdraw all ether from smart contract. Only contract owner can call.
     * @param _to - address ether will be sent to
     */
    function withdrawAllFunds(
        address payable _to
    ) external onlyOwner {
        require(
            address(this).balance > 0, 
            "No funds to withdraw"
        );
        _to.transfer(address(this).balance);
    }
    
    /**
     * @dev Add addresses to white list, giving access to mint 2 tokens at pre sale
     * @param _addresses - array of address' to add to white list mapping
     */
    function whitelistAddresses(
        address[] calldata _addresses
    ) external onlyOwner {
        for (uint i=0; i<_addresses.length; i++) {
            whitelist[_addresses[i]] = 2;
        }
    }
    
    /**
     * @dev Airdrop 1 token to each address in array '_to'
     * @param _to - array of address' that tokens will be sent to
     */
    function airDrop(
        address[] calldata _to
    ) external onlyOwner {
        for (uint i=0; i<_to.length; i++) {
            uint tokenId = totalSupply() + 1;
            require(tokenId <= maxSupply, "All tokens have been minted");
            _mint(_to[i], tokenId);
            emit TokenMinted(tokenId);
        }
        
    }
    /**
     * @dev Set the baseURI string
     */
    function setBaseUri(
        string memory _newBaseUri
    ) external onlyOwner {
        baseTokenURI = _newBaseUri;
    }
    
    /**
     * @dev Set the cost of minting a token
     * @param _newCost in Wei. Where 1 Wei = 10^-18 ether
     */
    function setCost(
        uint _newCost
    ) external onlyOwner {
        cost = _newCost;
    }
    
    /**
     * @dev Set the status of the pre sale, sets publicSaleStatus to false
     * @param _status boolean where true = live 
     */
    function setPreSaleStatus(
        bool _status
    ) external onlyOwner {
        if (publicSaleStatus) {
            publicSaleStatus = false;
        }
        preSaleStatus = _status;
    }
    
    /**
     * @dev Set the status of the public sale, sets preSaleStatus to false
     * @param _status boolean where true = live 
     */
    function setPublicSaleStatus(
        bool _status
    ) external onlyOwner {
        if (preSaleStatus) {
            preSaleStatus = false;
        }
        publicSaleStatus = _status;
    }
    
}
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);
    }
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

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

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

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

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 162 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}
IERC721Enumerable.sol 28 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

Read Contract

balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
cost 0x13faede6 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMintable 0x2154dc39 → uint256
maxPreSaleMintTotal 0x81a7deae → uint256
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
preSaleStatus 0x464bd640 → bool
publicSaleStatus 0xb6c693e5 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256

Write Contract 15 functions

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

airDrop 0x00b6849f
address[] _to
approve 0x095ea7b3
address to
uint256 tokenId
mint 0xa0712d68
uint256 _number
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 0xa0bcfc7f
string _newBaseUri
setCost 0x44a0d68a
uint256 _newCost
setPreSaleStatus 0x5e326b92
bool _status
setPublicSaleStatus 0xb423fe67
bool _status
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistAddresses 0x2bf04304
address[] _addresses
withdrawAllFunds 0x32dee40b
address _to

Recent Transactions

No transactions found for this address