Address Contract Verified
Address
0xc5351f93B67895F6dd0dF0e0C2bE0fc6Fec89c4c
Balance
0 ETH
Nonce
1
Code Size
17025 bytes
Creator
0x0aEFAe7e...D5b7 at tx 0x546695b3...4bd79b
Indexed Transactions
0
Contract Bytecode
17025 bytes
0x6080604052600436106102045760003560e01c80636c0360eb11610118578063a22cb465116100a0578063c87b56dd1161006f578063c87b56dd14610716578063d8258d9514610753578063dc95c4a71461077e578063e985e9c5146107a7578063f2fde38b146107e457610204565b8063a22cb4651461067d578063b232fe32146106a6578063b3e82dc9146106c2578063b88d4fde146106ed57610204565b80637d57b125116100e75780637d57b125146105965780638c74bf0e146105d35780638d859f3e146105fc5780638da5cb5b1461062757806395d89b411461065257610204565b80636c0360eb146104ec5780636cc979091461051757806370a0823114610542578063715018a61461057f57610204565b80632db115441161019b57806342842e0e1161016a57806342842e0e1461041b57806355f804b31461044457806358f6551e1461046d5780635fd8c710146104985780636352211e146104af57610204565b80632db115441461039457806331beb605146103b057806332882535146103d95780634047638d1461040457610204565b806318160ddd116101d757806318160ddd146102d757806323b872dd146103025780632a55205a1461032b5780632d6b62241461036957610204565b806301ffc9a71461020957806306fdde0314610246578063081812fc14610271578063095ea7b3146102ae575b600080fd5b34801561021557600080fd5b50610230600480360381019061022b9190612cf5565b61080d565b60405161023d9190612d3d565b60405180910390f35b34801561025257600080fd5b5061025b610887565b6040516102689190612df1565b60405180910390f35b34801561027d57600080fd5b5061029860048036038101906102939190612e49565b610919565b6040516102a59190612eb7565b60405180910390f35b3480156102ba57600080fd5b506102d560048036038101906102d09190612efe565b610995565b005b3480156102e357600080fd5b506102ec610b3b565b6040516102f99190612f4d565b60405180910390f35b34801561030e57600080fd5b5061032960048036038101906103249190612f68565b610b52565b005b34801561033757600080fd5b50610352600480360381019061034d9190612fbb565b610b62565b604051610360929190612ffb565b60405180910390f35b34801561037557600080fd5b5061037e610bed565b60405161038b9190612d3d565b60405180910390f35b6103ae60048036038101906103a99190612e49565b610c00565b005b3480156103bc57600080fd5b506103d760048036038101906103d29190613024565b610d55565b005b3480156103e557600080fd5b506103ee610e15565b6040516103fb9190612eb7565b60405180910390f35b34801561041057600080fd5b50610419610e3b565b005b34801561042757600080fd5b50610442600480360381019061043d9190612f68565b610ee3565b005b34801561045057600080fd5b5061046b600480360381019061046691906130b6565b610f03565b005b34801561047957600080fd5b50610482610f95565b60405161048f9190613126565b60405180910390f35b3480156104a457600080fd5b506104ad610f9a565b005b3480156104bb57600080fd5b506104d660048036038101906104d19190612e49565b6110a0565b6040516104e39190612eb7565b60405180910390f35b3480156104f857600080fd5b506105016110b2565b60405161050e9190612df1565b60405180910390f35b34801561052357600080fd5b5061052c611140565b6040516105399190612f4d565b60405180910390f35b34801561054e57600080fd5b5061056960048036038101906105649190613024565b611146565b6040516105769190612f4d565b60405180910390f35b34801561058b57600080fd5b506105946111fe565b005b3480156105a257600080fd5b506105bd60048036038101906105b89190613024565b611286565b6040516105ca9190612d3d565b60405180910390f35b3480156105df57600080fd5b506105fa60048036038101906105f59190612e49565b6112a6565b005b34801561060857600080fd5b506106116113eb565b60405161061e9190612f4d565b60405180910390f35b34801561063357600080fd5b5061063c6113f6565b6040516106499190612eb7565b60405180910390f35b34801561065e57600080fd5b50610667611420565b6040516106749190612df1565b60405180910390f35b34801561068957600080fd5b506106a4600480360381019061069f919061316d565b6114b2565b005b6106c060048036038101906106bb919061322f565b611629565b005b3480156106ce57600080fd5b506106d76118d6565b6040516106e49190612eb7565b60405180910390f35b3480156106f957600080fd5b50610714600480360381019061070f91906133f9565b6118fc565b005b34801561072257600080fd5b5061073d60048036038101906107389190612e49565b61196f565b60405161074a9190612df1565b60405180910390f35b34801561075f57600080fd5b50610768611a0d565b6040516107759190612f4d565b60405180910390f35b34801561078a57600080fd5b506107a560048036038101906107a09190613024565b611a13565b005b3480156107b357600080fd5b506107ce60048036038101906107c9919061347c565b611ad3565b6040516107db9190612d3d565b60405180910390f35b3480156107f057600080fd5b5061080b60048036038101906108069190613024565b611b67565b005b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610880575061087f82611c5e565b5b9050919050565b606060028054610896906134eb565b80601f01602080910402602001604051908101604052809291908181526020018280546108c2906134eb565b801561090f5780601f106108e45761010080835404028352916020019161090f565b820191906000526020600020905b8154815290600101906020018083116108f257829003601f168201915b5050505050905090565b600061092482611cf0565b61095a576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006109a082611d4f565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a07576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610a26611e1b565b73ffffffffffffffffffffffffffffffffffffffff1614610a8957610a5281610a4d611e1b565b611ad3565b610a88576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b826006600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000610b45611e23565b6001546000540303905090565b610b5d838383611e2c565b505050565b600080610b6e84611cf0565b610ba4576040517f6a3b775400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6009546103e884610bb5919061357a565b610bbf91906135ab565b9050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691509250929050565b600d60009054906101000a900460ff1681565b600d60009054906101000a900460ff16610c4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4690613651565b60405180910390fd5b66d529ae9e86000081610c6291906135ab565b3414610ca3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9a906136bd565b60405180910390fd5b600267ffffffffffffffff16811115610cf1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce890613729565b60405180910390fd5b610bb8610cfc610b3b565b82610d079190613749565b1115610d48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3f906137eb565b60405180910390fd5b610d5233826121d3565b50565b610d5d6121f1565b73ffffffffffffffffffffffffffffffffffffffff16610d7b6113f6565b73ffffffffffffffffffffffffffffffffffffffff1614610dd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc890613857565b60405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610e436121f1565b73ffffffffffffffffffffffffffffffffffffffff16610e616113f6565b73ffffffffffffffffffffffffffffffffffffffff1614610eb7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eae90613857565b60405180910390fd5b600d60009054906101000a900460ff1615600d60006101000a81548160ff021916908315150217905550565b610efe838383604051806020016040528060008152506118fc565b505050565b610f0b6121f1565b73ffffffffffffffffffffffffffffffffffffffff16610f296113f6565b73ffffffffffffffffffffffffffffffffffffffff1614610f7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7690613857565b60405180910390fd5b8181600c9182610f90929190613a2e565b505050565b600281565b610fa26121f1565b73ffffffffffffffffffffffffffffffffffffffff16610fc06113f6565b73ffffffffffffffffffffffffffffffffffffffff1614611016576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100d90613857565b60405180910390fd5b60004703611050576040517f2ee6022200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6110586113f6565b73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561109d573d6000803e3d6000fd5b50565b60006110ab82611d4f565b9050919050565b600c80546110bf906134eb565b80601f01602080910402602001604051908101604052809291908181526020018280546110eb906134eb565b80156111385780601f1061110d57610100808354040283529160200191611138565b820191906000526020600020905b81548152906001019060200180831161111b57829003601f168201915b505050505081565b600f5481565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036111ad576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054169050919050565b6112066121f1565b73ffffffffffffffffffffffffffffffffffffffff166112246113f6565b73ffffffffffffffffffffffffffffffffffffffff161461127a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127190613857565b60405180910390fd5b61128460006121f9565b565b600e6020528060005260406000206000915054906101000a900460ff1681565b6112ae6121f1565b73ffffffffffffffffffffffffffffffffffffffff166112cc6113f6565b73ffffffffffffffffffffffffffffffffffffffff1614611322576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131990613857565b60405180910390fd5b610bb861132d610b3b565b826113389190613749565b1115611379576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611370906137eb565b60405180910390fd5b80600f5410156113be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b5906137eb565b60405180910390fd5b80600f60008282546113d09190613afe565b925050819055506113e86113e26113f6565b826121d3565b50565b66d529ae9e86000081565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606003805461142f906134eb565b80601f016020809104026020016040519081016040528092919081815260200182805461145b906134eb565b80156114a85780601f1061147d576101008083540402835291602001916114a8565b820191906000526020600020905b81548152906001019060200180831161148b57829003601f168201915b5050505050905090565b6114ba611e1b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361151e576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806007600061152b611e1b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff166115d8611e1b565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161161d9190612d3d565b60405180910390a35050565b61168533878767ffffffffffffffff16878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506122bf565b6116c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bb90613b7e565b60405180910390fd5b838567ffffffffffffffff166116da91906135ab565b341461171b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611712906136bd565b60405180910390fd5b610bb8611726610b3b565b878767ffffffffffffffff1661173c9190613749565b6117469190613749565b1115611787576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177e906137eb565b60405180910390fd5b428311156117ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c190613bea565b60405180910390fd5b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611857576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184e90613c56565b60405180910390fd5b6001600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506118ce33878767ffffffffffffffff166118c99190613749565b6121d3565b505050505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611907848484611e2c565b60008373ffffffffffffffffffffffffffffffffffffffff163b14611969576119328484848461236b565b611968576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b50505050565b606061197a82611cf0565b6119b0576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006119ba6124bb565b905060008151036119da5760405180602001604052806000815250611a05565b806119e48461254d565b6040516020016119f5929190613cb2565b6040516020818303038152906040525b915050919050565b610bb881565b611a1b6121f1565b73ffffffffffffffffffffffffffffffffffffffff16611a396113f6565b73ffffffffffffffffffffffffffffffffffffffff1614611a8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8690613857565b60405180910390fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611b6f6121f1565b73ffffffffffffffffffffffffffffffffffffffff16611b8d6113f6565b73ffffffffffffffffffffffffffffffffffffffff1614611be3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bda90613857565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611c52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4990613d48565b60405180910390fd5b611c5b816121f9565b50565b60006301ffc9a760e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611cb957506380ac58cd60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611ce95750635b5e139f60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b600081611cfb611e23565b11158015611d0a575060005482105b8015611d48575060007c0100000000000000000000000000000000000000000000000000000000600460008581526020019081526020016000205416145b9050919050565b60008082905080611d5e611e23565b11611de457600054811015611de35760006004600083815260200190815260200160002054905060007c0100000000000000000000000000000000000000000000000000000000821603611de1575b60008103611dd7576004600083600190039350838152602001908152602001600020549050611dad565b8092505050611e16565b505b5b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600033905090565b60006001905090565b6000611e3782611d4f565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611e9e576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008473ffffffffffffffffffffffffffffffffffffffff16611ebf611e1b565b73ffffffffffffffffffffffffffffffffffffffff161480611eee5750611eed85611ee8611e1b565b611ad3565b5b80611f335750611efc611e1b565b73ffffffffffffffffffffffffffffffffffffffff16611f1b84610919565b73ffffffffffffffffffffffffffffffffffffffff16145b905080611f6c576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611fd2576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611fdf85858560016125a7565b6006600084815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081546001900391905081905550600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154600101919050819055507c020000000000000000000000000000000000000000000000000000000060a042901b6120dc866125ad565b1717600460008581526020019081526020016000208190555060007c02000000000000000000000000000000000000000000000000000000008316036121645760006001840190506000600460008381526020019081526020016000205403612162576000548114612161578260046000838152602001908152602001600020819055505b5b505b828473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46121cc85858560016125b7565b5050505050565b6121ed8282604051806020016040528060008152506125bd565b5050565b600033905090565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008087878787876040516020016122db959493929190613dd1565b60405160208183030381529060405280519060200120905061230e8361230083612870565b6128a090919063ffffffff16565b73ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149150509695505050505050565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612391611e1b565b8786866040518563ffffffff1660e01b81526004016123b39493929190613e85565b6020604051808303816000875af19250505080156123ef57506040513d601f19601f820116820180604052508101906123ec9190613ee6565b60015b612468573d806000811461241f576040519150601f19603f3d011682016040523d82523d6000602084013e612424565b606091505b506000815103612460576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b6060600c80546124ca906134eb565b80601f01602080910402602001604051908101604052809291908181526020018280546124f6906134eb565b80156125435780601f1061251857610100808354040283529160200191612543565b820191906000526020600020905b81548152906001019060200180831161252657829003601f168201915b5050505050905090565b60606080604051019050806040528082600183039250600a81066030018353600a810490505b801561259357600183039250600a81066030018353600a81049050612573565b508181036020830392508083525050919050565b50505050565b6000819050919050565b50505050565b600080549050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612629576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008303612663576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61267060008583866125a7565b600160406001901b178302600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060e16126d5600185146128c7565b901b60a042901b6126e5866125ad565b1717600460008381526020019081526020016000208190555060008190506000848201905060008673ffffffffffffffffffffffffffffffffffffffff163b146127e9575b818673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612799600087848060010195508761236b565b6127cf576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80821061272a5782600054146127e457600080fd5b612854565b5b818060010192508673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48082106127ea575b81600081905550505061286a60008583866125b7565b50505050565b6000816040516020016128839190613f8a565b604051602081830303815290604052805190602001209050919050565b60008060006128af85856128d1565b915091506128bc81612952565b819250505092915050565b6000819050919050565b60008060418351036129125760008060006020860151925060408601519150606086015160001a905061290687828585612b1e565b9450945050505061294b565b6040835103612942576000806020850151915060408501519050612937868383612c2a565b93509350505061294b565b60006002915091505b9250929050565b6000600481111561296657612965613fb0565b5b81600481111561297957612978613fb0565b5b0315612b1b576001600481111561299357612992613fb0565b5b8160048111156129a6576129a5613fb0565b5b036129e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129dd9061402b565b60405180910390fd5b600260048111156129fa576129f9613fb0565b5b816004811115612a0d57612a0c613fb0565b5b03612a4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4490614097565b60405180910390fd5b60036004811115612a6157612a60613fb0565b5b816004811115612a7457612a73613fb0565b5b03612ab4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612aab90614129565b60405180910390fd5b600480811115612ac757612ac6613fb0565b5b816004811115612ada57612ad9613fb0565b5b03612b1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b11906141bb565b60405180910390fd5b5b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115612b59576000600391509150612c21565b601b8560ff1614158015612b715750601c8560ff1614155b15612b83576000600491509150612c21565b600060018787878760405160008152602001604052604051612ba89493929190614206565b6020604051602081039080840390855afa158015612bca573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612c1857600060019250925050612c21565b80600092509250505b94509492505050565b60008060007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b841690506000601b60ff8660001c901c612c6d9190613749565b9050612c7b87828885612b1e565b935093505050935093915050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612cd281612c9d565b8114612cdd57600080fd5b50565b600081359050612cef81612cc9565b92915050565b600060208284031215612d0b57612d0a612c93565b5b6000612d1984828501612ce0565b91505092915050565b60008115159050919050565b612d3781612d22565b82525050565b6000602082019050612d526000830184612d2e565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612d92578082015181840152602081019050612d77565b83811115612da1576000848401525b50505050565b6000601f19601f8301169050919050565b6000612dc382612d58565b612dcd8185612d63565b9350612ddd818560208601612d74565b612de681612da7565b840191505092915050565b60006020820190508181036000830152612e0b8184612db8565b905092915050565b6000819050919050565b612e2681612e13565b8114612e3157600080fd5b50565b600081359050612e4381612e1d565b92915050565b600060208284031215612e5f57612e5e612c93565b5b6000612e6d84828501612e34565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ea182612e76565b9050919050565b612eb181612e96565b82525050565b6000602082019050612ecc6000830184612ea8565b92915050565b612edb81612e96565b8114612ee657600080fd5b50565b600081359050612ef881612ed2565b92915050565b60008060408385031215612f1557612f14612c93565b5b6000612f2385828601612ee9565b9250506020612f3485828601612e34565b9150509250929050565b612f4781612e13565b82525050565b6000602082019050612f626000830184612f3e565b92915050565b600080600060608486031215612f8157612f80612c93565b5b6000612f8f86828701612ee9565b9350506020612fa086828701612ee9565b9250506040612fb186828701612e34565b9150509250925092565b60008060408385031215612fd257612fd1612c93565b5b6000612fe085828601612e34565b9250506020612ff185828601612e34565b9150509250929050565b60006040820190506130106000830185612ea8565b61301d6020830184612f3e565b9392505050565b60006020828403121561303a57613039612c93565b5b600061304884828501612ee9565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261307657613075613051565b5b8235905067ffffffffffffffff81111561309357613092613056565b5b6020830191508360018202830111156130af576130ae61305b565b5b9250929050565b600080602083850312156130cd576130cc612c93565b5b600083013567ffffffffffffffff8111156130eb576130ea612c98565b5b6130f785828601613060565b92509250509250929050565b600067ffffffffffffffff82169050919050565b61312081613103565b82525050565b600060208201905061313b6000830184613117565b92915050565b61314a81612d22565b811461315557600080fd5b50565b60008135905061316781613141565b92915050565b6000806040838503121561318457613183612c93565b5b600061319285828601612ee9565b92505060206131a385828601613158565b9150509250929050565b6131b681613103565b81146131c157600080fd5b50565b6000813590506131d3816131ad565b92915050565b60008083601f8401126131ef576131ee613051565b5b8235905067ffffffffffffffff81111561320c5761320b613056565b5b6020830191508360018202830111156132285761322761305b565b5b9250929050565b60008060008060008060a0878903121561324c5761324b612c93565b5b600061325a89828a01612e34565b965050602061326b89828a016131c4565b955050604061327c89828a01612e34565b945050606061328d89828a01612e34565b935050608087013567ffffffffffffffff8111156132ae576132ad612c98565b5b6132ba89828a016131d9565b92509250509295509295509295565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61330682612da7565b810181811067ffffffffffffffff82111715613325576133246132ce565b5b80604052505050565b6000613338612c89565b905061334482826132fd565b919050565b600067ffffffffffffffff821115613364576133636132ce565b5b61336d82612da7565b9050602081019050919050565b82818337600083830152505050565b600061339c61339784613349565b61332e565b9050828152602081018484840111156133b8576133b76132c9565b5b6133c384828561337a565b509392505050565b600082601f8301126133e0576133df613051565b5b81356133f0848260208601613389565b91505092915050565b6000806000806080858703121561341357613412612c93565b5b600061342187828801612ee9565b945050602061343287828801612ee9565b935050604061344387828801612e34565b925050606085013567ffffffffffffffff81111561346457613463612c98565b5b613470878288016133cb565b91505092959194509250565b6000806040838503121561349357613492612c93565b5b60006134a185828601612ee9565b92505060206134b285828601612ee9565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061350357607f821691505b602082108103613516576135156134bc565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061358582612e13565b915061359083612e13565b9250826135a05761359f61351c565b5b828204905092915050565b60006135b682612e13565b91506135c183612e13565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135fa576135f961354b565b5b828202905092915050565b7f7075626c69634d696e744e6f7441637469766528290000000000000000000000600082015250565b600061363b601583612d63565b915061364682613605565b602082019050919050565b6000602082019050818103600083015261366a8161362e565b9050919050565b7f696e73756666696369656e745061696428290000000000000000000000000000600082015250565b60006136a7601283612d63565b91506136b282613671565b602082019050919050565b600060208201905081810360008301526136d68161369a565b9050919050565b7f746f6f4d616e79546f6b656e7350657254782829000000000000000000000000600082015250565b6000613713601483612d63565b915061371e826136dd565b602082019050919050565b6000602082019050818103600083015261374281613706565b9050919050565b600061375482612e13565b915061375f83612e13565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156137945761379361354b565b5b828201905092915050565b7f736f6c644f757428290000000000000000000000000000000000000000000000600082015250565b60006137d5600983612d63565b91506137e08261379f565b602082019050919050565b60006020820190508181036000830152613804816137c8565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613841602083612d63565b915061384c8261380b565b602082019050919050565b6000602082019050818103600083015261387081613834565b9050919050565b600082905092915050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026138e47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826138a7565b6138ee86836138a7565b95508019841693508086168417925050509392505050565b6000819050919050565b600061392b61392661392184612e13565b613906565b612e13565b9050919050565b6000819050919050565b61394583613910565b61395961395182613932565b8484546138b4565b825550505050565b600090565b61396e613961565b61397981848461393c565b505050565b5b8181101561399d57613992600082613966565b60018101905061397f565b5050565b601f8211156139e2576139b381613882565b6139bc84613897565b810160208510156139cb578190505b6139df6139d785613897565b83018261397e565b50505b505050565b600082821c905092915050565b6000613a05600019846008026139e7565b1980831691505092915050565b6000613a1e83836139f4565b9150826002028217905092915050565b613a388383613877565b67ffffffffffffffff811115613a5157613a506132ce565b5b613a5b82546134eb565b613a668282856139a1565b6000601f831160018114613a955760008415613a83578287013590505b613a8d8582613a12565b865550613af5565b601f198416613aa386613882565b60005b82811015613acb57848901358255600182019150602085019450602081019050613aa6565b86831015613ae85784890135613ae4601f8916826139f4565b8355505b6001600288020188555050505b50505050505050565b6000613b0982612e13565b9150613b1483612e13565b925082821015613b2757613b2661354b565b5b828203905092915050565b7f696e636f72726563745369676e61747572650000000000000000000000000000600082015250565b6000613b68601283612d63565b9150613b7382613b32565b602082019050919050565b60006020820190508181036000830152613b9781613b5b565b9050919050565b7f73616c654e6f7453746172746564282900000000000000000000000000000000600082015250565b6000613bd4601083612d63565b9150613bdf82613b9e565b602082019050919050565b60006020820190508181036000830152613c0381613bc7565b9050919050565b7f73616c65416c7265616479436c61696d65642829000000000000000000000000600082015250565b6000613c40601483612d63565b9150613c4b82613c0a565b602082019050919050565b60006020820190508181036000830152613c6f81613c33565b9050919050565b600081905092915050565b6000613c8c82612d58565b613c968185613c76565b9350613ca6818560208601612d74565b80840191505092915050565b6000613cbe8285613c81565b9150613cca8284613c81565b91508190509392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613d32602683612d63565b9150613d3d82613cd6565b604082019050919050565b60006020820190508181036000830152613d6181613d25565b9050919050565b60008160601b9050919050565b6000613d8082613d68565b9050919050565b6000613d9282613d75565b9050919050565b613daa613da582612e96565b613d87565b82525050565b6000819050919050565b613dcb613dc682612e13565b613db0565b82525050565b6000613ddd8288613d99565b601482019150613ded8287613dba565b602082019150613dfd8286613dba565b602082019150613e0d8285613dba565b602082019150613e1d8284613dba565b6020820191508190509695505050505050565b600081519050919050565b600082825260208201905092915050565b6000613e5782613e30565b613e618185613e3b565b9350613e71818560208601612d74565b613e7a81612da7565b840191505092915050565b6000608082019050613e9a6000830187612ea8565b613ea76020830186612ea8565b613eb46040830185612f3e565b8181036060830152613ec68184613e4c565b905095945050505050565b600081519050613ee081612cc9565b92915050565b600060208284031215613efc57613efb612c93565b5b6000613f0a84828501613ed1565b91505092915050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000613f49601c83613c76565b9150613f5482613f13565b601c82019050919050565b6000819050919050565b6000819050919050565b613f84613f7f82613f5f565b613f69565b82525050565b6000613f9582613f3c565b9150613fa18284613f73565b60208201915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000614015601883612d63565b915061402082613fdf565b602082019050919050565b6000602082019050818103600083015261404481614008565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000614081601f83612d63565b915061408c8261404b565b602082019050919050565b600060208201905081810360008301526140b081614074565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000614113602283612d63565b915061411e826140b7565b604082019050919050565b6000602082019050818103600083015261414281614106565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b60006141a5602283612d63565b91506141b082614149565b604082019050919050565b600060208201905081810360008301526141d481614198565b9050919050565b6141e481613f5f565b82525050565b600060ff82169050919050565b614200816141ea565b82525050565b600060808201905061421b60008301876141db565b61422860208301866141f7565b61423560408301856141db565b61424260608301846141db565b9594505050505056fea2646970667358221220d38ff721a8c43f7e04fe80757922f30eaa34ad10a2e80447a572b73dcdebefe664736f6c634300080f0033
Verified Source Code Full Match
Compiler: v0.8.15+commit.e14f2714
EVM: london
Optimization: No
LykeInhabitants.sol 192 lines
//SPDX-License-Identifier: Unlicense
//Author: Goldmember#0001
// Inhabitants ///
// ,//////////////
// //////////////////
// ///////////////////
// ////////////////////
// %% ////////////////////
// #%%%%%%% //////////////////
// %%%%%%%% ,///////////////
// #, %%%%%%%%% ///////////
// #### %%%%%%%%%%
// ##### %%%%%% ,,,
// %%%% /// %% (((( %% ,,
// %%%%%%%% //////// (((((((( %%%%%% ,,
// #%%%%%%%%%%%. //////// .(((((((( .%%%%%%% ,,
// %%%%%%%%%%%%%%% //////// (((((((( %%%%%%%. ,, %%%
// %%%%%%%%%%%%%% ////// ((((( %%%%%%%%%%%%%%%(
// ##### %%%%%%%%%%%%%%% / ( %%%%%%%%%%%%%%% ******
// ######### %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% **********
// ############( %%%%%%%%%%%%%%%%%%%%%%% **************
// ################# %%%%%%%%%%%%%%% *****************
// ##################### %%%%%%# *********************
// ######################### *************************
// ########################## **************************
// (########################## .**************************
// (######################## *************************
// *#################### *********************
// ################ *****************
// ############ *************
// ####### **********
// ## ******
pragma solidity ^0.8.15;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "erc721a/contracts/ERC721A.sol";
// errors
error nothingToWithdraw();
error tokenDoesNotExist();
contract LykeInhabitants is ERC721A, IERC2981, Ownable {
using Address for address;
using ECDSA for bytes32;
// collection details
uint256 public constant PRICE = 0.06 ether;
uint256 public constant COLLECTION_SIZE = 3000;
uint64 public constant MAX_MINTS_PER_PUBLIC_TX = 2;
uint256 private royaltiesPercentage; // represents a percentage like 3 = 3%
address public royaltiesAddress;
// ECDSA
address public signingAddress;
// variables and constants
string public baseURI = "nft://sorryDetective/";
bool public isPublicMintActive = false;
mapping(address => bool) public addressClaimMap;
uint256 public maxReserveMintRemaining;
constructor(
address _signerAddress,
address _royaltiesAddress,
uint256 _royaltiesPercentage,
uint256 _maxReserveMintRemaining
)
ERC721A("Lyke Inhabitants", "LYKEIN")
{
signingAddress = _signerAddress;
royaltiesAddress = _royaltiesAddress;
maxReserveMintRemaining = _maxReserveMintRemaining;
royaltiesPercentage = _royaltiesPercentage;
isPublicMintActive = false;
_startTokenId();
}
function verifySig(address _sender, uint256 _freeQuantity, uint256 _paidQuantity, uint256 _price, uint256 _saleStartTs, bytes memory _signature)
internal view returns(bool)
{
bytes32 messageHash = keccak256(abi.encodePacked(_sender, _freeQuantity, _paidQuantity, _price, _saleStartTs));
return signingAddress == messageHash.toEthSignedMessageHash().recover(_signature);
}
/*
* @dev Mints for public sale
*/
function publicMint(uint256 _quantity)
external payable
{
require(isPublicMintActive, "publicMintNotActive()");
require(msg.value == _quantity * PRICE, "insufficientPaid()");
require(_quantity <= MAX_MINTS_PER_PUBLIC_TX, "tooManyTokensPerTx()");
require(_quantity + totalSupply() <= COLLECTION_SIZE, "soldOut()");
// mint
_safeMint(msg.sender, _quantity);
}
/*
* @dev Mints free amounts and paid amounts if sale has started.
*/
function saleMint(uint256 _freeQuantity, uint64 _paidQuantity, uint256 _price, uint256 _saleStartTs, bytes calldata _signature)
external payable
{
require(verifySig(msg.sender, _freeQuantity, _paidQuantity, _price, _saleStartTs, _signature), "incorrectSignature");
require(msg.value == _paidQuantity * _price, "insufficientPaid()");
require(_paidQuantity + _freeQuantity + totalSupply() <= COLLECTION_SIZE, "soldOut()");
require(_saleStartTs <= block.timestamp, "saleNotStarted()");
require(!addressClaimMap[msg.sender], "saleAlreadyClaimed()");
// mint and update mapping
addressClaimMap[msg.sender] = true;
_safeMint(msg.sender, _paidQuantity + _freeQuantity);
}
/*
* @dev Mints a limited quantity into the community wallet
*/
function reservedMint(uint256 _quantity) external onlyOwner {
require(_quantity + totalSupply() <= COLLECTION_SIZE, "soldOut()");
require(maxReserveMintRemaining >= _quantity, "soldOut()");
// mint to first party wallet
maxReserveMintRemaining -= _quantity;
_safeMint(owner(), _quantity);
}
/*
* @dev Sets the signer for ECDSA validation
*/
function setSigningAddress(address _address) external onlyOwner {
signingAddress = _address;
}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
function setBaseURI(string calldata uri) external onlyOwner {
baseURI = uri;
}
function togglePublicMint() public onlyOwner {
isPublicMintActive = !isPublicMintActive;
}
function setRoyaltiesAddress(address _newAddress) public onlyOwner {
royaltiesAddress = _newAddress;
}
function withdrawBalance() public onlyOwner {
if(address(this).balance == 0) revert nothingToWithdraw();
payable(owner()).transfer(address(this).balance);
}
// ERC165
function supportsInterface(bytes4 _interfaceId)
public view override(ERC721A, IERC165) returns (bool)
{
return _interfaceId == type(IERC2981).interfaceId
|| super.supportsInterface(_interfaceId);
}
// IERC2981
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address, uint256 royaltyAmount) {
if(!_exists(_tokenId)) revert tokenDoesNotExist();
royaltyAmount = (_salePrice / 1000) * royaltiesPercentage;
return (royaltiesAddress, royaltyAmount);
}
// OVERRIDES
function _startTokenId() internal view virtual override(ERC721A) returns (uint256) {
return 1;
}
}
ERC721A.sol 816 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.0.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
/**
* @dev ERC721 token receiver interface.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @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 IERC721A {
// Mask of an entry in packed address data.
uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225;
// The tokenId of the next token to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _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 `_packedOwnershipOf` implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// 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();
}
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see `_totalMinted`.
*/
function totalSupply() public view override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev 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 Returns the total number of tokens burned.
*/
function _totalBurned() internal view returns (uint256) {
return _burnCounter;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes of the XOR of
// all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165
// e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> BITPOS_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 {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
assembly { // Cast aux without masking.
auxCasted := aux
}
packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
_packedAddressData[owner] = packed;
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
// If not burned.
if (packed & BITMASK_BURNED == 0) {
// 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.
//
// We can directly compare the packed value.
// If the address is zero, packed is zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP);
ownership.burned = packed & BITMASK_BURNED != 0;
}
/**
* Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* 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) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @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, _toString(tokenId))) : '';
}
/**
* @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 Casts the address to uint256 without masking.
*/
function _addressToUint256(address value) private pure returns (uint256 result) {
assembly {
result := value
}
}
/**
* @dev Casts the boolean to uint256 without branching.
*/
function _boolToUint256(bool value) private pure returns (uint256 result) {
assembly {
result := value
}
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = address(uint160(_packedOwnershipOf(tokenId)));
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @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 == _msgSenderERC721A()) revert ApproveToCaller();
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), 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.code.length != 0)
if (!_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 && // If within bounds,
_packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
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 {
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 {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the balance and number minted.
_packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] =
_addressToUint256(to) |
(block.timestamp << BITPOS_START_TIMESTAMP) |
(_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (to.code.length != 0) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex < end);
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex < end);
}
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @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) 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 {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the balance and number minted.
_packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] =
_addressToUint256(to) |
(block.timestamp << BITPOS_START_TIMESTAMP) |
(_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex < end);
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) private {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
bool isApprovedOrOwner = (_msgSenderERC721A() == from ||
isApprovedForAll(from, _msgSenderERC721A()) ||
getApproved(tokenId) == _msgSenderERC721A());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
delete _tokenApprovals[tokenId];
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] =
_addressToUint256(to) |
(block.timestamp << BITPOS_START_TIMESTAMP) |
BITMASK_NEXT_INITIALIZED;
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSenderERC721A() == from ||
isApprovedForAll(from, _msgSenderERC721A()) ||
getApproved(tokenId) == _msgSenderERC721A());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
delete _tokenApprovals[tokenId];
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] =
_addressToUint256(from) |
(block.timestamp << BITPOS_START_TIMESTAMP) |
BITMASK_BURNED |
BITMASK_NEXT_INITIALIZED;
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* 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, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
* And also called after one token has been burned.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function _toString(uint256 value) internal pure returns (string memory ptr) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit),
// but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged.
// We will need 1 32-byte word to store the length,
// and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128.
ptr := add(mload(0x40), 128)
// Update the free memory pointer to allocate.
mstore(0x40, ptr)
// Cache the end of the memory to calculate the length later.
let end := ptr
// We write the string from the rightmost digit to the leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// Costs a bit more than early returning for the zero case,
// but cheaper in terms of deployment and overall runtime costs.
for {
// Initialize and perform the first pass without check.
let temp := value
// Move the pointer 1 byte leftwards to point to an empty character slot.
ptr := sub(ptr, 1)
// Write the character to the pointer. 48 is the ASCII index of '0'.
mstore8(ptr, add(48, mod(temp, 10)))
temp := div(temp, 10)
} temp {
// Keep dividing `temp` until zero.
temp := div(temp, 10)
} { // Body of the for loop.
ptr := sub(ptr, 1)
mstore8(ptr, add(48, mod(temp, 10)))
}
let length := sub(end, ptr)
// Move the pointer 32 bytes leftwards to make room for the length.
ptr := sub(ptr, 32)
// Store the length.
mstore(ptr, length)
}
}
}
IERC721A.sol 260 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.0.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of an ERC721A compliant contract.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* The caller cannot approve to their own address.
*/
error ApproveToCaller();
/**
* The caller cannot approve to the current owner.
*/
error ApprovalToCurrentOwner();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
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;
}
/**
* @dev Returns the total amount of tokens stored by the contract.
*
* Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
*/
function totalSupply() external view returns (uint256);
// ==============================
// 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);
// ==============================
// IERC721
// ==============================
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must 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 Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
// ==============================
// IERC721Metadata
// ==============================
/**
* @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);
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// 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);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// 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);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev 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);
}
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
IERC2981.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
ERC2981.sol 118 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
external
view
virtual
override
returns (address, uint256)
{
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `tokenId` must be already minted.
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
ECDSA.sol 230 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
Read Contract
COLLECTION_SIZE 0xd8258d95 → uint256
MAX_MINTS_PER_PUBLIC_TX 0x58f6551e → uint64
PRICE 0x8d859f3e → uint256
addressClaimMap 0x7d57b125 → bool
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isPublicMintActive 0x2d6b6224 → bool
maxReserveMintRemaining 0x6cc97909 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
royaltiesAddress 0x32882535 → address
royaltyInfo 0x2a55205a → address, uint256
signingAddress 0xb3e82dc9 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 15 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
publicMint 0x2db11544
uint256 _quantity
renounceOwnership 0x715018a6
No parameters
reservedMint 0x8c74bf0e
uint256 _quantity
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
saleMint 0xb232fe32
uint256 _freeQuantity
uint64 _paidQuantity
uint256 _price
uint256 _saleStartTs
bytes _signature
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string uri
setRoyaltiesAddress 0xdc95c4a7
address _newAddress
setSigningAddress 0x31beb605
address _address
togglePublicMint 0x4047638d
No parameters
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdrawBalance 0x5fd8c710
No parameters
Recent Transactions
No transactions found for this address