Address Contract Partially Verified
Address
0x368AD4A7A7F49B8fA8f34476BE0Fc4d04cE622f5
Balance
0 ETH
Nonce
1
Code Size
24184 bytes
Creator
0xEa18a206...Ff9D at tx 0x1d426240...70ecaa
Indexed Transactions
0
Contract Bytecode
24184 bytes
0x6080604052600436106102515760003560e01c80636352211e11610139578063b83921a6116100b6578063d8a9e1e91161007a578063d8a9e1e9146108a5578063e71159b2146108d0578063e985e9c5146108f9578063eeca373714610936578063f2fde38b14610961578063fcc777f51461098a57610251565b8063b83921a6146107c2578063b88d4fde146107eb578063c154d6ca14610814578063c87b56dd1461083f578063d5dc0f2f1461087c57610251565b80638ec33726116100fd5780638ec33726146106ef57806390069b421461072c57806395d89b4114610757578063a10866ef14610782578063a22cb4651461079957610251565b80636352211e1461060857806370a08231146106455780637146bd0814610682578063715018a6146106ad5780638da5cb5b146106c457610251565b80632ab4d052116101d257806342842e0e1161019657806342842e0e146105075780634da79d5a146105305780634f6ccce71461054c57806358ac8eef146105895780636204b831146105c657806362a5af3b146105f157610251565b80632ab4d052146104345780632f745c591461045f5780633719e3b01461049c5780633af32abf146104b35780633ccfd60b146104f057610251565b806318160ddd1161021957806318160ddd1461034d5780631e84c4131461037857806323b872dd146103a357806326e0032d146103cc57806326f8873e146103f757610251565b806301ffc9a71461025657806306fdde0314610293578063081812fc146102be578063095ea7b3146102fb578063162094c414610324575b600080fd5b34801561026257600080fd5b5061027d60048036038101906102789190614523565b6109a6565b60405161028a9190615444565b60405180910390f35b34801561029f57600080fd5b506102a8610a20565b6040516102b5919061545f565b60405180910390f35b3480156102ca57600080fd5b506102e560048036038101906102e09190614575565b610ab2565b6040516102f2919061537d565b60405180910390f35b34801561030757600080fd5b50610322600480360381019061031d919061443b565b610b37565b005b34801561033057600080fd5b5061034b6004803603810190610346919061459e565b610c4f565b005b34801561035957600080fd5b50610362610d29565b60405161036f91906158a1565b60405180910390f35b34801561038457600080fd5b5061038d610d36565b60405161039a9190615444565b60405180910390f35b3480156103af57600080fd5b506103ca60048036038101906103c59190614335565b610d4d565b005b3480156103d857600080fd5b506103e1610dad565b6040516103ee91906158bc565b60405180910390f35b34801561040357600080fd5b5061041e600480360381019061041991906142d0565b610db2565b60405161042b91906158bc565b60405180910390f35b34801561044057600080fd5b50610449610e14565b60405161045691906158a1565b60405180910390f35b34801561046b57600080fd5b506104866004803603810190610481919061443b565b610e1a565b60405161049391906158a1565b60405180910390f35b3480156104a857600080fd5b506104b1610ebf565b005b3480156104bf57600080fd5b506104da60048036038101906104d591906142d0565b610fad565b6040516104e79190615444565b60405180910390f35b3480156104fc57600080fd5b50610505611029565b005b34801561051357600080fd5b5061052e60048036038101906105299190614335565b6110f4565b005b61054a6004803603810190610545919061464a565b611114565b005b34801561055857600080fd5b50610573600480360381019061056e9190614575565b6114a9565b60405161058091906158a1565b60405180910390f35b34801561059557600080fd5b506105b060048036038101906105ab9190614575565b611540565b6040516105bd91906158bc565b60405180910390f35b3480156105d257600080fd5b506105db6115b2565b6040516105e891906158a1565b60405180910390f35b3480156105fd57600080fd5b506106066115ce565b005b34801561061457600080fd5b5061062f600480360381019061062a9190614575565b6116c5565b60405161063c919061537d565b60405180910390f35b34801561065157600080fd5b5061066c600480360381019061066791906142d0565b611777565b60405161067991906158a1565b60405180910390f35b34801561068e57600080fd5b5061069761182f565b6040516106a491906158bc565b60405180910390f35b3480156106b957600080fd5b506106c2611834565b005b3480156106d057600080fd5b506106d96118bc565b6040516106e6919061537d565b60405180910390f35b3480156106fb57600080fd5b50610716600480360381019061071191906142d0565b6118e6565b60405161072391906158a1565b60405180910390f35b34801561073857600080fd5b5061074161193f565b60405161074e91906158a1565b60405180910390f35b34801561076357600080fd5b5061076c61194b565b604051610779919061545f565b60405180910390f35b34801561078e57600080fd5b506107976119dd565b005b3480156107a557600080fd5b506107c060048036038101906107bb91906143ff565b611acb565b005b3480156107ce57600080fd5b506107e960048036038101906107e491906144de565b611c4c565b005b3480156107f757600080fd5b50610812600480360381019061080d9190614384565b611e34565b005b34801561082057600080fd5b50610829611e96565b6040516108369190615444565b60405180910390f35b34801561084b57600080fd5b5061086660048036038101906108619190614575565b611ea9565b604051610873919061545f565b60405180910390f35b34801561088857600080fd5b506108a3600480360381019061089e9190614477565b611ffb565b005b3480156108b157600080fd5b506108ba612127565b6040516108c79190615444565b60405180910390f35b3480156108dc57600080fd5b506108f760048036038101906108f291906145f2565b61213e565b005b34801561090557600080fd5b50610920600480360381019061091b91906142f9565b6123f2565b60405161092d9190615444565b60405180910390f35b34801561094257600080fd5b5061094b612486565b6040516109589190615444565b60405180910390f35b34801561096d57600080fd5b50610988600480360381019061098391906142d0565b612499565b005b6109a4600480360381019061099f919061464a565b612591565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610a195750610a188261299e565b5b9050919050565b606060008054610a2f90615c2c565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5b90615c2c565b8015610aa85780601f10610a7d57610100808354040283529160200191610aa8565b820191906000526020600020905b815481529060010190602001808311610a8b57829003601f168201915b5050505050905090565b6000610abd82612a80565b610afc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af390615761565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610b42826116c5565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610baa90615801565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610bd2612aec565b73ffffffffffffffffffffffffffffffffffffffff161480610c015750610c0081610bfb612aec565b6123f2565b5b610c40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3790615621565b60405180910390fd5b610c4a8383612af4565b505050565b610c57612aec565b73ffffffffffffffffffffffffffffffffffffffff16610c756118bc565b73ffffffffffffffffffffffffffffffffffffffff1614610ccb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc290615781565b60405180910390fd5b600b60149054906101000a900460ff1615610d1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1290615701565b60405180910390fd5b610d258282612bad565b5050565b6000600880549050905090565b6000600e60019054906101000a900460ff16905090565b610d5e610d58612aec565b82612c21565b610d9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9490615841565b60405180910390fd5b610da8838383612cff565b505050565b600681565b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600a610e0d9190615b23565b9050919050565b600c5481565b6000610e2583611777565b8210610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906154e1565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610ec7612aec565b73ffffffffffffffffffffffffffffffffffffffff16610ee56118bc565b73ffffffffffffffffffffffffffffffffffffffff1614610f3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3290615781565b60405180910390fd5b600e60009054906101000a900460ff1615600e60006101000a81548160ff0219169083151502179055507fc08856a2421028bf2a88be7559541c7087eb189d1518a79356b4ace74b5252c9600e60009054906101000a900460ff16604051610fa39190615444565b60405180910390a1565b600080600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1611806110145750600061101283611777565b115b61101f576000611022565b60015b9050919050565b611031612aec565b73ffffffffffffffffffffffffffffffffffffffff1661104f6118bc565b73ffffffffffffffffffffffffffffffffffffffff16146110a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109c90615781565b60405180910390fd5b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156110f0573d6000803e3d6000fd5b5050565b61110f83838360405180602001604052806000815250611e34565b505050565b600e60009054906101000a900460ff16611163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115a90615821565b60405180910390fd5b60008260ff16116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090615481565b60405180910390fd5b600c548260ff166111b8610d29565b6111c291906159d7565b1115611203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fa906154c1565b60405180910390fd5b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff168260ff161115611298576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128f90615541565b60405180910390fd5b348260ff1667016df70c9a5020006112b09190615a95565b146112f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e7906156c1565b60405180910390fd5b6113558260ff16600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff16612f5b90919063ffffffff16565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055506113b7338383612f71565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561141f573d6000803e3d6000fd5b507fe7d264d696ff341e3e6a10c22579a979a96db58bda028ef4dca464bfbe6a1f0833600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660405161149d9291906153e4565b60405180910390a15050565b60006114b3610d29565b82106114f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114eb90615861565b60405180910390fd5b6008828154811061152e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b600061154b82612a80565b61158a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158190615641565b60405180910390fd5b6012600083815260200190815260200160002060009054906101000a900460ff169050919050565b60006115bc610d29565b600c546115c99190615aef565b905090565b6115d6612aec565b73ffffffffffffffffffffffffffffffffffffffff166115f46118bc565b73ffffffffffffffffffffffffffffffffffffffff161461164a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164190615781565b60405180910390fd5b600b60149054906101000a900460ff161561169a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169190615701565b60405180910390fd5b6001600b60146101000a81548160ff0219169083151502179055506116bd610d29565b600c81905550565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561176e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176590615681565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117df90615661565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a81565b61183c612aec565b73ffffffffffffffffffffffffffffffffffffffff1661185a6118bc565b73ffffffffffffffffffffffffffffffffffffffff16146118b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a790615781565b60405180910390fd5b6118ba600061316f565b565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff169050919050565b67016df70c9a50200081565b60606001805461195a90615c2c565b80601f016020809104026020016040519081016040528092919081815260200182805461198690615c2c565b80156119d35780601f106119a8576101008083540402835291602001916119d3565b820191906000526020600020905b8154815290600101906020018083116119b657829003601f168201915b5050505050905090565b6119e5612aec565b73ffffffffffffffffffffffffffffffffffffffff16611a036118bc565b73ffffffffffffffffffffffffffffffffffffffff1614611a59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5090615781565b60405180910390fd5b600e60019054906101000a900460ff1615600e60016101000a81548160ff0219169083151502179055507fd9bc49251edd474a55897591c0b750b4f5b2609a950c788f8ef8d44b45b0f718600e60019054906101000a900460ff16604051611ac19190615444565b60405180910390a1565b611ad3612aec565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b38906155a1565b60405180910390fd5b8060056000611b4e612aec565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611bfb612aec565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611c409190615444565b60405180910390a35050565b611c54612aec565b73ffffffffffffffffffffffffffffffffffffffff16611c726118bc565b73ffffffffffffffffffffffffffffffffffffffff1614611cc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cbf90615781565b60405180910390fd5b600b60149054906101000a900460ff1615611d18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0f90615701565b60405180910390fd5b600e60009054906101000a900460ff1615611d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5f90615881565b60405180910390fd5b60005b82829050811015611e2f576000600f6000858585818110611db5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002016020810190611dca91906142d0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055508080611e2790615c5e565b915050611d6b565b505050565b611e45611e3f612aec565b83612c21565b611e84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7b90615841565b60405180910390fd5b611e9084848484613235565b50505050565b600b60149054906101000a900460ff1681565b6060611eb482612a80565b611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea90615741565b60405180910390fd5b6000601160008481526020019081526020016000208054611f1390615c2c565b80601f0160208091040260200160405190810160405280929190818152602001828054611f3f90615c2c565b8015611f8c5780601f10611f6157610100808354040283529160200191611f8c565b820191906000526020600020905b815481529060010190602001808311611f6f57829003601f168201915b505050505090506000611f9d613291565b9050600081511415611fb3578192505050611ff6565b600082511115611fe8578082604051602001611fd092919061532a565b60405160208183030381529060405292505050611ff6565b611ff1846132a8565b925050505b919050565b612003612aec565b73ffffffffffffffffffffffffffffffffffffffff166120216118bc565b73ffffffffffffffffffffffffffffffffffffffff1614612077576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206e90615781565b60405180910390fd5b60008260ff16116120bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b490615481565b60405180910390fd5b600c548260ff166120cc610d29565b6120d691906159d7565b1115612117576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161210e906154c1565b60405180910390fd5b612122838383612f71565b505050565b6000600e60009054906101000a900460ff16905090565b612146612aec565b73ffffffffffffffffffffffffffffffffffffffff166121646118bc565b73ffffffffffffffffffffffffffffffffffffffff16146121ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b190615781565b60405180910390fd5b600b60149054906101000a900460ff161561220a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161220190615701565b60405180910390fd5b600e60009054906101000a900460ff161561225a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161225190615881565b60405180910390fd5b600a60ff168360ff1611156122a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229b906155c1565b60405180910390fd5b60005b828290508110156123ec57600073ffffffffffffffffffffffffffffffffffffffff16838383818110612303577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201602081019061231891906142d0565b73ffffffffffffffffffffffffffffffffffffffff16146123d95783600f6000858585818110612371577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201602081019061238691906142d0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055505b80806123e490615c5e565b9150506122a7565b50505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000612490610d29565b600c5414905090565b6124a1612aec565b73ffffffffffffffffffffffffffffffffffffffff166124bf6118bc565b73ffffffffffffffffffffffffffffffffffffffff1614612515576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250c90615781565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612585576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257c90615521565b60405180910390fd5b61258e8161316f565b50565b600e60019054906101000a900460ff166125e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d7906154a1565b60405180910390fd5b60008260ff1611612626576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161261d90615481565b60405180910390fd5b600a60ff168260ff161115612670576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612667906155e1565b60405180910390fd5b600c548260ff1661267f610d29565b61268991906159d7565b11156126ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c1906154c1565b60405180910390fd5b600a60ff16601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16836127279190615a2d565b60ff16111561276b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612762906157a1565b60405180910390fd5b348260ff1667016df70c9a5020006127839190615a95565b146127c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ba906156c1565b60405180910390fd5b6128288260ff16601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1661334f90919063ffffffff16565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff16021790555061288a338383612f71565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156128f2573d6000803e3d6000fd5b507fa21cede0a934fc8df5d3330132f2a959fbe0d70b901e2a17909bb1e1b8feb90433601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600a61296e9190615b23565b612976610d29565b600c546129839190615aef565b6040516129929392919061540d565b60405180910390a15050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612a6957507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612a795750612a7882613365565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612b67836116c5565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612bb682612a80565b612bf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bec906156a1565b60405180910390fd5b80601160008481526020019081526020016000209080519060200190612c1c929190613fff565b505050565b6000612c2c82612a80565b612c6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c6290615601565b60405180910390fd5b6000612c76836116c5565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612ce557508373ffffffffffffffffffffffffffffffffffffffff16612ccd84610ab2565b73ffffffffffffffffffffffffffffffffffffffff16145b80612cf65750612cf581856123f2565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612d1f826116c5565b73ffffffffffffffffffffffffffffffffffffffff1614612d75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d6c906157c1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612de5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ddc90615581565b60405180910390fd5b612df08383836133cf565b612dfb600082612af4565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612e4b9190615aef565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612ea291906159d7565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008183612f699190615aef565b905092915050565b600b60149054906101000a900460ff1615612fc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fb890615701565b60405180910390fd5b80518260ff1614613007576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ffe906156e1565b60405180910390fd5b60005b8260ff168160ff1610156131695760006130356001613027610d29565b61334f90919063ffffffff16565b905061304185826134e3565b6130e6816130e1600d805461305590615c2c565b80601f016020809104026020016040519081016040528092919081815260200182805461308190615c2c565b80156130ce5780601f106130a3576101008083540402835291602001916130ce565b820191906000526020600020905b8154815290600101906020018083116130b157829003601f168201915b50505050506130dc85613501565b6136d6565b612bad565b828260ff1681518110613122577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516012600083815260200190815260200160002060006101000a81548160ff021916908360ff16021790555050808061316190615ca7565b91505061300a565b50505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b613240848484612cff565b61324c84848484613702565b61328b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161328290615501565b60405180910390fd5b50505050565b606060405180602001604052806000815250905090565b60606132b382612a80565b6132f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132e9906157e1565b60405180910390fd5b60006132fc613291565b9050600081511161331c5760405180602001604052806000815250613347565b8061332684613899565b60405160200161333792919061532a565b6040516020818303038152906040525b915050919050565b6000818361335d91906159d7565b905092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6133da838383613a46565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561341d5761341881613a4b565b61345c565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461345b5761345a8382613a94565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561349f5761349a81613c01565b6134de565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146134dd576134dc8282613d44565b5b5b505050565b6134fd828260405180602001604052806000815250613dc3565b5050565b60606000821415613549576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506136d1565b600082905060005b6000821461357b57808061356490615c5e565b915050600a826135749190615a64565b9150613551565b60008167ffffffffffffffff8111156135bd577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156135ef5781602001600182028036833780820191505090505b50905060008290505b600086146136c95760018161360d9190615aef565b90506000600a808861361f9190615a64565b6136299190615a95565b876136349190615aef565b60306136409190615a2d565b905060008160f81b905080848481518110613684577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a886136c09190615a64565b975050506135f8565b819450505050505b919050565b606082826040516020016136eb92919061534e565b604051602081830303815290604052905092915050565b60006137238473ffffffffffffffffffffffffffffffffffffffff16613e1e565b1561388c578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261374c612aec565b8786866040518563ffffffff1660e01b815260040161376e9493929190615398565b602060405180830381600087803b15801561378857600080fd5b505af19250505080156137b957506040513d601f19601f820116820180604052508101906137b6919061454c565b60015b61383c573d80600081146137e9576040519150601f19603f3d011682016040523d82523d6000602084013e6137ee565b606091505b50600081511415613834576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161382b90615501565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613891565b600190505b949350505050565b606060008214156138e1576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613a41565b600082905060005b600082146139135780806138fc90615c5e565b915050600a8261390c9190615a64565b91506138e9565b60008167ffffffffffffffff811115613955577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156139875781602001600182028036833780820191505090505b5090505b60008514613a3a576001826139a09190615aef565b9150600a856139af9190615cd1565b60306139bb91906159d7565b60f81b8183815181106139f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85613a339190615a64565b945061398b565b8093505050505b919050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001613aa184611777565b613aab9190615aef565b9050600060076000848152602001908152602001600020549050818114613b90576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050613c159190615aef565b9050600060096000848152602001908152602001600020549050600060088381548110613c6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015490508060088381548110613cb3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480613d28577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000613d4f83611777565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b613dcd8383613e31565b613dda6000848484613702565b613e19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613e1090615501565b60405180910390fd5b505050565b600080823b905060008111915050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613ea1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613e9890615721565b60405180910390fd5b613eaa81612a80565b15613eea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613ee190615561565b60405180910390fd5b613ef6600083836133cf565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613f4691906159d7565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b82805461400b90615c2c565b90600052602060002090601f01602090048101928261402d5760008555614074565b82601f1061404657805160ff1916838001178555614074565b82800160010185558215614074579182015b82811115614073578251825591602001919060010190614058565b5b5090506140819190614085565b5090565b5b8082111561409e576000816000905550600101614086565b5090565b60006140b56140b084615908565b6158d7565b905080838252602082019050828560208602820111156140d457600080fd5b60005b8581101561410457816140ea88826142bb565b8452602084019350602083019250506001810190506140d7565b5050509392505050565b600061412161411c84615934565b6158d7565b90508281526020810184848401111561413957600080fd5b614144848285615bea565b509392505050565b600061415f61415a84615964565b6158d7565b90508281526020810184848401111561417757600080fd5b614182848285615bea565b509392505050565b60008135905061419981615dcf565b92915050565b60008083601f8401126141b157600080fd5b8235905067ffffffffffffffff8111156141ca57600080fd5b6020830191508360208202830111156141e257600080fd5b9250929050565b600082601f8301126141fa57600080fd5b813561420a8482602086016140a2565b91505092915050565b60008135905061422281615de6565b92915050565b60008135905061423781615dfd565b92915050565b60008151905061424c81615dfd565b92915050565b600082601f83011261426357600080fd5b813561427384826020860161410e565b91505092915050565b600082601f83011261428d57600080fd5b813561429d84826020860161414c565b91505092915050565b6000813590506142b581615e14565b92915050565b6000813590506142ca81615e2b565b92915050565b6000602082840312156142e257600080fd5b60006142f08482850161418a565b91505092915050565b6000806040838503121561430c57600080fd5b600061431a8582860161418a565b925050602061432b8582860161418a565b9150509250929050565b60008060006060848603121561434a57600080fd5b60006143588682870161418a565b93505060206143698682870161418a565b925050604061437a868287016142a6565b9150509250925092565b6000806000806080858703121561439a57600080fd5b60006143a88782880161418a565b94505060206143b98782880161418a565b93505060406143ca878288016142a6565b925050606085013567ffffffffffffffff8111156143e757600080fd5b6143f387828801614252565b91505092959194509250565b6000806040838503121561441257600080fd5b60006144208582860161418a565b925050602061443185828601614213565b9150509250929050565b6000806040838503121561444e57600080fd5b600061445c8582860161418a565b925050602061446d858286016142a6565b9150509250929050565b60008060006060848603121561448c57600080fd5b600061449a8682870161418a565b93505060206144ab868287016142bb565b925050604084013567ffffffffffffffff8111156144c857600080fd5b6144d4868287016141e9565b9150509250925092565b600080602083850312156144f157600080fd5b600083013567ffffffffffffffff81111561450b57600080fd5b6145178582860161419f565b92509250509250929050565b60006020828403121561453557600080fd5b600061454384828501614228565b91505092915050565b60006020828403121561455e57600080fd5b600061456c8482850161423d565b91505092915050565b60006020828403121561458757600080fd5b6000614595848285016142a6565b91505092915050565b600080604083850312156145b157600080fd5b60006145bf858286016142a6565b925050602083013567ffffffffffffffff8111156145dc57600080fd5b6145e88582860161427c565b9150509250929050565b60008060006040848603121561460757600080fd5b6000614615868287016142bb565b935050602084013567ffffffffffffffff81111561463257600080fd5b61463e8682870161419f565b92509250509250925092565b6000806040838503121561465d57600080fd5b600061466b858286016142bb565b925050602083013567ffffffffffffffff81111561468857600080fd5b614694858286016141e9565b9150509250929050565b6146a781615b57565b82525050565b6146b681615b69565b82525050565b60006146c782615994565b6146d181856159aa565b93506146e1818560208601615bf9565b6146ea81615dbe565b840191505092915050565b60006147008261599f565b61470a81856159bb565b935061471a818560208601615bf9565b61472381615dbe565b840191505092915050565b60006147398261599f565b61474381856159cc565b9350614753818560208601615bf9565b80840191505092915050565b600061476c6035836159bb565b91507f4e756d626572206f6620746f6b656e732063616e6e6f74206265206c6f77657260008301527f207468616e2c206f7220657175616c20746f20302100000000000000000000006020830152604082019050919050565b60006147d2601a836159bb565b91507f5075626c69632073616c65206973206e6f7420616374697665210000000000006000830152602082019050919050565b60006148126020836159bb565b91507f546f74616c20537570706c79206c696d697420686176652072656163686564216000830152602082019050919050565b6000614852602b836159bb565b91507f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008301527f74206f6620626f756e64730000000000000000000000000000000000000000006020830152604082019050919050565b60006148b86032836159bb565b91507f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008301527f63656976657220696d706c656d656e74657200000000000000000000000000006020830152604082019050919050565b600061491e6026836159bb565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006149846028836159bb565b91507f4e6f7420656e6f7567682070726573616c6520736c6f747320746f206d696e7460008301527f20746f6b656e73210000000000000000000000000000000000000000000000006020830152604082019050919050565b60006149ea601c836159bb565b91507f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006000830152602082019050919050565b6000614a2a6024836159bb565b91507f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614a906019836159bb565b91507f4552433732313a20617070726f766520746f2063616c6c6572000000000000006000830152602082019050919050565b6000614ad06031836159bb565b91507f6e756d6265724f66546f6b656e73206973206869676865722074686174204d4160008301527f58205055524348415345206c696d6974210000000000000000000000000000006020830152604082019050919050565b6000614b36601f836159bb565b91507f547279696e6720746f206d696e7420746f6f206d616e7920746f6b656e7321006000830152602082019050919050565b6000614b76602c836159bb565b91507f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000614bdc6038836159bb565b91507f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008301527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006020830152604082019050919050565b6000614c426033836159bb565b91507f45524337323155524953746f726167653a20436f6c6f7220717565727920666f60008301527f72206e6f6e6578697374656e7420746f6b656e000000000000000000000000006020830152604082019050919050565b6000614ca8602a836159bb565b91507f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008301527f726f2061646472657373000000000000000000000000000000000000000000006020830152604082019050919050565b6000614d0e6029836159bb565b91507f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008301527f656e7420746f6b656e00000000000000000000000000000000000000000000006020830152604082019050919050565b6000614d74602e836159bb565b91507f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60008301527f6578697374656e7420746f6b656e0000000000000000000000000000000000006020830152604082019050919050565b6000614dda6020836159bb565b91507f45746865722076616c75652073656e74206973206e6f7420636f7272656374216000830152602082019050919050565b6000614e1a6036836159bb565b91507f436f6c6f7273206172726179206c656e6774682073686f756c6420626520657160008301527f75616c20746f206e756d6265724f66546f6b656e7321000000000000000000006020830152604082019050919050565b6000614e80601d836159bb565b91507f636f6e7472616374206861766520616c72656164792066726f7a656e210000006000830152602082019050919050565b6000614ec06020836159bb565b91507f4552433732313a206d696e7420746f20746865207a65726f20616464726573736000830152602082019050919050565b6000614f006031836159bb565b91507f45524337323155524953746f726167653a2055524920717565727920666f722060008301527f6e6f6e6578697374656e7420746f6b656e0000000000000000000000000000006020830152604082019050919050565b6000614f66602c836159bb565b91507f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000614fcc6005836159cc565b91507f2e6a736f6e0000000000000000000000000000000000000000000000000000006000830152600582019050919050565b600061500c6020836159bb565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b600061504c601b836159bb565b91507f41646472657373206c696d6974206861766520726561636865642100000000006000830152602082019050919050565b600061508c6029836159bb565b91507f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008301527f73206e6f74206f776e00000000000000000000000000000000000000000000006020830152604082019050919050565b60006150f2602f836159bb565b91507f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008301527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006020830152604082019050919050565b60006151586021836159bb565b91507f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008301527f72000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006151be601b836159bb565b91507f507269766174652073616c65206973206e6f74206163746976652100000000006000830152602082019050919050565b60006151fe6031836159bb565b91507f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f7665640000000000000000000000000000006020830152604082019050919050565b6000615264602c836159bb565b91507f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008301527f7574206f6620626f756e647300000000000000000000000000000000000000006020830152604082019050919050565b60006152ca601e836159bb565b91507f507269766174652073616c65206973206e6f772072756e6e696e6721212100006000830152602082019050919050565b61530681615bc1565b82525050565b61531581615bd8565b82525050565b61532481615bcb565b82525050565b6000615336828561472e565b9150615342828461472e565b91508190509392505050565b600061535a828561472e565b9150615366828461472e565b915061537182614fbf565b91508190509392505050565b6000602082019050615392600083018461469e565b92915050565b60006080820190506153ad600083018761469e565b6153ba602083018661469e565b6153c760408301856152fd565b81810360608301526153d981846146bc565b905095945050505050565b60006040820190506153f9600083018561469e565b615406602083018461530c565b9392505050565b6000606082019050615422600083018661469e565b61542f602083018561530c565b61543c60408301846152fd565b949350505050565b600060208201905061545960008301846146ad565b92915050565b6000602082019050818103600083015261547981846146f5565b905092915050565b6000602082019050818103600083015261549a8161475f565b9050919050565b600060208201905081810360008301526154ba816147c5565b9050919050565b600060208201905081810360008301526154da81614805565b9050919050565b600060208201905081810360008301526154fa81614845565b9050919050565b6000602082019050818103600083015261551a816148ab565b9050919050565b6000602082019050818103600083015261553a81614911565b9050919050565b6000602082019050818103600083015261555a81614977565b9050919050565b6000602082019050818103600083015261557a816149dd565b9050919050565b6000602082019050818103600083015261559a81614a1d565b9050919050565b600060208201905081810360008301526155ba81614a83565b9050919050565b600060208201905081810360008301526155da81614ac3565b9050919050565b600060208201905081810360008301526155fa81614b29565b9050919050565b6000602082019050818103600083015261561a81614b69565b9050919050565b6000602082019050818103600083015261563a81614bcf565b9050919050565b6000602082019050818103600083015261565a81614c35565b9050919050565b6000602082019050818103600083015261567a81614c9b565b9050919050565b6000602082019050818103600083015261569a81614d01565b9050919050565b600060208201905081810360008301526156ba81614d67565b9050919050565b600060208201905081810360008301526156da81614dcd565b9050919050565b600060208201905081810360008301526156fa81614e0d565b9050919050565b6000602082019050818103600083015261571a81614e73565b9050919050565b6000602082019050818103600083015261573a81614eb3565b9050919050565b6000602082019050818103600083015261575a81614ef3565b9050919050565b6000602082019050818103600083015261577a81614f59565b9050919050565b6000602082019050818103600083015261579a81614fff565b9050919050565b600060208201905081810360008301526157ba8161503f565b9050919050565b600060208201905081810360008301526157da8161507f565b9050919050565b600060208201905081810360008301526157fa816150e5565b9050919050565b6000602082019050818103600083015261581a8161514b565b9050919050565b6000602082019050818103600083015261583a816151b1565b9050919050565b6000602082019050818103600083015261585a816151f1565b9050919050565b6000602082019050818103600083015261587a81615257565b9050919050565b6000602082019050818103600083015261589a816152bd565b9050919050565b60006020820190506158b660008301846152fd565b92915050565b60006020820190506158d1600083018461531b565b92915050565b6000604051905081810181811067ffffffffffffffff821117156158fe576158fd615d8f565b5b8060405250919050565b600067ffffffffffffffff82111561592357615922615d8f565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561594f5761594e615d8f565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561597f5761597e615d8f565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b60006159e282615bc1565b91506159ed83615bc1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115615a2257615a21615d02565b5b828201905092915050565b6000615a3882615bcb565b9150615a4383615bcb565b92508260ff03821115615a5957615a58615d02565b5b828201905092915050565b6000615a6f82615bc1565b9150615a7a83615bc1565b925082615a8a57615a89615d31565b5b828204905092915050565b6000615aa082615bc1565b9150615aab83615bc1565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615615ae457615ae3615d02565b5b828202905092915050565b6000615afa82615bc1565b9150615b0583615bc1565b925082821015615b1857615b17615d02565b5b828203905092915050565b6000615b2e82615bcb565b9150615b3983615bcb565b925082821015615b4c57615b4b615d02565b5b828203905092915050565b6000615b6282615ba1565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000615be382615bcb565b9050919050565b82818337600083830152505050565b60005b83811015615c17578082015181840152602081019050615bfc565b83811115615c26576000848401525b50505050565b60006002820490506001821680615c4457607f821691505b60208210811415615c5857615c57615d60565b5b50919050565b6000615c6982615bc1565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415615c9c57615c9b615d02565b5b600182019050919050565b6000615cb282615bcb565b915060ff821415615cc657615cc5615d02565b5b600182019050919050565b6000615cdc82615bc1565b9150615ce783615bc1565b925082615cf757615cf6615d31565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b615dd881615b57565b8114615de357600080fd5b50565b615def81615b69565b8114615dfa57600080fd5b50565b615e0681615b75565b8114615e1157600080fd5b50565b615e1d81615bc1565b8114615e2857600080fd5b50565b615e3481615bcb565b8114615e3f57600080fd5b5056fea264697066735822122091bddc1a6f9574f4a53fa3c17f7a7b2327a6462d62cb335ffe88d3f308182c4f64736f6c63430008000033
Verified Source Code Partial Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: No
og.sol 440 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Organic Grow Crystals contract
*
* @notice Smart Contract provides ERC721 functionality with public and private sales options.
* @author Andrey Skurlatov
*/
contract Og is ERC721Enumerable, Ownable {
// Use safeMath library for doing arithmetic with uint256 and uint8 numbers
using SafeMath for uint256;
using SafeMath for uint8;
// address to withdraw funds from contract
address payable private withdrawAddress;
// maximum number of tokens that can be purchased in one transaction
uint8 public constant MAX_PURCHASE = 10;
// price of a single crystal in wei
uint256 public constant OG_PRICE = 103010000000000000 wei;
// color id should be in this range
uint8 public constant COLORS_VARIATIONS = 6;
// freeze contract tokens have persistence tokenURI that can not be changed
bool public isFreeze;
// maximum number of crystals that can be minted on this contract
uint256 public maxTotalSupply;
// base uri for token metadata
string private _baseTokenURI;
// private sale current status - active or not
bool private _privateSale;
// public sale current status - active or not
bool private _publicSale;
// whitelisted addresses that can participate in the presale event
mapping(address => uint8) private _whiteList;
// used minting slots for public sale
mapping(address => uint8) private _publicSlots;
// all token URI's map
mapping(uint256 => string) private _tokenURIs;
// token colors storage
mapping(uint256 => uint8) private _tokenColors;
// event that emits when private sale changes state
event privateSaleState(bool active);
// event that emits when public sale changes state
event publicSaleState(bool active);
// event that emits when user bought crystals on private sale
event addressPrivateSlotsChange(address addr, uint256 slots);
// event that emits when user bought crystals on public sale
event addressPublicSlotsChange(address addr, uint256 slots, uint256 totalRemaining);
/**
* @dev contract constructor
*
* @param name is contract name
* @param symbol is contract basic symbol
* @param baseTokenURI is base (default) tokenURI with metadata
* @param maxSupply is Crystals tokens max supply
* @param _withDrawAddress is address to withdraw funds from contract
*/
constructor (
string memory name,
string memory symbol,
string memory baseTokenURI,
uint256 maxSupply,
address payable _withDrawAddress
) ERC721(name,symbol) {
_baseTokenURI = baseTokenURI;
maxTotalSupply = maxSupply;
withdrawAddress = _withDrawAddress;
}
/**
* @dev check if private sale is active now
*
* @return bool if private sale active
*/
function isPrivateSaleActive() public view virtual returns (bool) {
return _privateSale;
}
/**
* @dev switch private sale state
*/
function flipPrivateSaleState() external onlyOwner {
_privateSale = !_privateSale;
emit privateSaleState(_privateSale);
}
/**
* @dev check if public sale is active now
*
* @return bool if private sale active
*/
function isPublicSaleActive() public view virtual returns (bool) {
return _publicSale;
}
/**
* @dev check if public sale is already finished
*
* @return bool if private sale active
*/
function isPublicSaleEnded() public view virtual returns (bool) {
return maxTotalSupply == totalSupply();
}
/**
* @dev switch public sale state
*/
function flipPublicSaleState() external onlyOwner {
_publicSale = !_publicSale;
emit publicSaleState(_publicSale);
}
/**
* @dev add ETH addresses to whitelist
*
* Requirements:
* - private sale must be inactive
* - numberOfTokens should be less than MAX_PURCHASE value
*
* @param addresses address[] array of ETH addresses that need to be whitelisted
* @param numberOfTokens uint8 tokens amount for private sale per address
*/
function addWhitelistAddresses(uint8 numberOfTokens, address[] calldata addresses) external onlyOwner {
require(!isFreeze, "contract have already frozen!");
require(!_privateSale, "Private sale is now running!!!");
require(numberOfTokens <= MAX_PURCHASE, "numberOfTokens is higher that MAX PURCHASE limit!");
for (uint256 i = 0; i < addresses.length; i++) {
if (addresses[i] != address(0)) {
_whiteList[addresses[i]] = numberOfTokens;
}
}
}
/**
* @dev remove ETH addresses from whitelist
*
* Requirements:
* - private sale must be inactive
*
* @param addresses address[] array of ETH addresses that need to be removed from whitelist
*/
function removeWhitelistAddresses(address[] calldata addresses) external onlyOwner {
require(!isFreeze, "contract have already frozen!");
require(!_privateSale, "Private sale is now running!!!");
for (uint256 i = 0; i < addresses.length; i++) {
_whiteList[addresses[i]] = 0;
}
}
/**
* @dev check if address whitelisted
*
* @param _address address ETH address to check
* @return bool whitelist status
*/
function isWhitelisted(address _address) public view returns (bool) {
return (_whiteList[_address] > 0 || balanceOf(_address) > 0)
? true
: false;
}
/**
* @dev check address remaining mint slots for private sale
*
* @param _address address ETH address to check
* @return uint8 remaining slots
*/
function addressPrivateSaleSlots(address _address) public view returns (uint256) {
return _whiteList[_address];
}
/**
* @dev check address remaining mint slots for public sale
*
* @param _address address ETH address to check
* @return uint8 remaining slots
*/
function addressPublicSaleSlots(address _address) public view returns (uint8) {
return MAX_PURCHASE - _publicSlots[_address];
}
/**
* @dev mint new Crystal token with given
* color to provided address
*
* Requirements:
* - private sale should be active
* - color should be in a valid range
* - sender should have private sale minting slots
* - sender should pay OG price for each token
*
* @param numberOfTokens is an amount of tokens to mint
* @param colors is array with Crystal colors
*/
function mintPrivate(uint8 numberOfTokens, uint8[] memory colors) public payable {
require(_privateSale, "Private sale is not active!");
require(numberOfTokens > 0, "Number of tokens cannot be lower than, or equal to 0!");
require(totalSupply() + numberOfTokens <= maxTotalSupply, "Total Supply limit have reached!");
require(numberOfTokens <= _whiteList[msg.sender], "Not enough presale slots to mint tokens!");
require(OG_PRICE * numberOfTokens == msg.value, "Ether value sent is not correct!");
_whiteList[msg.sender] = uint8(_whiteList[msg.sender].sub(numberOfTokens));
_mintTokens(msg.sender, numberOfTokens, colors);
payable(withdrawAddress).transfer(msg.value);
emit addressPrivateSlotsChange(msg.sender, _whiteList[msg.sender]);
}
/**
* @dev mint new Crystal token with given
* color to provided address
*
* Requirements:
* - public sale should be active
* - color should be in a valid range
* - sender should have public sale minting slots
* - sender should pay OG price for each token
*
* @param numberOfTokens is an amount of tokens to mint
* @param colors is array with Crystal colors
*/
function mintPublic(uint8 numberOfTokens, uint8[] memory colors) public payable {
require(_publicSale, "Public sale is not active!");
require(numberOfTokens > 0, "Number of tokens cannot be lower than, or equal to 0!");
require(numberOfTokens <= MAX_PURCHASE, "Trying to mint too many tokens!");
require(totalSupply() + numberOfTokens <= maxTotalSupply, "Total Supply limit have reached!");
require(numberOfTokens + _publicSlots[msg.sender] <= MAX_PURCHASE, "Address limit have reached!");
require(OG_PRICE * numberOfTokens == msg.value, "Ether value sent is not correct!");
_publicSlots[msg.sender] = uint8(_publicSlots[msg.sender].add(numberOfTokens));
_mintTokens(msg.sender, numberOfTokens, colors);
payable(withdrawAddress).transfer(msg.value);
emit addressPublicSlotsChange(msg.sender, MAX_PURCHASE - _publicSlots[msg.sender], maxTotalSupply - totalSupply());
}
/**
* @dev mint gift Crystal tokens with given URI
*
* Requirements:
* - sender must be contract owner
*
* @param to is address where to mint new token
* @param numberOfTokens is an amount of tokens to mint
* @param colors is array with Crystal colors
*/
function mintGiftToken(address to, uint8 numberOfTokens, uint8[] memory colors) public onlyOwner {
require(numberOfTokens > 0, "Number of tokens cannot be lower than, or equal to 0!");
require(totalSupply() + numberOfTokens <= maxTotalSupply, "Total Supply limit have reached!");
_mintTokens(to, numberOfTokens, colors);
}
/**
* @dev mint new Crystal tokens with given
* color to sender
*
* @param numberOfTokens is an amount of tokens to mint
* @param colors is array with Crystal colors
*/
function _mintTokens(address to, uint8 numberOfTokens, uint8[] memory colors) private {
require(!isFreeze, "contract have already frozen!");
require(numberOfTokens == colors.length, "Colors array length should be equal to numberOfTokens!");
for (uint8 i = 0; i < numberOfTokens; i++) {
uint256 tokenId = totalSupply().add(1);
_safeMint(to, tokenId);
_setTokenURI(tokenId, _formatURI(_baseTokenURI, _uint2str(tokenId)));
_tokenColors[tokenId] = colors[i];
}
}
/**
* @dev return color of given crystal
*/
function tokenColor(uint256 tokenId) public view virtual returns (uint8) {
require(_exists(tokenId), "ERC721URIStorage: Color query for nonexistent token");
return _tokenColors[tokenId];
}
/**
* @dev freeze contract to prevent any tokenURI changes
* and set maxTotalSupply as current total supply
*
* Requirements:
*
* - `sender` must be contract owner
*/
function freeze() external onlyOwner {
require(!isFreeze, "contract have already frozen!");
isFreeze = true;
maxTotalSupply = totalSupply();
}
/**
* @dev Sets public function that will set
* `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
* - `sender` must be contract owner
*/
function setTokenURI(uint256 tokenId, string memory _tokenURI) external onlyOwner {
require(!isFreeze, "contract have already frozen!");
_setTokenURI(tokenId, _tokenURI);
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
delete _tokenColors[tokenId];
}
/**
* @dev check how many tokens is available for mint
*
* @return uint256 remaining tokens
*/
function availableForMint() public view virtual returns (uint256) {
return (maxTotalSupply - totalSupply());
}
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
/**
* @dev format token URI for given token ID
*
* @param basePath is tokenURI base path
* @param tokenID is string representation of SST token ID
* @return string is formatted tokenURI with metadata
*/
function _formatURI(string memory basePath, string memory tokenID) internal pure returns (string memory) {
return string(abi.encodePacked(basePath, tokenID, ".json"));
}
/**
* @dev format given uint to memory string
*
* @param _i uint to convert
* @return string is uint converted to string
*/
function _uint2str(uint _i) internal pure returns (string memory) {
if (_i == 0) {
return "0";
}
uint j = _i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len;
while (_i != 0) {
k = k-1;
uint8 temp = (48 + uint8(_i - _i / 10 * 10));
bytes1 b1 = bytes1(temp);
bstr[k] = b1;
_i /= 10;
}
return string(bstr);
}
}
Address.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
SafeMath.sol 226 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 162 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
COLORS_VARIATIONS 0x26e0032d → uint8
MAX_PURCHASE 0x7146bd08 → uint8
OG_PRICE 0x90069b42 → uint256
addressPrivateSaleSlots 0x8ec33726 → uint256
addressPublicSaleSlots 0x26f8873e → uint8
availableForMint 0x6204b831 → uint256
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isFreeze 0xc154d6ca → bool
isPrivateSaleActive 0xd8a9e1e9 → bool
isPublicSaleActive 0x1e84c413 → bool
isPublicSaleEnded 0xeeca3737 → bool
isWhitelisted 0x3af32abf → bool
maxTotalSupply 0x2ab4d052 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenColor 0x58ac8eef → uint8
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
addWhitelistAddresses 0xe71159b2
uint8 numberOfTokens
address[] addresses
approve 0x095ea7b3
address to
uint256 tokenId
flipPrivateSaleState 0x3719e3b0
No parameters
flipPublicSaleState 0xa10866ef
No parameters
freeze 0x62a5af3b
No parameters
mintGiftToken 0xd5dc0f2f
address to
uint8 numberOfTokens
uint8[] colors
mintPrivate 0x4da79d5a
uint8 numberOfTokens
uint8[] colors
mintPublic 0xfcc777f5
uint8 numberOfTokens
uint8[] colors
removeWhitelistAddresses 0xb83921a6
address[] addresses
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setTokenURI 0x162094c4
uint256 tokenId
string _tokenURI
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address