Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xa44bb5b4A4D8db99F1F92e00BB34EF759042ccCE
Balance 0.000550000 ETH
Nonce 886
Code Size 13142 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

13142 bytes
0x6080604052600436106100a4575f3560e01c80631bea83fe146100af5780633bcc75f6146100e55780635a3afecf146101045780638d99aeb01461011a57806396e59682146101465780639f181b5e146101735780639f9baaaa14610188578063a361e0d91461019c578063aced8d81146101af578063ad5c4648146101db578063b17acdcd146101fb578063c60058931461022f578063ec81aadb14610256575f80fd5b366100ab57005b5f80fd5b3480156100ba575f80fd5b506100cf5f8051602061330183398151915281565b6040516100dc9190611c84565b60405180910390f35b3480156100f0575f80fd5b506002546100cf906001600160a01b031681565b34801561010f575f80fd5b50610118610288565b005b348015610125575f80fd5b50610139610134366004611d4c565b610466565b6040516100dc9190611df0565b348015610151575f80fd5b50610165610160366004611e09565b6104d7565b6040519081526020016100dc565b34801561017e575f80fd5b5061016560015481565b348015610193575f80fd5b506101186105bb565b6101186101aa366004611e20565b61063c565b3480156101ba575f80fd5b506101ce6101c9366004611eb3565b610903565b6040516100dc9190611ed3565b3480156101e6575f80fd5b506100cf5f805160206132e183398151915281565b348015610206575f80fd5b5061021a610215366004611e09565b6110dc565b604080519283526020830191909152016100dc565b34801561023a575f80fd5b506100cf7368b3465833fb72a70ecdf485e0e4c7bd8665fc4581565b348015610261575f80fd5b50610275610270366004611e09565b6116e6565b6040516100dc9796959493929190611fb3565b6002546001600160a01b031633146102bb5760405162461bcd60e51b81526004016102b290612027565b60405180910390fd5b6040516370a0823160e01b81525f905f805160206132e1833981519152906370a08231906102ed903090600401611c84565b602060405180830381865afa158015610308573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061032c9190612059565b90505f81116103735760405162461bcd60e51b81526020600482015260136024820152724e6f205745544820746f20776974686472617760681b60448201526064016102b2565b604051632e1a7d4d60e01b8152600481018290525f805160206132e183398151915290632e1a7d4d906024015f604051808303815f87803b1580156103b6575f80fd5b505af11580156103c8573d5f803e3d5ffd5b505050505f336001600160a01b0316826040515b5f6040518083038185875af1925050503d805f8114610416576040519150601f19603f3d011682016040523d82523d5f602084013e61041b565b606091505b50509050806104625760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b60448201526064016102b2565b5050565b60606040518060200161047890611c6a565b601f1982820381018352601f9091011660408190526104a1908690869086903090602001612070565b60408051601f19818403018152908290526104bf92916020016120d0565b60405160208183030381529060405290509392505050565b5f67011c37937e0800008210156104ef57505f919050565b6706f05b59d3b20000821061050757506109c4919050565b5f6705d423c655aa000061052367011c37937e08000085612100565b61053590670de0b6b3a7640000612113565b61053f919061212a565b90505f61055482670de0b6b3a7640000612113565b90505f610560826118ca565b90505f61056c826118ca565b90505f670de0b6b3a76400006105828386612113565b61058c919061212a565b9050676765c793fa10079d601b1b6105a6826109c4612113565b6105b0919061212a565b979650505050505050565b6002546001600160a01b031633146105e55760405162461bcd60e51b81526004016102b290612027565b47806106285760405162461bcd60e51b81526020600482015260126024820152714e6f2045544820746f20776974686472617760701b60448201526064016102b2565b5f336001600160a01b0316826040516103dc565b5f818585333060405161064e90611c6a565b61065b9493929190612070565b8190604051809103905ff5905080158015610678573d5f803e3d5ffd5b5090507f60122e78030aba0a2e4a67adb3e52b411343cc51778f919095d3fe394090c1b2816040516106aa9190611c84565b60405180910390a1806106ca815f805160206132e183398151915261192e565b3415610807575f6106da346104d7565b90505f6127106106ea8334612113565b6106f4919061212a565b90505f6107018234612100565b6040805160e0810182525f805160206132e183398151915281526001600160a01b03878116602083019081526127108385019081523360608501908152608085018781525f60a0870181815260c0880191825297516304e45aaf60e01b8152965186166004880152935185166024870152915162ffffff1660448601525183166064850152516084840152925160a4830152915190911660c48201529091507368b3465833fb72a70ecdf485e0e4c7bd8665fc45906304e45aaf90839060e40160206040518083038185885af11580156107dd573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906108029190612059565b505050505b6040805160e0810182526001600160a01b03838116825260208083018a81528385018a905233606085015242608085015260a084018990525f60c085018190526001805482529281905294909420835181546001600160a01b03191693169290921782559251919290919082019061087f90826121c7565b506040820151600282019061089490826121c7565b5060608201516003820180546001600160a01b0319166001600160a01b039092169190911790556080820151600482015560a082015160058201906108d990826121c7565b5060c0919091015160069091015560018054905f6108f683612281565b9190505550505050505050565b60015460609060329061094d5760405162461bcd60e51b8152602060048201526012602482015271139bc81d1bdad95b9cc819195c1b1bde595960721b60448201526064016102b2565b5f8160018360015461095f9190612299565b6109699190612100565b610973919061212a565b90508085106109b85760405162461bcd60e51b815260206004820152601160248201527050616765206f7574206f662072616e676560781b60448201526064016102b2565b5f805f865f03610a3957846109ce896001612299565b6109d89190612113565b600154116109e6575f610a09565b846109f2896001612299565b6109fc9190612113565b600154610a099190612100565b9250610a158589612113565b600154610a229190612100565b9150600154821115610a345760015491505b610a61565b610a438589612113565b9250610a4f8584612299565b9150600154821115610a615760015491505b5f610a6c8484612100565b6001600160401b03811115610a8357610a83611c98565b604051908082528060200260200182016040528015610b0257816020015b610aef6040518060e001604052805f6001600160a01b0316815260200160608152602001606081526020015f6001600160a01b031681526020015f8152602001606081526020015f81525090565b815260200190600190039081610aa15790505b5090505f5f805160206133018339815191526001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b4f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b7391906122bc565b90505f5f805160206133018339815191526001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bbf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610be391906122bc565b9050855b858110156110ca575f8b15610bfc5781610c1b565b610c068883612100565b610c11600189612100565b610c1b9190612100565b5f81815260208181526040808320815160e0810190925280546001600160a01b03168252600181018054959650939491939092840191610c5a90612149565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8690612149565b8015610cd15780601f10610ca857610100808354040283529160200191610cd1565b820191905f5260205f20905b815481529060010190602001808311610cb457829003601f168201915b50505050508152602001600282018054610cea90612149565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1690612149565b8015610d615780601f10610d3857610100808354040283529160200191610d61565b820191905f5260205f20905b815481529060010190602001808311610d4457829003601f168201915b505050918352505060038201546001600160a01b0316602082015260048201546040820152600582018054606090920191610d9b90612149565b80601f0160208091040260200160405190810160405280929190818152602001828054610dc790612149565b8015610e125780601f10610de957610100808354040283529160200191610e12565b820191905f5260205f20905b815481529060010190602001808311610df557829003601f168201915b5050509183525050600691909101546020909101528051604051630b4c774160e11b81526001600160a01b039182166004820152878216602482015261271060448201529192505f918291871690631698ee8290606401602060405180830381865afa158015610e84573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ea891906122bc565b90506001600160a01b03811615611034576040516370a0823160e01b81525f906001600160a01b038916906370a0823190610ee7908590600401611c84565b602060405180830381865afa158015610f02573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f269190612059565b90505f845f01516001600160a01b03166370a08231846040518263ffffffff1660e01b8152600401610f589190611c84565b602060405180830381865afa158015610f73573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f979190612059565b90505f855f01516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ffd9190612059565b90508115611030578181611019856714d1120d7b160000612299565b6110239190612113565b61102d919061212a565b94505b5050505b6040518060e00160405280845f01516001600160a01b03168152602001846020015181526020018460400151815260200184606001516001600160a01b03168152602001846080015181526020018460a00151815260200183815250888a8061109c90612281565b9b50815181106110ae576110ae6122d7565b6020026020010181905250505050508080600101915050610be7565b50919750505050505050505b92915050565b60405163133f757160e31b8152600481018290525f908190819081905f80516020613301833981519152906399fbab889060240161018060405180830381865afa15801561112c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111509190612324565b50979b509599508a985089975050506001600160a01b0387165f805160206132e183398151915214945050831592506111a291505057506001600160a01b0383165f805160206132e183398151915214155b156111ad5750819050825b5f826001600160a01b03166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111ea573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061120e91906122bc565b9050336001600160a01b038216148061123157506002546001600160a01b031633145b61126e5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016102b2565b6040516370a0823160e01b81525f906001600160a01b038516906370a082319061129c903090600401611c84565b602060405180830381865afa1580156112b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112db9190612059565b90505f836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161130a9190611c84565b602060405180830381865afa158015611325573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113499190612059565b604080516080810182528c815230602082019081526001600160801b0382840181815260608401828152945163fc6f786560e01b81528451600482015292516001600160a01b031660248401525181166044830152925190921660648301529192505f805160206133018339815191529063fc6f78659060840160408051808303815f875af11580156113de573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061140291906123f9565b50505f83876001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016114329190611c84565b602060405180830381865afa15801561144d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114719190612059565b61147b9190612100565b90505f83876001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016114ab9190611c84565b602060405180830381865afa1580156114c6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114ea9190612059565b6114f49190612100565b9050811561156e5760405163a9059cbb60e01b81526001600160a01b0389169063a9059cbb9061152c9061dead90869060040161241b565b6020604051808303815f875af1158015611548573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061156c9190612434565b505b80156116d4575f61158060028361212a565b90506001600160a01b0388165f805160206132e1833981519152146115dd5760405162461bcd60e51b81526020600482015260136024820152720e8ded6cadc6240daeae6e840c4ca40ae8aa89606b1b60448201526064016102b2565b604051632e1a7d4d60e01b8152600481018290526001600160a01b03891690632e1a7d4d906024015f604051808303815f87803b15801561161c575f80fd5b505af115801561162e573d5f803e3d5ffd5b505050505f876001600160a01b0316826040515f6040518083038185875af1925050503d805f811461167b576040519150601f19603f3d011682016040523d82523d5f602084013e611680565b606091505b50509050806116d15760405162461bcd60e51b815260206004820152601e60248201527f455448207472616e7366657220746f2063726561746f72206661696c6564000060448201526064016102b2565b50505b909c909b509950505050505050505050565b5f60208190529081526040902080546001820180546001600160a01b03909216929161171190612149565b80601f016020809104026020016040519081016040528092919081815260200182805461173d90612149565b80156117885780601f1061175f57610100808354040283529160200191611788565b820191905f5260205f20905b81548152906001019060200180831161176b57829003601f168201915b50505050509080600201805461179d90612149565b80601f01602080910402602001604051908101604052809291908181526020018280546117c990612149565b80156118145780601f106117eb57610100808354040283529160200191611814565b820191905f5260205f20905b8154815290600101906020018083116117f757829003601f168201915b505050506003830154600484015460058501805494956001600160a01b03909316949193509061184390612149565b80601f016020809104026020016040519081016040528092919081815260200182805461186f90612149565b80156118ba5780601f10611891576101008083540402835291602001916118ba565b820191905f5260205f20905b81548152906001019060200180831161189d57829003601f168201915b5050505050908060060154905087565b5f815f036118d957505f919050565b50805f6118e760028361212a565b6118f2906001612299565b90505b818110156119285790508060028161190d818661212a565b6119179190612299565b611921919061212a565b90506118f5565b50919050565b6001600160a01b03808216908316105f81611949578261194b565b835b90505f82611959578461195b565b835b60405163095ea7b360e01b81529091506001600160a01b0383169063095ea7b39061199a905f80516020613301833981519152905f199060040161241b565b6020604051808303815f875af11580156119b6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119da9190612434565b5060405163095ea7b360e01b81526001600160a01b0382169063095ea7b390611a17905f80516020613301833981519152905f199060040161241b565b6020604051808303815f875af1158015611a33573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a579190612434565b505f805160206133018339815191525f84611a80576d64dbacb643e10eedf7378a0b5df7611a8d565b6a0289c06ea6df5a36ae398a5b6001600160701b031690505f85611aa857620d899f19611aae565b620318f7195b90505f86611abf57620318f8611ac4565b620d89a05b90505f87611ad2575f611adf565b676765c793fa10079d601b1b5b6001600160601b031690505f88611b0157676765c793fa10079d601b1b611b03565b5f5b6040516309f56ab160e11b81526001600160a01b038a811660048301528981166024830152612710604483015287811660648301526001600160601b03929092169250908716906313ead562906084016020604051808303815f875af1158015611b6f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b9391906122bc565b5060408051610160810182526001600160a01b038a81168252898116602083015261271082840152600287810b606084015286900b608083015260a0820185905260c082018490525f60e0830181905261010083015230610120830152426101408301529151634418b22b60e11b815291881691638831645691611c1991600401612453565b6080604051808303815f875af1158015611c35573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c599190612508565b505050505050505050505050505050565b610d9f8061254283390190565b6001600160a01b03169052565b6001600160a01b0391909116815260200190565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112611cbb575f80fd5b81356001600160401b03811115611cd457611cd4611c98565b604051601f8201601f19908116603f011681016001600160401b0381118282101715611d0257611d02611c98565b604052818152838201602001851015611d19575f80fd5b816020850160208301375f918101602001919091529392505050565b6001600160a01b0381168114611d49575f80fd5b50565b5f805f60608486031215611d5e575f80fd5b83356001600160401b03811115611d73575f80fd5b611d7f86828701611cac565b93505060208401356001600160401b03811115611d9a575f80fd5b611da686828701611cac565b9250506040840135611db781611d35565b809150509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f611e026020830184611dc2565b9392505050565b5f60208284031215611e19575f80fd5b5035919050565b5f805f8060808587031215611e33575f80fd5b84356001600160401b03811115611e48575f80fd5b611e5487828801611cac565b94505060208501356001600160401b03811115611e6f575f80fd5b611e7b87828801611cac565b93505060408501356001600160401b03811115611e96575f80fd5b611ea287828801611cac565b949793965093946060013593505050565b5f8060408385031215611ec4575f80fd5b50508035926020909101359150565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b82811015611fa757868503603f19018452815180516001600160a01b0316865260208082015160e091880182905290611f3490880182611dc2565b905060408201518782036040890152611f4d8282611dc2565b91505060018060a01b0360608301511660608801526080820151608088015260a082015187820360a0890152611f838282611dc2565b60c09384015198909301979097525094506020938401939190910190600101611ef9565b50929695505050505050565b6001600160a01b038816815260e0602082018190525f90611fd690830189611dc2565b8281036040840152611fe88189611dc2565b6001600160a01b03881660608501526080840187905283810360a085015290506120128186611dc2565b9150508260c083015298975050505050505050565b60208082526018908201527721b0b63632b91034b9903737ba1031b7b73a3937b63632b960411b604082015260600190565b5f60208284031215612069575f80fd5b5051919050565b608081525f6120826080830187611dc2565b82810360208401526120948187611dc2565b6001600160a01b03958616604085015293909416606090920191909152509392505050565b5f81518060208401855e5f93019283525090919050565b5f6120e46120de83866120b9565b846120b9565b949350505050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156110d6576110d66120ec565b80820281158282048414176110d6576110d66120ec565b5f8261214457634e487b7160e01b5f52601260045260245ffd5b500490565b600181811c9082168061215d57607f821691505b60208210810361192857634e487b7160e01b5f52602260045260245ffd5b601f8211156121c257805f5260205f20601f840160051c810160208510156121a05750805b601f840160051c820191505b818110156121bf575f81556001016121ac565b50505b505050565b81516001600160401b038111156121e0576121e0611c98565b6121f4816121ee8454612149565b8461217b565b6020601f821160018114612226575f831561220f5750848201515b5f19600385901b1c1916600184901b1784556121bf565b5f84815260208120601f198516915b828110156122555787850151825560209485019460019092019101612235565b508482101561227257868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f60018201612292576122926120ec565b5060010190565b808201808211156110d6576110d66120ec565b80516122b781611d35565b919050565b5f602082840312156122cc575f80fd5b8151611e0281611d35565b634e487b7160e01b5f52603260045260245ffd5b805162ffffff811681146122b7575f80fd5b8051600281900b81146122b7575f80fd5b80516001600160801b03811681146122b7575f80fd5b5f805f805f805f805f805f806101808d8f031215612340575f80fd5b8c516001600160601b0381168114612356575f80fd5b9b5061236460208e016122ac565b9a5061237260408e016122ac565b995061238060608e016122ac565b985061238e60808e016122eb565b975061239c60a08e016122fd565b96506123aa60c08e016122fd565b95506123b860e08e0161230e565b6101008e01516101208f0151919650945092506123d86101408e0161230e565b91506123e76101608e0161230e565b90509295989b509295989b509295989b565b5f806040838503121561240a575f80fd5b505080516020909101519092909150565b6001600160a01b03929092168252602082015260400190565b5f60208284031215612444575f80fd5b81518015158114611e02575f80fd5b5f61016082019050612466828451611c77565b60208301516124786020840182611c77565b50604083015161248f604084018262ffffff169052565b5060608301516124a4606084018260020b9052565b5060808301516124b9608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008301516101008301526101208301516124f8610120840182611c77565b5061014092830151919092015290565b5f805f806080858703121561251b575f80fd5b8451935061252b6020860161230e565b604086015160609096015194979096509250505056fe608060405234801561000f575f80fd5b50604051610d9f380380610d9f83398101604081905261002e916102ca565b8383600361003c83826103d3565b50600461004982826103d3565b5050600580546001600160a01b038085166001600160a01b0319928316179092556006805492861692909116919091179055506100a681610088601290565b61009390600a610586565b6100a190633b9aca0061059b565b6100af565b505050506105c5565b6001600160a01b0382166100dd5760405163ec442f0560e01b81525f60048201526024015b60405180910390fd5b6100e85f83836100ec565b5050565b6001600160a01b038316610116578060025f82825461010b91906105b2565b909155506101869050565b6001600160a01b0383165f90815260208190526040902054818110156101685760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016100d4565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166101a2576002805482900390556101c0565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161020591815260200190565b60405180910390a3505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610235575f80fd5b81516001600160401b0381111561024e5761024e610212565b604051601f8201601f19908116603f011681016001600160401b038111828210171561027c5761027c610212565b604052818152838201602001851015610293575f80fd5b8160208501602083015e5f918101602001919091529392505050565b80516001600160a01b03811681146102c5575f80fd5b919050565b5f805f80608085870312156102dd575f80fd5b84516001600160401b038111156102f2575f80fd5b6102fe87828801610226565b602087015190955090506001600160401b0381111561031b575f80fd5b61032787828801610226565b935050610336604086016102af565b9150610344606086016102af565b905092959194509250565b600181811c9082168061036357607f821691505b60208210810361038157634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156103ce57805f5260205f20601f840160051c810160208510156103ac5750805b601f840160051c820191505b818110156103cb575f81556001016103b8565b50505b505050565b81516001600160401b038111156103ec576103ec610212565b610400816103fa845461034f565b84610387565b6020601f821160018114610432575f831561041b5750848201515b5f19600385901b1c1916600184901b1784556103cb565b5f84815260208120601f198516915b828110156104615787850151825560209485019460019092019101610441565b508482101561047e57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156104dc578085048111156104c0576104c061048d565b60018416156104ce57908102905b60019390931c9280026104a5565b935093915050565b5f826104f257506001610580565b816104fe57505f610580565b8160018114610514576002811461051e5761053a565b6001915050610580565b60ff84111561052f5761052f61048d565b50506001821b610580565b5060208310610133831016604e8410600b841016171561055d575081810a610580565b6105695f1984846104a1565b805f190482111561057c5761057c61048d565b0290505b92915050565b5f61059460ff8416836104e4565b9392505050565b80820281158282048414176105805761058061048d565b808201808211156105805761058061048d565b6107cd806105d25f395ff3fe608060405234801561000f575f80fd5b50600436106100ad575f3560e01c806302d05d3f146100b157806306fdde03146100da578063095ea7b3146100ef57806318160ddd1461011257806323b872dd14610124578063313ce5671461013757806342966c68146101465780634bde38c81461015b57806370a082311461016e57806379cc67901461019657806395d89b41146101a9578063a9059cbb146101b1578063dd62ed3e146101c4575b5f80fd5b6006546100c4906001600160a01b031681565b6040516100d191906105f1565b60405180910390f35b6100e26101d7565b6040516100d19190610605565b6101026100fd366004610655565b610267565b60405190151581526020016100d1565b6002545b6040519081526020016100d1565b61010261013236600461067d565b610280565b604051601281526020016100d1565b6101596101543660046106b7565b6102a3565b005b6005546100c4906001600160a01b031681565b61011661017c3660046106ce565b6001600160a01b03165f9081526020819052604090205490565b6101596101a4366004610655565b6102b0565b6100e26102c9565b6101026101bf366004610655565b6102d8565b6101166101d23660046106ee565b6102e5565b6060600380546101e69061071f565b80601f01602080910402602001604051908101604052809291908181526020018280546102129061071f565b801561025d5780601f106102345761010080835404028352916020019161025d565b820191905f5260205f20905b81548152906001019060200180831161024057829003601f168201915b5050505050905090565b5f3361027481858561030f565b60019150505b92915050565b5f3361028d858285610321565b61029885858561037b565b506001949350505050565b6102ad33826103d8565b50565b6102bb823383610321565b6102c582826103d8565b5050565b6060600480546101e69061071f565b5f3361027481858561037b565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b61031c838383600161040c565b505050565b5f61032c84846102e5565b90505f19811015610375578181101561036757828183604051637dc7a0d960e11b815260040161035e93929190610757565b60405180910390fd5b61037584848484035f61040c565b50505050565b6001600160a01b0383166103a4575f604051634b637e8f60e11b815260040161035e91906105f1565b6001600160a01b0382166103cd575f60405163ec442f0560e01b815260040161035e91906105f1565b61031c8383836104de565b6001600160a01b038216610401575f604051634b637e8f60e11b815260040161035e91906105f1565b6102c5825f836104de565b6001600160a01b038416610435575f60405163e602df0560e01b815260040161035e91906105f1565b6001600160a01b03831661045e575f604051634a1406b160e11b815260040161035e91906105f1565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561037557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516104d091815260200190565b60405180910390a350505050565b6001600160a01b038316610508578060025f8282546104fd9190610778565b909155506105659050565b6001600160a01b0383165f90815260208190526040902054818110156105475783818360405163391434e360e21b815260040161035e93929190610757565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166105815760028054829003905561059f565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516105e491815260200190565b60405180910390a3505050565b6001600160a01b0391909116815260200190565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b0381168114610650575f80fd5b919050565b5f8060408385031215610666575f80fd5b61066f8361063a565b946020939093013593505050565b5f805f6060848603121561068f575f80fd5b6106988461063a565b92506106a66020850161063a565b929592945050506040919091013590565b5f602082840312156106c7575f80fd5b5035919050565b5f602082840312156106de575f80fd5b6106e78261063a565b9392505050565b5f80604083850312156106ff575f80fd5b6107088361063a565b91506107166020840161063a565b90509250929050565b600181811c9082168061073357607f821691505b60208210810361075157634e487b7160e01b5f52602260045260245ffd5b50919050565b6001600160a01b039390931683526020830191909152604082015260600190565b8082018082111561027a57634e487b7160e01b5f52601160045260245ffdfea26469706673582212206f724dd31c739290d8586d56cdce99fdf46c7afc1d9565eac133e754c0fdc7dc64736f6c634300081a0033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88a264697066735822122004f47ce235700551fcc01887bdfe69e6bb80c458e915c1f8e99e6b1a2a85c22064736f6c634300081a0033

Verified Source Code Partial Match

Compiler: v0.8.26+commit.8a97fa7a EVM: cancun Optimization: Yes (1 runs)
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);
}
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);
}
ERC20Burnable.sol 39 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.20;

import {ERC20} from "../ERC20.sol";
import {Context} from "../../../utils/Context.sol";

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys a `value` amount of tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 value) public virtual {
        _burn(_msgSender(), value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, deducting from
     * the caller's allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `value`.
     */
    function burnFrom(address account, uint256 value) public virtual {
        _spendAllowance(account, _msgSender(), value);
        _burn(account, value);
    }
}
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);
}
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;
    }
}
factory.sol 432 lines
/*

 __  _  _      ____  __  _      _____  ____  ____    ____  ____     __    ___ 
|  |/ ]| |    |    ||  |/ ]    |     ||    ||    \  /    ||    \   /  ]  /  _]
|  ' / | |     |  | |  ' /     |   __| |  | |  _  ||  o  ||  _  | /  /  /  [_ 
|    \ | |___  |  | |    \     |  |_   |  | |  |  ||     ||  |  |/  /  |    _]
|     \|     | |  | |     \ __ |   _]  |  | |  |  ||  _  ||  |  /   \_ |   [_ 
|  .  ||     | |  | |  .  ||  ||  |    |  | |  |  ||  |  ||  |  \     ||     |
|__|\_||_____||____||__|\_||__||__|   |____||__|__||__|__||__|__|\____||_____|


https://klik.finance
https://x.com/klik_evm

*/

pragma solidity >=0.8.9;

interface IToken {
    function creator() external view returns (address);
}

interface IWETH {
    function withdraw(uint256 amount) external;
}

interface IUniswapV3Factory {
    function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address);
}

interface ISwapRouter02 {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    function exactInputSingle(ExactInputSingleParams calldata params)
        external
        payable
        returns (uint256 amountOut);
}

interface INonfungiblePositionManager {
    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }

    function factory() external view returns (address);
    function WETH9() external view returns (address);

    function positions(uint256 tokenId) external view returns (
        uint96 nonce,
        address operator,
        address token0,
        address token1,
        uint24 fee,
        int24 tickLower,
        int24 tickUpper,
        uint128 liquidity,
        uint256 feeGrowthInside0LastX128,
        uint256 feeGrowthInside1LastX128,
        uint128 tokensOwed0,
        uint128 tokensOwed1
    );

    function createAndInitializePoolIfNecessary(
        address token0,
        address token1,
        uint24 fee,
        uint160 sqrtPriceX96
    ) external returns (address pool);

    function mint(MintParams calldata params) external returns (
        uint256 tokenId,
        uint128 liquidity,
        uint256 amount0,
        uint256 amount1
    );

    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }

    function collect(CollectParams calldata params) external payable returns (
        uint256 amount0,
        uint256 amount1
    );

    function getApproved(uint256 tokenId) external view returns (address);
    function isApprovedForAll(address owner, address operator) external view returns (bool);
    function ownerOf(uint256 tokenId) external view returns (address);
}


contract Factory {
    event ERC20TokenCreated(address tokenAddress);

    struct TokenInfo {
        address tokenAddress;
        string name;
        string symbol;
        address deployer;
        uint256 time;
        string metadata;
        uint256 marketCapInETH;
    }

    mapping(uint256 => TokenInfo) public deployedTokens;
    uint256 public tokenCount = 0;
    address public platformController;

    address public constant POSITION_MANAGER = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88;
    uint256 constant Q96 = 2 ** 96;
    address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
    address public constant SWAP_ROUTER = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45; // SwapRouter02

    uint24 private constant FEE_TIER = 10000;
    uint256 private constant VIRTUAL_ETH = 1.5 ether;

    event TokenPurchased(address buyer, address tokenOut, uint256 ethSpent, uint256 tokensReceived);

    constructor() {
        platformController = msg.sender;
    }

    receive() external payable {}

    function deployCoin(string memory _name, string memory _symbol, string memory _metadata, bytes32 salt) public payable {
        Token t = new Token{salt: salt}(
            _name,
            _symbol,
            msg.sender,
            address(this)
        );
        emit ERC20TokenCreated(address(t));

        address coin_address = address(t);
        provideLiquidity(coin_address, WETH);

        if (msg.value > 0) {
            uint256 taxBps = getPenalty(msg.value); // in basis points (e.g., 2500 = 25%)
            uint256 tax = (msg.value * taxBps) / 10000;
            uint256 amountAfterTax = msg.value - tax;

            // Retain the tax inside the contract
            // Note: address(this) already received msg.value, we only use part for swap

            ISwapRouter02(SWAP_ROUTER).exactInputSingle{ value: amountAfterTax }(
                ISwapRouter02.ExactInputSingleParams({
                    tokenIn: WETH,
                    tokenOut: coin_address,
                    fee: 10000,
                    recipient: msg.sender,
                    amountIn: amountAfterTax,
                    amountOutMinimum: 0,
                    sqrtPriceLimitX96: 0
                })
            );
        }

        deployedTokens[tokenCount] = TokenInfo({
            tokenAddress: coin_address,
            name: _name,
            symbol: _symbol,
            deployer: msg.sender,
            time: block.timestamp,
            metadata: _metadata,
            marketCapInETH: 0
        });

        tokenCount++;
    }

    function getTokenBytecode(
        string memory _name,
        string memory _symbol,
        address creator
    ) public view returns (bytes memory bytecode) {
        bytecode = abi.encodePacked(
            type(Token).creationCode,
            abi.encode(_name, _symbol, creator, address(this))
        );
    }

    

   function getPenalty(uint256 ethAmount) public pure returns (uint256) {
        if (ethAmount < 0.08 ether) return 0;
        if (ethAmount >= 0.5 ether) return 2500; // max 25%

        // Normalize: x in [0, 1e18]
        uint256 x = ((ethAmount - 0.08 ether) * 1e18) / (0.42 ether);
        uint256 xHigh = x * 1e18; // 1e36 scale

        uint256 sqrt1 = sqrt(xHigh);       // ~1e18
        uint256 sqrt2 = sqrt(sqrt1);       // ~1e9
        uint256 power = (xHigh * sqrt2) / 1e18; // ~1e27

        return (power * 2500) / 1e27; // Final result in basis points
    }

    /// @notice Babylonian square root
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y == 0) return 0;
        z = y;
        uint256 x = (y / 2) + 1;
        while (x < z) {
            z = x;
            x = (y / x + x) / 2;
        }
    } 

    function getDeploysByPage(uint256 page, uint256 order) public view returns (TokenInfo[] memory) {
        uint256 itemsPerPage = 50;
        require(tokenCount > 0, "No tokens deployed");

        uint256 totalPages = (tokenCount + itemsPerPage - 1) / itemsPerPage;
        require(page < totalPages, "Page out of range");

        uint256 start;
        uint256 end;
        uint256 j = 0;

        if (order == 0) {
            // Newest first
            start = tokenCount > (page + 1) * itemsPerPage ? tokenCount - (page + 1) * itemsPerPage : 0;
            end = tokenCount - page * itemsPerPage;
            if (end > tokenCount) end = tokenCount;
        } else {
            // Oldest first
            start = page * itemsPerPage;
            end = start + itemsPerPage;
            if (end > tokenCount) end = tokenCount;
        }

        TokenInfo[] memory tokens = new TokenInfo[](end - start);
        address weth = INonfungiblePositionManager(POSITION_MANAGER).WETH9();
        address factory = INonfungiblePositionManager(POSITION_MANAGER).factory();

        for (uint256 i = start; i < end; i++) {
            uint256 index = order == 0 ? end - 1 - (i - start) : i;
            TokenInfo memory info = deployedTokens[index];

            uint256 marketCap = 0;
            address pool = IUniswapV3Factory(factory).getPool(info.tokenAddress, weth, 10000);
            if (pool != address(0)) {
                uint256 wethInPool = IERC20(weth).balanceOf(pool);
                uint256 tokenInPool = IERC20(info.tokenAddress).balanceOf(pool);
                uint256 totalSupply = IERC20(info.tokenAddress).totalSupply();

                if (tokenInPool > 0) {
                    marketCap = ((wethInPool + 1.5 ether) * totalSupply) / tokenInPool;
                }
            }

            tokens[j++] = TokenInfo({
                tokenAddress: info.tokenAddress,
                name: info.name,
                symbol: info.symbol,
                deployer: info.deployer,
                time: info.time,
                metadata: info.metadata,
                marketCapInETH: marketCap
            });
        }

        return tokens;
    }



    function withdrawFeesWETH() external {
        require(msg.sender == platformController, "Caller is not controller");
        uint256 wethBalance = IERC20(WETH).balanceOf(address(this));
        require(wethBalance > 0, "No WETH to withdraw");

        IWETH(WETH).withdraw(wethBalance);

        (bool success, ) = msg.sender.call{ value: wethBalance }("");
        require(success, "ETH transfer failed");
    }

    function withdrawFeesETH() external {
        require(msg.sender == platformController, "Caller is not controller");

        uint256 ethBalance = address(this).balance;
        require(ethBalance > 0, "No ETH to withdraw");

        (bool success, ) = msg.sender.call{ value: ethBalance }("");
        require(success, "ETH transfer failed");
    }


    function provideLiquidity(address tokenA, address tokenB) internal {
        bool tokenAIsToken0 = tokenA < tokenB;
        
        address token0 = tokenAIsToken0 ? tokenA : tokenB;
        address token1 = tokenAIsToken0 ? tokenB : tokenA;

        IERC20(token0).approve(POSITION_MANAGER, type(uint256).max);
        IERC20(token1).approve(POSITION_MANAGER, type(uint256).max);

        INonfungiblePositionManager manager = INonfungiblePositionManager(POSITION_MANAGER);

        uint160 sqrtPriceX96 = tokenAIsToken0
            ? 3068365595550320841079178
            : 2045645379722529521098596513701367;

        int24 tickLower = tokenAIsToken0 ? int24(-203000) : int24(-887200);
        int24 tickUpper = tokenAIsToken0 ? int24(887200) : int24(203000);

        uint256 amount0Desired = tokenAIsToken0 ? 1000000000000000000000000000 : 0;
        uint256 amount1Desired = tokenAIsToken0 ? 0 : 1000000000000000000000000000;

        manager.createAndInitializePoolIfNecessary(token0, token1, 10000, sqrtPriceX96);

        manager.mint(
            INonfungiblePositionManager.MintParams({
                token0: token0,
                token1: token1,
                fee: 10000,
                tickLower: tickLower,
                tickUpper: tickUpper,
                amount0Desired: amount0Desired,
                amount1Desired: amount1Desired,
                amount0Min: 0,
                amount1Min: 0,
                recipient: address(this),
                deadline: block.timestamp
            })
        );
    }



    function collectFees(uint256 tokenId) external returns (uint256 amount0, uint256 amount1) {
        (
            , // nonce
            , // operator
            address token0Raw,
            address token1Raw,
            , , , , , , , 
        ) = INonfungiblePositionManager(POSITION_MANAGER).positions(tokenId);

        // Ensure token1 is always WETH
        address token0 = token0Raw;
        address token1 = token1Raw;

        if (token0Raw == WETH && token1Raw != WETH) {
            token0 = token1Raw;
            token1 = token0Raw;
        }

        address creator = IToken(token0).creator();
        require(msg.sender == creator || msg.sender == platformController, "Not authorized");

        uint256 beforeToken0 = IERC20(token0).balanceOf(address(this));
        uint256 beforeToken1 = IERC20(token1).balanceOf(address(this));

        INonfungiblePositionManager.CollectParams memory params = INonfungiblePositionManager.CollectParams({
            tokenId: tokenId,
            recipient: address(this),
            amount0Max: type(uint128).max,
            amount1Max: type(uint128).max
        });

        INonfungiblePositionManager(POSITION_MANAGER).collect(params);

        uint256 collected0 = IERC20(token0).balanceOf(address(this)) - beforeToken0;
        uint256 collected1 = IERC20(token1).balanceOf(address(this)) - beforeToken1;

        if (collected0 > 0) {
            IERC20(token0).transfer(address(0x000000000000000000000000000000000000dEaD), collected0); // burn tokens
        }
        if (collected1 > 0) {
            uint256 half = collected1 / 2;

            // Ensure token1 is actually WETH
            require(token1 == WETH, "token1 must be WETH");

            IWETH(token1).withdraw(half);

            (bool success, ) = payable(creator).call{value: half}("");
            require(success, "ETH transfer to creator failed");
        }


        return (collected0, collected1);
    }

}


// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Token is ERC20, ERC20Burnable {
    address public platform;
    address public creator;

    constructor(
        string memory _name,
        string memory _symbol,
        address _creator,
        address _platform
    ) ERC20(_name, _symbol) {
        platform = _platform;
        creator = _creator;
        _mint(_platform, 1000000000 * 10 ** decimals());
    }
}

Read Contract

POSITION_MANAGER 0x1bea83fe → address
SWAP_ROUTER 0xc6005893 → address
WETH 0xad5c4648 → address
deployedTokens 0xec81aadb → address, string, string, address, uint256, string, uint256
getDeploysByPage 0xaced8d81 → tuple[]
getPenalty 0x96e59682 → uint256
getTokenBytecode 0x8d99aeb0 → bytes
platformController 0x3bcc75f6 → address
tokenCount 0x9f181b5e → uint256

Write Contract 4 functions

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

collectFees 0xb17acdcd
uint256 tokenId
returns: uint256, uint256
deployCoin 0xa361e0d9
string _name
string _symbol
string _metadata
bytes32 salt
withdrawFeesETH 0x9f9baaaa
No parameters
withdrawFeesWETH 0x5a3afecf
No parameters

Recent Transactions

No transactions found for this address