Address Contract Verified
Address
0x73B755BdBfb1D9B5D2CC2d2C1bd3f28bA63cB511
Balance
0 ETH
Nonce
1
Code Size
20127 bytes
Creator
0x31817637...1858 at tx 0xec017b36...78d2e5
Indexed Transactions
0
Contract Bytecode
20127 bytes
0x6080604052600436106102e45760003560e01c8063715018a611610190578063a22cb465116100dc578063c87b56dd11610095578063e985e9c51161006f578063e985e9c514610b34578063f2fde38b14610b71578063faefa87014610b9a578063fc1a1c3614610bc3576102e4565b8063c87b56dd14610aa1578063d5abeb0114610ade578063e8a3d48514610b09576102e4565b8063a22cb4651461098e578063a94ff0b1146109b7578063b88d4fde146109f4578063beab8b8514610a10578063c021872714610a3b578063c23dc68f14610a64576102e4565b8063938e3d7b1161014957806395d89b411161012357806395d89b41146108df57806399a2557a1461090a5780639ecfab9b14610947578063a0712d6814610972576102e4565b8063938e3d7b1461084e57806393c7e98714610877578063945ec9dd146108b4576102e4565b8063715018a614610764578063717d57d31461077b5780637a7177f5146107a45780638462151c146107cf578063853828b61461080c5780638da5cb5b14610823576102e4565b80633048ad2b1161024f57806352866d0b116102085780636352211e116101e25780636352211e146106985780636f8b44b0146106d557806370a08231146106fe57806370d1dec91461073b576102e4565b806352866d0b146105f557806355f804b3146106325780635bbb21771461065b576102e4565b80633048ad2b146104e05780633a87bfe01461051d5780633e65408a1461054857806342842e0e1461057357806342966c681461058f578063517bf683146105b8576102e4565b806310b2d71a116102a157806310b2d71a146103f15780631361deb31461041a57806318160ddd146104435780631c0e61a41461046e5780631f682a591461049957806323b872dd146104c4576102e4565b806301ffc9a7146102e957806306fdde0314610326578063081812fc1461035157806308e3f8681461038e578063095ea7b3146103aa5780630c2cd50c146103c6575b600080fd5b3480156102f557600080fd5b50610310600480360381019061030b9190613600565b610bee565b60405161031d9190613648565b60405180910390f35b34801561033257600080fd5b5061033b610c80565b60405161034891906136fc565b60405180910390f35b34801561035d57600080fd5b5061037860048036038101906103739190613754565b610d12565b60405161038591906137c2565b60405180910390f35b6103a860048036038101906103a39190613842565b610d91565b005b6103c460048036038101906103bf91906138ce565b61117f565b005b3480156103d257600080fd5b506103db6112c3565b6040516103e8919061391d565b60405180910390f35b3480156103fd57600080fd5b5061041860048036038101906104139190613754565b6112c9565b005b34801561042657600080fd5b50610441600480360381019061043c9190613754565b6112db565b005b34801561044f57600080fd5b506104586112ed565b604051610465919061391d565b60405180910390f35b34801561047a57600080fd5b50610483611304565b604051610490919061391d565b60405180910390f35b3480156104a557600080fd5b506104ae61130a565b6040516104bb919061391d565b60405180910390f35b6104de60048036038101906104d99190613938565b611310565b005b3480156104ec57600080fd5b5061050760048036038101906105029190613abb565b611632565b60405161051491906137c2565b60405180910390f35b34801561052957600080fd5b50610532611684565b60405161053f9190613648565b60405180910390f35b34801561055457600080fd5b5061055d61169f565b60405161056a919061391d565b60405180910390f35b61058d60048036038101906105889190613938565b6116a5565b005b34801561059b57600080fd5b506105b660048036038101906105b19190613754565b6116c5565b005b3480156105c457600080fd5b506105df60048036038101906105da9190613b17565b6116d3565b6040516105ec9190613648565b60405180910390f35b34801561060157600080fd5b5061061c60048036038101906106179190613b17565b611729565b6040516106299190613648565b60405180910390f35b34801561063e57600080fd5b5061065960048036038101906106549190613be5565b61177f565b005b34801561066757600080fd5b50610682600480360381019061067d9190613c84565b61179a565b60405161068f9190613e34565b60405180910390f35b3480156106a457600080fd5b506106bf60048036038101906106ba9190613754565b61185d565b6040516106cc91906137c2565b60405180910390f35b3480156106e157600080fd5b506106fc60048036038101906106f79190613754565b61186f565b005b34801561070a57600080fd5b5061072560048036038101906107209190613b17565b611881565b604051610732919061391d565b60405180910390f35b34801561074757600080fd5b50610762600480360381019061075d9190613e56565b611939565b005b34801561077057600080fd5b50610779611953565b005b34801561078757600080fd5b506107a2600480360381019061079d9190613754565b611967565b005b3480156107b057600080fd5b506107b9611979565b6040516107c6919061391d565b60405180910390f35b3480156107db57600080fd5b506107f660048036038101906107f19190613b17565b61197f565b6040516108039190613f54565b60405180910390f35b34801561081857600080fd5b50610821611ac2565b005b34801561082f57600080fd5b50610838611b0a565b60405161084591906137c2565b60405180910390f35b34801561085a57600080fd5b5061087560048036038101906108709190613be5565b611b34565b005b34801561088357600080fd5b5061089e60048036038101906108999190613b17565b611b4f565b6040516108ab919061391d565b60405180910390f35b3480156108c057600080fd5b506108c9611b98565b6040516108d6919061391d565b60405180910390f35b3480156108eb57600080fd5b506108f4611b9e565b60405161090191906136fc565b60405180910390f35b34801561091657600080fd5b50610931600480360381019061092c9190613f76565b611c30565b60405161093e9190613f54565b60405180910390f35b34801561095357600080fd5b5061095c611e3c565b604051610969919061391d565b60405180910390f35b61098c60048036038101906109879190613754565b611e42565b005b34801561099a57600080fd5b506109b560048036038101906109b09190613ff5565b612151565b005b3480156109c357600080fd5b506109de60048036038101906109d99190613b17565b61225c565b6040516109eb919061391d565b60405180910390f35b610a0e6004803603810190610a099190614035565b6122a5565b005b348015610a1c57600080fd5b50610a25612318565b604051610a329190613648565b60405180910390f35b348015610a4757600080fd5b50610a626004803603810190610a5d9190613e56565b612333565b005b348015610a7057600080fd5b50610a8b6004803603810190610a869190613754565b61234d565b604051610a98919061410d565b60405180910390f35b348015610aad57600080fd5b50610ac86004803603810190610ac39190613754565b6123b7565b604051610ad591906136fc565b60405180910390f35b348015610aea57600080fd5b50610af3612455565b604051610b00919061391d565b60405180910390f35b348015610b1557600080fd5b50610b1e61245b565b604051610b2b91906136fc565b60405180910390f35b348015610b4057600080fd5b50610b5b6004803603810190610b569190614128565b6124ed565b604051610b689190613648565b60405180910390f35b348015610b7d57600080fd5b50610b986004803603810190610b939190613b17565b612581565b005b348015610ba657600080fd5b50610bc16004803603810190610bbc9190613754565b612604565b005b348015610bcf57600080fd5b50610bd8612616565b604051610be5919061391d565b60405180910390f35b60006301ffc9a760e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610c4957506380ac58cd60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610c795750635b5e139f60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b606060028054610c8f90614197565b80601f0160208091040260200160405190810160405280929190818152602001828054610cbb90614197565b8015610d085780601f10610cdd57610100808354040283529160200191610d08565b820191906000526020600020905b815481529060010190602001808311610ceb57829003601f168201915b5050505050905090565b6000610d1d8261261c565b610d53576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600954610d9c6112ed565b10610ddc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd39061423a565b60405180910390fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e6384848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505033611632565b73ffffffffffffffffffffffffffffffffffffffff1614610eb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb0906142a6565b60405180910390fd5b610ec1611684565b610f00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef790614312565b60405180910390fd5b60008111610f43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3a9061437e565b60405180910390fd5b600a54610f4f3361267b565b82610f5a91906143cd565b610f649190614401565b341015610fa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9d906144a7565b60405180910390fd5b600954610fb16112ed565b82610fbc91906144c7565b1115610ffd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff490614569565b60405180910390fd5b600c54601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110493361267b565b8361105491906143cd565b61105e91906144c7565b111561109f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611096906145d5565b60405180910390fd5b60006110aa3361267b565b9050600081111561110e576001601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808261111a91906143cd565b601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461116891906144c7565b9250508190555061117933836126e2565b50505050565b600061118a8261185d565b90508073ffffffffffffffffffffffffffffffffffffffff166111ab612700565b73ffffffffffffffffffffffffffffffffffffffff161461120e576111d7816111d2612700565b6124ed565b61120d576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b826006600084815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600f5481565b6112d1612708565b80600b8190555050565b6112e3612708565b80600d8190555050565b60006112f7612786565b6001546000540303905090565b600c5481565b60115481565b600061131b8261278b565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611382576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061138e84612857565b915091506113a4818761139f612700565b61287e565b6113f0576113b9866113b4612700565b6124ed565b6113ef576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603611456576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61146386868660016128c2565b801561146e57600082555b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081546001900391905081905550600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081546001019190508190555061153c856115188888876128c8565b7c0200000000000000000000000000000000000000000000000000000000176128f0565b600460008681526020019081526020016000208190555060007c02000000000000000000000000000000000000000000000000000000008416036115c257600060018501905060006004600083815260200190815260200160002054036115c05760005481146115bf578360046000838152602001908152602001600020819055505b5b505b838573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461162a868686600161291b565b505050505050565b600080308360405160200161164892919061463d565b60405160208183030381529060405280519060200120905061167b8461166d83612921565b61295190919063ffffffff16565b91505092915050565b6000600e54421015801561169a5750600f544211155b905090565b60105481565b6116c0838383604051806020016040528060008152506122a5565b505050565b6116d0816001612978565b50565b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b611787612708565b80601890816117969190614815565b5050565b6060600083839050905060008167ffffffffffffffff8111156117c0576117bf613990565b5b6040519080825280602002602001820160405280156117f957816020015b6117e6613545565b8152602001906001900390816117de5790505b50905060005b8281146118515761182886868381811061181c5761181b6148e7565b5b9050602002013561234d565b82828151811061183b5761183a6148e7565b5b60200260200101819052508060010190506117ff565b50809250505092915050565b60006118688261278b565b9050919050565b611877612708565b8060098190555050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036118e8576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054169050919050565b611941612708565b81601081905550806011819055505050565b61195b612708565b6119656000612bca565b565b61196f612708565b80600a8190555050565b600d5481565b6060600080600061198f85611881565b905060008167ffffffffffffffff8111156119ad576119ac613990565b5b6040519080825280602002602001820160405280156119db5781602001602082028036833780820191505090505b5090506119e6613545565b60006119f0612786565b90505b838614611ab457611a0381612c90565b91508160400151611aa957600073ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1614611a4e57816000015194505b8773ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603611aa85780838780600101985081518110611a9b57611a9a6148e7565b5b6020026020010181815250505b5b8060010190506119f3565b508195505050505050919050565b611aca612708565b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050611b0857600080fd5b565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611b3c612708565b8060179081611b4b9190614815565b5050565b6000601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600b5481565b606060038054611bad90614197565b80601f0160208091040260200160405190810160405280929190818152602001828054611bd990614197565b8015611c265780601f10611bfb57610100808354040283529160200191611c26565b820191906000526020600020905b815481529060010190602001808311611c0957829003601f168201915b5050505050905090565b6060818310611c6b576040517f32c1995a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080611c76612cbb565b9050611c80612786565b851015611c9257611c8f612786565b94505b80841115611c9e578093505b6000611ca987611881565b905084861015611ccc576000868603905081811015611cc6578091505b50611cd1565b600090505b60008167ffffffffffffffff811115611ced57611cec613990565b5b604051908082528060200260200182016040528015611d1b5781602001602082028036833780820191505090505b50905060008203611d325780945050505050611e35565b6000611d3d8861234d565b905060008160400151611d5257816000015190505b60008990505b888114158015611d685750848714155b15611e2757611d7681612c90565b92508260400151611e1c57600073ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff1614611dc157826000015191505b8a73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611e1b5780848880600101995081518110611e0e57611e0d6148e7565b5b6020026020010181815250505b5b806001019050611d58565b508583528296505050505050505b9392505050565b600e5481565b600954611e4d6112ed565b10611e8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8490614962565b60405180910390fd5b611e95612318565b611ed4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ecb90614312565b60405180910390fd5b60008111611f17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0e9061437e565b60405180910390fd5b600b54611f2333612cc4565b82611f2e91906143cd565b611f389190614401565b341015611f7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f71906144a7565b60405180910390fd5b600954611f856112ed565b82611f9091906144c7565b1115611fd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fc890614569565b60405180910390fd5b600d54601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461201d33612cc4565b8361202891906143cd565b61203291906144c7565b1115612073576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206a906145d5565b60405180910390fd5b600061207e33612cc4565b905060008111156120e2576001601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80826120ee91906143cd565b601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461213c91906144c7565b9250508190555061214d33836126e2565b5050565b806007600061215e612700565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661220b612700565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516122509190613648565b60405180910390a35050565b6000601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6122b0848484611310565b60008373ffffffffffffffffffffffffffffffffffffffff163b14612312576122db84848484612d2b565b612311576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b50505050565b6000601054421015801561232e57506011544211155b905090565b61233b612708565b81600e8190555080600f819055505050565b612355613545565b61235d613545565b612365612786565b8310806123795750612375612cbb565b8310155b1561238757809150506123b2565b61239083612c90565b90508060400151156123a557809150506123b2565b6123ae83612e7b565b9150505b919050565b60606123c28261261c565b6123f8576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612402612e9b565b90506000815103612422576040518060200160405280600081525061244d565b8061242c84612f2d565b60405160200161243d9291906149be565b6040516020818303038152906040525b915050919050565b60095481565b60606017805461246a90614197565b80601f016020809104026020016040519081016040528092919081815260200182805461249690614197565b80156124e35780601f106124b8576101008083540402835291602001916124e3565b820191906000526020600020905b8154815290600101906020018083116124c657829003601f168201915b5050505050905090565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b612589612708565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036125f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125ef90614a54565b60405180910390fd5b61260181612bca565b50565b61260c612708565b80600c8190555050565b600a5481565b600081612627612786565b11158015612636575060005482105b8015612674575060007c0100000000000000000000000000000000000000000000000000000000600460008581526020019081526020016000205416145b9050919050565b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166126d55760016126d8565b60005b60ff169050919050565b6126fc828260405180602001604052806000815250612f7d565b5050565b600033905090565b61271061301a565b73ffffffffffffffffffffffffffffffffffffffff1661272e611b0a565b73ffffffffffffffffffffffffffffffffffffffff1614612784576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161277b90614ac0565b60405180910390fd5b565b600090565b6000808290508061279a612786565b116128205760005481101561281f5760006004600083815260200190815260200160002054905060007c010000000000000000000000000000000000000000000000000000000082160361281d575b600081036128135760046000836001900393508381526020019081526020016000205490506127e9565b8092505050612852565b505b5b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b60008060006006600085815260200190815260200160002090508092508254915050915091565b600073ffffffffffffffffffffffffffffffffffffffff8316925073ffffffffffffffffffffffffffffffffffffffff821691508382148383141790509392505050565b50505050565b60008060e883901c905060e86128df868684613022565b62ffffff16901b9150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff83169250814260a01b178317905092915050565b50505050565b6000816040516020016129349190614b57565b604051602081830303815290604052805190602001209050919050565b6000806000612960858561302b565b9150915061296d8161307c565b819250505092915050565b60006129838361278b565b9050600081905060008061299686612857565b9150915084156129ff576129b281846129ad612700565b61287e565b6129fe576129c7836129c2612700565b6124ed565b6129fd576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b5b612a0d8360008860016128c2565b8015612a1857600082555b600160806001901b03600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550612ac083612a7d856000886128c8565b7c02000000000000000000000000000000000000000000000000000000007c010000000000000000000000000000000000000000000000000000000017176128f0565b600460008881526020019081526020016000208190555060007c0200000000000000000000000000000000000000000000000000000000851603612b465760006001870190506000600460008381526020019081526020016000205403612b44576000548114612b43578460046000838152602001908152602001600020819055505b5b505b85600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612bb083600088600161291b565b600160008154809291906001019190505550505050505050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612c98613545565b612cb460046000848152602001908152602001600020546131e2565b9050919050565b60008054905090565b6000601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612d1e576001612d21565b60005b60ff169050919050565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612d51612700565b8786866040518563ffffffff1660e01b8152600401612d739493929190614bd2565b6020604051808303816000875af1925050508015612daf57506040513d601f19601f82011682018060405250810190612dac9190614c33565b60015b612e28573d8060008114612ddf576040519150601f19603f3d011682016040523d82523d6000602084013e612de4565b606091505b506000815103612e20576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b612e83613545565b612e94612e8f8361278b565b6131e2565b9050919050565b606060188054612eaa90614197565b80601f0160208091040260200160405190810160405280929190818152602001828054612ed690614197565b8015612f235780601f10612ef857610100808354040283529160200191612f23565b820191906000526020600020905b815481529060010190602001808311612f0657829003601f168201915b5050505050905090565b606060a060405101806040526020810391506000825281835b600115612f6857600184039350600a81066030018453600a8104905080612f46575b50828103602084039350808452505050919050565b612f878383613298565b60008373ffffffffffffffffffffffffffffffffffffffff163b1461301557600080549050600083820390505b612fc76000868380600101945086612d2b565b612ffd576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818110612fb457816000541461301257600080fd5b50505b505050565b600033905090565b60009392505050565b600080604183510361306c5760008060006020860151925060408601519150606086015160001a905061306087828585613453565b94509450505050613075565b60006002915091505b9250929050565b600060048111156130905761308f614c60565b5b8160048111156130a3576130a2614c60565b5b03156131df57600160048111156130bd576130bc614c60565b5b8160048111156130d0576130cf614c60565b5b03613110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161310790614cdb565b60405180910390fd5b6002600481111561312457613123614c60565b5b81600481111561313757613136614c60565b5b03613177576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161316e90614d47565b60405180910390fd5b6003600481111561318b5761318a614c60565b5b81600481111561319e5761319d614c60565b5b036131de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131d590614dd9565b60405180910390fd5b5b50565b6131ea613545565b81816000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060a082901c816020019067ffffffffffffffff16908167ffffffffffffffff168152505060007c01000000000000000000000000000000000000000000000000000000008316141581604001901515908115158152505060e882901c816060019062ffffff16908162ffffff1681525050919050565b600080549050600082036132d8576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6132e560008483856128c2565b600160406001901b178202600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061335c8361334d60008660006128c8565b61335685613535565b176128f0565b6004600083815260200190815260200160002081905550600080838301905073ffffffffffffffffffffffffffffffffffffffff85169150828260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600183015b8181146133fd57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46001810190506133c2565b5060008203613438576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600081905550505061344e600084838561291b565b505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c111561348e57600060039150915061352c565b6000600187878787604051600081526020016040526040516134b39493929190614e24565b6020604051602081039080840390855afa1580156134d5573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036135235760006001925092505061352c565b80600092509250505b94509492505050565b60006001821460e11b9050919050565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff168152602001600015158152602001600062ffffff1681525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6135dd816135a8565b81146135e857600080fd5b50565b6000813590506135fa816135d4565b92915050565b6000602082840312156136165761361561359e565b5b6000613624848285016135eb565b91505092915050565b60008115159050919050565b6136428161362d565b82525050565b600060208201905061365d6000830184613639565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561369d578082015181840152602081019050613682565b838111156136ac576000848401525b50505050565b6000601f19601f8301169050919050565b60006136ce82613663565b6136d8818561366e565b93506136e881856020860161367f565b6136f1816136b2565b840191505092915050565b6000602082019050818103600083015261371681846136c3565b905092915050565b6000819050919050565b6137318161371e565b811461373c57600080fd5b50565b60008135905061374e81613728565b92915050565b60006020828403121561376a5761376961359e565b5b60006137788482850161373f565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006137ac82613781565b9050919050565b6137bc816137a1565b82525050565b60006020820190506137d760008301846137b3565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112613802576138016137dd565b5b8235905067ffffffffffffffff81111561381f5761381e6137e2565b5b60208301915083600182028301111561383b5761383a6137e7565b5b9250929050565b60008060006040848603121561385b5761385a61359e565b5b600084013567ffffffffffffffff811115613879576138786135a3565b5b613885868287016137ec565b935093505060206138988682870161373f565b9150509250925092565b6138ab816137a1565b81146138b657600080fd5b50565b6000813590506138c8816138a2565b92915050565b600080604083850312156138e5576138e461359e565b5b60006138f3858286016138b9565b92505060206139048582860161373f565b9150509250929050565b6139178161371e565b82525050565b6000602082019050613932600083018461390e565b92915050565b6000806000606084860312156139515761395061359e565b5b600061395f868287016138b9565b9350506020613970868287016138b9565b92505060406139818682870161373f565b9150509250925092565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6139c8826136b2565b810181811067ffffffffffffffff821117156139e7576139e6613990565b5b80604052505050565b60006139fa613594565b9050613a0682826139bf565b919050565b600067ffffffffffffffff821115613a2657613a25613990565b5b613a2f826136b2565b9050602081019050919050565b82818337600083830152505050565b6000613a5e613a5984613a0b565b6139f0565b905082815260208101848484011115613a7a57613a7961398b565b5b613a85848285613a3c565b509392505050565b600082601f830112613aa257613aa16137dd565b5b8135613ab2848260208601613a4b565b91505092915050565b60008060408385031215613ad257613ad161359e565b5b600083013567ffffffffffffffff811115613af057613aef6135a3565b5b613afc85828601613a8d565b9250506020613b0d858286016138b9565b9150509250929050565b600060208284031215613b2d57613b2c61359e565b5b6000613b3b848285016138b9565b91505092915050565b600067ffffffffffffffff821115613b5f57613b5e613990565b5b613b68826136b2565b9050602081019050919050565b6000613b88613b8384613b44565b6139f0565b905082815260208101848484011115613ba457613ba361398b565b5b613baf848285613a3c565b509392505050565b600082601f830112613bcc57613bcb6137dd565b5b8135613bdc848260208601613b75565b91505092915050565b600060208284031215613bfb57613bfa61359e565b5b600082013567ffffffffffffffff811115613c1957613c186135a3565b5b613c2584828501613bb7565b91505092915050565b60008083601f840112613c4457613c436137dd565b5b8235905067ffffffffffffffff811115613c6157613c606137e2565b5b602083019150836020820283011115613c7d57613c7c6137e7565b5b9250929050565b60008060208385031215613c9b57613c9a61359e565b5b600083013567ffffffffffffffff811115613cb957613cb86135a3565b5b613cc585828601613c2e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613d06816137a1565b82525050565b600067ffffffffffffffff82169050919050565b613d2981613d0c565b82525050565b613d388161362d565b82525050565b600062ffffff82169050919050565b613d5681613d3e565b82525050565b608082016000820151613d726000850182613cfd565b506020820151613d856020850182613d20565b506040820151613d986040850182613d2f565b506060820151613dab6060850182613d4d565b50505050565b6000613dbd8383613d5c565b60808301905092915050565b6000602082019050919050565b6000613de182613cd1565b613deb8185613cdc565b9350613df683613ced565b8060005b83811015613e27578151613e0e8882613db1565b9750613e1983613dc9565b925050600181019050613dfa565b5085935050505092915050565b60006020820190508181036000830152613e4e8184613dd6565b905092915050565b60008060408385031215613e6d57613e6c61359e565b5b6000613e7b8582860161373f565b9250506020613e8c8582860161373f565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ecb8161371e565b82525050565b6000613edd8383613ec2565b60208301905092915050565b6000602082019050919050565b6000613f0182613e96565b613f0b8185613ea1565b9350613f1683613eb2565b8060005b83811015613f47578151613f2e8882613ed1565b9750613f3983613ee9565b925050600181019050613f1a565b5085935050505092915050565b60006020820190508181036000830152613f6e8184613ef6565b905092915050565b600080600060608486031215613f8f57613f8e61359e565b5b6000613f9d868287016138b9565b9350506020613fae8682870161373f565b9250506040613fbf8682870161373f565b9150509250925092565b613fd28161362d565b8114613fdd57600080fd5b50565b600081359050613fef81613fc9565b92915050565b6000806040838503121561400c5761400b61359e565b5b600061401a858286016138b9565b925050602061402b85828601613fe0565b9150509250929050565b6000806000806080858703121561404f5761404e61359e565b5b600061405d878288016138b9565b945050602061406e878288016138b9565b935050604061407f8782880161373f565b925050606085013567ffffffffffffffff8111156140a05761409f6135a3565b5b6140ac87828801613a8d565b91505092959194509250565b6080820160008201516140ce6000850182613cfd565b5060208201516140e16020850182613d20565b5060408201516140f46040850182613d2f565b5060608201516141076060850182613d4d565b50505050565b600060808201905061412260008301846140b8565b92915050565b6000806040838503121561413f5761413e61359e565b5b600061414d858286016138b9565b925050602061415e858286016138b9565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806141af57607f821691505b6020821081036141c2576141c1614168565b5b50919050565b7f77686974656c697374206d696e742072656163686564206d617820737570706c60008201527f7900000000000000000000000000000000000000000000000000000000000000602082015250565b600061422460218361366e565b915061422f826141c8565b604082019050919050565b6000602082019050818103600083015261425381614217565b9050919050565b7f6163636f756e74206973206e6f742077686974656c6973746564000000000000600082015250565b6000614290601a8361366e565b915061429b8261425a565b602082019050919050565b600060208201905081810360008301526142bf81614283565b9050919050565b7f73616c6573206973206e6f742061637469766500000000000000000000000000600082015250565b60006142fc60138361366e565b9150614307826142c6565b602082019050919050565b6000602082019050818103600083015261432b816142ef565b9050919050565b7f696e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b6000614368600e8361366e565b915061437382614332565b602082019050919050565b600060208201905081810360008301526143978161435b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006143d88261371e565b91506143e38361371e565b9250828210156143f6576143f561439e565b5b828203905092915050565b600061440c8261371e565b91506144178361371e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156144505761444f61439e565b5b828202905092915050565b7f696e76616c6964206d696e742070726963650000000000000000000000000000600082015250565b600061449160128361366e565b915061449c8261445b565b602082019050919050565b600060208201905081810360008301526144c081614484565b9050919050565b60006144d28261371e565b91506144dd8361371e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156145125761451161439e565b5b828201905092915050565b7f616d6f756e742065786365656473206d617820737570706c7900000000000000600082015250565b600061455360198361366e565b915061455e8261451d565b602082019050919050565b6000602082019050818103600083015261458281614546565b9050919050565b7f6d617820746f6b656e7320706572206163636f756e7420726561636865640000600082015250565b60006145bf601e8361366e565b91506145ca82614589565b602082019050919050565b600060208201905081810360008301526145ee816145b2565b9050919050565b60008160601b9050919050565b600061460d826145f5565b9050919050565b600061461f82614602565b9050919050565b614637614632826137a1565b614614565b82525050565b60006146498285614626565b6014820191506146598284614626565b6014820191508190509392505050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026146cb7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261468e565b6146d5868361468e565b95508019841693508086168417925050509392505050565b6000819050919050565b600061471261470d6147088461371e565b6146ed565b61371e565b9050919050565b6000819050919050565b61472c836146f7565b61474061473882614719565b84845461469b565b825550505050565b600090565b614755614748565b614760818484614723565b505050565b5b818110156147845761477960008261474d565b600181019050614766565b5050565b601f8211156147c95761479a81614669565b6147a38461467e565b810160208510156147b2578190505b6147c66147be8561467e565b830182614765565b50505b505050565b600082821c905092915050565b60006147ec600019846008026147ce565b1980831691505092915050565b600061480583836147db565b9150826002028217905092915050565b61481e82613663565b67ffffffffffffffff81111561483757614836613990565b5b6148418254614197565b61484c828285614788565b600060209050601f83116001811461487f576000841561486d578287015190505b61487785826147f9565b8655506148df565b601f19841661488d86614669565b60005b828110156148b557848901518255600182019150602085019450602081019050614890565b868310156148d257848901516148ce601f8916826147db565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f736f6c64206f7574000000000000000000000000000000000000000000000000600082015250565b600061494c60088361366e565b915061495782614916565b602082019050919050565b6000602082019050818103600083015261497b8161493f565b9050919050565b600081905092915050565b600061499882613663565b6149a28185614982565b93506149b281856020860161367f565b80840191505092915050565b60006149ca828561498d565b91506149d6828461498d565b91508190509392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614a3e60268361366e565b9150614a49826149e2565b604082019050919050565b60006020820190508181036000830152614a6d81614a31565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614aaa60208361366e565b9150614ab582614a74565b602082019050919050565b60006020820190508181036000830152614ad981614a9d565b9050919050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000614b16601c83614982565b9150614b2182614ae0565b601c82019050919050565b6000819050919050565b6000819050919050565b614b51614b4c82614b2c565b614b36565b82525050565b6000614b6282614b09565b9150614b6e8284614b40565b60208201915081905092915050565b600081519050919050565b600082825260208201905092915050565b6000614ba482614b7d565b614bae8185614b88565b9350614bbe81856020860161367f565b614bc7816136b2565b840191505092915050565b6000608082019050614be760008301876137b3565b614bf460208301866137b3565b614c01604083018561390e565b8181036060830152614c138184614b99565b905095945050505050565b600081519050614c2d816135d4565b92915050565b600060208284031215614c4957614c4861359e565b5b6000614c5784828501614c1e565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000614cc560188361366e565b9150614cd082614c8f565b602082019050919050565b60006020820190508181036000830152614cf481614cb8565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000614d31601f8361366e565b9150614d3c82614cfb565b602082019050919050565b60006020820190508181036000830152614d6081614d24565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000614dc360228361366e565b9150614dce82614d67565b604082019050919050565b60006020820190508181036000830152614df281614db6565b9050919050565b614e0281614b2c565b82525050565b600060ff82169050919050565b614e1e81614e08565b82525050565b6000608082019050614e396000830187614df9565b614e466020830186614e15565b614e536040830185614df9565b614e606060830184614df9565b9594505050505056fea264697066735822122039db33b7cf90d14ddb7d79431695c134bf013b6660ad70ca88032630f9fe1c0964736f6c634300080f0033
Verified Source Code Full Match
Compiler: v0.8.15+commit.e14f2714
EVM: london
Optimization: No
Contrato.sol 2439 lines
/**
*Submitted for verification at Etherscan.io on 2023-01-29
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}
library Strings {
bytes16 private constant _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) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @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] = _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);
}
}
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
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");
}
}
/**
* @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) {
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.
/// @solidity memory-safe-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 {
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 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));
}
}
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* 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();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @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() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 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`,
* 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,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` 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 payable;
/**
* @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 payable;
/**
* @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);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC721A
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
* starting from `_startTokenId()`.
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// 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 bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID 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`
// - [232..255] `extraData`
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 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @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 virtual 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 virtual 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 virtual 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 virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual 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 auxiliary 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 auxiliary 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 virtual {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
_packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
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: [ERC165](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.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
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, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* 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 initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `curr` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev 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;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @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) public payable virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId].value;
}
/**
* @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) public virtual override {
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForA...
// [truncated — 91847 bytes total]
Read Contract
_isMessageValid 0x3048ad2b → address
balanceOf 0x70a08231 → uint256
contractURI 0xe8a3d485 → string
explicitOwnershipOf 0xc23dc68f → tuple
explicitOwnershipsOf 0x5bbb2177 → tuple[]
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isFreePublicMinted 0x52866d0b → bool
isFreeWhitelistMinted 0x517bf683 → bool
isPublicSalesActive 0xbeab8b85 → bool
isWhitelistSalesActive 0x3a87bfe0 → bool
maxNormalMintPerAccount 0x7a7177f5 → uint256
maxSupply 0xd5abeb01 → uint256
maxWhitelistMintPerAccount 0x1c0e61a4 → uint256
name 0x06fdde03 → string
normalPrice 0x945ec9dd → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
publicEndTimestamp 0x1f682a59 → uint256
publicStartTimestamp 0x3e65408a → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
tokensOfOwner 0x8462151c → uint256[]
tokensOfOwnerIn 0x99a2557a → uint256[]
totalNormalMintPerAccount 0x93c7e987 → uint256
totalSupply 0x18160ddd → uint256
totalWhitelistMintPerAccount 0xa94ff0b1 → uint256
whitelistEndTimestamp 0x0c2cd50c → uint256
whitelistPrice 0xfc1a1c36 → uint256
whitelistStartTimestamp 0x9ecfab9b → uint256
Write Contract 20 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 tokenId
mint 0xa0712d68
uint256 _amount
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _BaseURI
setContractURI 0x938e3d7b
string _ContractURI
setMaxNormalMintPerAccount 0x1361deb3
uint256 _maxNormalMintPerAccount
setMaxSupply 0x6f8b44b0
uint256 _maxSupply
setMaxWhitelistMintPerAccount 0xfaefa870
uint256 _maxWhitelistMintPerAccount
setNormalPrice 0x10b2d71a
uint256 _normalPrice
setPublicStartTimestamp 0x70d1dec9
uint256 _startTimestamp
uint256 _endTimestamp
setWhitelistPrice 0x717d57d3
uint256 _whitelistPrice
setWhitelistStartTimestamp 0xc0218727
uint256 _startTimestamp
uint256 _endTimestamp
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistMint 0x08e3f868
bytes signature
uint256 _amount
withdrawAll 0x853828b6
No parameters
Recent Transactions
No transactions found for this address