Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x81a870168748e9f4E0Eae703403b69cA7B70CB69
Balance 0 ETH
Nonce 1
Code Size 22535 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

22535 bytes
0x6080604052600436106102e7575f3560e01c8063790ca4131161018f578063a4202504116100db578063c634b78e11610094578063dac6270d1161006e578063dac6270d14610b2c578063dd62ed3e14610b56578063e88b773714610b92578063f2fde38b14610bbc576102ee565b8063c634b78e14610a88578063cad4730314610ab0578063d800b9bd14610aec576102ee565b8063a420250414610952578063a607a8d91461098e578063a9059cbb146109b8578063a98ad46c146109f4578063b187bd2614610a1e578063b4f0dc4414610a48576102ee565b80639031c1e9116101485780639a19c7b0116101225780639a19c7b01461089c5780639be572f6146108c45780639ca5e849146108ee578063a2bdedf414610916576102ee565b80639031c1e91461082057806395d89b41146108485780639785fac814610872576102ee565b8063790ca413146107495780637b97008d146107735780638456cb591461079b5780638a8c523c146107b15780638c3c4b34146107c75780638da5cb5b146107f6576102ee565b80632e37eef61161024e5780634b7f1d811161020757806370a08231116101e157806370a08231146106a3578063715018a6146106df57806375b238fc146106f5578063777e0d861461071f576102ee565b80634b7f1d811461060f5780636386c1c7146106395780636e94729814610679576102ee565b80632e37eef614610526578063313ce5671461056757806331ae450b146105915780633f4ba83a146105bb5780634782f779146105d157806348c54b9d146105f9576102ee565b80631481794e116102a05780631481794e1461041257806318160ddd1461043a5780631959a00214610464578063235caa21146104a457806323b872dd146104ae57806324d7806c146104ea576102ee565b8063055ad42e146102f2578063064a59d01461031c57806306def8021461034657806306fdde0314610382578063095ea7b3146103ac5780630f0f30b2146103e8576102ee565b366102ee57005b5f80fd5b3480156102fd575f80fd5b50610306610be4565b6040516103139190614616565b60405180910390f35b348015610327575f80fd5b50610330610bfa565b60405161033d9190614649565b60405180910390f35b348015610351575f80fd5b5061036c600480360381019061036791906146c0565b610c0d565b6040516103799190614703565b60405180910390f35b34801561038d575f80fd5b50610396610cce565b6040516103a3919061478c565b60405180910390f35b3480156103b7575f80fd5b506103d260048036038101906103cd91906147d6565b610d5e565b6040516103df9190614649565b60405180910390f35b3480156103f3575f80fd5b506103fc610d80565b6040516104099190614823565b60405180910390f35b34801561041d575f80fd5b50610438600480360381019061043391906147d6565b610da8565b005b348015610445575f80fd5b5061044e611188565b60405161045b9190614703565b60405180910390f35b34801561046f575f80fd5b5061048a600480360381019061048591906146c0565b611191565b60405161049b959493929190614888565b60405180910390f35b6104ac61122d565b005b3480156104b9575f80fd5b506104d460048036038101906104cf91906148d9565b6116c9565b6040516104e19190614649565b60405180910390f35b3480156104f5575f80fd5b50610510600480360381019061050b91906146c0565b6116f7565b60405161051d9190614649565b60405180910390f35b348015610531575f80fd5b5061054c60048036038101906105479190614929565b611714565b60405161055e96959493929190614954565b60405180910390f35b348015610572575f80fd5b5061057b6117cc565b60405161058891906149ce565b60405180910390f35b34801561059c575f80fd5b506105a56117d4565b6040516105b29190614a9e565b60405180910390f35b3480156105c6575f80fd5b506105cf61185f565b005b3480156105dc575f80fd5b506105f760048036038101906105f29190614af9565b611883565b005b348015610604575f80fd5b5061060d611c1d565b005b34801561061a575f80fd5b50610623611cc5565b6040516106309190614703565b60405180910390f35b348015610644575f80fd5b5061065f600480360381019061065a91906146c0565b611cd1565b604051610670959493929190614b37565b60405180910390f35b348015610684575f80fd5b5061068d611df0565b60405161069a9190614703565b60405180910390f35b3480156106ae575f80fd5b506106c960048036038101906106c491906146c0565b611df7565b6040516106d69190614703565b60405180910390f35b3480156106ea575f80fd5b506106f3611e3c565b005b348015610700575f80fd5b50610709611e4f565b6040516107169190614ba0565b60405180910390f35b34801561072a575f80fd5b50610733611e73565b6040516107409190614703565b60405180910390f35b348015610754575f80fd5b5061075d611f63565b60405161076a9190614bb9565b60405180910390f35b34801561077e575f80fd5b5061079960048036038101906107949190614929565b611f7c565b005b3480156107a6575f80fd5b506107af61243a565b005b3480156107bc575f80fd5b506107c561245f565b005b3480156107d2575f80fd5b506107db61258d565b6040516107ed96959493929190614bd2565b60405180910390f35b348015610801575f80fd5b5061080a6126b2565b6040516108179190614823565b60405180910390f35b34801561082b575f80fd5b5061084660048036038101906108419190614c31565b6126da565b005b348015610853575f80fd5b5061085c612a5d565b604051610869919061478c565b60405180910390f35b34801561087d575f80fd5b50610886612aed565b6040516108939190614703565b60405180910390f35b3480156108a7575f80fd5b506108c260048036038101906108bd91906146c0565b612b8c565b005b3480156108cf575f80fd5b506108d8612db5565b6040516108e59190614703565b60405180910390f35b3480156108f9575f80fd5b50610914600480360381019061090f9190614ca8565b612dc1565b005b348015610921575f80fd5b5061093c60048036038101906109379190614929565b613210565b6040516109499190614823565b60405180910390f35b34801561095d575f80fd5b5061097860048036038101906109739190614929565b61324b565b6040516109859190614703565b60405180910390f35b348015610999575f80fd5b506109a2613295565b6040516109af9190614703565b60405180910390f35b3480156109c3575f80fd5b506109de60048036038101906109d991906147d6565b6132a3565b6040516109eb9190614649565b60405180910390f35b3480156109ff575f80fd5b50610a086132c5565b604051610a159190614d53565b60405180910390f35b348015610a29575f80fd5b50610a326132ea565b604051610a3f9190614649565b60405180910390f35b348015610a53575f80fd5b50610a6e6004803603810190610a699190614929565b6132fd565b604051610a7f959493929190614d6c565b60405180910390f35b348015610a93575f80fd5b50610aae6004803603810190610aa991906146c0565b613431565b005b348015610abb575f80fd5b50610ad66004803603810190610ad19190614929565b6135a5565b604051610ae39190614703565b60405180910390f35b348015610af7575f80fd5b50610b126004803603810190610b0d9190614929565b61361e565b604051610b23959493929190614dbd565b60405180910390f35b348015610b37575f80fd5b50610b406136d9565b604051610b4d9190614703565b60405180910390f35b348015610b61575f80fd5b50610b7c6004803603810190610b779190614e0e565b613771565b604051610b899190614703565b60405180910390f35b348015610b9d575f80fd5b50610ba66137f3565b604051610bb39190614703565b60405180910390f35b348015610bc7575f80fd5b50610be26004803603810190610bdd91906146c0565b6137f8565b005b600760089054906101000a900463ffffffff1681565b6007600c9054906101000a900460ff1681565b5f80600a5f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090508060010160109054906101000a900460ff16610cb257805f0160109054906101000a90046fffffffffffffffffffffffffffffffff16815f015f9054906101000a90046fffffffffffffffffffffffffffffffff16610cad9190614e79565b610cb4565b5f5b6fffffffffffffffffffffffffffffffff16915050919050565b606060038054610cdd90614ee9565b80601f0160208091040260200160405190810160405280929190818152602001828054610d0990614ee9565b8015610d545780601f10610d2b57610100808354040283529160200191610d54565b820191905f5260205f20905b815481529060010190602001808311610d3757829003601f168201915b5050505050905090565b5f80610d68613943565b9050610d7581858561394a565b600191505092915050565b5f60085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610db061395c565b610db86139e3565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610e1d576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8103610e56576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060095f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610eb19190614823565b602060405180830381865afa158015610ecc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ef09190614f2d565b1015610f28576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f74828260095f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16613a329092919063ffffffff16565b600e6040518060a001604052808473ffffffffffffffffffffffffffffffffffffffff168152602001836fffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff168152602001600160ff16815250908060018154018082558091505060019003905f5260205f2090600302015f909190919091505f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060408201518160010160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506060820151816002015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060808201518160020160146101000a81548160ff021916908360ff16021790555050508173ffffffffffffffffffffffffffffffffffffffff167fd913220df549c2d5c13a1b85066da67839daa09672540ec21301dccf41ccbc688260014260405161117493929190614f91565b60405180910390a2611184613ab1565b5050565b5f600254905090565b600a602052805f5260405f205f91509050805f015f9054906101000a90046fffffffffffffffffffffffffffffffff1690805f0160109054906101000a90046fffffffffffffffffffffffffffffffff1690806001015f9054906101000a900467ffffffffffffffff16908060010160089054906101000a900467ffffffffffffffff16908060010160109054906101000a900460ff16905085565b6007600d9054906101000a900460ff1615611274576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127c6139e3565b5f34036112b5576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112be33613abb565b5f600b5f600760089054906101000a900463ffffffff1663ffffffff1681526020019081526020015f2090505f6112f3611e73565b90505f670de0b6b3a7640000823461130b9190614fc6565b6113159190615034565b90505f835f015f9054906101000a900467ffffffffffffffff1667ffffffffffffffff166113416117cc565b600a61134d9190615193565b836113589190614fc6565b6113629190615034565b90505f810361139d576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6064855f0160089054906101000a900463ffffffff1663ffffffff16836113c59190614fc6565b6113cf9190615034565b9050845f01600c9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682866001015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1661144091906151dd565b1115611478576040517fe0374fbc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61148d30828461148891906151dd565b613bc2565b5f600a5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20905082815f015f8282829054906101000a90046fffffffffffffffffffffffffffffffff166114fa9190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555081815f0160108282829054906101000a90046fffffffffffffffffffffffffffffffff1661155e9190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555034816001015f8282829054906101000a900467ffffffffffffffff166115ba9190615210565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555082866001015f8282829054906101000a90046fffffffffffffffffffffffffffffffff1661160e9190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff167fc851fa0728bdb8a6ced5988459fb65da54e26d9870e988658ef1ac6c3a5f15d48434855f80604051611692959493929190615284565b60405180910390a26007600c9054906101000a900460ff16156116b9576116b833613c41565b5b5050505050506116c7613ab1565b565b5f806116d3613943565b90506116e0858285613de5565b6116eb858585613e78565b60019150509392505050565b600c602052805f5260405f205f915054906101000a900460ff1681565b600b602052805f5260405f205f91509050805f015f9054906101000a900467ffffffffffffffff1690805f0160089054906101000a900463ffffffff1690805f01600c9054906101000a90046fffffffffffffffffffffffffffffffff1690806001015f9054906101000a90046fffffffffffffffffffffffffffffffff16908060010160109054906101000a900467ffffffffffffffff16908060010160189054906101000a900467ffffffffffffffff16905086565b5f6012905090565b6060601080548060200260200160405190810160405280929190818152602001828054801561185557602002820191905f5260205f20905b815f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161180c575b5050505050905090565b61186761395c565b5f6007600d6101000a81548160ff021916908315150217905550565b61188b61395c565b6118936139e3565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036118f8576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8103611931576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8047101561196b576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8273ffffffffffffffffffffffffffffffffffffffff168260405161199090615302565b5f6040518083038185875af1925050503d805f81146119ca576040519150601f19603f3d011682016040523d82523d5f602084013e6119cf565b606091505b5050905080611a0a576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e6040518060a001604052808573ffffffffffffffffffffffffffffffffffffffff168152602001846fffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020015f60ff16815250908060018154018082558091505060019003905f5260205f2090600302015f909190919091505f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060408201518160010160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506060820151816002015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060808201518160020160146101000a81548160ff021916908360ff16021790555050508273ffffffffffffffffffffffffffffffffffffffff167fd913220df549c2d5c13a1b85066da67839daa09672540ec21301dccf41ccbc68835f42604051611c0893929190615316565b60405180910390a250611c19613ab1565b5050565b6007600d9054906101000a900460ff1615611c64576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611c6c6139e3565b6007600c9054906101000a900460ff16611cb2576040517fbcb8b8fb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611cbb33613c41565b611cc3613ab1565b565b5f600e80549050905090565b5f805f805f80600a5f8873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f209050805f015f9054906101000a90046fffffffffffffffffffffffffffffffff16815f0160109054906101000a90046fffffffffffffffffffffffffffffffff16826001015f9054906101000a900467ffffffffffffffff168360010160089054906101000a900467ffffffffffffffff168460010160109054906101000a900460ff16846fffffffffffffffffffffffffffffffff169450836fffffffffffffffffffffffffffffffff1693508267ffffffffffffffff1692508167ffffffffffffffff169150955095509550955095505091939590929450565b5f47905090565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b611e4461395c565b611e4d5f613f68565b565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b5f805f60085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611ee0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f0491906153bd565b509350509250505f82131580611f1957505f81145b15611f4f576040517ebfc92100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606482611f5c9190615034565b9250505090565b60075f9054906101000a900467ffffffffffffffff1681565b6007600d9054906101000a900460ff1615611fc3576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611fcb6139e3565b5f8103612004576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61200d33613abb565b5f600b5f600760089054906101000a900463ffffffff1663ffffffff1681526020019081526020015f2090505f815f015f9054906101000a900467ffffffffffffffff1667ffffffffffffffff166120636117cc565b600a61206f9190615193565b8461207a9190614fc6565b6120849190615034565b90505f81036120bf576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6064835f0160089054906101000a900463ffffffff1663ffffffff16836120e79190614fc6565b6120f19190615034565b9050825f01600c9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682846001015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1661216291906151dd565b111561219a576040517fe0374fbc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6121e833308660095f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661402b909392919063ffffffff16565b6121fd3082846121f891906151dd565b613bc2565b5f600a5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20905082815f015f8282829054906101000a90046fffffffffffffffffffffffffffffffff1661226a9190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555081815f0160108282829054906101000a90046fffffffffffffffffffffffffffffffff166122ce9190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550848160010160088282829054906101000a900467ffffffffffffffff1661232b9190615210565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555082846001015f8282829054906101000a90046fffffffffffffffffffffffffffffffff1661237f9190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff167fc851fa0728bdb8a6ced5988459fb65da54e26d9870e988658ef1ac6c3a5f15d48487855f6001604051612404959493929190615434565b60405180910390a26007600c9054906101000a900460ff161561242b5761242a33613c41565b5b50505050612437613ab1565b50565b61244261395c565b60016007600d6101000a81548160ff021916908315150217905550565b600c5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff166124df576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007600c9054906101000a900460ff16156124f8575f80fd5b60016007600c6101000a81548160ff0219169083151502179055504260075f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff167f0cabb11218ae6faf5539e3f0907c46086eaa4a9a4077d53006bb590ddd0ac3415f806040516125839291906154b5565b60405180910390a2565b5f805f805f805f600b5f600760089054906101000a900463ffffffff1663ffffffff1681526020019081526020015f209050600760089054906101000a900463ffffffff16815f015f9054906101000a900467ffffffffffffffff16825f0160089054906101000a900463ffffffff16835f01600c9054906101000a90046fffffffffffffffffffffffffffffffff168460010160109054906101000a900467ffffffffffffffff168560010160189054906101000a900467ffffffffffffffff168563ffffffff1695508467ffffffffffffffff1694508363ffffffff169350826fffffffffffffffffffffffffffffffff1692508167ffffffffffffffff1691508067ffffffffffffffff16905096509650965096509650965050909192939495565b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600c5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1661275a576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8514806127685750603285115b1561279f576040517f9a36fd9c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f84036127d7576040517ebfc92100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6064831115612812576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84600760086101000a81548163ffffffff021916908363ffffffff1602179055506040518060c001604052808567ffffffffffffffff1681526020018463ffffffff168152602001836fffffffffffffffffffffffffffffffff168152602001600b5f8881526020019081526020015f206001015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1681526020014267ffffffffffffffff16815250600b5f8781526020019081526020015f205f820151815f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506020820151815f0160086101000a81548163ffffffff021916908363ffffffff1602179055506040820151815f01600c6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506060820151816001015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060808201518160010160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060a08201518160010160186101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055509050507f6e3a8b552e498eb290256a11cedb8d03dcffce3845a8ed3e0ed80a9e2fdb619a8585858585604051612a4e9594939291906154dc565b60405180910390a15050505050565b606060048054612a6c90614ee9565b80601f0160208091040260200160405190810160405280929190818152602001828054612a9890614ee9565b8015612ae35780601f10612aba57610100808354040283529160200191612ae3565b820191905f5260205f20905b815481529060010190602001808311612ac657829003601f168201915b5050505050905090565b5f60095f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612b489190614823565b602060405180830381865afa158015612b63573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b879190614f2d565b905090565b612b9461395c565b600c5f8273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1615612db2575f600c5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505f5b601080549050811015612db0578173ffffffffffffffffffffffffffffffffffffffff1660108281548110612c7157612c7061552d565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603612da35760106001601080549050612cc8919061555a565b81548110612cd957612cd861552d565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660108281548110612d1557612d1461552d565b5b905f5260205f20015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506010805480612d6c57612d6b61558d565b5b600190038181905f5260205f20015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055612db0565b8080600101915050612c39565b505b50565b5f600f80549050905090565b600c5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16612e41576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007600d9054906101000a900460ff1615612e88576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612e906139e3565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612ef5576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8203612f2e576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600b5f600760089054906101000a900463ffffffff1663ffffffff1681526020019081526020015f209050805f01600c9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1683826001015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16612fc991906151dd565b1115613001576040517fe0374fbc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61300a84613abb565b61301f30838561301a91906151dd565b613bc2565b5f600a5f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20905083815f015f8282829054906101000a90046fffffffffffffffffffffffffffffffff1661308c9190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555082815f0160108282829054906101000a90046fffffffffffffffffffffffffffffffff166130f09190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555083826001015f8282829054906101000a90046fffffffffffffffffffffffffffffffff166131549190614e79565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508473ffffffffffffffffffffffffffffffffffffffff167fc851fa0728bdb8a6ced5988459fb65da54e26d9870e988658ef1ac6c3a5f15d4855f86600160026040516131da9594939291906155f3565b60405180910390a26007600c9054906101000a900460ff16156132015761320085613c41565b5b505061320b613ab1565b505050565b600f818154811061321f575f80fd5b905f5260205f20015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f600b5f8381526020019081526020015f206001015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050919050565b5f61329e611e73565b905090565b5f806132ad613943565b90506132ba818585613e78565b600191505092915050565b60095f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6007600d9054906101000a900460ff1681565b5f805f805f600e805490508610613340576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600e87815481106133555761335461552d565b5b905f5260205f2090600302019050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816001015f9054906101000a90046fffffffffffffffffffffffffffffffff168260020160149054906101000a900460ff168360010160109054906101000a900467ffffffffffffffff16846002015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff1693508260ff1692508167ffffffffffffffff169150955095509550955095505091939590929450565b61343961395c565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361349e576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c5f8273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff166135a2576001600c5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550601081908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b5f80600b5f8481526020019081526020015f209050806001015f9054906101000a90046fffffffffffffffffffffffffffffffff16815f01600c9054906101000a90046fffffffffffffffffffffffffffffffff166136049190615644565b6fffffffffffffffffffffffffffffffff16915050919050565b600e818154811061362d575f80fd5b905f5260205f2090600302015f91509050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015f9054906101000a90046fffffffffffffffffffffffffffffffff16908060010160109054906101000a900467ffffffffffffffff1690806002015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160149054906101000a900460ff16905085565b5f80600b5f600760089054906101000a900463ffffffff1663ffffffff1681526020019081526020015f2090505f8160010160109054906101000a900467ffffffffffffffff168260010160189054906101000a900467ffffffffffffffff166137439190615210565b67ffffffffffffffff16905080421015613768574281613763919061555a565b61376a565b5f5b9250505090565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b603281565b61380061395c565b6138086126b2565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361386c576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036138d1576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6138da6126b2565b90506138e582613f68565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b61395783838360016140ad565b505050565b613964613943565b73ffffffffffffffffffffffffffffffffffffffff166139826126b2565b73ffffffffffffffffffffffffffffffffffffffff16146139e1576139a5613943565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016139d89190614823565b60405180910390fd5b565b600260065403613a28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a1f906156d1565b60405180910390fd5b6002600681905550565b613aac838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401613a659291906156ef565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061427c565b505050565b6001600681905550565b600d5f8273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16613bbf57600f81908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600d5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505b50565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603613c32575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401613c299190614823565b60405180910390fd5b613c3d5f8383614317565b5050565b5f600a5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090508060010160109054906101000a900460ff1615613cca576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f815f0160109054906101000a90046fffffffffffffffffffffffffffffffff16825f015f9054906101000a90046fffffffffffffffffffffffffffffffff16613d149190614e79565b6fffffffffffffffffffffffffffffffff1690505f8103613d61576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018260010160106101000a81548160ff021916908315150217905550613d89308483613e78565b8273ffffffffffffffffffffffffffffffffffffffff167fc851fa0728bdb8a6ced5988459fb65da54e26d9870e988658ef1ac6c3a5f15d4825f80600280604051613dd8959493929190615716565b60405180910390a2505050565b5f613df08484613771565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015613e725781811015613e63578281836040517ffb8f41b2000000000000000000000000000000000000000000000000000000008152600401613e5a93929190615767565b60405180910390fd5b613e7184848484035f6140ad565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603613ee8575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401613edf9190614823565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603613f58575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401613f4f9190614823565b60405180910390fd5b613f63838383614317565b505050565b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160055f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6140a7848573ffffffffffffffffffffffffffffffffffffffff166323b872dd8686866040516024016140609392919061579c565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061427c565b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361411d575f6040517fe602df050000000000000000000000000000000000000000000000000000000081526004016141149190614823565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361418d575f6040517f94280d620000000000000000000000000000000000000000000000000000000081526004016141849190614823565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508015614276578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161426d9190614703565b60405180910390a35b50505050565b5f8060205f8451602086015f885af18061429b576040513d5f823e3d81fd5b3d92505f519150505f82146142b45760018114156142cf565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b1561431157836040517f5274afe70000000000000000000000000000000000000000000000000000000081526004016143089190614823565b60405180910390fd5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561437f57505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561439857506007600c9054906101000a900460ff16155b156143cf576040517fbcb8b8fb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6143da8383836143df565b505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361442f578060025f82825461442391906151dd565b925050819055506144fd565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156144b8578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016144af93929190615767565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603614544578060025f828254039250508190555061458e565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516145eb9190614703565b60405180910390a3505050565b5f63ffffffff82169050919050565b614610816145f8565b82525050565b5f6020820190506146295f830184614607565b92915050565b5f8115159050919050565b6146438161462f565b82525050565b5f60208201905061465c5f83018461463a565b92915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61468f82614666565b9050919050565b61469f81614685565b81146146a9575f80fd5b50565b5f813590506146ba81614696565b92915050565b5f602082840312156146d5576146d4614662565b5b5f6146e2848285016146ac565b91505092915050565b5f819050919050565b6146fd816146eb565b82525050565b5f6020820190506147165f8301846146f4565b92915050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61475e8261471c565b6147688185614726565b9350614778818560208601614736565b61478181614744565b840191505092915050565b5f6020820190508181035f8301526147a48184614754565b905092915050565b6147b5816146eb565b81146147bf575f80fd5b50565b5f813590506147d0816147ac565b92915050565b5f80604083850312156147ec576147eb614662565b5b5f6147f9858286016146ac565b925050602061480a858286016147c2565b9150509250929050565b61481d81614685565b82525050565b5f6020820190506148365f830184614814565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b6148608161483c565b82525050565b5f67ffffffffffffffff82169050919050565b61488281614866565b82525050565b5f60a08201905061489b5f830188614857565b6148a86020830187614857565b6148b56040830186614879565b6148c26060830185614879565b6148cf608083018461463a565b9695505050505050565b5f805f606084860312156148f0576148ef614662565b5b5f6148fd868287016146ac565b935050602061490e868287016146ac565b925050604061491f868287016147c2565b9150509250925092565b5f6020828403121561493e5761493d614662565b5b5f61494b848285016147c2565b91505092915050565b5f60c0820190506149675f830189614879565b6149746020830188614607565b6149816040830187614857565b61498e6060830186614857565b61499b6080830185614879565b6149a860a0830184614879565b979650505050505050565b5f60ff82169050919050565b6149c8816149b3565b82525050565b5f6020820190506149e15f8301846149bf565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b614a1981614685565b82525050565b5f614a2a8383614a10565b60208301905092915050565b5f602082019050919050565b5f614a4c826149e7565b614a5681856149f1565b9350614a6183614a01565b805f5b83811015614a91578151614a788882614a1f565b9750614a8383614a36565b925050600181019050614a64565b5085935050505092915050565b5f6020820190508181035f830152614ab68184614a42565b905092915050565b5f614ac882614666565b9050919050565b614ad881614abe565b8114614ae2575f80fd5b50565b5f81359050614af381614acf565b92915050565b5f8060408385031215614b0f57614b0e614662565b5b5f614b1c85828601614ae5565b9250506020614b2d858286016147c2565b9150509250929050565b5f60a082019050614b4a5f8301886146f4565b614b5760208301876146f4565b614b6460408301866146f4565b614b7160608301856146f4565b614b7e608083018461463a565b9695505050505050565b5f819050919050565b614b9a81614b88565b82525050565b5f602082019050614bb35f830184614b91565b92915050565b5f602082019050614bcc5f830184614879565b92915050565b5f60c082019050614be55f8301896146f4565b614bf260208301886146f4565b614bff60408301876146f4565b614c0c60608301866146f4565b614c1960808301856146f4565b614c2660a08301846146f4565b979650505050505050565b5f805f805f60a08688031215614c4a57614c49614662565b5b5f614c57888289016147c2565b9550506020614c68888289016147c2565b9450506040614c79888289016147c2565b9350506060614c8a888289016147c2565b9250506080614c9b888289016147c2565b9150509295509295909350565b5f805f60608486031215614cbf57614cbe614662565b5b5f614ccc868287016146ac565b9350506020614cdd868287016147c2565b9250506040614cee868287016147c2565b9150509250925092565b5f819050919050565b5f614d1b614d16614d1184614666565b614cf8565b614666565b9050919050565b5f614d2c82614d01565b9050919050565b5f614d3d82614d22565b9050919050565b614d4d81614d33565b82525050565b5f602082019050614d665f830184614d44565b92915050565b5f60a082019050614d7f5f830188614814565b614d8c60208301876146f4565b614d9960408301866146f4565b614da660608301856146f4565b614db36080830184614814565b9695505050505050565b5f60a082019050614dd05f830188614814565b614ddd6020830187614857565b614dea6040830186614879565b614df76060830185614814565b614e0460808301846149bf565b9695505050505050565b5f8060408385031215614e2457614e23614662565b5b5f614e31858286016146ac565b9250506020614e42858286016146ac565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f614e838261483c565b9150614e8e8361483c565b925082820190506fffffffffffffffffffffffffffffffff811115614eb657614eb5614e4c565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680614f0057607f821691505b602082108103614f1357614f12614ebc565b5b50919050565b5f81519050614f27816147ac565b92915050565b5f60208284031215614f4257614f41614662565b5b5f614f4f84828501614f19565b91505092915050565b5f819050919050565b5f614f7b614f76614f7184614f58565b614cf8565b6149b3565b9050919050565b614f8b81614f61565b82525050565b5f606082019050614fa45f8301866146f4565b614fb16020830185614f82565b614fbe60408301846146f4565b949350505050565b5f614fd0826146eb565b9150614fdb836146eb565b9250828202614fe9816146eb565b9150828204841483151761500057614fff614e4c565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61503e826146eb565b9150615049836146eb565b92508261505957615058615007565b5b828204905092915050565b5f8160011c9050919050565b5f808291508390505b60018511156150b95780860481111561509557615094614e4c565b5b60018516156150a45780820291505b80810290506150b285615064565b9450615079565b94509492505050565b5f826150d1576001905061518c565b816150de575f905061518c565b81600181146150f457600281146150fe5761512d565b600191505061518c565b60ff8411156151105761510f614e4c565b5b8360020a91508482111561512757615126614e4c565b5b5061518c565b5060208310610133831016604e8410600b84101617156151625782820a90508381111561515d5761515c614e4c565b5b61518c565b61516f8484846001615070565b9250905081840481111561518657615185614e4c565b5b81810290505b9392505050565b5f61519d826146eb565b91506151a8836149b3565b92506151d57fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846150c2565b905092915050565b5f6151e7826146eb565b91506151f2836146eb565b925082820190508082111561520a57615209614e4c565b5b92915050565b5f61521a82614866565b915061522583614866565b9250828201905067ffffffffffffffff81111561524557615244614e4c565b5b92915050565b5f819050919050565b5f61526e6152696152648461524b565b614cf8565b6149b3565b9050919050565b61527e81615254565b82525050565b5f60a0820190506152975f8301886146f4565b6152a460208301876146f4565b6152b160408301866146f4565b6152be6060830185615275565b6152cb6080830184615275565b9695505050505050565b5f81905092915050565b50565b5f6152ed5f836152d5565b91506152f8826152df565b5f82019050919050565b5f61530c826152e2565b9150819050919050565b5f6060820190506153295f8301866146f4565b6153366020830185615275565b61534360408301846146f4565b949350505050565b5f69ffffffffffffffffffff82169050919050565b6153698161534b565b8114615373575f80fd5b50565b5f8151905061538481615360565b92915050565b5f819050919050565b61539c8161538a565b81146153a6575f80fd5b50565b5f815190506153b781615393565b92915050565b5f805f805f60a086880312156153d6576153d5614662565b5b5f6153e388828901615376565b95505060206153f4888289016153a9565b945050604061540588828901614f19565b935050606061541688828901614f19565b925050608061542788828901615376565b9150509295509295909350565b5f60a0820190506154475f8301886146f4565b61545460208301876146f4565b61546160408301866146f4565b61546e6060830185615275565b61547b6080830184614f82565b9695505050505050565b5f61549f61549a6154958461524b565b614cf8565b6146eb565b9050919050565b6154af81615485565b82525050565b5f6040820190506154c85f830185615275565b6154d560208301846154a6565b9392505050565b5f60a0820190506154ef5f8301886146f4565b6154fc60208301876146f4565b61550960408301866146f4565b61551660608301856146f4565b61552360808301846146f4565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f615564826146eb565b915061556f836146eb565b925082820390508181111561558757615586614e4c565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffd5b5f819050919050565b5f6155dd6155d86155d3846155ba565b614cf8565b6149b3565b9050919050565b6155ed816155c3565b82525050565b5f60a0820190506156065f8301886146f4565b61561360208301876154a6565b61562060408301866146f4565b61562d6060830185614f82565b61563a60808301846155e4565b9695505050505050565b5f61564e8261483c565b91506156598361483c565b925082820390506fffffffffffffffffffffffffffffffff81111561568157615680614e4c565b5b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c005f82015250565b5f6156bb601f83614726565b91506156c682615687565b602082019050919050565b5f6020820190508181035f8301526156e8816156af565b9050919050565b5f6040820190506157025f830185614814565b61570f60208301846146f4565b9392505050565b5f60a0820190506157295f8301886146f4565b61573660208301876154a6565b61574360408301866154a6565b61575060608301856155e4565b61575d60808301846155e4565b9695505050505050565b5f60608201905061577a5f830186614814565b61578760208301856146f4565b61579460408301846146f4565b949350505050565b5f6060820190506157af5f830186614814565b6157bc6020830185614814565b6157c960408301846146f4565b94935050505056fea264697066735822122090cdeca0c9e631740fe2931f480625e9cf4a672ea3e948217095e1dd5507b54964736f6c634300081a0033

Verified Source Code Full Match

Compiler: v0.8.26+commit.8a97fa7a EVM: cancun Optimization: No
AggregatorV3Interface.sol 19 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  function getRoundData(
    uint80 _roundId
  ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

  function latestRoundData()
    external
    view
    returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
IERC1363.sol 86 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";
IERC20.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
ReentrancyGuard.sol 77 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
ERC20.sol 311 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * Both values are immutable: they can only be set once during construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     *
     * ```solidity
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner`'s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance < type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
SafeERC20.sol 212 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC 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);
}
contract.sol 392 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

// Custom errors (saves gas and reduces contract size)
error InvalidAddress();
error InvalidAmount();
error InsufficientBalance();
error TradingDisabled();
error PhaseLimit();
error AlreadyClaimed();
error InvalidPhase();
error InvalidPrice();
error TransferFailed();
error NotAuthorized();
error ContractPaused();

// Packed structs for gas optimization
struct UserInfo {
    uint128 locked;
    uint128 bonus;
    uint64 purchasedETH;
    uint64 purchasedUSDT;
    bool claimed;
}

struct WithdrawalHistory {
    address recipient;
    uint128 amount;
    uint64 timestamp;
    address executedBy;
    uint8 assetType; // 0=ETH, 1=USDT
}

struct PhaseConfig {
    uint64 price;
    uint32 bonusRate;
    uint128 tokenLimit;
    uint128 tokensSold;
    uint64 period;
    uint64 startTime;
}

contract LaunchToken is ERC20, Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    // Constants
    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
    uint256 public constant MAX_PHASES = 50;

    // State variables (packed for gas efficiency)
    uint64 public launchTime;
    uint32 public currentPhase = 1;
    bool public isTradingEnabled;
    bool public isPaused;

    AggregatorV3Interface internal priceFeed;
    IERC20 public usdtToken;

    mapping(address => UserInfo) public userInfo;
    mapping(uint256 => PhaseConfig) public phases;
    mapping(address => bool) public isAdmin;
    mapping(address => bool) private isExistingUser;

    WithdrawalHistory[] public withdrawalHistory;
    address[] public allUsers;
    address[] private adminAddresses;

    // Events (optimized)
    event TokenOp(address indexed user, uint256 amount, uint256 cost, uint256 bonus, uint8 opType, uint8 payType);
    event AdminAct(uint8 actionType, address indexed admin, uint256 amount);
    event Withdrawal(address indexed recipient, uint256 amount, uint8 assetType, uint256 timestamp);
    event PhaseUpd(uint256 phase, uint256 price, uint256 bonusRate, uint256 tokenLimit, uint256 period);

    modifier onlyAdmin() {
        if (!isAdmin[msg.sender]) revert NotAuthorized();
        _;
    }

    modifier whenNotPaused() {
        if (isPaused) revert ContractPaused();
        _;
    }

    constructor(
        string memory name,
        string memory symbol,
        address admin,
        address usdtAddress,
        address priceFeedAddress
    ) ERC20(name, symbol) Ownable(msg.sender) {
        if (admin == address(0) || usdtAddress == address(0) || priceFeedAddress == address(0)) 
            revert InvalidAddress();

        isAdmin[admin] = true;
        adminAddresses.push(admin);
        usdtToken = IERC20(usdtAddress);
        priceFeed = AggregatorV3Interface(priceFeedAddress);

        phases[1] = PhaseConfig({
            price: 10000,
            bonusRate: 20,
            tokenLimit: uint128(1_000_000 * 10**decimals()),
            tokensSold: 0,
            period: 7 days,
            startTime: uint64(block.timestamp)
        });
    }

    function grantAdminRole(address account) external onlyOwner {
        if (account == address(0)) revert InvalidAddress();
        if (!isAdmin[account]) {
            isAdmin[account] = true;
            adminAddresses.push(account);
        }
    }

    function revokeAdminRole(address account) external onlyOwner {
        if (isAdmin[account]) {
            isAdmin[account] = false;
            for (uint256 i = 0; i < adminAddresses.length; i++) {
                if (adminAddresses[i] == account) {
                    adminAddresses[i] = adminAddresses[adminAddresses.length - 1];
                    adminAddresses.pop();
                    break;
                }
            }
        }
    }

    function pause() external onlyOwner {
        isPaused = true;
    }

    function unpause() external onlyOwner {
        isPaused = false;
    }

    function getLatestETHPrice() public view returns (uint256) {
        (, int256 price, , uint256 timeStamp, ) = priceFeed.latestRoundData();
        if (price <= 0 || timeStamp == 0) revert InvalidPrice();
        return uint256(price) / 100;
    }

    function withdrawUSDT(address recipient, uint256 amount) external onlyOwner nonReentrant {
        if (recipient == address(0)) revert InvalidAddress();
        if (amount == 0) revert InvalidAmount();
        if (usdtToken.balanceOf(address(this)) < amount) revert InsufficientBalance();
        
        usdtToken.safeTransfer(recipient, amount);
        
        withdrawalHistory.push(WithdrawalHistory({
            recipient: recipient,
            amount: uint128(amount),
            timestamp: uint64(block.timestamp),
            executedBy: msg.sender,
            assetType: 1
        }));
        
        emit Withdrawal(recipient, amount, 1, block.timestamp);
    }

    function withdrawETH(address payable recipient, uint256 amount) external onlyOwner nonReentrant {
        if (recipient == address(0)) revert InvalidAddress();
        if (amount == 0) revert InvalidAmount();
        if (address(this).balance < amount) revert InsufficientBalance();
        
        (bool success, ) = recipient.call{value: amount}("");
        if (!success) revert TransferFailed();
        
        withdrawalHistory.push(WithdrawalHistory({
            recipient: recipient,
            amount: uint128(amount),
            timestamp: uint64(block.timestamp),
            executedBy: msg.sender,
            assetType: 0
        }));
        
        emit Withdrawal(recipient, amount, 0, block.timestamp);
    }

    function purchaseTokens(uint256 usdtAmount) external whenNotPaused nonReentrant {
        if (usdtAmount == 0) revert InvalidAmount();
        
        _addUser(msg.sender);
        
        PhaseConfig storage phase = phases[currentPhase];
        uint256 tokenAmount = usdtAmount * 10**decimals() / phase.price;
        if (tokenAmount == 0) revert InvalidAmount();
        
        uint256 bonusAmount = tokenAmount * phase.bonusRate / 100;
        if (phase.tokensSold + tokenAmount > phase.tokenLimit) revert PhaseLimit();
        
        usdtToken.safeTransferFrom(msg.sender, address(this), usdtAmount);
        _mint(address(this), tokenAmount + bonusAmount);
        
        UserInfo storage user = userInfo[msg.sender];
        user.locked += uint128(tokenAmount);
        user.bonus += uint128(bonusAmount);
        user.purchasedUSDT += uint64(usdtAmount);
        phase.tokensSold += uint128(tokenAmount);
        
        emit TokenOp(msg.sender, tokenAmount, usdtAmount, bonusAmount, 0, 1);
        
        if (isTradingEnabled) _claimTokens(msg.sender);
    }

    function purchaseTokensWithETH() external payable whenNotPaused nonReentrant {
        if (msg.value == 0) revert InvalidAmount();
        
        _addUser(msg.sender);
        
        PhaseConfig storage phase = phases[currentPhase];
        uint256 ethPriceUSD = getLatestETHPrice();
        uint256 ethValueUSD = (msg.value * ethPriceUSD) / 10**18;
        uint256 tokenAmount = ethValueUSD * 10**decimals() / phase.price;
        if (tokenAmount == 0) revert InvalidAmount();
        
        uint256 bonusAmount = tokenAmount * phase.bonusRate / 100;
        if (phase.tokensSold + tokenAmount > phase.tokenLimit) revert PhaseLimit();
        
        _mint(address(this), tokenAmount + bonusAmount);
        
        UserInfo storage user = userInfo[msg.sender];
        user.locked += uint128(tokenAmount);
        user.bonus += uint128(bonusAmount);
        user.purchasedETH += uint64(msg.value);
        phase.tokensSold += uint128(tokenAmount);
        
        emit TokenOp(msg.sender, tokenAmount, msg.value, bonusAmount, 0, 0);
        
        if (isTradingEnabled) _claimTokens(msg.sender);
    }

    function adminGrantTokens(address recipient, uint256 tokenAmount, uint256 bonusAmount) 
        external onlyAdmin whenNotPaused nonReentrant {
        if (recipient == address(0)) revert InvalidAddress();
        if (tokenAmount == 0) revert InvalidAmount();
        
        PhaseConfig storage phase = phases[currentPhase];
        if (phase.tokensSold + tokenAmount > phase.tokenLimit) revert PhaseLimit();
        
        _addUser(recipient);
        _mint(address(this), tokenAmount + bonusAmount);
        
        UserInfo storage user = userInfo[recipient];
        user.locked += uint128(tokenAmount);
        user.bonus += uint128(bonusAmount);
        phase.tokensSold += uint128(tokenAmount);
        
        emit TokenOp(recipient, tokenAmount, 0, bonusAmount, 1, 2);
        
        if (isTradingEnabled) _claimTokens(recipient);
    }

    function claimTokens() external whenNotPaused nonReentrant {
        if (!isTradingEnabled) revert TradingDisabled();
        _claimTokens(msg.sender);
    }

    function _claimTokens(address user) private {
        UserInfo storage u = userInfo[user];
        if (u.claimed) revert AlreadyClaimed();
        
        uint256 claimable = u.locked + u.bonus;
        if (claimable == 0) revert InvalidAmount();
        
        u.claimed = true;
        _transfer(address(this), user, claimable);
        emit TokenOp(user, claimable, 0, 0, 2, 2);
    }

    function _addUser(address user) private {
        if (!isExistingUser[user]) {
            allUsers.push(user);
            isExistingUser[user] = true;
        }
    }

    function enableTrading() external onlyAdmin {
        if (isTradingEnabled) revert();
        isTradingEnabled = true;
        launchTime = uint64(block.timestamp);
        emit AdminAct(0, msg.sender, 0);
    }

    function setPhase(uint256 phase, uint256 price, uint256 bonusRate, uint256 tokenLimit, uint256 period) 
        external onlyAdmin {
        if (phase == 0 || phase > MAX_PHASES) revert InvalidPhase();
        if (price == 0) revert InvalidPrice();
        if (bonusRate > 100) revert InvalidAmount();
        
        currentPhase = uint32(phase);
        phases[phase] = PhaseConfig({
            price: uint64(price),
            bonusRate: uint32(bonusRate),
            tokenLimit: uint128(tokenLimit),
            tokensSold: phases[phase].tokensSold,
            period: uint64(period),
            startTime: uint64(block.timestamp)
        });
        
        emit PhaseUpd(phase, price, bonusRate, tokenLimit, period);
    }

    // View functions (optimized)
    function getClaimableBalance(address user) external view returns (uint256) {
        UserInfo storage u = userInfo[user];
        return u.claimed ? 0 : u.locked + u.bonus;
    }

    function getUserInfo(address user) external view returns (uint256, uint256, uint256, uint256, bool) {
        UserInfo storage u = userInfo[user];
        return (u.locked, u.bonus, u.purchasedETH, u.purchasedUSDT, u.claimed);
    }

    function getSaleStatus() external view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
        PhaseConfig storage p = phases[currentPhase];
        return (currentPhase, p.price, p.bonusRate, p.tokenLimit, p.period, p.startTime);
    }

    function getPhaseSold(uint256 phase) external view returns (uint256) {
        return phases[phase].tokensSold;
    }

    function getPhaseRemaining(uint256 phase) external view returns (uint256) {
        PhaseConfig storage p = phases[phase];
        return p.tokenLimit - p.tokensSold;
    }

    function getTimeRemaining() external view returns (uint256) {
        PhaseConfig storage phase = phases[currentPhase];
        uint256 endTime = phase.startTime + phase.period;
        return block.timestamp >= endTime ? 0 : endTime - block.timestamp;
    }

    function getTotalUsers() external view returns (uint256) {
        return allUsers.length;
    }

    function getAdmins() external view returns (address[] memory) {
        return adminAddresses;
    }

    function getWithdrawalHistory(uint256 index) external view returns (address, uint256, uint256, uint256, address) {
        if (index >= withdrawalHistory.length) revert InvalidAmount();
        WithdrawalHistory storage w = withdrawalHistory[index];
        return (w.recipient, w.amount, w.assetType, w.timestamp, w.executedBy);
    }

    function getTotalWithdrawals() external view returns (uint256) {
        return withdrawalHistory.length;
    }

    function getETHPrice() external view returns (uint256) {
        return getLatestETHPrice();
    }

    function getETHBalance() external view returns (uint256) {
        return address(this).balance;
    }

    function getUSDTBalance() external view returns (uint256) {
        return usdtToken.balanceOf(address(this));
    }

    function getPriceFeedAddress() external view returns (address) {
        return address(priceFeed);
    }

    function _update(address from, address to, uint256 value) internal override {
        if (from != address(0) && to != address(0) && !isTradingEnabled) revert TradingDisabled();
        super._update(from, to, value);
    }

    function transferOwnership(address newOwner) public override onlyOwner {
        if (newOwner == owner()) revert InvalidAddress();
        if (newOwner == address(0)) revert InvalidAddress();
        
        address oldOwner = owner();
        _transferOwnership(newOwner);
        
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    receive() external payable {}
}

Read Contract

ADMIN_ROLE 0x75b238fc → bytes32
MAX_PHASES 0xe88b7737 → uint256
allUsers 0xa2bdedf4 → address
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
currentPhase 0x055ad42e → uint32
decimals 0x313ce567 → uint8
getAdmins 0x31ae450b → address[]
getClaimableBalance 0x06def802 → uint256
getETHBalance 0x6e947298 → uint256
getETHPrice 0xa607a8d9 → uint256
getLatestETHPrice 0x777e0d86 → uint256
getPhaseRemaining 0xcad47303 → uint256
getPhaseSold 0xa4202504 → uint256
getPriceFeedAddress 0x0f0f30b2 → address
getSaleStatus 0x8c3c4b34 → uint256, uint256, uint256, uint256, uint256, uint256
getTimeRemaining 0xdac6270d → uint256
getTotalUsers 0x9be572f6 → uint256
getTotalWithdrawals 0x4b7f1d81 → uint256
getUSDTBalance 0x9785fac8 → uint256
getUserInfo 0x6386c1c7 → uint256, uint256, uint256, uint256, bool
getWithdrawalHistory 0xb4f0dc44 → address, uint256, uint256, uint256, address
isAdmin 0x24d7806c → bool
isPaused 0xb187bd26 → bool
isTradingEnabled 0x064a59d0 → bool
launchTime 0x790ca413 → uint64
name 0x06fdde03 → string
owner 0x8da5cb5b → address
phases 0x2e37eef6 → uint64, uint32, uint128, uint128, uint64, uint64
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
usdtToken 0xa98ad46c → address
userInfo 0x1959a002 → uint128, uint128, uint64, uint64, bool
withdrawalHistory 0xd800b9bd → address, uint128, uint64, address, uint8

Write Contract 17 functions

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

adminGrantTokens 0x9ca5e849
address recipient
uint256 tokenAmount
uint256 bonusAmount
approve 0x095ea7b3
address spender
uint256 value
returns: bool
claimTokens 0x48c54b9d
No parameters
enableTrading 0x8a8c523c
No parameters
grantAdminRole 0xc634b78e
address account
pause 0x8456cb59
No parameters
purchaseTokens 0x7b97008d
uint256 usdtAmount
purchaseTokensWithETH 0x235caa21
No parameters
renounceOwnership 0x715018a6
No parameters
revokeAdminRole 0x9a19c7b0
address account
setPhase 0x9031c1e9
uint256 phase
uint256 price
uint256 bonusRate
uint256 tokenLimit
uint256 period
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
withdrawETH 0x4782f779
address recipient
uint256 amount
withdrawUSDT 0x1481794e
address recipient
uint256 amount

Recent Transactions

No transactions found for this address