Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x6C9B0650DF63f99cEC1d50032b23720A927c44Cd
Balance 0 ETH
Nonce 1
Code Size 19123 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

19123 bytes
0x608060405234801561000f575f80fd5b50600436106101e3575f3560e01c806370a082311161010d578063b88d4fde116100a0578063e985e9c51161006f578063e985e9c514610589578063ee99205c146105b9578063f2fde38b146105d7578063f46eccc4146105f3576101e3565b8063b88d4fde14610503578063c66828621461051f578063c87b56dd1461053d578063cf456ae71461056d576101e3565b806395d89b41116100dc57806395d89b41146104915780639dd373b9146104af578063a22cb465146104cb578063af704f56146104e7576101e3565b806370a0823114610409578063715018a614610439578063766ca46c146104435780638da5cb5b14610473576101e3565b80632f745c591161018557806351cff8d91161015457806351cff8d91461038557806355f804b3146103a15780636112e8ac146103bd5780636352211e146103d9576101e3565b80632f745c59146102eb57806332cb6b0c1461031b57806342842e0e146103395780634f6ccce714610355576101e3565b8063095ea7b3116101c1578063095ea7b31461026557806318160ddd1461028157806323b872dd1461029f5780632b92284e146102bb576101e3565b806301ffc9a7146101e757806306fdde0314610217578063081812fc14610235575b5f80fd5b61020160048036038101906101fc9190612e19565b610623565b60405161020e9190612e5e565b60405180910390f35b61021f61069c565b60405161022c9190612ee7565b60405180910390f35b61024f600480360381019061024a9190612f3a565b61072b565b60405161025c9190612fa4565b60405180910390f35b61027f600480360381019061027a9190612fe7565b6107ac565b005b6102896108c2565b6040516102969190613034565b60405180910390f35b6102b960048036038101906102b4919061304d565b6108ce565b005b6102d560048036038101906102d0919061309d565b61092e565b6040516102e29190613034565b60405180910390f35b61030560048036038101906103009190612fe7565b610943565b6040516103129190613034565b60405180910390f35b6103236109e3565b6040516103309190613034565b60405180910390f35b610353600480360381019061034e919061304d565b6109e8565b005b61036f600480360381019061036a9190612f3a565b610a07565b60405161037c9190613034565b60405180910390f35b61039f600480360381019061039a919061309d565b610a75565b005b6103bb60048036038101906103b691906131f4565b610b3d565b005b6103d760048036038101906103d29190613271565b610bcc565b005b6103f360048036038101906103ee9190612f3a565b61109e565b6040516104009190612fa4565b60405180910390f35b610423600480360381019061041e919061309d565b61114a565b6040516104309190613034565b60405180910390f35b6104416111fe565b005b61045d600480360381019061045891906132c1565b611285565b60405161046a9190612e5e565b60405180910390f35b61047b6112af565b6040516104889190612fa4565b60405180910390f35b6104996112d7565b6040516104a69190612ee7565b60405180910390f35b6104c960048036038101906104c4919061309d565b611367565b005b6104e560048036038101906104e09190613329565b611426565b005b61050160048036038101906104fc91906133c4565b6115a1565b005b61051d600480360381019061051891906134bf565b6117bb565b005b61052761181d565b6040516105349190612ee7565b60405180910390f35b61055760048036038101906105529190612f3a565b6118a9565b6040516105649190612ee7565b60405180910390f35b61058760048036038101906105829190613329565b611a16565b005b6105a3600480360381019061059e919061353f565b611aea565b6040516105b09190612e5e565b60405180910390f35b6105c1611b78565b6040516105ce9190612fa4565b60405180910390f35b6105f160048036038101906105ec919061309d565b611b9d565b005b61060d6004803603810190610608919061309d565b611c93565b60405161061a9190612e5e565b60405180910390f35b5f7f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610695575061069482611cb0565b5b9050919050565b60605f80546106aa906135aa565b80601f01602080910402602001604051908101604052809291908181526020018280546106d6906135aa565b80156107215780601f106106f857610100808354040283529160200191610721565b820191905f5260205f20905b81548152906001019060200180831161070457829003601f168201915b5050505050905090565b5f61073582611d91565b610774576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076b9061364a565b60405180910390fd5b60045f8381526020019081526020015f205f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b5f6107b68261109e565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610826576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081d906136d8565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610845611df9565b73ffffffffffffffffffffffffffffffffffffffff16148061087457506108738161086e611df9565b611aea565b5b6108b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108aa90613766565b60405180910390fd5b6108bd8383611e00565b505050565b5f600880549050905090565b6108df6108d9611df9565b82611eb6565b61091e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610915906137f4565b60405180910390fd5b610929838383611f92565b505050565b6011602052805f5260405f205f915090505481565b5f61094d8361114a565b821061098e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098590613882565b60405180910390fd5b60065f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f2054905092915050565b60c881565b610a0283838360405180602001604052805f8152506117bb565b505050565b5f610a106108c2565b8210610a51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4890613910565b60405180910390fd5b60088281548110610a6557610a6461392e565b5b905f5260205f2001549050919050565b610a7d611df9565b73ffffffffffffffffffffffffffffffffffffffff16610a9b6112af565b73ffffffffffffffffffffffffffffffffffffffff1614610af1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae8906139a5565b60405180910390fd5b5f4790508173ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015610b38573d5f803e3d5ffd5b505050565b610b45611df9565b73ffffffffffffffffffffffffffffffffffffffff16610b636112af565b73ffffffffffffffffffffffffffffffffffffffff1614610bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb0906139a5565b60405180910390fd5b80600b9081610bc89190613b60565b5050565b600e5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16610c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4c90613c79565b60405180910390fd5b60c882610c606108c2565b610c6a9190613cc4565b1115610cab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca290613d41565b60405180910390fd5b60018160ff1610158015610cc3575060048160ff1611155b610d02576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf990613da9565b60405180910390fd5b60018214610d45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3c90613e37565b60405180910390fd5b600460115f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205410610dc5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dbc90613e9f565b60405180910390fd5b60105f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8260ff1660ff1681526020019081526020015f205f9054906101000a900460ff1615610e64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5b90613f2d565b60405180910390fd5b5f8060018360ff1603610e9157610e7a836121e2565b6079610e869190613cc4565b915060c89050610f11565b60028360ff1603610ebc57610ea5836121e2565b603d610eb19190613cc4565b915060789050610f10565b60038360ff1603610ee757610ed0836121e2565b6015610edc9190613cc4565b9150603c9050610f0f565b60048360ff1603610f0e57610efb836121e2565b6001610f079190613cc4565b9150601490505b5b5b5b8060018584610f209190613cc4565b610f2a9190613f4b565b1115610f6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6290613fc8565b60405180910390fd5b5f829050610f79868261228d565b600160105f8873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8660ff1660ff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555060115f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f81548092919061103090613fe6565b919050555060125f81548092919061104790613fe6565b91905055508360ff168673ffffffffffffffffffffffffffffffffffffffff166012547f1ec9f78f7ceb3f89742b1bc359b0614e8f0cc003eca99d1a202b52a58c7653ff60405160405180910390a4505050505050565b5f8060025f8481526020019081526020015f205f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611141576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111389061409d565b60405180910390fd5b80915050919050565b5f8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b09061412b565b60405180910390fd5b60035f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b611206611df9565b73ffffffffffffffffffffffffffffffffffffffff166112246112af565b73ffffffffffffffffffffffffffffffffffffffff161461127a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611271906139a5565b60405180910390fd5b6112835f6122aa565b565b6010602052815f5260405f20602052805f5260405f205f915091509054906101000a900460ff1681565b5f600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546112e6906135aa565b80601f0160208091040260200160405190810160405280929190818152602001828054611312906135aa565b801561135d5780601f106113345761010080835404028352916020019161135d565b820191905f5260205f20905b81548152906001019060200180831161134057829003601f168201915b5050505050905090565b61136f611df9565b73ffffffffffffffffffffffffffffffffffffffff1661138d6112af565b73ffffffffffffffffffffffffffffffffffffffff16146113e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113da906139a5565b60405180910390fd5b80600d5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61142e611df9565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361149b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149290614193565b60405180910390fd5b8060055f6114a7611df9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611550611df9565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516115959190612e5e565b60405180910390a35050565b600d5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611630576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162790614221565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361169e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169590614289565b60405180910390fd5b5f5b8282905081101561172a575f8383838181106116bf576116be61392e565b5b9050602002013590506116d23382611eb6565b611711576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611708906142f1565b60405180910390fd5b61171c338683611f92565b5080806001019150506116a0565b50600d5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c9a3911e3384846040518463ffffffff1660e01b815260040161178993929190614387565b5f604051808303815f87803b1580156117a0575f80fd5b505af11580156117b2573d5f803e3d5ffd5b50505050505050565b6117cc6117c6611df9565b83611eb6565b61180b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611802906137f4565b60405180910390fd5b6118178484848461236d565b50505050565b600c805461182a906135aa565b80601f0160208091040260200160405190810160405280929190818152602001828054611856906135aa565b80156118a15780601f10611878576101008083540402835291602001916118a1565b820191905f5260205f20905b81548152906001019060200180831161188457829003601f168201915b505050505081565b60606118b482611d91565b6118f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ea90614427565b60405180910390fd5b5f600f5f8481526020019081526020015f208054611910906135aa565b80601f016020809104026020016040519081016040528092919081815260200182805461193c906135aa565b80156119875780601f1061195e57610100808354040283529160200191611987565b820191905f5260205f20905b81548152906001019060200180831161196a57829003601f168201915b505050505090505f6119976123c9565b90505f8151036119ab578192505050611a11565b5f825111156119df5780826040516020016119c792919061447f565b60405160208183030381529060405292505050611a11565b806119e985612459565b600c6040516020016119fd93929190614522565b604051602081830303815290604052925050505b919050565b611a1e611df9565b73ffffffffffffffffffffffffffffffffffffffff16611a3c6112af565b73ffffffffffffffffffffffffffffffffffffffff1614611a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a89906139a5565b60405180910390fd5b80600e5f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505050565b5f60055f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b600d5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611ba5611df9565b73ffffffffffffffffffffffffffffffffffffffff16611bc36112af565b73ffffffffffffffffffffffffffffffffffffffff1614611c19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c10906139a5565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611c87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7e906145c2565b60405180910390fd5b611c90816122aa565b50565b600e602052805f5260405f205f915054906101000a900460ff1681565b5f7f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611d7a57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611d8a5750611d89826125b2565b5b9050919050565b5f8073ffffffffffffffffffffffffffffffffffffffff1660025f8481526020019081526020015f205f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b5f33905090565b8160045f8381526020019081526020015f205f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611e708361109e565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f611ec082611d91565b611eff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef690614650565b60405180910390fd5b5f611f098361109e565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611f7857508373ffffffffffffffffffffffffffffffffffffffff16611f608461072b565b73ffffffffffffffffffffffffffffffffffffffff16145b80611f895750611f888185611aea565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611fb28261109e565b73ffffffffffffffffffffffffffffffffffffffff1614612008576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fff906146de565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612076576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206d9061476c565b60405180910390fd5b61208183838361261b565b61208b5f82611e00565b600160035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546120d89190613f4b565b92505081905550600160035f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461212c9190613cc4565b925050819055508160025f8381526020019081526020015f205f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b5f805f60018460ff16036121fd576079915060c89050612244565b60028460ff160361221557603d915060789050612243565b60038460ff160361222d5760159150603c9050612242565b60048460ff16036122415760019150601490505b5b5b5b5f808390505b8281116122815761225a81611d91565b1561226e57818061226a90613fe6565b9250505b808061227990613fe6565b91505061224a565b50809350505050919050565b6122a6828260405180602001604052805f81525061272b565b5050565b5f600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612378848484611f92565b61238484848484612785565b6123c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123ba906147fa565b60405180910390fd5b50505050565b6060600b80546123d8906135aa565b80601f0160208091040260200160405190810160405280929190818152602001828054612404906135aa565b801561244f5780601f106124265761010080835404028352916020019161244f565b820191905f5260205f20905b81548152906001019060200180831161243257829003601f168201915b5050505050905090565b60605f820361249f576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506125ad565b5f8290505f5b5f82146124ce5780806124b790613fe6565b915050600a826124c79190614845565b91506124a5565b5f8167ffffffffffffffff8111156124e9576124e86130d0565b5b6040519080825280601f01601f19166020018201604052801561251b5781602001600182028036833780820191505090505b5090505b5f85146125a6576001826125339190613f4b565b9150600a856125429190614875565b603061254e9190613cc4565b60f81b8183815181106125645761256361392e565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a905350600a8561259f9190614845565b945061251f565b8093505050505b919050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612626838383612907565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612667576126628161290c565b6126a6565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146126a5576126a48382612950565b5b5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036126e7576126e281612aa6565b612726565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612725576127248282612b66565b5b5b505050565b6127358383612bde565b6127415f848484612785565b612780576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612777906147fa565b60405180910390fd5b505050565b5f6127a58473ffffffffffffffffffffffffffffffffffffffff16612da2565b156128fa578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026127ce611df9565b8786866040518563ffffffff1660e01b81526004016127f094939291906148f7565b6020604051808303815f875af192505050801561282b57506040513d601f19601f820116820180604052508101906128289190614955565b60015b6128aa573d805f8114612859576040519150601f19603f3d011682016040523d82523d5f602084013e61285e565b606091505b505f8151036128a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612899906147fa565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506128ff565b600190505b949350505050565b505050565b60088054905060095f8381526020019081526020015f2081905550600881908060018154018082558091505060019003905f5260205f20015f909190919091505550565b5f600161295c8461114a565b6129669190613f4b565b90505f60075f8481526020019081526020015f20549050818114612a3d575f60065f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8481526020019081526020015f205490508060065f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8481526020019081526020015f20819055508160075f8381526020019081526020015f2081905550505b60075f8481526020019081526020015f205f905560065f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f205f905550505050565b5f6001600880549050612ab99190613f4b565b90505f60095f8481526020019081526020015f205490505f60088381548110612ae557612ae461392e565b5b905f5260205f20015490508060088381548110612b0557612b0461392e565b5b905f5260205f2001819055508160095f8381526020019081526020015f208190555060095f8581526020019081526020015f205f90556008805480612b4d57612b4c614980565b5b600190038181905f5260205f20015f9055905550505050565b5f612b708361114a565b90508160065f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f20819055508060075f8481526020019081526020015f2081905550505050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612c4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c43906149f7565b60405180910390fd5b612c5581611d91565b15612c95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c8c90614a5f565b60405180910390fd5b612ca05f838361261b565b600160035f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254612ced9190613cc4565b925050819055508160025f8381526020019081526020015f205f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b5f80823b90505f8111915050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612df881612dc4565b8114612e02575f80fd5b50565b5f81359050612e1381612def565b92915050565b5f60208284031215612e2e57612e2d612dbc565b5b5f612e3b84828501612e05565b91505092915050565b5f8115159050919050565b612e5881612e44565b82525050565b5f602082019050612e715f830184612e4f565b92915050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f612eb982612e77565b612ec38185612e81565b9350612ed3818560208601612e91565b612edc81612e9f565b840191505092915050565b5f6020820190508181035f830152612eff8184612eaf565b905092915050565b5f819050919050565b612f1981612f07565b8114612f23575f80fd5b50565b5f81359050612f3481612f10565b92915050565b5f60208284031215612f4f57612f4e612dbc565b5b5f612f5c84828501612f26565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f612f8e82612f65565b9050919050565b612f9e81612f84565b82525050565b5f602082019050612fb75f830184612f95565b92915050565b612fc681612f84565b8114612fd0575f80fd5b50565b5f81359050612fe181612fbd565b92915050565b5f8060408385031215612ffd57612ffc612dbc565b5b5f61300a85828601612fd3565b925050602061301b85828601612f26565b9150509250929050565b61302e81612f07565b82525050565b5f6020820190506130475f830184613025565b92915050565b5f805f6060848603121561306457613063612dbc565b5b5f61307186828701612fd3565b935050602061308286828701612fd3565b925050604061309386828701612f26565b9150509250925092565b5f602082840312156130b2576130b1612dbc565b5b5f6130bf84828501612fd3565b91505092915050565b5f80fd5b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61310682612e9f565b810181811067ffffffffffffffff82111715613125576131246130d0565b5b80604052505050565b5f613137612db3565b905061314382826130fd565b919050565b5f67ffffffffffffffff821115613162576131616130d0565b5b61316b82612e9f565b9050602081019050919050565b828183375f83830152505050565b5f61319861319384613148565b61312e565b9050828152602081018484840111156131b4576131b36130cc565b5b6131bf848285613178565b509392505050565b5f82601f8301126131db576131da6130c8565b5b81356131eb848260208601613186565b91505092915050565b5f6020828403121561320957613208612dbc565b5b5f82013567ffffffffffffffff81111561322657613225612dc0565b5b613232848285016131c7565b91505092915050565b5f60ff82169050919050565b6132508161323b565b811461325a575f80fd5b50565b5f8135905061326b81613247565b92915050565b5f805f6060848603121561328857613287612dbc565b5b5f61329586828701612fd3565b93505060206132a686828701612f26565b92505060406132b78682870161325d565b9150509250925092565b5f80604083850312156132d7576132d6612dbc565b5b5f6132e485828601612fd3565b92505060206132f58582860161325d565b9150509250929050565b61330881612e44565b8114613312575f80fd5b50565b5f81359050613323816132ff565b92915050565b5f806040838503121561333f5761333e612dbc565b5b5f61334c85828601612fd3565b925050602061335d85828601613315565b9150509250929050565b5f80fd5b5f80fd5b5f8083601f840112613384576133836130c8565b5b8235905067ffffffffffffffff8111156133a1576133a0613367565b5b6020830191508360208202830111156133bd576133bc61336b565b5b9250929050565b5f805f604084860312156133db576133da612dbc565b5b5f6133e886828701612fd3565b935050602084013567ffffffffffffffff81111561340957613408612dc0565b5b6134158682870161336f565b92509250509250925092565b5f67ffffffffffffffff82111561343b5761343a6130d0565b5b61344482612e9f565b9050602081019050919050565b5f61346361345e84613421565b61312e565b90508281526020810184848401111561347f5761347e6130cc565b5b61348a848285613178565b509392505050565b5f82601f8301126134a6576134a56130c8565b5b81356134b6848260208601613451565b91505092915050565b5f805f80608085870312156134d7576134d6612dbc565b5b5f6134e487828801612fd3565b94505060206134f587828801612fd3565b935050604061350687828801612f26565b925050606085013567ffffffffffffffff81111561352757613526612dc0565b5b61353387828801613492565b91505092959194509250565b5f806040838503121561355557613554612dbc565b5b5f61356285828601612fd3565b925050602061357385828601612fd3565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806135c157607f821691505b6020821081036135d4576135d361357d565b5b50919050565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e65785f8201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b5f613634602c83612e81565b915061363f826135da565b604082019050919050565b5f6020820190508181035f83015261366181613628565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e655f8201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b5f6136c2602183612e81565b91506136cd82613668565b604082019050919050565b5f6020820190508181035f8301526136ef816136b6565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f775f8201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b5f613750603883612e81565b915061375b826136f6565b604082019050919050565b5f6020820190508181035f83015261377d81613744565b9050919050565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f5f8201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b5f6137de603183612e81565b91506137e982613784565b604082019050919050565b5f6020820190508181035f83015261380b816137d2565b9050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f755f8201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b5f61386c602b83612e81565b915061387782613812565b604082019050919050565b5f6020820190508181035f83015261389981613860565b9050919050565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f5f8201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b5f6138fa602c83612e81565b9150613905826138a0565b604082019050919050565b5f6020820190508181035f830152613927816138ee565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f61398f602083612e81565b915061399a8261395b565b602082019050919050565b5f6020820190508181035f8301526139bc81613983565b9050919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302613a1f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826139e4565b613a2986836139e4565b95508019841693508086168417925050509392505050565b5f819050919050565b5f613a64613a5f613a5a84612f07565b613a41565b612f07565b9050919050565b5f819050919050565b613a7d83613a4a565b613a91613a8982613a6b565b8484546139f0565b825550505050565b5f90565b613aa5613a99565b613ab0818484613a74565b505050565b5b81811015613ad357613ac85f82613a9d565b600181019050613ab6565b5050565b601f821115613b1857613ae9816139c3565b613af2846139d5565b81016020851015613b01578190505b613b15613b0d856139d5565b830182613ab5565b50505b505050565b5f82821c905092915050565b5f613b385f1984600802613b1d565b1980831691505092915050565b5f613b508383613b29565b9150826002028217905092915050565b613b6982612e77565b67ffffffffffffffff811115613b8257613b816130d0565b5b613b8c82546135aa565b613b97828285613ad7565b5f60209050601f831160018114613bc8575f8415613bb6578287015190505b613bc08582613b45565b865550613c27565b601f198416613bd6866139c3565b5f5b82811015613bfd57848901518255600182019150602085019450602081019050613bd8565b86831015613c1a5784890151613c16601f891682613b29565b8355505b6001600288020188555050505b505050505050565b7f4e6f7420617574686f72697a656420746f206d696e74000000000000000000005f82015250565b5f613c63601683612e81565b9150613c6e82613c2f565b602082019050919050565b5f6020820190508181035f830152613c9081613c57565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f613cce82612f07565b9150613cd983612f07565b9250828201905080821115613cf157613cf0613c97565b5b92915050565b7f53616c6520776f756c6420657863656564206d617820737570706c79000000005f82015250565b5f613d2b601c83612e81565b9150613d3682613cf7565b602082019050919050565b5f6020820190508181035f830152613d5881613d1f565b9050919050565b7f496e76616c6964206c6576656c000000000000000000000000000000000000005f82015250565b5f613d93600d83612e81565b9150613d9e82613d5f565b602082019050919050565b5f6020820190508181035f830152613dc081613d87565b9050919050565b7f4f6e6c792031204e46542063616e206265206d696e74656420706572207472615f8201527f6e73616374696f6e000000000000000000000000000000000000000000000000602082015250565b5f613e21602883612e81565b9150613e2c82613dc7565b604082019050919050565b5f6020820190508181035f830152613e4e81613e15565b9050919050565b7f557365722063616e206f6e6c79206f776e20757020746f2034204e46547300005f82015250565b5f613e89601e83612e81565b9150613e9482613e55565b602082019050919050565b5f6020820190508181035f830152613eb681613e7d565b9050919050565b7f5573657220616c7265616479206f776e7320616e204e4654206f6620746869735f8201527f206c6576656c0000000000000000000000000000000000000000000000000000602082015250565b5f613f17602683612e81565b9150613f2282613ebd565b604082019050919050565b5f6020820190508181035f830152613f4481613f0b565b9050919050565b5f613f5582612f07565b9150613f6083612f07565b9250828203905081811115613f7857613f77613c97565b5b92915050565b7f4e6f7420656e6f756768204e46547320696e2074686973206c6576656c0000005f82015250565b5f613fb2601d83612e81565b9150613fbd82613f7e565b602082019050919050565b5f6020820190508181035f830152613fdf81613fa6565b9050919050565b5f613ff082612f07565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361402257614021613c97565b5b600182019050919050565b7f4552433732313a206f776e657220717565727920666f72206e6f6e65786973745f8201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b5f614087602983612e81565b91506140928261402d565b604082019050919050565b5f6020820190508181035f8301526140b48161407b565b9050919050565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a655f8201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b5f614115602a83612e81565b9150614120826140bb565b604082019050919050565b5f6020820190508181035f83015261414281614109565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c6572000000000000005f82015250565b5f61417d601983612e81565b915061418882614149565b602082019050919050565b5f6020820190508181035f8301526141aa81614171565b9050919050565b7f43616e206f6e6c79207472616e7366657220746f20746865207374616b696e675f8201527f20636f6e74726163740000000000000000000000000000000000000000000000602082015250565b5f61420b602983612e81565b9150614216826141b1565b604082019050919050565b5f6020820190508181035f830152614238816141ff565b9050919050565b7f496e76616c696420746f206164647265737300000000000000000000000000005f82015250565b5f614273601283612e81565b915061427e8261423f565b602082019050919050565b5f6020820190508181035f8301526142a081614267565b9050919050565b7f43616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665645f82015250565b5f6142db602083612e81565b91506142e6826142a7565b602082019050919050565b5f6020820190508181035f830152614308816142cf565b9050919050565b5f82825260208201905092915050565b5f80fd5b82818337505050565b5f614337838561430f565b93507f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561436a5761436961431f565b5b60208302925061437b838584614323565b82840190509392505050565b5f60408201905061439a5f830186612f95565b81810360208301526143ad81848661432c565b9050949350505050565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f5f8201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b5f614411602f83612e81565b915061441c826143b7565b604082019050919050565b5f6020820190508181035f83015261443e81614405565b9050919050565b5f81905092915050565b5f61445982612e77565b6144638185614445565b9350614473818560208601612e91565b80840191505092915050565b5f61448a828561444f565b9150614496828461444f565b91508190509392505050565b5f81546144ae816135aa565b6144b88186614445565b9450600182165f81146144d257600181146144e757614519565b60ff1983168652811515820286019350614519565b6144f0856139c3565b5f5b83811015614511578154818901526001820191506020810190506144f2565b838801955050505b50505092915050565b5f61452d828661444f565b9150614539828561444f565b915061454582846144a2565b9150819050949350505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f6145ac602683612e81565b91506145b782614552565b604082019050919050565b5f6020820190508181035f8301526145d9816145a0565b9050919050565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e65785f8201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b5f61463a602c83612e81565b9150614645826145e0565b604082019050919050565b5f6020820190508181035f8301526146678161462e565b9050919050565b7f4552433732313a207472616e73666572206f6620746f6b656e207468617420695f8201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b5f6146c8602983612e81565b91506146d38261466e565b604082019050919050565b5f6020820190508181035f8301526146f5816146bc565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f614756602483612e81565b9150614761826146fc565b604082019050919050565b5f6020820190508181035f8301526147838161474a565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e2045524337323152655f8201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b5f6147e4603283612e81565b91506147ef8261478a565b604082019050919050565b5f6020820190508181035f830152614811816147d8565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61484f82612f07565b915061485a83612f07565b92508261486a57614869614818565b5b828204905092915050565b5f61487f82612f07565b915061488a83612f07565b92508261489a57614899614818565b5b828206905092915050565b5f81519050919050565b5f82825260208201905092915050565b5f6148c9826148a5565b6148d381856148af565b93506148e3818560208601612e91565b6148ec81612e9f565b840191505092915050565b5f60808201905061490a5f830187612f95565b6149176020830186612f95565b6149246040830185613025565b818103606083015261493681846148bf565b905095945050505050565b5f8151905061494f81612def565b92915050565b5f6020828403121561496a57614969612dbc565b5b5f61497784828501614941565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffd5b7f4552433732313a206d696e7420746f20746865207a65726f20616464726573735f82015250565b5f6149e1602083612e81565b91506149ec826149ad565b602082019050919050565b5f6020820190508181035f830152614a0e816149d5565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e746564000000005f82015250565b5f614a49601c83612e81565b9150614a5482614a15565b602082019050919050565b5f6020820190508181035f830152614a7681614a3d565b905091905056fea2646970667358221220a1455a4fed614bcd8ac240ae1b10310f95022bacc7f45977bbd61341f54b78f764736f6c634300081a0033

Verified Source Code Partial Match

Compiler: v0.8.26+commit.8a97fa7a EVM: cancun Optimization: No
TooENFT.sol 1144 lines
/**
 *Submitted for verification at Etherscan.io on 2024-12-10
*/

// Contract based on https://docs.openzeppelin.com/contracts/3.x/erc721
// 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);
    }
}

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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);
    }
}


/**
 * @dev Collection of functions related to the address type
 */
library Address {

    function isContract(address account) internal view returns (bool) {

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    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");
    }


    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    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);
            }
        }
    }
}

interface IERC721Receiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}


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);
}


abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}


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;
}

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);
}

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);
}

/**
 * @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;
    }

    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())) : "";
    }

    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 {}
}

/**
 * @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) internal {
        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) internal {
        _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) internal {
        // 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) internal  {
        // 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();
    }
}

interface NFTStaking {
    function stake(address from, uint256[] calldata tokenIds) external;
}

contract TooENFT is ERC721Enumerable, Ownable{
    using Strings for uint256;

    // Constants
    uint256 public constant MAX_SUPPLY = 200;

    uint256 private constant LEVEL1_START = 121;
    uint256 private constant LEVEL1_END = 200;

    uint256 private constant LEVEL2_START = 61;
    uint256 private constant LEVEL2_END = 120;

    uint256 private constant LEVEL3_START = 21;
    uint256 private constant LEVEL3_END = 60;

    uint256 private constant LEVEL4_START = 1;
    uint256 private constant LEVEL4_END = 20;
    
    string baseURI;
    string public baseExtension = ".json";
     // Pledge contract address
    address public stakingContract;
     // Contract address that allows calling mint
    mapping(address => bool) public minters;
    mapping(uint256 => string) private _tokenURIs;
    // Record whether the user already owns NFT at each level
    mapping(address => mapping(uint8 => bool)) public userLevelOwned;
    // Record the total number of NFTs owned by the user
    mapping(address => uint256) public userTotalOwned;
    event mintTFTNFT(uint256 indexed  eventId,address indexed  sender, uint256 indexed  level);
    uint256 private eventCounter; 

    constructor(string memory initBaseURI)
        ERC721("TooENFT", "TENFT")
    {
        minters[owner()] = true;
        setBaseURI(initBaseURI);
        eventCounter = 0; 
    }

    function setMinter(address minter, bool isAllowed) external onlyOwner {
        minters[minter] = isAllowed;
    }

    // Set the pledge contract address (contract administrator only)
    function setStakingContract(address _stakingContract) external onlyOwner {
        stakingContract = _stakingContract;
    }

    // Mint method, passing in the receiving address, quantity and level
    function mint(address to, uint256 quantity, uint8 level) external {
        require(minters[msg.sender], "Not authorized to mint");
        require(totalSupply() + quantity <= MAX_SUPPLY, "Sale would exceed max supply");
        require(level >= 1 && level <= 4, "Invalid level");
        require(quantity == 1, "Only 1 NFT can be minted per transaction");
        require(userTotalOwned[to] < 4, "User can only own up to 4 NFTs");
        require(!userLevelOwned[to][level], "User already owns an NFT of this level");

        uint256 startTokenId;
        uint256 endTokenId;

        // Determine number range
        if (level == 1) {
            startTokenId = LEVEL1_START + _levelMinted(level);
            endTokenId = LEVEL1_END;
        } else if (level == 2) {
            startTokenId = LEVEL2_START + _levelMinted(level);
            endTokenId = LEVEL2_END;
        } else if (level == 3) {
            startTokenId = LEVEL3_START + _levelMinted(level);
            endTokenId = LEVEL3_END;
        } else if (level == 4) {
            startTokenId = LEVEL4_START + _levelMinted(level);
            endTokenId = LEVEL4_END;
        }

        require(
            startTokenId + quantity - 1 <= endTokenId,
            "Not enough NFTs in this level"
        );

        // Mint NFTs by number range
        uint256 tokenId = startTokenId;
        _safeMint(to, tokenId);

        //  Update user data
        userLevelOwned[to][level] = true;
        userTotalOwned[to]++;
         eventCounter++;
        emit mintTFTNFT(eventCounter,to, level);
    }

    // Get the minted quantity of a certain level
     function _levelMinted(uint8 level) internal view returns (uint256) {
        uint256 levelStart;
        uint256 levelEnd;

        if (level == 1) {
            levelStart = LEVEL1_START;
            levelEnd = LEVEL1_END;
        } else if (level == 2) {
            levelStart = LEVEL2_START;
            levelEnd = LEVEL2_END;
        } else if (level == 3) {
            levelStart = LEVEL3_START;
            levelEnd = LEVEL3_END;
        } else if (level == 4) {
            levelStart = LEVEL4_START;
            levelEnd = LEVEL4_END;
        }

        uint256 mintedInLevel = 0;
        for (uint256 i = levelStart; i <= levelEnd; i++) {
            if (_exists(i)) {
                mintedInLevel++;
            }
        }
        return mintedInLevel;
    }

    function batchTransferFrom(
        address to,
        uint256[] calldata tokenIds
    ) external {
        require(to == stakingContract, "Can only transfer to the staking contract");
        require(to != address(0), "Invalid to address");
        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 tokenId = tokenIds[i];
            // Make sure the caller has permission to transfer this NFT
            require(_isApprovedOrOwner(msg.sender, tokenId), "Caller is not owner nor approved");
            _transfer(msg.sender, to, tokenId);
        }
        // Call the batch pledge method of the pledge contract
        NFTStaking(stakingContract).stake(msg.sender, tokenIds);
    }


    function tokenURI(uint256 tokenId)
        public view override(ERC721) returns (string memory)
    {
        require(
            _exists(tokenId),
        "ERC721Metadata: 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));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return 
            string(abi.encodePacked(base, tokenId.toString(), baseExtension));
    }

    // internal
    function _baseURI() internal view virtual override returns (string memory) {
        return baseURI;
    }

    function setBaseURI(string memory _newBaseURI) public onlyOwner {
        baseURI = _newBaseURI;
    }

    function withdraw(address to) public onlyOwner {
        uint256 balance = address(this).balance;
        payable(to).transfer(balance);
    }
    
}

Read Contract

MAX_SUPPLY 0x32cb6b0c → uint256
balanceOf 0x70a08231 → uint256
baseExtension 0xc6682862 → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
minters 0xf46eccc4 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
stakingContract 0xee99205c → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
userLevelOwned 0x766ca46c → bool
userTotalOwned 0x2b92284e → uint256

Write Contract 13 functions

These functions modify contract state and require a wallet transaction to execute.

approve 0x095ea7b3
address to
uint256 tokenId
batchTransferFrom 0xaf704f56
address to
uint256[] tokenIds
mint 0x6112e8ac
address to
uint256 quantity
uint8 level
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _newBaseURI
setMinter 0xcf456ae7
address minter
bool isAllowed
setStakingContract 0x9dd373b9
address _stakingContract
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x51cff8d9
address to

Recent Transactions

No transactions found for this address