Address Contract Partially Verified
Address
0x14F6f80aa18860214cE94B2B57808348D975F2ff
Balance
0 ETH
Nonce
1
Code Size
17075 bytes
Creator
0x37A7C2a7...8f60 at tx 0xda46c671...5709f7
Indexed Transactions
0
Contract Bytecode
17075 bytes
0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c806370c425751161011a578063ae3bb460116100ad578063d39c4de71161007c578063d39c4de714610588578063dbe7e3bd146105b8578063e985e9c5146105e8578063f2fde38b14610618578063f8e93ef914610634576101fb565b8063ae3bb460146104ee578063b484eff71461050c578063b88d4fde1461053c578063c87b56dd14610558576101fb565b806398e52f9a116100e957806398e52f9a1461047c578063a101ff6d14610498578063a22cb465146104b4578063a6179719146104d0576101fb565b806370c425751461041a578063715018a6146104365780638da5cb5b1461044057806395d89b411461045e576101fb565b806334837ad31161019257806360d938dc1161016157806360d938dc1461036c5780636352211e1461038a57806369cdcfdc146103ba57806370a08231146103ea576101fb565b806334837ad31461030e5780633e07ac021461032a57806342842e0e1461033457806355f804b314610350576101fb565b806318160ddd116101ce57806318160ddd1461029a57806323b872dd146102b85780632446548f146102d457806332cb6b0c146102f0576101fb565b806301ffc9a71461020057806306fdde0314610230578063081812fc1461024e578063095ea7b31461027e575b600080fd5b61021a600480360381019061021591906132e4565b610650565b604051610227919061385d565b60405180910390f35b6102386106e2565b6040516102459190613893565b60405180910390f35b6102686004803603810190610263919061338b565b610774565b60405161027591906137d4565b60405180910390f35b610298600480360381019061029391906130e7565b6107f0565b005b6102a2610997565b6040516102af9190613a35565b60405180910390f35b6102d260048036038101906102cd9190612fd1565b6109ae565b005b6102ee60048036038101906102e99190613127565b6109be565b005b6102f8610b81565b6040516103059190613a35565b60405180910390f35b6103286004803603810190610323919061319f565b610b87565b005b610332610ee4565b005b61034e60048036038101906103499190612fd1565b610f8c565b005b61036a6004803603810190610365919061333e565b610fac565b005b61037461103e565b604051610381919061385d565b60405180910390f35b6103a4600480360381019061039f919061338b565b611051565b6040516103b191906137d4565b60405180910390f35b6103d460048036038101906103cf919061338b565b611063565b6040516103e19190613a35565b60405180910390f35b61040460048036038101906103ff9190612f37565b611087565b6040516104119190613a35565b60405180910390f35b610434600480360381019061042f91906132b7565b61111c565b005b61043e6111a2565b005b61044861122a565b60405161045591906137d4565b60405180910390f35b610466611254565b6040516104739190613893565b60405180910390f35b6104966004803603810190610491919061338b565b6112e6565b005b6104b260048036038101906104ad9190613257565b6113b0565b005b6104ce60048036038101906104c991906130a7565b61145d565b005b6104d86115d5565b6040516104e59190613878565b60405180910390f35b6104f66115fb565b604051610503919061383b565b60405180910390f35b61052660048036038101906105219190612f37565b611653565b6040516105339190613a35565b60405180910390f35b61055660048036038101906105519190613024565b611671565b005b610572600480360381019061056d919061338b565b6116e4565b60405161057f9190613893565b60405180910390f35b6105a2600480360381019061059d91906132b7565b611756565b6040516105af919061385d565b60405180910390f35b6105d260048036038101906105cd919061338b565b611776565b6040516105df919061385d565b60405180910390f35b61060260048036038101906105fd9190612f91565b611796565b60405161060f919061385d565b60405180910390f35b610632600480360381019061062d9190612f37565b61182a565b005b61064e6004803603810190610649919061320e565b611922565b005b60006301ffc9a760e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806106ab57506380ac58cd60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806106db5750635b5e139f60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b6060600280546106f190613dc6565b80601f016020809104026020016040519081016040528092919081815260200182805461071d90613dc6565b801561076a5780601f1061073f5761010080835404028352916020019161076a565b820191906000526020600020905b81548152906001019060200180831161074d57829003601f168201915b5050505050905090565b600061077f82611da2565b6107b5576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006107fb82611e01565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610863576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610882611ecf565b73ffffffffffffffffffffffffffffffffffffffff16146108e5576108ae816108a9611ecf565b611796565b6108e4576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b826006600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b60006109a1611ed7565b6001546000540303905090565b6109b9838383611edc565b505050565b6109c66122a4565b73ffffffffffffffffffffffffffffffffffffffff166109e461122a565b73ffffffffffffffffffffffffffffffffffffffff1614610a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3190613995565b60405180910390fd5b8051825114610a7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a75906138b5565b60405180910390fd5b6000805b8251811015610ac657828181518110610a9e57610a9d613f5e565b5b602002602001015182610ab19190613bbb565b91508080610abe90613e29565b915050610a82565b50600a54610ad2610997565b82610add9190613bbb565b1115610b1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b15906139d5565b60405180910390fd5b60005b8351811015610b7b57610b68848281518110610b4057610b3f613f5e565b5b6020026020010151848381518110610b5b57610b5a613f5e565b5b60200260200101516122ac565b8080610b7390613e29565b915050610b21565b50505050565b600a5481565b600342600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190613955565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610c78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6f906138d5565b60405180910390fd5b60038160ff161415610cd457600b60009054906101000a900460ff16610cd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cca90613935565b60405180910390fd5b5b82600a54610ce0610997565b82610ceb9190613bbb565b1115610d2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d23906139d5565b60405180910390fd5b60003384604051602001610d4192919061376d565b604051602081830303815290604052805190602001209050610d6686600d54836122ca565b610da5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9c90613a15565b60405180910390fd5b8385600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154610df49190613bbb565b1115610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906139b5565b60405180910390fd5b42600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254610ecb9190613bbb565b92505081905550610edc33866122e1565b505050505050565b610eec6122a4565b73ffffffffffffffffffffffffffffffffffffffff16610f0a61122a565b73ffffffffffffffffffffffffffffffffffffffff1614610f60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5790613995565b60405180910390fd5b600b60009054906101000a900460ff1615600b60006101000a81548160ff021916908315150217905550565b610fa783838360405180602001604052806000815250611671565b505050565b610fb46122a4565b73ffffffffffffffffffffffffffffffffffffffff16610fd261122a565b73ffffffffffffffffffffffffffffffffffffffff1614611028576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101f90613995565b60405180910390fd5b8181600c9190611039929190612b61565b505050565b600b60009054906101000a900460ff1681565b600061105c82611e01565b9050919050565b6011818154811061107357600080fd5b906000526020600020016000915090505481565b60008061109383612491565b14156110cb576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054169050919050565b6111246122a4565b73ffffffffffffffffffffffffffffffffffffffff1661114261122a565b73ffffffffffffffffffffffffffffffffffffffff1614611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118f90613995565b60405180910390fd5b80600d8190555050565b6111aa6122a4565b73ffffffffffffffffffffffffffffffffffffffff166111c861122a565b73ffffffffffffffffffffffffffffffffffffffff161461121e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121590613995565b60405180910390fd5b611228600061249b565b565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606003805461126390613dc6565b80601f016020809104026020016040519081016040528092919081815260200182805461128f90613dc6565b80156112dc5780601f106112b1576101008083540402835291602001916112dc565b820191906000526020600020905b8154815290600101906020018083116112bf57829003601f168201915b5050505050905090565b6112ee6122a4565b73ffffffffffffffffffffffffffffffffffffffff1661130c61122a565b73ffffffffffffffffffffffffffffffffffffffff1614611362576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135990613995565b60405180910390fd5b600a5481106113a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139d90613975565b60405180910390fd5b80600a8190555050565b6113b86122a4565b73ffffffffffffffffffffffffffffffffffffffff166113d661122a565b73ffffffffffffffffffffffffffffffffffffffff161461142c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142390613995565b60405180910390fd5b82600b60016101000a81548160ff0219169083151502179055508181600c9190611457929190612b61565b50505050565b611465611ecf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114ca576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600760006114d7611ecf565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611584611ecf565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516115c9919061385d565b60405180910390a35050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060601180548060200260200160405190810160405280929190818152602001828054801561164957602002820191906000526020600020905b815481526020019060010190808311611635575b5050505050905090565b600e6020528060005260406000206000915090508060000154905081565b61167c848484611edc565b60008373ffffffffffffffffffffffffffffffffffffffff163b146116de576116a784848484612561565b6116dd576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b50505050565b6060600b60019054906101000a900460ff161561172d57600c611706836126c1565b6040516020016117179291906137b0565b6040516020818303038152906040529050611751565b600c60405160200161173f9190613799565b60405160208183030381529060405290505b919050565b60126020528060005260406000206000915054906101000a900460ff1681565b60106020528060005260406000206000915054906101000a900460ff1681565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6118326122a4565b73ffffffffffffffffffffffffffffffffffffffff1661185061122a565b73ffffffffffffffffffffffffffffffffffffffff16146118a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189d90613995565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190d90613915565b60405180910390fd5b61191f8161249b565b50565b600342600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199c90613955565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614611a13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0a906138d5565b60405180910390fd5b60038160ff161415611a6f57600b60009054906101000a900460ff16611a6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6590613935565b60405180910390fd5b5b8151600a54611a7c610997565b82611a879190613bbb565b1115611ac8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abf906139d5565b60405180910390fd5b60005b8351811015611d23573373ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e868481518110611b3c57611b3b613f5e565b5b60200260200101516040518263ffffffff1660e01b8152600401611b609190613a35565b60206040518083038186803b158015611b7857600080fd5b505afa158015611b8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb09190612f64565b73ffffffffffffffffffffffffffffffffffffffff1614611c06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bfd906138f5565b60405180910390fd5b6000151560106000868481518110611c2157611c20613f5e565b5b6020026020010151815260200190815260200160002060009054906101000a900460ff16151514611c87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7e906139f5565b60405180910390fd5b600160106000868481518110611ca057611c9f613f5e565b5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055506011848281518110611ce257611ce1613f5e565b5b602002602001015190806001815401808255809150506001900390600052602060002001600090919091909150558080611d1b90613e29565b915050611acb565b5042600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600260088551611d7a9190613c11565b611d849190613c42565b9050611d9c33828651611d979190613bbb565b6122e1565b50505050565b600081611dad611ed7565b11158015611dbc575060005482105b8015611dfa575060007c0100000000000000000000000000000000000000000000000000000000600460008581526020019081526020016000205416145b9050919050565b60008082905080611e10611ed7565b11611e9857600054811015611e975760006004600083815260200190815260200160002054905060007c010000000000000000000000000000000000000000000000000000000082161415611e95575b6000811415611e8b576004600083600190039350838152602001908152602001600020549050611e60565b8092505050611eca565b505b5b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600033905090565b600090565b6000611ee782611e01565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611f4e576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006006600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008573ffffffffffffffffffffffffffffffffffffffff16611fa7611ecf565b73ffffffffffffffffffffffffffffffffffffffff161480611fd65750611fd586611fd0611ecf565b611796565b5b806120135750611fe4611ecf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b90508061204c576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061205786612491565b141561208f576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61209c8686866001612822565b60006120a783612491565b146120e3576006600085815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081546001900391905081905550600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154600101919050819055507c020000000000000000000000000000000000000000000000000000000060a042901b6121aa87612491565b1717600460008681526020019081526020016000208190555060007c020000000000000000000000000000000000000000000000000000000084161415612234576000600185019050600060046000838152602001908152602001600020541415612232576000548114612231578360046000838152602001908152602001600020819055505b5b505b838573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461229c8686866001612828565b505050505050565b600033905090565b6122c682826040518060200160405280600081525061282e565b5050565b6000826122d78584612abf565b1490509392505050565b60008054905060006122f284612491565b141561232a576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000821415612365576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6123726000848385612822565b600160406001901b178202600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060e16123d760018414612b15565b901b60a042901b6123e785612491565b171760046000838152602001908152602001600020819055506000819050600083820190505b818060010192508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a480821061240d5781600081905550505061248c6000848385612828565b505050565b6000819050919050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612587611ecf565b8786866040518563ffffffff1660e01b81526004016125a994939291906137ef565b602060405180830381600087803b1580156125c357600080fd5b505af19250505080156125f457506040513d601f19601f820116820180604052508101906125f19190613311565b60015b61266e573d8060008114612624576040519150601f19603f3d011682016040523d82523d6000602084013e612629565b606091505b50600081511415612666576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b60606000821415612709576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061281d565b600082905060005b6000821461273b57808061272490613e29565b915050600a826127349190613c11565b9150612711565b60008167ffffffffffffffff81111561275757612756613f8d565b5b6040519080825280601f01601f1916602001820160405280156127895781602001600182028036833780820191505090505b5090505b60008514612816576001826127a29190613c9c565b9150600a856127b19190613ea0565b60306127bd9190613bbb565b60f81b8183815181106127d3576127d2613f5e565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561280f9190613c11565b945061278d565b8093505050505b919050565b50505050565b50505050565b600080549050600061283f85612491565b1415612877576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008314156128b2576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6128bf6000858386612822565b600160406001901b178302600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060e161292460018514612b15565b901b60a042901b61293486612491565b1717600460008381526020019081526020016000208190555060008190506000848201905060008673ffffffffffffffffffffffffffffffffffffffff163b14612a38575b818673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46129e86000878480600101955087612561565b612a1e576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808210612979578260005414612a3357600080fd5b612aa3565b5b818060010192508673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4808210612a39575b816000819055505050612ab96000858386612828565b50505050565b60008082905060005b8451811015612b0a57612af582868381518110612ae857612ae7613f5e565b5b6020026020010151612b1f565b91508080612b0290613e29565b915050612ac8565b508091505092915050565b6000819050919050565b6000818310612b3757612b328284612b4a565b612b42565b612b418383612b4a565b5b905092915050565b600082600052816020526040600020905092915050565b828054612b6d90613dc6565b90600052602060002090601f016020900481019282612b8f5760008555612bd6565b82601f10612ba857803560ff1916838001178555612bd6565b82800160010185558215612bd6579182015b82811115612bd5578235825591602001919060010190612bba565b5b509050612be39190612be7565b5090565b5b80821115612c00576000816000905550600101612be8565b5090565b6000612c17612c1284613a75565b613a50565b90508083825260208201905082856020860282011115612c3a57612c39613fc6565b5b60005b85811015612c6a5781612c508882612d96565b845260208401935060208301925050600181019050612c3d565b5050509392505050565b6000612c87612c8284613aa1565b613a50565b90508083825260208201905082856020860282011115612caa57612ca9613fc6565b5b60005b85811015612cda5781612cc08882612e5f565b845260208401935060208301925050600181019050612cad565b5050509392505050565b6000612cf7612cf284613acd565b613a50565b90508083825260208201905082856020860282011115612d1a57612d19613fc6565b5b60005b85811015612d4a5781612d308882612f22565b845260208401935060208301925050600181019050612d1d565b5050509392505050565b6000612d67612d6284613af9565b613a50565b905082815260208101848484011115612d8357612d82613fcb565b5b612d8e848285613d84565b509392505050565b600081359050612da58161420a565b92915050565b600081519050612dba8161420a565b92915050565b600082601f830112612dd557612dd4613fc1565b5b8135612de5848260208601612c04565b91505092915050565b600082601f830112612e0357612e02613fc1565b5b8135612e13848260208601612c74565b91505092915050565b600082601f830112612e3157612e30613fc1565b5b8135612e41848260208601612ce4565b91505092915050565b600081359050612e5981614221565b92915050565b600081359050612e6e81614238565b92915050565b600081359050612e838161424f565b92915050565b600081519050612e988161424f565b92915050565b600082601f830112612eb357612eb2613fc1565b5b8135612ec3848260208601612d54565b91505092915050565b60008083601f840112612ee257612ee1613fc1565b5b8235905067ffffffffffffffff811115612eff57612efe613fbc565b5b602083019150836001820283011115612f1b57612f1a613fc6565b5b9250929050565b600081359050612f3181614266565b92915050565b600060208284031215612f4d57612f4c613fd5565b5b6000612f5b84828501612d96565b91505092915050565b600060208284031215612f7a57612f79613fd5565b5b6000612f8884828501612dab565b91505092915050565b60008060408385031215612fa857612fa7613fd5565b5b6000612fb685828601612d96565b9250506020612fc785828601612d96565b9150509250929050565b600080600060608486031215612fea57612fe9613fd5565b5b6000612ff886828701612d96565b935050602061300986828701612d96565b925050604061301a86828701612f22565b9150509250925092565b6000806000806080858703121561303e5761303d613fd5565b5b600061304c87828801612d96565b945050602061305d87828801612d96565b935050604061306e87828801612f22565b925050606085013567ffffffffffffffff81111561308f5761308e613fd0565b5b61309b87828801612e9e565b91505092959194509250565b600080604083850312156130be576130bd613fd5565b5b60006130cc85828601612d96565b92505060206130dd85828601612e4a565b9150509250929050565b600080604083850312156130fe576130fd613fd5565b5b600061310c85828601612d96565b925050602061311d85828601612f22565b9150509250929050565b6000806040838503121561313e5761313d613fd5565b5b600083013567ffffffffffffffff81111561315c5761315b613fd0565b5b61316885828601612dc0565b925050602083013567ffffffffffffffff81111561318957613188613fd0565b5b61319585828601612e1c565b9150509250929050565b6000806000606084860312156131b8576131b7613fd5565b5b600084013567ffffffffffffffff8111156131d6576131d5613fd0565b5b6131e286828701612dee565b93505060206131f386828701612f22565b925050604061320486828701612f22565b9150509250925092565b60006020828403121561322457613223613fd5565b5b600082013567ffffffffffffffff81111561324257613241613fd0565b5b61324e84828501612e1c565b91505092915050565b6000806000604084860312156132705761326f613fd5565b5b600061327e86828701612e4a565b935050602084013567ffffffffffffffff81111561329f5761329e613fd0565b5b6132ab86828701612ecc565b92509250509250925092565b6000602082840312156132cd576132cc613fd5565b5b60006132db84828501612e5f565b91505092915050565b6000602082840312156132fa576132f9613fd5565b5b600061330884828501612e74565b91505092915050565b60006020828403121561332757613326613fd5565b5b600061333584828501612e89565b91505092915050565b6000806020838503121561335557613354613fd5565b5b600083013567ffffffffffffffff81111561337357613372613fd0565b5b61337f85828601612ecc565b92509250509250929050565b6000602082840312156133a1576133a0613fd5565b5b60006133af84828501612f22565b91505092915050565b60006133c48383613738565b60208301905092915050565b6133d981613cd0565b82525050565b6133f06133eb82613cd0565b613e72565b82525050565b600061340182613b4f565b61340b8185613b7d565b935061341683613b2a565b8060005b8381101561344757815161342e88826133b8565b975061343983613b70565b92505060018101905061341a565b5085935050505092915050565b61345d81613ce2565b82525050565b600061346e82613b5a565b6134788185613b8e565b9350613488818560208601613d93565b61349181613fda565b840191505092915050565b6134a581613d4e565b82525050565b60006134b682613b65565b6134c08185613b9f565b93506134d0818560208601613d93565b6134d981613fda565b840191505092915050565b60006134ef82613b65565b6134f98185613bb0565b9350613509818560208601613d93565b80840191505092915050565b6000815461352281613dc6565b61352c8186613bb0565b9450600182166000811461354757600181146135585761358b565b60ff1983168652818601935061358b565b61356185613b3a565b60005b8381101561358357815481890152600182019150602081019050613564565b838801955050505b50505092915050565b60006135a1601083613b9f565b91506135ac82613ff8565b602082019050919050565b60006135c4601d83613b9f565b91506135cf82614021565b602082019050919050565b60006135e7601383613b9f565b91506135f28261404a565b602082019050919050565b600061360a602683613b9f565b915061361582614073565b604082019050919050565b600061362d601b83613b9f565b9150613638826140c2565b602082019050919050565b6000613650601d83613b9f565b915061365b826140eb565b602082019050919050565b6000613673601483613b9f565b915061367e82614114565b602082019050919050565b6000613696602083613b9f565b91506136a18261413d565b602082019050919050565b60006136b9601b83613b9f565b91506136c482614166565b602082019050919050565b60006136dc601183613b9f565b91506136e78261418f565b602082019050919050565b60006136ff601583613b9f565b915061370a826141b8565b602082019050919050565b6000613722600d83613b9f565b915061372d826141e1565b602082019050919050565b61374181613d44565b82525050565b61375081613d44565b82525050565b61376761376282613d44565b613e96565b82525050565b600061377982856133df565b6014820191506137898284613756565b6020820191508190509392505050565b60006137a58284613515565b915081905092915050565b60006137bc8285613515565b91506137c882846134e4565b91508190509392505050565b60006020820190506137e960008301846133d0565b92915050565b600060808201905061380460008301876133d0565b61381160208301866133d0565b61381e6040830185613747565b81810360608301526138308184613463565b905095945050505050565b6000602082019050818103600083015261385581846133f6565b905092915050565b60006020820190506138726000830184613454565b92915050565b600060208201905061388d600083018461349c565b92915050565b600060208201905081810360008301526138ad81846134ab565b905092915050565b600060208201905081810360008301526138ce81613594565b9050919050565b600060208201905081810360008301526138ee816135b7565b9050919050565b6000602082019050818103600083015261390e816135da565b9050919050565b6000602082019050818103600083015261392e816135fd565b9050919050565b6000602082019050818103600083015261394e81613620565b9050919050565b6000602082019050818103600083015261396e81613643565b9050919050565b6000602082019050818103600083015261398e81613666565b9050919050565b600060208201905081810360008301526139ae81613689565b9050919050565b600060208201905081810360008301526139ce816136ac565b9050919050565b600060208201905081810360008301526139ee816136cf565b9050919050565b60006020820190508181036000830152613a0e816136f2565b9050919050565b60006020820190508181036000830152613a2e81613715565b9050919050565b6000602082019050613a4a6000830184613747565b92915050565b6000613a5a613a6b565b9050613a668282613df8565b919050565b6000604051905090565b600067ffffffffffffffff821115613a9057613a8f613f8d565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613abc57613abb613f8d565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613ae857613ae7613f8d565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613b1457613b13613f8d565b5b613b1d82613fda565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613bc682613d44565b9150613bd183613d44565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c0657613c05613ed1565b5b828201905092915050565b6000613c1c82613d44565b9150613c2783613d44565b925082613c3757613c36613f00565b5b828204905092915050565b6000613c4d82613d44565b9150613c5883613d44565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613c9157613c90613ed1565b5b828202905092915050565b6000613ca782613d44565b9150613cb283613d44565b925082821015613cc557613cc4613ed1565b5b828203905092915050565b6000613cdb82613d24565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000613d5982613d60565b9050919050565b6000613d6b82613d72565b9050919050565b6000613d7d82613d24565b9050919050565b82818337600083830152505050565b60005b83811015613db1578082015181840152602081019050613d96565b83811115613dc0576000848401525b50505050565b60006002820490506001821680613dde57607f821691505b60208210811415613df257613df1613f2f565b5b50919050565b613e0182613fda565b810181811067ffffffffffffffff82111715613e2057613e1f613f8d565b5b80604052505050565b6000613e3482613d44565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613e6757613e66613ed1565b5b600182019050919050565b6000613e7d82613e84565b9050919050565b6000613e8f82613feb565b9050919050565b6000819050919050565b6000613eab82613d44565b9150613eb683613d44565b925082613ec657613ec5613f00565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f57524f4e475f504152414d455445525300000000000000000000000000000000600082015250565b7f434f4e5452414354535f4e4f545f414c4c4f5745445f544f5f4d494e54000000600082015250565b7f4d5553545f4f574e5f414c4c5f544f4b454e5300000000000000000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f465245455f4d494e545f49535f4e4f545f5945545f4143544956450000000000600082015250565b7f43414e4e4f545f4d494e545f4f4e5f5448455f53414d455f424c4f434b000000600082015250565b7f43414e545f494e4352454153455f535550504c59000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4558434545445f414c4c4f43415445445f4d494e545f4c494d49540000000000600082015250565b7f4e4f545f454e4f5547485f535550504c59000000000000000000000000000000600082015250565b7f544f4b454e5f414c52454144595f434c41494d45440000000000000000000000600082015250565b7f50524f4f465f494e56414c494400000000000000000000000000000000000000600082015250565b61421381613cd0565b811461421e57600080fd5b50565b61422a81613ce2565b811461423557600080fd5b50565b61424181613cee565b811461424c57600080fd5b50565b61425881613cf8565b811461426357600080fd5b50565b61426f81613d44565b811461427a57600080fd5b5056fea26469706673582212205ccad55c90cfc02551aa1c703e0da86af54b9bc560c939ced18cb3e5ec605c5c64736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
VerbToy.sol 1639 lines
// SPDX-License-Identifier: MIT
// File: contracts/IERC721A.sol
// 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);
}
// File: contracts/ERC721A.sol
// ERC721A Contracts v4.0.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @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 (_addressToUint256(owner) == 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 (_addressToUint256(to) == 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 (_addressToUint256(to) == 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();
address approvedAddress = _tokenApprovals[tokenId];
bool isApprovedOrOwner = (_msgSenderERC721A() == from ||
isApprovedForAll(from, _msgSenderERC721A()) ||
approvedAddress == _msgSenderERC721A());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (_addressToUint256(to) == 0) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
if (_addressToUint256(approvedAddress) != 0) {
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));
address approvedAddress = _tokenApprovals[tokenId];
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSenderERC721A() == from ||
isApprovedForAll(from, _msgSenderERC721A()) ||
approvedAddress == _msgSenderERC721A());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
if (_addressToUint256(approvedAddress) != 0) {
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)
}
}
}
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,
* consuming from one or the other at each step according to the instructions given by
* `proofFlags`.
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @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);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma sol...
// [truncated — 57786 bytes total]
Read Contract
MAX_SUPPLY 0x32cb6b0c → uint256
Verb 0xa6179719 → address
balanceOf 0x70a08231 → uint256
claimed 0xdbe7e3bd → bool
claimedIds 0x69cdcfdc → uint256
getApproved 0x081812fc → address
getClaimed 0xae3bb460 → uint256[]
isApprovedForAll 0xe985e9c5 → bool
isPresaleActive 0x60d938dc → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
usedDigests 0xd39c4de7 → bool
userPurchase 0xb484eff7 → uint256
Write Contract 15 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
decreaseSupply 0x98e52f9a
uint256 _maxSupply
devMint 0x2446548f
address[] _addresses
uint256[] quantities
freeMint 0x34837ad3
bytes32[] proof
uint256 numberOfTokens
uint256 maxMint
mint 0xf8e93ef9
uint256[] tokenIds
renounceOwnership 0x715018a6
No parameters
reveal 0xa101ff6d
bool revealed
string _baseURI
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string URI
setFreeMintRoot 0x70c42575
bytes32 _freemintRoot
setPreSaleStatus 0x3e07ac02
No parameters
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address