Address Contract Verified
Address
0xA2B63e4C1ea4f494F6d63Ac1c5A673c5BcC43b6C
Balance
0 ETH
Nonce
1
Code Size
23722 bytes
Creator
0xb9B6856e...a979 at tx 0x39c48b2b...2d4e38
Indexed Transactions
0
Contract Bytecode
23722 bytes
0x608060405260043610610334575f3560e01c80638462151c116101aa578063aca8ffe7116100f6578063e985e9c511610094578063f5aa406d1161006e578063f5aa406d14610c13578063f8dd1f7614610c3b578063fc1a1c3614610c63578063fe60d12c14610c8d57610334565b8063e985e9c514610b85578063eea83a7014610bc1578063f2fde38b14610beb57610334565b8063c23dc68f116100d0578063c23dc68f14610a95578063c87b56dd14610ad1578063c884ef8314610b0d578063dc33e68114610b4957610334565b8063aca8ffe714610a29578063b007629614610a51578063b88d4fde14610a7957610334565b806399a2557a11610163578063a6c9c71c1161013d578063a6c9c71c14610973578063a7ee5eb51461099b578063a945bf80146109d7578063aafecbc014610a0157610334565b806399a2557a146108e75780639e1c944014610923578063a22cb4651461094b57610334565b80638462151c146107da578063858d8a21146108165780638da5cb5b1461083e57806390aa0b0f1461086857806395d89b4114610893578063993cb902146108bd57610334565b80633c90ab79116102845780635bbb21771161022257806370a08231116101fc57806370a0823114610722578063715018a61461075e5780637bb10e6514610774578063823f82c2146107b057610334565b80635bbb21771461066e5780636352211e146106aa5780637031a89f146106e657610334565b806345c0f5331161025e57806345c0f533146105a45780634d5963f4146105ce578063553144d31461060a57806355f804b31461064657610334565b80633c90ab79146105365780633ccfd60b1461057257806342842e0e1461058857610334565b806321b97f20116102f15780632904e6d9116102cb5780632904e6d9146104aa5780632d14c593146104c65780632db11544146104f0578063386bfc981461050c57610334565b806321b97f201461044a57806322d5274a1461047257806323b872dd1461048e57610334565b806301ffc9a71461033857806306fdde0314610374578063081812fc1461039e578063095ea7b3146103da57806314ea35e7146103f657806318160ddd14610420575b5f80fd5b348015610343575f80fd5b5061035e600480360381019061035991906140cd565b610cb7565b60405161036b9190614112565b60405180910390f35b34801561037f575f80fd5b50610388610d48565b60405161039591906141b5565b60405180910390f35b3480156103a9575f80fd5b506103c460048036038101906103bf9190614208565b610dd8565b6040516103d19190614272565b60405180910390f35b6103f460048036038101906103ef91906142b5565b610e31565b005b348015610401575f80fd5b5061040a610e41565b604051610417919061430b565b60405180910390f35b34801561042b575f80fd5b50610434610e47565b6040516104419190614333565b60405180910390f35b348015610455575f80fd5b50610470600480360381019061046b9190614376565b610e5c565b005b61048c60048036038101906104879190614208565b610e6e565b005b6104a860048036038101906104a391906143a1565b61117e565b005b6104c460048036038101906104bf9190614452565b611429565b005b3480156104d1575f80fd5b506104da611704565b6040516104e79190614112565b60405180910390f35b61050a60048036038101906105059190614208565b611716565b005b348015610517575f80fd5b50610520611955565b60405161052d919061430b565b60405180910390f35b348015610541575f80fd5b5061055c600480360381019061055791906144af565b61195b565b6040516105699190614591565b60405180910390f35b34801561057d575f80fd5b50610586611b61565b005b6105a2600480360381019061059d91906143a1565b611bf4565b005b3480156105af575f80fd5b506105b8611c13565b6040516105c59190614333565b60405180910390f35b3480156105d9575f80fd5b506105f460048036038101906105ef91906144af565b611c19565b6040516106019190614591565b60405180910390f35b348015610615575f80fd5b50610630600480360381019061062b9190614208565b611e1f565b60405161063d9190614112565b60405180910390f35b348015610651575f80fd5b5061066c60048036038101906106679190614606565b611e45565b005b348015610679575f80fd5b50610694600480360381019061068f91906146a6565b611e63565b6040516106a19190614849565b60405180910390f35b3480156106b5575f80fd5b506106d060048036038101906106cb9190614208565b611ebf565b6040516106dd9190614272565b60405180910390f35b3480156106f1575f80fd5b5061070c60048036038101906107079190614208565b611ed0565b6040516107199190614112565b60405180910390f35b34801561072d575f80fd5b50610748600480360381019061074391906144af565b611eed565b6040516107559190614333565b60405180910390f35b348015610769575f80fd5b50610772611f81565b005b34801561077f575f80fd5b5061079a60048036038101906107959190614208565b611f94565b6040516107a79190614112565b60405180910390f35b3480156107bb575f80fd5b506107c4611fba565b6040516107d19190614272565b60405180910390f35b3480156107e5575f80fd5b5061080060048036038101906107fb91906144af565b611fd2565b60405161080d9190614591565b60405180910390f35b348015610821575f80fd5b5061083c600480360381019061083791906146a6565b61205f565b005b348015610849575f80fd5b5061085261232a565b60405161085f9190614272565b60405180910390f35b348015610873575f80fd5b5061087c612352565b60405161088a929190614869565b60405180910390f35b34801561089e575f80fd5b506108a761237b565b6040516108b491906141b5565b60405180910390f35b3480156108c8575f80fd5b506108d161240b565b6040516108de9190614272565b60405180910390f35b3480156108f2575f80fd5b5061090d60048036038101906109089190614890565b612423565b60405161091a9190614591565b60405180910390f35b34801561092e575f80fd5b50610949600480360381019061094491906146a6565b612533565b005b348015610956575f80fd5b50610971600480360381019061096c919061490a565b6127f0565b005b34801561097e575f80fd5b5061099960048036038101906109949190614948565b6128f6565b005b3480156109a6575f80fd5b506109c160048036038101906109bc9190614208565b61295c565b6040516109ce9190614112565b60405180910390f35b3480156109e2575f80fd5b506109eb612979565b6040516109f89190614995565b60405180910390f35b348015610a0c575f80fd5b50610a276004803603810190610a2291906149ae565b612993565b005b348015610a34575f80fd5b50610a4f6004803603810190610a4a9190614208565b612cdb565b005b348015610a5c575f80fd5b50610a776004803603810190610a7291906149f9565b612d82565b005b610a936004803603810190610a8e9190614b5f565b612e4f565b005b348015610aa0575f80fd5b50610abb6004803603810190610ab69190614208565b612ea0565b604051610ac89190614c32565b60405180910390f35b348015610adc575f80fd5b50610af76004803603810190610af29190614208565b612eec565b604051610b0491906141b5565b60405180910390f35b348015610b18575f80fd5b50610b336004803603810190610b2e91906144af565b612f66565b604051610b409190614112565b60405180910390f35b348015610b54575f80fd5b50610b6f6004803603810190610b6a91906144af565b612f83565b604051610b7c9190614333565b60405180910390f35b348015610b90575f80fd5b50610bab6004803603810190610ba69190614c4b565b612f94565b604051610bb89190614112565b60405180910390f35b348015610bcc575f80fd5b50610bd5613022565b604051610be29190614272565b60405180910390f35b348015610bf6575f80fd5b50610c116004803603810190610c0c91906144af565b61303a565b005b348015610c1e575f80fd5b50610c396004803603810190610c349190614376565b6130bc565b005b348015610c46575f80fd5b50610c616004803603810190610c5c9190614208565b6130ce565b005b348015610c6e575f80fd5b50610c77613137565b604051610c849190614995565b60405180910390f35b348015610c98575f80fd5b50610ca1613151565b604051610cae9190614333565b60405180910390f35b5f6301ffc9a760e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d1157506380ac58cd60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610d415750635b5e139f60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b606060028054610d5790614cb6565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8390614cb6565b8015610dce5780601f10610da557610100808354040283529160200191610dce565b820191905f5260205f20905b815481529060010190602001808311610db157829003601f168201915b5050505050905090565b5f610de282613157565b610df757610df663cf4700e460e01b6131b1565b5b60065f8381526020019081526020015f205f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b610e3d828260016131b9565b5050565b600e5481565b5f610e506132e3565b6001545f540303905090565b610e646132ec565b80600e8190555050565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610edc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed390614d30565b60405180910390fd5b5f1515600b5f9054906101000a900460ff16151514610f30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2790614d98565b60405180910390fd5b5f600f6040518060400160405290815f82015f9054906101000a900460ff161515151581526020015f820160019054906101000a900460ff16151515158152505090505f815f015190506001151581151514610fc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb890614e26565b60405180910390fd5b5f73f91523bc0ffa151abd971f1b11d2567d4167db3e73ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b815260040161100f9190614272565b602060405180830381865afa15801561102a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061104e9190614e58565b90506007841115611094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108b90614ecd565b60405180910390fd5b600c54600a546110a49190614f18565b846110ad610e47565b6110b79190614f4b565b11156110f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ef90614fc8565b60405180910390fd5b5f811161113a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113190615030565b60405180910390fd5b611144338561336a565b61117884600b60099054906101000a900467ffffffffffffffff1667ffffffffffffffff16611173919061504e565b613387565b50505050565b5f61118882613425565b905073ffffffffffffffffffffffffffffffffffffffff8473ffffffffffffffffffffffffffffffffffffffff161693508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146111fd576111fc63a114810060e01b6131b1565b5b5f80611208846134d2565b9150915061121e81876112196134f5565b6134fc565b611249576112338661122e6134f5565b612f94565b611248576112476359c896be60e01b6131b1565b5b5b611256868686600161353f565b8015611260575f82555b60055f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8154600190039190508190555060055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f81546001019190508190555061132885611304888887613545565b7c02000000000000000000000000000000000000000000000000000000001761356c565b60045f8681526020019081526020015f20819055505f7c02000000000000000000000000000000000000000000000000000000008416036113a4575f6001850190505f60045f8381526020019081526020015f2054036113a2575f5481146113a1578360045f8381526020019081526020015f20819055505b5b505b5f73ffffffffffffffffffffffffffffffffffffffff8673ffffffffffffffffffffffffffffffffffffffff161690508481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f80a45f81036114135761141263ea553b3460e01b6131b1565b5b6114208787876001613596565b50505050505050565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614611497576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148e90614d30565b60405180910390fd5b5f1515600b5f9054906101000a900460ff161515146114eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e290614d98565b60405180910390fd5b5f600f6040518060400160405290815f82015f9054906101000a900460ff161515151581526020015f820160019054906101000a900460ff16151515158152505090505f815f01519050600115158115151461157c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157390614e26565b60405180910390fd5b600c54600a5461158c9190614f18565b83611595610e47565b61159f9190614f4b565b11156115e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d7906150d9565b60405180910390fd5b6007831115611624576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161b90615141565b60405180910390fd5b6001151561167d8686808060200260200160405190810160405280939291908181526020018383602002808284375f81840152601f19601f82011690508083019250505050505050600d546116783361359c565b6135bd565b1515146116bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b6906151a9565b60405180910390fd5b6116c9338461336a565b6116fd83600b60099054906101000a900467ffffffffffffffff1667ffffffffffffffff166116f8919061504e565b613387565b5050505050565b600b5f9054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614611784576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177b90614d30565b60405180910390fd5b5f1515600b5f9054906101000a900460ff161515146117d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117cf90614d98565b60405180910390fd5b5f600f6040518060400160405290815f82015f9054906101000a900460ff161515151581526020015f820160019054906101000a900460ff16151515158152505090505f81602001519050600115158115151461186a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186190615211565b60405180910390fd5b600c54600a5461187a9190614f18565b83611883610e47565b61188d9190614f4b565b11156118ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c5906150d9565b60405180910390fd5b6007831115611912576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190990615279565b60405180910390fd5b61191c338461336a565b61195083600b60019054906101000a900467ffffffffffffffff1667ffffffffffffffff1661194b919061504e565b613387565b505050565b600d5481565b60605f73cba5ac55d5e1c56cf16482456ad0a47f27d38a6273ffffffffffffffffffffffffffffffffffffffff16638462151c846040518263ffffffff1660e01b81526004016119ab9190614272565b5f60405180830381865afa1580156119c5573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906119ed9190615357565b90505f815190505f805b82811015611a62575f848281518110611a1357611a1261539e565b5b602002602001015190505f151560125f8381526020019081526020015f205f9054906101000a900460ff16151503611a54578280611a50906153cb565b9350505b5080806001019150506119f7565b505f8167ffffffffffffffff811115611a7e57611a7d614a3b565b5b604051908082528060200260200182016040528015611aac5781602001602082028036833780820191505090505b5090505f91505f5b83811015611b54575f151560125f878481518110611ad557611ad461539e565b5b602002602001015181526020019081526020015f205f9054906101000a900460ff16151503611b4757848181518110611b1157611b1061539e565b5b6020026020010151828481518110611b2c57611b2b61539e565b5b6020026020010181815250508280611b43906153cb565b9350505b8080600101915050611ab4565b5080945050505050919050565b611b696132ec565b611b716135d3565b5f611b7a61232a565b73ffffffffffffffffffffffffffffffffffffffff1647604051611b9d9061543f565b5f6040518083038185875af1925050503d805f8114611bd7576040519150601f19603f3d011682016040523d82523d5f602084013e611bdc565b606091505b5050905080611be9575f80fd5b50611bf2613622565b565b611c0e83838360405180602001604052805f815250612e4f565b505050565b600a5481565b60605f73bea8123277142de42571f1fac045225a1d34797773ffffffffffffffffffffffffffffffffffffffff16638462151c846040518263ffffffff1660e01b8152600401611c699190614272565b5f60405180830381865afa158015611c83573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f82011682018060405250810190611cab9190615357565b90505f815190505f805b82811015611d20575f848281518110611cd157611cd061539e565b5b602002602001015190505f151560115f8381526020019081526020015f205f9054906101000a900460ff16151503611d12578280611d0e906153cb565b9350505b508080600101915050611cb5565b505f8167ffffffffffffffff811115611d3c57611d3b614a3b565b5b604051908082528060200260200182016040528015611d6a5781602001602082028036833780820191505090505b5090505f91505f5b83811015611e12575f151560115f878481518110611d9357611d9261539e565b5b602002602001015181526020019081526020015f205f9054906101000a900460ff16151503611e0557848181518110611dcf57611dce61539e565b5b6020026020010151828481518110611dea57611de961539e565b5b6020026020010181815250508280611e01906153cb565b9350505b8080600101915050611d72565b5080945050505050919050565b5f60115f8381526020019081526020015f205f9054906101000a900460ff169050919050565b611e4d6132ec565b818160149182611e5e9291906155fa565b505050565b6060805f84849050905060405191508082528060051b90508060208301016040525b5f8114611eb4575f6020820391508186013590505f611ea382612ea0565b905080836020860101525050611e85565b819250505092915050565b5f611ec982613425565b9050919050565b6011602052805f5260405f205f915054906101000a900460ff1681565b5f8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611f3257611f31638f4eb60460e01b6131b1565b5b67ffffffffffffffff60055f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054169050919050565b611f896132ec565b611f925f61362c565b565b5f60125f8381526020019081526020015f205f9054906101000a900460ff169050919050565b73cba5ac55d5e1c56cf16482456ad0a47f27d38a6281565b60605f611fde83611eed565b9050606060405190506001820160051b81016040528181525f805f6120016132e3565b90505b848214612052575f612015826136ef565b905060408101516120465780511561202c57805193505b87841860601b61204557600183019250818360051b8601525b5b60018201915050612004565b5082945050505050919050565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16146120cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c490614d30565b60405180910390fd5b5f1515600b5f9054906101000a900460ff16151514612121576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211890614d98565b60405180910390fd5b5f8282905090505f600f6040518060400160405290815f82015f9054906101000a900460ff161515151581526020015f820160019054906101000a900460ff16151515158152505090505f815f0151905060011515811515146121b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b090614e26565b60405180910390fd5b60018310156121fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f490615711565b60405180910390fd5b600a5483612209610e47565b6122139190614f4b565b1115612254576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161224b906150d9565b60405180910390fd5b61225e8585613718565b61229d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229490615779565b60405180910390fd5b5f6122a88686613869565b90505f5b8481101561230357600160125f8989858181106122cc576122cb61539e565b5b9050602002013581526020019081526020015f205f6101000a81548160ff02191690831515021790555080806001019150506122ac565b5061230e338261336a565b80600c5461231c9190614f18565b600c81905550505050505050565b5f60085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600f805f015f9054906101000a900460ff1690805f0160019054906101000a900460ff16905082565b60606003805461238a90614cb6565b80601f01602080910402602001604051908101604052809291908181526020018280546123b690614cb6565b80156124015780601f106123d857610100808354040283529160200191612401565b820191905f5260205f20905b8154815290600101906020018083116123e457829003601f168201915b5050505050905090565b73bea8123277142de42571f1fac045225a1d34797781565b606081831061243d5761243c6332c1995a60e01b6131b1565b5b6124456132e3565b831015612457576124546132e3565b92505b5f612460613918565b905080831061246d578092505b60605f61247987611eed565b90505f858710905080820291505f821461252557818787031161249c5786860391505b60405192506001820160051b83016040525f6124b788612ea0565b90505f81604001516124ca57815f015190505b5f5b6124d58a6136ef565b92506040830151612506578251156124ec57825191505b8a821860601b61250557600181019050898160051b8701525b5b60018a019950888a148061251957508481145b156124cc578086525050505b829450505050509392505050565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16146125a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161259890614d30565b60405180910390fd5b5f1515600b5f9054906101000a900460ff161515146125f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125ec90614d98565b60405180910390fd5b5f8282905090505f600f6040518060400160405290815f82015f9054906101000a900460ff161515151581526020015f820160019054906101000a900460ff16151515158152505090505f815f01519050600115158115151461268d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161268490614e26565b60405180910390fd5b60018310156126d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c890615711565b60405180910390fd5b600a54836126dd610e47565b6126e79190614f4b565b1115612728576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161271f906150d9565b60405180910390fd5b6127328585613920565b612771576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276890615779565b60405180910390fd5b5f5b838110156127ca57600160115f8888858181106127935761279261539e565b5b9050602002013581526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050612773565b506127d5338461336a565b82600c546127e39190614f18565b600c819055505050505050565b8060075f6127fc6134f5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff166128a56134f5565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516128ea9190614112565b60405180910390a35050565b6128fe6132ec565b60405180604001604052808315158152602001821515815250600f5f820151815f015f6101000a81548160ff0219169083151502179055506020820151815f0160016101000a81548160ff0219169083151502179055509050505050565b6012602052805f5260405f205f915054906101000a900460ff1681565b600b60019054906101000a900467ffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614612a01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129f890614d30565b60405180910390fd5b5f1515600b5f9054906101000a900460ff16151514612a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4c90614d98565b60405180910390fd5b5f600f6040518060400160405290815f82015f9054906101000a900460ff161515151581526020015f820160019054906101000a900460ff16151515158152505090505f815f015190506001151581151514612ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612add90614e26565b60405180910390fd5b600c54600a54612af69190614f18565b6001612b00610e47565b612b0a9190614f4b565b1115612b4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b42906150d9565b60405180910390fd5b5f151560105f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16151514612bda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd1906157e1565b60405180910390fd5b60011515612c338585808060200260200160405190810160405280939291908181526020018383602002808284375f81840152601f19601f82011690508083019250505050505050600e54612c2e3361359c565b6135bd565b151514612c75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c6c906151a9565b60405180910390fd5b600160105f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550612cd533600161336a565b50505050565b612ce36132ec565b600a54612cee610e47565b10612d2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d2590615849565b60405180910390fd5b612d36610e47565b811015612d78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d6f906158b1565b60405180910390fd5b80600a8190555050565b612d8a6132ec565b5f1515600b5f9054906101000a900460ff16151514612dde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dd590614d98565b60405180910390fd5b600c54600a54612dee9190614f18565b82612df7610e47565b612e019190614f4b565b10612e41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e3890614fc8565b60405180910390fd5b612e4b818361336a565b5050565b612e5a84848461117e565b5f8373ffffffffffffffffffffffffffffffffffffffff163b14612e9a57612e8484848484613a71565b612e9957612e9863d1a57ed660e01b6131b1565b5b5b50505050565b612ea861401c565b612eb06132e3565b8210612ee757612ebe613918565b821015612ee657612ece826136ef565b90508060400151612ee557612ee282613b9b565b90505b5b5b919050565b6060612ef782613157565b612f0c57612f0b63a14c4b5060e01b6131b1565b5b5f612f15613bbb565b90505f815103612f335760405180602001604052805f815250612f5e565b80612f3d84613c4b565b604051602001612f4e929190615909565b6040516020818303038152906040525b915050919050565b6010602052805f5260405f205f915054906101000a900460ff1681565b5f612f8d82613c9a565b9050919050565b5f60075f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b73f91523bc0ffa151abd971f1b11d2567d4167db3e81565b6130426132ec565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036130b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130a79061599c565b60405180910390fd5b6130b98161362c565b50565b6130c46132ec565b80600d8190555050565b6130d66132ec565b61081d811461311a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161311190615a04565b60405180910390fd5b6001600b5f6101000a81548160ff02191690831515021790555050565b600b60099054906101000a900467ffffffffffffffff1681565b600c5481565b5f816131616132e3565b1115801561316f57505f5482105b80156131aa57505f7c010000000000000000000000000000000000000000000000000000000060045f8581526020019081526020015f205416145b9050919050565b805f5260045ffd5b5f6131c383611ebf565b905081801561320557508073ffffffffffffffffffffffffffffffffffffffff166131ec6134f5565b73ffffffffffffffffffffffffffffffffffffffff1614155b156132315761321b816132166134f5565b612f94565b6132305761322f63cfb3b94260e01b6131b1565b5b5b8360065f8581526020019081526020015f205f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550828473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a450505050565b5f601354905090565b6132f4613cee565b73ffffffffffffffffffffffffffffffffffffffff1661331261232a565b73ffffffffffffffffffffffffffffffffffffffff1614613368576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161335f90615a6c565b60405180910390fd5b565b613383828260405180602001604052805f815250613cf5565b5050565b803410156133ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133c190615ad4565b60405180910390fd5b80341115613422573373ffffffffffffffffffffffffffffffffffffffff166108fc82346133f89190614f18565b90811502906040515f60405180830381858888f19350505050158015613420573d5f803e3d5ffd5b505b50565b5f8161342f6132e3565b116134bc5760045f8381526020019081526020015f205490505f7c01000000000000000000000000000000000000000000000000000000008216036134bb575f81036134b6575f54821061348e5761348d63df2d9b4260e01b6131b1565b5b5b60045f836001900393508381526020019081526020015f205490505f81036134cd5761348f565b6134cd565b5b6134cc63df2d9b4260e01b6131b1565b5b919050565b5f805f60065f8581526020019081526020015f2090508092508254915050915091565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff8316925073ffffffffffffffffffffffffffffffffffffffff821691508382148383141790509392505050565b50505050565b5f8060e883901c905060e861355b868684613d74565b62ffffff16901b9150509392505050565b5f73ffffffffffffffffffffffffffffffffffffffff83169250814260a01b178317905092915050565b50505050565b5f8173ffffffffffffffffffffffffffffffffffffffff165f1b9050919050565b5f826135c98584613d7c565b1490509392505050565b600260095403613618576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161360f90615b3c565b60405180910390fd5b6002600981905550565b6001600981905550565b5f60085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160085f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6136f761401c565b61371160045f8481526020019081526020015f2054613dca565b9050919050565b5f808383905090505f805f5b83811015613850575f61374f8888848181106137435761374261539e565b5b90506020020135611f94565b905080613842575f73cba5ac55d5e1c56cf16482456ad0a47f27d38a6273ffffffffffffffffffffffffffffffffffffffff16636352211e8a8a8681811061379a5761379961539e565b5b905060200201356040518263ffffffff1660e01b81526004016137bd9190614333565b602060405180830381865afa1580156137d8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137fc9190615b6e565b90503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361384057848061383c906153cb565b9550505b505b508080600101915050613724565b5081830361385d57600190505b80935050505092915050565b5f80603290505f60fa90505f805f90505b8686905081101561390b57838787838181106138995761389861539e565b5b90506020020135116138b9576004826138b29190614f4b565b91506138fe565b828787838181106138cd576138cc61539e565b5b90506020020135116138ed576002826138e69190614f4b565b91506138fd565b6001826138fa9190614f4b565b91505b5b808060010191505061387a565b5080935050505092915050565b5f8054905090565b5f808383905090505f805f5b83811015613a58575f61395788888481811061394b5761394a61539e565b5b90506020020135611e1f565b905080613a4a575f73bea8123277142de42571f1fac045225a1d34797773ffffffffffffffffffffffffffffffffffffffff16636352211e8a8a868181106139a2576139a161539e565b5b905060200201356040518263ffffffff1660e01b81526004016139c59190614333565b602060405180830381865afa1580156139e0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a049190615b6e565b90503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603613a48578480613a44906153cb565b9550505b505b50808060010191505061392c565b50818303613a6557600190505b80935050505092915050565b5f8373ffffffffffffffffffffffffffffffffffffffff1663150b7a02613a966134f5565b8786866040518563ffffffff1660e01b8152600401613ab89493929190615beb565b6020604051808303815f875af1925050508015613af357506040513d601f19601f82011682018060405250810190613af09190615c49565b60015b613b48573d805f8114613b21576040519150601f19603f3d011682016040523d82523d5f602084013e613b26565b606091505b505f815103613b4057613b3f63d1a57ed660e01b6131b1565b5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b613ba361401c565b613bb4613baf83613425565b613dca565b9050919050565b606060148054613bca90614cb6565b80601f0160208091040260200160405190810160405280929190818152602001828054613bf690614cb6565b8015613c415780601f10613c1857610100808354040283529160200191613c41565b820191905f5260205f20905b815481529060010190602001808311613c2457829003601f168201915b5050505050905090565b606060a060405101806040526020810391505f825281835b600115613c8557600184039350600a81066030018453600a8104905080613c63575b50828103602084039350808452505050919050565b5f67ffffffffffffffff604060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054901c169050919050565b5f33905090565b613cff8383613e7e565b5f8373ffffffffffffffffffffffffffffffffffffffff163b14613d6f575f805490505f83820390505b613d3b5f868380600101945086613a71565b613d5057613d4f63d1a57ed660e01b6131b1565b5b818110613d2957815f5414613d6c57613d6b5f60e01b6131b1565b5b50505b505050565b5f9392505050565b5f808290505f5b8451811015613dbf57613db082868381518110613da357613da261539e565b5b6020026020010151613fcf565b91508080600101915050613d83565b508091505092915050565b613dd261401c565b81815f019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060a082901c816020019067ffffffffffffffff16908167ffffffffffffffff16815250505f7c01000000000000000000000000000000000000000000000000000000008316141581604001901515908115158152505060e882901c816060019062ffffff16908162ffffff1681525050919050565b5f805490505f8203613e9b57613e9a63b562e8dd60e01b6131b1565b5b613ea75f84838561353f565b613ec583613eb65f865f613545565b613ebf85613ff9565b1761356c565b60045f8381526020019081526020015f2081905550600160406001901b17820260055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505f73ffffffffffffffffffffffffffffffffffffffff8473ffffffffffffffffffffffffffffffffffffffff161690505f8103613f7657613f75632e07630060e01b6131b1565b5b5f83830190505f8390505b80835f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f80a4818160010191508103613f8157815f81905550505050613fca5f848385613596565b505050565b5f818310613fe657613fe18284614008565b613ff1565b613ff08383614008565b5b905092915050565b5f6001821460e11b9050919050565b5f825f528160205260405f20905092915050565b60405180608001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f67ffffffffffffffff1681526020015f151581526020015f62ffffff1681525090565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6140ac81614078565b81146140b6575f80fd5b50565b5f813590506140c7816140a3565b92915050565b5f602082840312156140e2576140e1614070565b5b5f6140ef848285016140b9565b91505092915050565b5f8115159050919050565b61410c816140f8565b82525050565b5f6020820190506141255f830184614103565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015614162578082015181840152602081019050614147565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6141878261412b565b6141918185614135565b93506141a1818560208601614145565b6141aa8161416d565b840191505092915050565b5f6020820190508181035f8301526141cd818461417d565b905092915050565b5f819050919050565b6141e7816141d5565b81146141f1575f80fd5b50565b5f81359050614202816141de565b92915050565b5f6020828403121561421d5761421c614070565b5b5f61422a848285016141f4565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61425c82614233565b9050919050565b61426c81614252565b82525050565b5f6020820190506142855f830184614263565b92915050565b61429481614252565b811461429e575f80fd5b50565b5f813590506142af8161428b565b92915050565b5f80604083850312156142cb576142ca614070565b5b5f6142d8858286016142a1565b92505060206142e9858286016141f4565b9150509250929050565b5f819050919050565b614305816142f3565b82525050565b5f60208201905061431e5f8301846142fc565b92915050565b61432d816141d5565b82525050565b5f6020820190506143465f830184614324565b92915050565b614355816142f3565b811461435f575f80fd5b50565b5f813590506143708161434c565b92915050565b5f6020828403121561438b5761438a614070565b5b5f61439884828501614362565b91505092915050565b5f805f606084860312156143b8576143b7614070565b5b5f6143c5868287016142a1565b93505060206143d6868287016142a1565b92505060406143e7868287016141f4565b9150509250925092565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112614412576144116143f1565b5b8235905067ffffffffffffffff81111561442f5761442e6143f5565b5b60208301915083602082028301111561444b5761444a6143f9565b5b9250929050565b5f805f6040848603121561446957614468614070565b5b5f84013567ffffffffffffffff81111561448657614485614074565b5b614492868287016143fd565b935093505060206144a5868287016141f4565b9150509250925092565b5f602082840312156144c4576144c3614070565b5b5f6144d1848285016142a1565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61450c816141d5565b82525050565b5f61451d8383614503565b60208301905092915050565b5f602082019050919050565b5f61453f826144da565b61454981856144e4565b9350614554836144f4565b805f5b8381101561458457815161456b8882614512565b975061457683614529565b925050600181019050614557565b5085935050505092915050565b5f6020820190508181035f8301526145a98184614535565b905092915050565b5f8083601f8401126145c6576145c56143f1565b5b8235905067ffffffffffffffff8111156145e3576145e26143f5565b5b6020830191508360018202830111156145ff576145fe6143f9565b5b9250929050565b5f806020838503121561461c5761461b614070565b5b5f83013567ffffffffffffffff81111561463957614638614074565b5b614645858286016145b1565b92509250509250929050565b5f8083601f840112614666576146656143f1565b5b8235905067ffffffffffffffff811115614683576146826143f5565b5b60208301915083602082028301111561469f5761469e6143f9565b5b9250929050565b5f80602083850312156146bc576146bb614070565b5b5f83013567ffffffffffffffff8111156146d9576146d8614074565b5b6146e585828601614651565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61472381614252565b82525050565b5f67ffffffffffffffff82169050919050565b61474581614729565b82525050565b614754816140f8565b82525050565b5f62ffffff82169050919050565b6147718161475a565b82525050565b608082015f82015161478b5f85018261471a565b50602082015161479e602085018261473c565b5060408201516147b1604085018261474b565b5060608201516147c46060850182614768565b50505050565b5f6147d58383614777565b60808301905092915050565b5f602082019050919050565b5f6147f7826146f1565b61480181856146fb565b935061480c8361470b565b805f5b8381101561483c57815161482388826147ca565b975061482e836147e1565b92505060018101905061480f565b5085935050505092915050565b5f6020820190508181035f83015261486181846147ed565b905092915050565b5f60408201905061487c5f830185614103565b6148896020830184614103565b9392505050565b5f805f606084860312156148a7576148a6614070565b5b5f6148b4868287016142a1565b93505060206148c5868287016141f4565b92505060406148d6868287016141f4565b9150509250925092565b6148e9816140f8565b81146148f3575f80fd5b50565b5f81359050614904816148e0565b92915050565b5f80604083850312156149205761491f614070565b5b5f61492d858286016142a1565b925050602061493e858286016148f6565b9150509250929050565b5f806040838503121561495e5761495d614070565b5b5f61496b858286016148f6565b925050602061497c858286016148f6565b9150509250929050565b61498f81614729565b82525050565b5f6020820190506149a85f830184614986565b92915050565b5f80602083850312156149c4576149c3614070565b5b5f83013567ffffffffffffffff8111156149e1576149e0614074565b5b6149ed858286016143fd565b92509250509250929050565b5f8060408385031215614a0f57614a0e614070565b5b5f614a1c858286016141f4565b9250506020614a2d858286016142a1565b9150509250929050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b614a718261416d565b810181811067ffffffffffffffff82111715614a9057614a8f614a3b565b5b80604052505050565b5f614aa2614067565b9050614aae8282614a68565b919050565b5f67ffffffffffffffff821115614acd57614acc614a3b565b5b614ad68261416d565b9050602081019050919050565b828183375f83830152505050565b5f614b03614afe84614ab3565b614a99565b905082815260208101848484011115614b1f57614b1e614a37565b5b614b2a848285614ae3565b509392505050565b5f82601f830112614b4657614b456143f1565b5b8135614b56848260208601614af1565b91505092915050565b5f805f8060808587031215614b7757614b76614070565b5b5f614b84878288016142a1565b9450506020614b95878288016142a1565b9350506040614ba6878288016141f4565b925050606085013567ffffffffffffffff811115614bc757614bc6614074565b5b614bd387828801614b32565b91505092959194509250565b608082015f820151614bf35f85018261471a565b506020820151614c06602085018261473c565b506040820151614c19604085018261474b565b506060820151614c2c6060850182614768565b50505050565b5f608082019050614c455f830184614bdf565b92915050565b5f8060408385031215614c6157614c60614070565b5b5f614c6e858286016142a1565b9250506020614c7f858286016142a1565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680614ccd57607f821691505b602082108103614ce057614cdf614c89565b5b50919050565b7f5468652063616c6c657220697320616e6f7468657220636f6e747261637400005f82015250565b5f614d1a601e83614135565b9150614d2582614ce6565b602082019050919050565b5f6020820190508181035f830152614d4781614d0e565b9050919050565b7f53616c652069732073746f7065640000000000000000000000000000000000005f82015250565b5f614d82600e83614135565b9150614d8d82614d4e565b602082019050919050565b5f6020820190508181035f830152614daf81614d76565b9050919050565b7f507269766174652073616c6520686173206e6f7420616c7265616479207374615f8201527f7274656400000000000000000000000000000000000000000000000000000000602082015250565b5f614e10602483614135565b9150614e1b82614db6565b604082019050919050565b5f6020820190508181035f830152614e3d81614e04565b9050919050565b5f81519050614e52816141de565b92915050565b5f60208284031215614e6d57614e6c614070565b5b5f614e7a84828501614e44565b91505092915050565b7f37206d617820746f6b656e7300000000000000000000000000000000000000005f82015250565b5f614eb7600c83614135565b9150614ec282614e83565b602082019050919050565b5f6020820190508181035f830152614ee481614eab565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f614f22826141d5565b9150614f2d836141d5565b9250828203905081811115614f4557614f44614eeb565b5b92915050565b5f614f55826141d5565b9150614f60836141d5565b9250828201905080821115614f7857614f77614eeb565b5b92915050565b7f4578636565647320636f6c6c656374696f6e2073697a650000000000000000005f82015250565b5f614fb2601783614135565b9150614fbd82614f7e565b602082019050919050565b5f6020820190508181035f830152614fdf81614fa6565b9050919050565b7f4e6f742077686974656c697374656400000000000000000000000000000000005f82015250565b5f61501a600f83614135565b915061502582614fe6565b602082019050919050565b5f6020820190508181035f8301526150478161500e565b9050919050565b5f615058826141d5565b9150615063836141d5565b9250828202615071816141d5565b9150828204841483151761508857615087614eeb565b5b5092915050565b7f72656163686564206d617820737570706c7900000000000000000000000000005f82015250565b5f6150c3601283614135565b91506150ce8261508f565b602082019050919050565b5f6020820190508181035f8301526150f0816150b7565b9050919050565b7f65786365656473206d696e7420616c6c6f77616e6365000000000000000000005f82015250565b5f61512b601683614135565b9150615136826150f7565b602082019050919050565b5f6020820190508181035f8301526151588161511f565b9050919050565b7f696e76616c69642070726f6f66000000000000000000000000000000000000005f82015250565b5f615193600d83614135565b915061519e8261515f565b602082019050919050565b5f6020820190508181035f8301526151c081615187565b9050919050565b7f53616c6520686173206e6f7420616c72656164792073746172746564000000005f82015250565b5f6151fb601c83614135565b9150615206826151c7565b602082019050919050565b5f6020820190508181035f830152615228816151ef565b9050919050565b7f746f6f206d616e792070657220747800000000000000000000000000000000005f82015250565b5f615263600f83614135565b915061526e8261522f565b602082019050919050565b5f6020820190508181035f83015261529081615257565b9050919050565b5f67ffffffffffffffff8211156152b1576152b0614a3b565b5b602082029050602081019050919050565b5f6152d46152cf84615297565b614a99565b905080838252602082019050602084028301858111156152f7576152f66143f9565b5b835b81811015615320578061530c8882614e44565b8452602084019350506020810190506152f9565b5050509392505050565b5f82601f83011261533e5761533d6143f1565b5b815161534e8482602086016152c2565b91505092915050565b5f6020828403121561536c5761536b614070565b5b5f82015167ffffffffffffffff81111561538957615388614074565b5b6153958482850161532a565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f6153d5826141d5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361540757615406614eeb565b5b600182019050919050565b5f81905092915050565b50565b5f61542a5f83615412565b91506154358261541c565b5f82019050919050565b5f6154498261541f565b9150819050919050565b5f82905092915050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026154b97fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261547e565b6154c3868361547e565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6154fe6154f96154f4846141d5565b6154db565b6141d5565b9050919050565b5f819050919050565b615517836154e4565b61552b61552382615505565b84845461548a565b825550505050565b5f90565b61553f615533565b61554a81848461550e565b505050565b5b8181101561556d576155625f82615537565b600181019050615550565b5050565b601f8211156155b2576155838161545d565b61558c8461546f565b8101602085101561559b578190505b6155af6155a78561546f565b83018261554f565b50505b505050565b5f82821c905092915050565b5f6155d25f19846008026155b7565b1980831691505092915050565b5f6155ea83836155c3565b9150826002028217905092915050565b6156048383615453565b67ffffffffffffffff81111561561d5761561c614a3b565b5b6156278254614cb6565b615632828285615571565b5f601f83116001811461565f575f841561564d578287013590505b61565785826155df565b8655506156be565b601f19841661566d8661545d565b5f5b828110156156945784890135825560018201915060208501945060208101905061566f565b868310156156b157848901356156ad601f8916826155c3565b8355505b6001600288020188555050505b50505050505050565b7f4e6f206964732070726f766964656400000000000000000000000000000000005f82015250565b5f6156fb600f83614135565b9150615706826156c7565b602082019050919050565b5f6020820190508181035f830152615728816156ef565b9050919050565b7f4e6f742061206d696e7461626c6520636f6d62696e6174696f6e0000000000005f82015250565b5f615763601a83614135565b915061576e8261572f565b602082019050919050565b5f6020820190508181035f83015261579081615757565b9050919050565b7f616c726561647920636c61696d656400000000000000000000000000000000005f82015250565b5f6157cb600f83614135565b91506157d682615797565b602082019050919050565b5f6020820190508181035f8301526157f8816157bf565b9050919050565b7f536f6c64204f75742100000000000000000000000000000000000000000000005f82015250565b5f615833600983614135565b915061583e826157ff565b602082019050919050565b5f6020820190508181035f83015261586081615827565b9050919050565b7f43616e6e6f74206265206c6f776572207468616e20737570706c7900000000005f82015250565b5f61589b601b83614135565b91506158a682615867565b602082019050919050565b5f6020820190508181035f8301526158c88161588f565b9050919050565b5f81905092915050565b5f6158e38261412b565b6158ed81856158cf565b93506158fd818560208601614145565b80840191505092915050565b5f61591482856158d9565b915061592082846158d9565b91508190509392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f615986602683614135565b91506159918261592c565b604082019050919050565b5f6020820190508181035f8301526159b38161597a565b9050919050565b7f496e76616c6964000000000000000000000000000000000000000000000000005f82015250565b5f6159ee600783614135565b91506159f9826159ba565b602082019050919050565b5f6020820190508181035f830152615a1b816159e2565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f615a56602083614135565b9150615a6182615a22565b602082019050919050565b5f6020820190508181035f830152615a8381615a4a565b9050919050565b7f4e65656420746f2073656e64206d6f7265204554482e000000000000000000005f82015250565b5f615abe601683614135565b9150615ac982615a8a565b602082019050919050565b5f6020820190508181035f830152615aeb81615ab2565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c005f82015250565b5f615b26601f83614135565b9150615b3182615af2565b602082019050919050565b5f6020820190508181035f830152615b5381615b1a565b9050919050565b5f81519050615b688161428b565b92915050565b5f60208284031215615b8357615b82614070565b5b5f615b9084828501615b5a565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f615bbd82615b99565b615bc78185615ba3565b9350615bd7818560208601614145565b615be08161416d565b840191505092915050565b5f608082019050615bfe5f830187614263565b615c0b6020830186614263565b615c186040830185614324565b8181036060830152615c2a8184615bb3565b905095945050505050565b5f81519050615c43816140a3565b92915050565b5f60208284031215615c5e57615c5d614070565b5b5f615c6b84828501615c35565b9150509291505056fea2646970667358221220d8bdf804980e8b82ea049520285ebd6aacbaf2faa11698797d69ff1031035db264736f6c63430008160033
Verified Source Code Full Match
Compiler: v0.8.22+commit.4fc1097e
EVM: shanghai
Optimization: No
Leg1on.sol 360 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "contracts/ERC721AQueryable.sol";
import "contracts/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "contracts/utils/cryptography/MerkleProof.sol";
interface DystoPunks {
function tokensOfOwner(address owner) external view returns (uint256[] memory);
function ownerOf(uint256 tokenId) external view returns(address);
}
interface EncodeGraphics {
function tokensOfOwner(address owner) external view returns (uint256[] memory);
function ownerOf(uint256 tokenId) external view returns(address);
}
interface DystoPunksVX {
function balanceOf(address owner) external view returns (uint256);
}
contract Leg1on is ERC721AQueryable, Ownable, ReentrancyGuard {
address constant public DystoAddress = 0xbEA8123277142dE42571f1fAc045225a1D347977;
address constant public EncodeAddress = 0xCBA5AC55D5e1c56Cf16482456aD0a47f27D38a62;
address constant public VXAddress = 0xf91523Bc0ffA151ABd971f1b11D2567d4167DB3E;
uint256 public collectionSize = 7777;
bool public stoped = false;
uint64 public publicPrice=70000000000000000;
uint64 public whitelistPrice=50000000000000000;
uint public reserved=4077;
bytes32 public whitelistRoot;
bytes32 public claimRoot;
struct SaleConfig {
bool privateSale;
bool publicSaleStart;
}
SaleConfig public saleConfig;
mapping(address => bool) public claimed;
mapping(uint => bool) public claimedDysto;
mapping(uint => bool) public claimedKey;
uint256 startingTokenId = 1;
constructor(
bytes32 whitelistRoot_,
bytes32 claimRoot_
) ERC721A("LEG1ON", "LEG1ON") {
whitelistRoot = whitelistRoot_;
claimRoot = claimRoot_;
}
modifier callerIsUser() {
require(tx.origin == msg.sender, "The caller is another contract");
_;
}
function toBytes32(address addr) pure internal returns (bytes32) {
return bytes32(uint256(uint160(addr)));
}
/*
|----------------------------|
|------ Mint Functions ------|
|----------------------------|
*/
function whitelistMint(bytes32[] calldata whitelistProof, uint256 _mintAmount) external payable callerIsUser {
require(stoped == false, "Sale is stoped");
SaleConfig memory config = saleConfig;
bool privateSale = bool(config.privateSale);
require(privateSale == true, "Private sale has not already started");
require(totalSupply() + _mintAmount <= (collectionSize-reserved), "reached max supply");
require(_mintAmount <= 7, "exceeds mint allowance");
require(MerkleProof.verify(whitelistProof, whitelistRoot, toBytes32(msg.sender)) == true, "invalid proof");
_safeMint(msg.sender, _mintAmount);
refundIfOver(whitelistPrice * _mintAmount);
}
function publicMint(uint256 _mintAmount) external payable callerIsUser {
require(stoped == false, "Sale is stoped");
SaleConfig memory config = saleConfig;
bool publicSaleStart = bool(config.publicSaleStart);
require(publicSaleStart == true, "Sale has not already started");
require(totalSupply() + _mintAmount <= (collectionSize-reserved), "reached max supply");
require(_mintAmount <= 7, "too many per tx");
_safeMint(msg.sender, _mintAmount);
refundIfOver(publicPrice * _mintAmount);
}
function mintVXList(uint _mintAmount) external payable callerIsUser {
require(stoped == false, "Sale is stoped");
SaleConfig memory config = saleConfig;
bool privateSale = bool(config.privateSale);
require(privateSale == true, "Private sale has not already started");
uint256 vx = DystoPunksVX(VXAddress).balanceOf(msg.sender);
require(_mintAmount <= 7, "7 max tokens");
require(totalSupply() + _mintAmount <= (collectionSize-reserved), "Exceeds collection size");
require(vx > 0, "Not whitelisted");
_safeMint(msg.sender, _mintAmount);
refundIfOver(whitelistPrice * _mintAmount);
}
function freeClaim(bytes32[] calldata claimProof) external callerIsUser {
require(stoped == false, "Sale is stoped");
SaleConfig memory config = saleConfig;
bool privateSale = bool(config.privateSale);
require(privateSale == true, "Private sale has not already started");
require(totalSupply() + 1 <= (collectionSize-reserved), "reached max supply");
require(claimed[msg.sender] == false, "already claimed");
require(MerkleProof.verify(claimProof, claimRoot, toBytes32(msg.sender)) == true, "invalid proof");
claimed[msg.sender] = true;
_safeMint(msg.sender, 1);
}
function dystoClaim(uint[] calldata ids) external callerIsUser {
require(stoped == false, "Sale is stoped");
uint arrayIdsLength = ids.length;
SaleConfig memory config = saleConfig;
bool privateSale = bool(config.privateSale);
require(privateSale == true, "Private sale has not already started");
require(arrayIdsLength >= 1, "No ids provided");
require(totalSupply() + arrayIdsLength <= collectionSize, "reached max supply");
require(isMintableArrayDysto(ids), "Not a mintable combination");
for (uint i=0; i<arrayIdsLength; i++) {
claimedDysto[ids[i]] = true;
}
_safeMint(msg.sender, arrayIdsLength);
reserved = reserved - arrayIdsLength;
}
function keyClaim(uint[] calldata ids) external callerIsUser {
require(stoped == false, "Sale is stoped");
uint arrayIdsLength = ids.length;
SaleConfig memory config = saleConfig;
bool privateSale = bool(config.privateSale);
require(privateSale == true, "Private sale has not already started");
require(arrayIdsLength >= 1, "No ids provided");
require(totalSupply() + arrayIdsLength <= collectionSize, "reached max supply");
require(isMintableArrayEncode(ids), "Not a mintable combination");
uint256 mintAmount = getAmountOfEncodeMints(ids);
for (uint i=0; i<arrayIdsLength; i++) {
claimedKey[ids[i]] = true;
}
_safeMint(msg.sender, mintAmount);
reserved = reserved - mintAmount;
}
/*
|----------------------------|
|---------- Reads -----------|
|----------------------------|
*/
// Check if all ids in array are indeed mintable and msg.sender is the owner
function isMintableArrayDysto(uint[] calldata ids) private view returns(bool) {
uint totalIds = ids.length;
uint totalValidIds = 0;
bool isValid = false;
for (uint i=0; i<totalIds; i++) {
bool isClaimed = checkDystoToClaim(ids[i]);
if (!isClaimed){
address ownerOfTokenId = DystoPunks(DystoAddress).ownerOf(ids[i]);
if (ownerOfTokenId == msg.sender) {
totalValidIds++;
}
}
}
if (totalIds == totalValidIds) {
isValid = true;
}
return isValid;
}
function isMintableArrayEncode(uint[] calldata ids) private view returns(bool) {
uint totalIds = ids.length;
uint totalValidIds = 0;
bool isValid = false;
for (uint i=0; i<totalIds; i++) {
bool isClaimed = checkKeyClaim(ids[i]);
if (!isClaimed){
address ownerOfTokenId = EncodeGraphics(EncodeAddress).ownerOf(ids[i]);
if (ownerOfTokenId == msg.sender) {
totalValidIds++;
}
}
}
if (totalIds == totalValidIds) {
isValid = true;
}
return isValid;
}
function getAmountOfEncodeMints(uint[] calldata ids) private pure returns(uint) {
uint gold = 50;
uint silver = 250;
uint total;
for (uint i=0; i<ids.length; i++) {
if (ids[i] <= gold) {
total = total + 4;
} else if (ids[i] <= silver) {
total = total + 2;
} else {
total = total + 1;
}
}
return total;
}
// returns any extra funds sent by user, protects user from over paying
function refundIfOver(uint256 price) private {
require(msg.value >= price, "Need to send more ETH.");
if (msg.value > price) {
payable(msg.sender).transfer(msg.value - price);
}
}
function numberMinted(address owner) public view returns (uint256) {
return _numberMinted(owner);
}
string private _baseTokenURI;
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
function availableDystoToClaim(address owner) public view returns (uint[] memory) {
uint[] memory punksOfOwner = DystoPunks(DystoAddress).tokensOfOwner(owner);
uint arrayPunksOfOwnerLength = punksOfOwner.length;
uint x=0;
for (uint i=0; i<arrayPunksOfOwnerLength; i++) {
uint256 id = punksOfOwner[i];
if (claimedDysto[id]==false) {
x++;
}
}
uint[] memory tokensAvailable = new uint[](x);
x=0;
for (uint i=0; i<arrayPunksOfOwnerLength; i++) {
if (claimedDysto[punksOfOwner[i]]==false) {
tokensAvailable[x]=punksOfOwner[i];
x++;
}
}
return tokensAvailable;
}
function availableKeyClaim(address owner) public view returns (uint[] memory) {
uint[] memory keys = EncodeGraphics(EncodeAddress).tokensOfOwner(owner);
uint arrayKeysLength = keys.length;
uint x=0;
for (uint i=0; i<arrayKeysLength; i++) {
uint256 id = keys[i];
if (claimedKey[id]==false) {
x++;
}
}
uint[] memory tokensAvailable = new uint[](x);
x=0;
for (uint i=0; i<arrayKeysLength; i++) {
if (claimedKey[keys[i]]==false) {
tokensAvailable[x]=keys[i];
x++;
}
}
return tokensAvailable;
}
function checkDystoToClaim(uint id) public view returns (bool) {
return claimedDysto[id];
}
function checkKeyClaim(uint id) public view returns (bool) {
return claimedKey[id];
}
/*
|----------------------------|
|----- Owner Functions -----|
|----------------------------|
*/
// setup minting info
function setupSaleInfo(
bool privateSale,
bool publicSaleStart
) external onlyOwner {
saleConfig = SaleConfig(
privateSale,
publicSaleStart
);
}
function stopSale(uint num) public onlyOwner {
require(num == 2077, "Invalid");
stoped = true;
}
function setBaseURI(string calldata baseURI) external onlyOwner {
_baseTokenURI = baseURI;
}
function setCollectionSize(uint256 _maxCollectionSize) external onlyOwner {
require(totalSupply() < collectionSize, "Sold Out!");
require(_maxCollectionSize >= totalSupply(), "Cannot be lower than supply");
collectionSize = _maxCollectionSize;
}
function withdraw() external onlyOwner nonReentrant {
(bool success, ) = payable(owner()).call{value: address(this).balance}("");
require(success);
}
function setWhitelistRoot(bytes32 _whitelistRoot) external onlyOwner {
whitelistRoot = _whitelistRoot;
}
function setClaimRoot(bytes32 _claimRoot) external onlyOwner {
claimRoot = _claimRoot;
}
// for team/promotions/giveaways
function reserveAirdrop(uint _mintAmount, address addr) public onlyOwner {
require(stoped == false, "Sale is stoped");
require(totalSupply() + _mintAmount < (collectionSize-reserved), "Exceeds collection size");
_safeMint(addr, _mintAmount);
}
/*
|----------------------------|
|---- Operator Overrides ----|
|----------------------------|
*/
function _startTokenId() internal override(ERC721A) view returns (uint256) {
return startingTokenId;
}
}
ERC721A.sol 1136 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import 'contracts/IERC721A.sol';
/**
* @dev Interface of ERC721 token receiver.
*/
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.selector);
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.selector);
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 packed) {
if (_startTokenId() <= tokenId) {
packed = _packedOwnerships[tokenId];
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
// If the data at the starting slot does not exist, start the scan.
if (packed == 0) {
if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector);
// 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, `tokenId` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
for (;;) {
unchecked {
packed = _packedOwnerships[--tokenId];
}
if (packed == 0) continue;
return packed;
}
}
// Otherwise, the data exists and is not burned. We can skip the scan.
// This is possible because we have already achieved the target condition.
// This saves 2143 gas on transfers of initialized tokens.
return packed;
}
}
_revert(OwnerQueryForNonexistentToken.selector);
}
/**
* @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. See {ERC721A-_approve}.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
*/
function approve(address to, uint256 tokenId) public payable virtual override {
_approve(to, tokenId, true);
}
/**
* @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.selector);
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 {setApprovalForAll}.
*
* Tokens start existing when they are minted. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
// Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));
if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// 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] = _packOwnershipData(
to,
_BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// 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;
}
}
}
}
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
from, // `from`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
if (toMasked == 0) _revert(TransferToZeroAddress.selector);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @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 memory _data
) public payable virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
}
/**
* @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 Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns 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.selector);
}
assembly {
revert(add(32, reason), mload(reason))
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @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 for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (quantity == 0) _revert(MintZeroQuantity.selector);
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
if (toMasked == 0) _revert(MintToZeroAddress.selector);
uint256 end = startTokenId + quantity;
uint256 tokenId = startTokenId;
do {
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
// The `!=` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
} while (++tokenId != end);
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) _revert(MintToZeroAddress.selector);
if (quantity == 0) _revert(MintZeroQuantity.selector);
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_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] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, 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.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) _revert(bytes4(0));
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_approve(to, tokenId, false)`.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_approve(to, tokenId, false);
}
/**
* @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:
*
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
bool approvalCheck
) internal virtual {
address owner = ownerOf(tokenId);
if (approvalCheck && _msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
_revert(ApprovalCallerNotOwnerNorApproved.selector);
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @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));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// 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] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// 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++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* 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 _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
}
// =============================================================
// OTHER OPERATIONS
// =============================================================
/**
* @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 virtual returns (string memory str) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
// Update the free memory pointer to allocate.
mstore(0x40, m)
// Assign the `str` to the end.
str := sub(m, 0x20)
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 {} {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
/**
* @dev For more efficient reverts.
*/
function _revert(bytes4 errorSelector) internal pure {
assembly {
mstore(0x00, errorSelector)
revert(0x00, 0x04)
}
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "./utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
IERC721A.sol 282 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
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);
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
ERC721AQueryable.sol 236 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import 'contracts/IERC721AQueryable.sol';
import 'contracts/ERC721A.sol';
/**
* @title ERC721AQueryable.
*
* @dev ERC721A subclass with convenience query functions.
*/
abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId)
public
view
virtual
override
returns (TokenOwnership memory ownership)
{
if (tokenId >= _startTokenId()) {
if (tokenId < _nextTokenId()) {
ownership = _ownershipAt(tokenId);
if (!ownership.burned) {
ownership = _ownershipOf(tokenId);
}
}
}
}
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] calldata tokenIds)
external
view
virtual
override
returns (TokenOwnership[] memory)
{
TokenOwnership[] memory ownerships;
uint256 i = tokenIds.length;
assembly {
// Grab the free memory pointer.
ownerships := mload(0x40)
// Store the length.
mstore(ownerships, i)
// Allocate one word for the length,
// `tokenIds.length` words for the pointers.
i := shl(5, i) // Multiply `i` by 32.
mstore(0x40, add(add(ownerships, 0x20), i))
}
while (i != 0) {
uint256 tokenId;
assembly {
i := sub(i, 0x20)
tokenId := calldataload(add(tokenIds.offset, i))
}
TokenOwnership memory ownership = explicitOwnershipOf(tokenId);
assembly {
// Store the pointer of `ownership` in the `ownerships` array.
mstore(add(add(ownerships, 0x20), i), ownership)
}
}
return ownerships;
}
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view virtual override returns (uint256[] memory) {
unchecked {
if (start >= stop) _revert(InvalidQueryRange.selector);
// Set `start = max(start, _startTokenId())`.
if (start < _startTokenId()) {
start = _startTokenId();
}
uint256 stopLimit = _nextTokenId();
// Set `stop = min(stop, stopLimit)`.
if (stop >= stopLimit) {
stop = stopLimit;
}
uint256[] memory tokenIds;
uint256 tokenIdsMaxLength = balanceOf(owner);
bool startLtStop = start < stop;
assembly {
// Set `tokenIdsMaxLength` to zero if `start` is less than `stop`.
tokenIdsMaxLength := mul(tokenIdsMaxLength, startLtStop)
}
if (tokenIdsMaxLength != 0) {
// Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,
// to cater for cases where `balanceOf(owner)` is too big.
if (stop - start <= tokenIdsMaxLength) {
tokenIdsMaxLength = stop - start;
}
assembly {
// Grab the free memory pointer.
tokenIds := mload(0x40)
// Allocate one word for the length, and `tokenIdsMaxLength` words
// for the data. `shl(5, x)` is equivalent to `mul(32, x)`.
mstore(0x40, add(tokenIds, shl(5, add(tokenIdsMaxLength, 1))))
}
// We need to call `explicitOwnershipOf(start)`,
// because the slot at `start` may not be initialized.
TokenOwnership memory ownership = explicitOwnershipOf(start);
address currOwnershipAddr;
// If the starting slot exists (i.e. not burned),
// initialize `currOwnershipAddr`.
// `ownership.address` will not be zero,
// as `start` is clamped to the valid token ID range.
if (!ownership.burned) {
currOwnershipAddr = ownership.addr;
}
uint256 tokenIdsIdx;
// Use a do-while, which is slightly more efficient for this case,
// as the array will at least contain one element.
do {
ownership = _ownershipAt(start);
assembly {
// if `ownership.burned == false`.
if iszero(mload(add(ownership, 0x40))) {
// if `ownership.addr != address(0)`.
// The `addr` already has it's upper 96 bits clearned,
// since it is written to memory with regular Solidity.
if mload(ownership) {
currOwnershipAddr := mload(ownership)
}
// if `currOwnershipAddr == owner`.
// The `shl(96, x)` is to make the comparison agnostic to any
// dirty upper 96 bits in `owner`.
if iszero(shl(96, xor(currOwnershipAddr, owner))) {
tokenIdsIdx := add(tokenIdsIdx, 1)
mstore(add(tokenIds, shl(5, tokenIdsIdx)), start)
}
}
start := add(start, 1)
}
} while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength));
// Store the length of the array.
assembly {
mstore(tokenIds, tokenIdsIdx)
}
}
return tokenIds;
}
}
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds;
assembly {
// Grab the free memory pointer.
tokenIds := mload(0x40)
// Allocate one word for the length, and `tokenIdsMaxLength` words
// for the data. `shl(5, x)` is equivalent to `mul(32, x)`.
mstore(0x40, add(tokenIds, shl(5, add(tokenIdsLength, 1))))
// Store the length of `tokenIds`.
mstore(tokenIds, tokenIdsLength)
}
address currOwnershipAddr;
uint256 tokenIdsIdx;
for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ) {
TokenOwnership memory ownership = _ownershipAt(i);
assembly {
// if `ownership.burned == false`.
if iszero(mload(add(ownership, 0x40))) {
// if `ownership.addr != address(0)`.
// The `addr` already has it's upper 96 bits clearned,
// since it is written to memory with regular Solidity.
if mload(ownership) {
currOwnershipAddr := mload(ownership)
}
// if `currOwnershipAddr == owner`.
// The `shl(96, x)` is to make the comparison agnostic to any
// dirty upper 96 bits in `owner`.
if iszero(shl(96, xor(currOwnershipAddr, owner))) {
tokenIdsIdx := add(tokenIdsIdx, 1)
mstore(add(tokenIds, shl(5, tokenIdsIdx)), i)
}
}
i := add(i, 1)
}
}
return tokenIds;
}
}
IERC721AQueryable.sol 79 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import 'contracts/IERC721A.sol';
/**
* @dev Interface of ERC721AQueryable.
*/
interface IERC721AQueryable is IERC721A {
/**
* Invalid query range (`start` >= `stop`).
*/
error InvalidQueryRange();
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view returns (uint256[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view returns (uint256[] memory);
}
MerkleProof.sol 223 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* 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.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
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 simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _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}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _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 sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _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}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _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)
}
}
}
ReentrancyGuard.sol 77 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
Read Contract
DystoAddress 0x993cb902 → address
EncodeAddress 0x823f82c2 → address
VXAddress 0xeea83a70 → address
availableDystoToClaim 0x4d5963f4 → uint256[]
availableKeyClaim 0x3c90ab79 → uint256[]
balanceOf 0x70a08231 → uint256
checkDystoToClaim 0x553144d3 → bool
checkKeyClaim 0x7bb10e65 → bool
claimRoot 0x14ea35e7 → bytes32
claimed 0xc884ef83 → bool
claimedDysto 0x7031a89f → bool
claimedKey 0xa7ee5eb5 → bool
collectionSize 0x45c0f533 → uint256
explicitOwnershipOf 0xc23dc68f → tuple
explicitOwnershipsOf 0x5bbb2177 → tuple[]
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
numberMinted 0xdc33e681 → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
publicPrice 0xa945bf80 → uint64
reserved 0xfe60d12c → uint256
saleConfig 0x90aa0b0f → bool, bool
stoped 0x2d14c593 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
tokensOfOwner 0x8462151c → uint256[]
tokensOfOwnerIn 0x99a2557a → uint256[]
totalSupply 0x18160ddd → uint256
whitelistPrice 0xfc1a1c36 → uint64
whitelistRoot 0x386bfc98 → bytes32
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
dystoClaim 0x9e1c9440
uint256[] ids
freeClaim 0xaafecbc0
bytes32[] claimProof
keyClaim 0x858d8a21
uint256[] ids
mintVXList 0x22d5274a
uint256 _mintAmount
publicMint 0x2db11544
uint256 _mintAmount
renounceOwnership 0x715018a6
No parameters
reserveAirdrop 0xb0076296
uint256 _mintAmount
address addr
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
setClaimRoot 0x21b97f20
bytes32 _claimRoot
setCollectionSize 0xaca8ffe7
uint256 _maxCollectionSize
setWhitelistRoot 0xf5aa406d
bytes32 _whitelistRoot
setupSaleInfo 0xa6c9c71c
bool privateSale
bool publicSaleStart
stopSale 0xf8dd1f76
uint256 num
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistMint 0x2904e6d9
bytes32[] whitelistProof
uint256 _mintAmount
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address