Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xF6fC44CDF9251cE26a60600320e243e7708a8962
Balance 0 ETH
Nonce 140
Code Size 14608 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

14608 bytes
0x6080604052600436106100f2575f3560e01c8063a361e0d911610087578063c600589311610057578063c6005893146102c2578063ec81aadb146102e9578063f7b64c831461031b578063fe6b94541461032f575f5ffd5b8063a361e0d914610228578063aced8d811461023b578063ad5c464814610267578063b17acdcd1461028e575f5ffd5b80638d99aeb0116100c25780638d99aeb0146101a657806396e59682146101d25780639f181b5e146101ff5780639f9baaaa14610214575f5ffd5b80631bea83fe146100fd5780633bcc75f6146101415780635a3afecf146101605780636758704614610176575f5ffd5b366100f957005b5f5ffd5b348015610108575f5ffd5b5061012473c36442b4a4522e871399cd717abdd847ab11fe8881565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014c575f5ffd5b50600254610124906001600160a01b031681565b34801561016b575f5ffd5b5061017461034e565b005b348015610181575f5ffd5b5060025461019690600160a01b900460ff1681565b6040519015158152602001610138565b3480156101b1575f5ffd5b506101c56101c0366004611ee2565b610535565b6040516101389190611f88565b3480156101dd575f5ffd5b506101f16101ec366004611fa1565b6105a6565b604051908152602001610138565b34801561020a575f5ffd5b506101f160015481565b34801561021f575f5ffd5b5061017461061f565b610174610236366004611fb8565b6106a0565b348015610246575f5ffd5b5061025a61025536600461204e565b610a01565b604051610138919061206e565b348015610272575f5ffd5b5061012473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b348015610299575f5ffd5b506102ad6102a8366004611fa1565b6111e6565b60408051928352602083019190915201610138565b3480156102cd575f5ffd5b506101247368b3465833fb72a70ecdf485e0e4c7bd8665fc4581565b3480156102f4575f5ffd5b50610308610303366004611fa1565b611818565b604051610138979695949392919061214e565b348015610326575f5ffd5b506101746119fc565b34801561033a575f5ffd5b50610174610349366004611fa1565b611a47565b6002546001600160a01b031633146103815760405162461bcd60e51b8152600401610378906121c2565b60405180910390fd5b6040516370a0823160e01b81523060048201525f9073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190602401602060405180830381865afa1580156103d0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103f491906121f9565b90505f811161043b5760405162461bcd60e51b81526020600482015260136024820152724e6f205745544820746f20776974686472617760681b6044820152606401610378565b604051632e1a7d4d60e01b81526004810182905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d906024015f604051808303815f87803b158015610485575f5ffd5b505af1158015610497573d5f5f3e3d5ffd5b505050505f336001600160a01b0316826040515b5f6040518083038185875af1925050503d805f81146104e5576040519150601f19603f3d011682016040523d82523d5f602084013e6104ea565b606091505b50509050806105315760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610378565b5050565b60606040518060200161054790611e1f565b601f1982820381018352601f909101166040819052610570908690869086903090602001612210565b60408051601f198184030181529082905261058e9291602001612270565b60405160208183030381529060405290509392505050565b5f66b1a2bc2ec500008210156105bd57505f919050565b670429d069189e000082106105d55750611388919050565b6146505f6105ea66b1a2bc2ec50000856122a0565b90505f670de0b6b3a764000061060084846122b3565b61060a91906122ca565b610616906101f46122e9565b95945050505050565b6002546001600160a01b031633146106495760405162461bcd60e51b8152600401610378906121c2565b478061068c5760405162461bcd60e51b81526020600482015260126024820152714e6f2045544820746f20776974686472617760701b6044820152606401610378565b5f336001600160a01b0316826040516104ab565b600254600160a01b900460ff166107085760405162461bcd60e51b815260206004820152602660248201527f546f6b656e206465706c6f796d656e742069732063757272656e746c792064696044820152651cd8589b195960d21b6064820152608401610378565b5f818585333060405161071a90611e1f565b6107279493929190612210565b8190604051809103905ff5905080158015610744573d5f5f3e3d5ffd5b506040516001600160a01b03821681529091507f60122e78030aba0a2e4a67adb3e52b411343cc51778f919095d3fe394090c1b29060200160405180910390a1806107a38173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2611ac7565b3415610905575f6107b3346105a6565b90505f6064600354836107c691906122b3565b6107d091906122ca565b90505f6127106107e083346122b3565b6107ea91906122ca565b90505f6107f782346122a0565b6040805160e08101825273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281526001600160a01b03888116602083019081526127108385019081523360608501908152608085018781525f60a0870181815260c0880191825297516304e45aaf60e01b8152965186166004880152935185166024870152915162ffffff1660448601525183166064850152516084840152925160a4830152915190911660c48201529091507368b3465833fb72a70ecdf485e0e4c7bd8665fc45906304e45aaf90839060e40160206040518083038185885af11580156108da573d5f5f3e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906108ff91906121f9565b50505050505b6040805160e0810182526001600160a01b03838116825260208083018a81528385018a905233606085015242608085015260a084018990525f60c085018190526001805482529281905294909420835181546001600160a01b03191693169290921782559251919290919082019061097d9082612380565b50604082015160028201906109929082612380565b5060608201516003820180546001600160a01b0319166001600160a01b039092169190911790556080820151600482015560a082015160058201906109d79082612380565b5060c0919091015160069091015560018054905f6109f48361243b565b9190505550505050505050565b600154606090603290610a4b5760405162461bcd60e51b8152602060048201526012602482015271139bc81d1bdad95b9cc819195c1b1bde595960721b6044820152606401610378565b5f81600183600154610a5d91906122e9565b610a6791906122a0565b610a7191906122ca565b9050808510610ab65760405162461bcd60e51b815260206004820152601160248201527050616765206f7574206f662072616e676560781b6044820152606401610378565b5f8080868103610b375784610acc8960016122e9565b610ad691906122b3565b60015411610ae4575f610b07565b84610af08960016122e9565b610afa91906122b3565b600154610b0791906122a0565b9250610b1385896122b3565b600154610b2091906122a0565b9150600154821115610b325760015491505b610b5f565b610b4185896122b3565b9250610b4d85846122e9565b9150600154821115610b5f5760015491505b5f610b6a84846122a0565b67ffffffffffffffff811115610b8257610b82611e2c565b604051908082528060200260200182016040528015610c0157816020015b610bee6040518060e001604052805f6001600160a01b0316815260200160608152602001606081526020015f6001600160a01b031681526020015f8152602001606081526020015f81525090565b815260200190600190039081610ba05790505b5090505f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c55573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c799190612463565b90505f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ccc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cf09190612463565b9050855b858110156111d4575f8b15610d095781610d28565b610d1388836122a0565b610d1e6001896122a0565b610d2891906122a0565b5f81815260208181526040808320815160e0810190925280546001600160a01b03168252600181018054959650939491939092840191610d67906122fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610d93906122fc565b8015610dde5780601f10610db557610100808354040283529160200191610dde565b820191905f5260205f20905b815481529060010190602001808311610dc157829003601f168201915b50505050508152602001600282018054610df7906122fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610e23906122fc565b8015610e6e5780601f10610e4557610100808354040283529160200191610e6e565b820191905f5260205f20905b815481529060010190602001808311610e5157829003601f168201915b505050918352505060038201546001600160a01b0316602082015260048201546040820152600582018054606090920191610ea8906122fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed4906122fc565b8015610f1f5780601f10610ef657610100808354040283529160200191610f1f565b820191905f5260205f20905b815481529060010190602001808311610f0257829003601f168201915b5050509183525050600691909101546020909101528051604051630b4c774160e11b81526001600160a01b039182166004820152878216602482015261271060448201529192505f918291871690631698ee8290606401602060405180830381865afa158015610f91573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fb59190612463565b90506001600160a01b0381161561113e576040516370a0823160e01b81526001600160a01b0382811660048301525f91908916906370a0823190602401602060405180830381865afa15801561100d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061103191906121f9565b84516040516370a0823160e01b81526001600160a01b0385811660048301529293505f92909116906370a0823190602401602060405180830381865afa15801561107d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110a191906121f9565b90505f855f01516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110e3573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061110791906121f9565b9050811561113a578181611123856714d1120d7b1600006122e9565b61112d91906122b3565b61113791906122ca565b94505b5050505b6040518060e00160405280845f01516001600160a01b03168152602001846020015181526020018460400151815260200184606001516001600160a01b03168152602001846080015181526020018460a00151815260200183815250888a806111a69061243b565b9b50815181106111b8576111b861247e565b6020026020010181905250505050508080600101915050610cf4565b50919750505050505050505b92915050565b60405163133f757160e31b8152600481018290525f9081908190819073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab889060240161018060405180830381865afa15801561123d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061126191906124cb565b50979b509599508a985089975050506001600160a01b03871673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214945050831592506112c191505057506001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214155b156112cc5750819050825b5f826001600160a01b03166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611309573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061132d9190612463565b9050336001600160a01b038216148061135057506002546001600160a01b031633145b61138d5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606401610378565b6040516370a0823160e01b81523060048201525f906001600160a01b038516906370a0823190602401602060405180830381865afa1580156113d1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113f591906121f9565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038516906370a0823190602401602060405180830381865afa15801561143c573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061146091906121f9565b604080516080810182528c81523060208201526001600160801b0391810182905260608101919091529091506001600160a01b03851673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2146114ee5760405162461bcd60e51b81526020600482015260136024820152720e8ded6cadc6240daeae6e840c4ca40ae8aa89606b1b6044820152606401610378565b6040805163fc6f786560e01b81528251600482015260208301516001600160a01b03166024820152908201516001600160801b039081166044830152606083015116606482015273c36442b4a4522e871399cd717abdd847ab11fe889063fc6f78659060840160408051808303815f875af115801561156f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061159391906125a0565b50506040516370a0823160e01b81523060048201525f9084906001600160a01b038916906370a0823190602401602060405180830381865afa1580156115db573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115ff91906121f9565b61160991906122a0565b6040516370a0823160e01b81523060048201529091505f9084906001600160a01b038916906370a0823190602401602060405180830381865afa158015611652573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061167691906121f9565b61168091906122a0565b905081156116fa5760405163a9059cbb60e01b815261dead6004820152602481018390526001600160a01b0389169063a9059cbb906044016020604051808303815f875af11580156116d4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116f891906125c2565b505b8015611806575f61170c6002836122ca565b604051632e1a7d4d60e01b8152600481018290529091506001600160a01b03891690632e1a7d4d906024015f604051808303815f87803b15801561174e575f5ffd5b505af1158015611760573d5f5f3e3d5ffd5b505050505f876001600160a01b0316826040515f6040518083038185875af1925050503d805f81146117ad576040519150601f19603f3d011682016040523d82523d5f602084013e6117b2565b606091505b50509050806118035760405162461bcd60e51b815260206004820152601e60248201527f455448207472616e7366657220746f2063726561746f72206661696c656400006044820152606401610378565b50505b909c909b509950505050505050505050565b5f60208190529081526040902080546001820180546001600160a01b039092169291611843906122fc565b80601f016020809104026020016040519081016040528092919081815260200182805461186f906122fc565b80156118ba5780601f10611891576101008083540402835291602001916118ba565b820191905f5260205f20905b81548152906001019060200180831161189d57829003601f168201915b5050505050908060020180546118cf906122fc565b80601f01602080910402602001604051908101604052809291908181526020018280546118fb906122fc565b80156119465780601f1061191d57610100808354040283529160200191611946565b820191905f5260205f20905b81548152906001019060200180831161192957829003601f168201915b505050506003830154600484015460058501805494956001600160a01b039093169491935090611975906122fc565b80601f01602080910402602001604051908101604052809291908181526020018280546119a1906122fc565b80156119ec5780601f106119c3576101008083540402835291602001916119ec565b820191905f5260205f20905b8154815290600101906020018083116119cf57829003601f168201915b5050505050908060060154905087565b6002546001600160a01b03163314611a265760405162461bcd60e51b8152600401610378906121c2565b6002805460ff60a01b198116600160a01b9182900460ff1615909102179055565b6002546001600160a01b03163314611a715760405162461bcd60e51b8152600401610378906121c2565b6064811115611ac25760405162461bcd60e51b815260206004820152601d60248201527f4d756c7469706c6965722063616e6e6f742065786365656420313030250000006044820152606401610378565b600355565b6001600160a01b03808216908316105f81611ae25782611ae4565b835b90505f82611af25784611af4565b835b60405163095ea7b360e01b815273c36442b4a4522e871399cd717abdd847ab11fe8860048201525f1960248201529091506001600160a01b0383169063095ea7b3906044016020604051808303815f875af1158015611b55573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b7991906125c2565b5060405163095ea7b360e01b815273c36442b4a4522e871399cd717abdd847ab11fe8860048201525f1960248201526001600160a01b0382169063095ea7b3906044016020604051808303815f875af1158015611bd8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bfc91906125c2565b5073c36442b4a4522e871399cd717abdd847ab11fe885f84611c2c576d64dbacb643e10eedf7378a0b5df7611c39565b6a0289c06ea6df5a36ae398a5b6dffffffffffffffffffffffffffff1690505f85611c5b57620d899f19611c61565b620318f7195b90505f86611c7257620318f8611c77565b620d89a05b90505f87611c85575f611c93565b6b033b2e3c9fd0803ce80000005b6001600160601b031690505f88611cb6576b033b2e3c9fd0803ce8000000611cb8565b5f5b6040516309f56ab160e11b81526001600160a01b038a811660048301528981166024830152612710604483015287811660648301526001600160601b03929092169250908716906313ead562906084016020604051808303815f875af1158015611d24573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d489190612463565b5060408051610160810182526001600160a01b038a81168252898116602083015261271082840152600287810b606084015286900b608083015260a0820185905260c082018490525f60e0830181905261010083015230610120830152426101408301529151634418b22b60e11b815291881691638831645691611dce916004016125e1565b6080604051808303815f875af1158015611dea573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e0e91906126a5565b505050505050505050505050505050565b6111fc806126df83390190565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112611e4f575f5ffd5b813567ffffffffffffffff811115611e6957611e69611e2c565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715611e9857611e98611e2c565b604052818152838201602001851015611eaf575f5ffd5b816020850160208301375f918101602001919091529392505050565b6001600160a01b0381168114611edf575f5ffd5b50565b5f5f5f60608486031215611ef4575f5ffd5b833567ffffffffffffffff811115611f0a575f5ffd5b611f1686828701611e40565b935050602084013567ffffffffffffffff811115611f32575f5ffd5b611f3e86828701611e40565b9250506040840135611f4f81611ecb565b809150509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f611f9a6020830184611f5a565b9392505050565b5f60208284031215611fb1575f5ffd5b5035919050565b5f5f5f5f60808587031215611fcb575f5ffd5b843567ffffffffffffffff811115611fe1575f5ffd5b611fed87828801611e40565b945050602085013567ffffffffffffffff811115612009575f5ffd5b61201587828801611e40565b935050604085013567ffffffffffffffff811115612031575f5ffd5b61203d87828801611e40565b949793965093946060013593505050565b5f5f6040838503121561205f575f5ffd5b50508035926020909101359150565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b8281101561214257868503603f19018452815180516001600160a01b0316865260208082015160e0918801829052906120cf90880182611f5a565b9050604082015187820360408901526120e88282611f5a565b91505060018060a01b0360608301511660608801526080820151608088015260a082015187820360a089015261211e8282611f5a565b60c09384015198909301979097525094506020938401939190910190600101612094565b50929695505050505050565b6001600160a01b038816815260e0602082018190525f9061217190830189611f5a565b82810360408401526121838189611f5a565b6001600160a01b03881660608501526080840187905283810360a085015290506121ad8186611f5a565b9150508260c083015298975050505050505050565b60208082526018908201527f43616c6c6572206973206e6f7420636f6e74726f6c6c65720000000000000000604082015260600190565b5f60208284031215612209575f5ffd5b5051919050565b608081525f6122226080830187611f5a565b82810360208401526122348187611f5a565b6001600160a01b03958616604085015293909416606090920191909152509392505050565b5f81518060208401855e5f93019283525090919050565b5f61228461227e8386612259565b84612259565b949350505050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156111e0576111e061228c565b80820281158282048414176111e0576111e061228c565b5f826122e457634e487b7160e01b5f52601260045260245ffd5b500490565b808201808211156111e0576111e061228c565b600181811c9082168061231057607f821691505b60208210810361232e57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561237b57805f5260205f20601f840160051c810160208510156123595750805b601f840160051c820191505b81811015612378575f8155600101612365565b50505b505050565b815167ffffffffffffffff81111561239a5761239a611e2c565b6123ae816123a884546122fc565b84612334565b6020601f8211600181146123e0575f83156123c95750848201515b5f19600385901b1c1916600184901b178455612378565b5f84815260208120601f198516915b8281101561240f57878501518255602094850194600190920191016123ef565b508482101561242c57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f6001820161244c5761244c61228c565b5060010190565b805161245e81611ecb565b919050565b5f60208284031215612473575f5ffd5b8151611f9a81611ecb565b634e487b7160e01b5f52603260045260245ffd5b805162ffffff8116811461245e575f5ffd5b8051600281900b811461245e575f5ffd5b80516001600160801b038116811461245e575f5ffd5b5f5f5f5f5f5f5f5f5f5f5f5f6101808d8f0312156124e7575f5ffd5b8c516001600160601b03811681146124fd575f5ffd5b9b5061250b60208e01612453565b9a5061251960408e01612453565b995061252760608e01612453565b985061253560808e01612492565b975061254360a08e016124a4565b965061255160c08e016124a4565b955061255f60e08e016124b5565b6101008e01516101208f01519196509450925061257f6101408e016124b5565b915061258e6101608e016124b5565b90509295989b509295989b509295989b565b5f5f604083850312156125b1575f5ffd5b505080516020909101519092909150565b5f602082840312156125d2575f5ffd5b81518015158114611f9a575f5ffd5b81516001600160a01b031681526101608101602083015161260d60208401826001600160a01b03169052565b506040830151612624604084018262ffffff169052565b506060830151612639606084018260020b9052565b50608083015161264e608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008301516101008301526101208301516126956101208401826001600160a01b03169052565b5061014092830151919092015290565b5f5f5f5f608085870312156126b8575f5ffd5b845193506126c8602086016124b5565b604086015160609096015194979096509250505056fe608060405234801561000f575f5ffd5b506040516111fc3803806111fc83398101604081905261002e916104d1565b8383600361003c83826105d9565b50600461004982826105d9565b5050600580546001600160a01b038085166001600160a01b031992831617909255600680549286169290911691909117905550426007555f610089601290565b61009490600a61078c565b6100a290633b9aca006107a1565b905060646100b16002836107a1565b6100bb91906107b8565b6008556100c882826100d2565b50505050506107ea565b6001600160a01b0382166101005760405163ec442f0560e01b81525f60048201526024015b60405180910390fd5b61010b5f838361010f565b5050565b603c60075461011e91906107d7565b42101561020f576001600160a01b0383161580159061014557506001600160a01b03821615155b801561015f57506006546001600160a01b03838116911614155b801561017957506005546001600160a01b03848116911614155b1561020f57600854816101a0846001600160a01b03165f9081526020819052604090205490565b6101aa91906107d7565b111561020f5760405162461bcd60e51b815260206004820152602e60248201527f4d61782077616c6c6574206c696d697420657863656564656420647572696e6760448201526d081b185d5b98da081c195c9a5bd960921b60648201526084016100f7565b6007544214801561022857506001600160a01b03831615155b801561023c57506001600160a01b03821615155b801561025657506006546001600160a01b03838116911614155b801561027057506005546001600160a01b03838116911614155b801561028a57506005546001600160a01b03848116911614155b156102e35760405162461bcd60e51b8152602060048201526024808201527f4e6f206275797320616c6c6f77656420647572696e67206c61756e636820626c6044820152636f636b2160e01b60648201526084016100f7565b6102ee8383836102f3565b505050565b6001600160a01b03831661031d578060025f82825461031291906107d7565b9091555061038d9050565b6001600160a01b0383165f908152602081905260409020548181101561036f5760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016100f7565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166103a9576002805482900390556103c7565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161040c91815260200190565b60405180910390a3505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f83011261043c575f5ffd5b81516001600160401b0381111561045557610455610419565b604051601f8201601f19908116603f011681016001600160401b038111828210171561048357610483610419565b60405281815283820160200185101561049a575f5ffd5b8160208501602083015e5f918101602001919091529392505050565b80516001600160a01b03811681146104cc575f5ffd5b919050565b5f5f5f5f608085870312156104e4575f5ffd5b84516001600160401b038111156104f9575f5ffd5b6105058782880161042d565b602087015190955090506001600160401b03811115610522575f5ffd5b61052e8782880161042d565b93505061053d604086016104b6565b915061054b606086016104b6565b905092959194509250565b600181811c9082168061056a57607f821691505b60208210810361058857634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156102ee57805f5260205f20601f840160051c810160208510156105b35750805b601f840160051c820191505b818110156105d2575f81556001016105bf565b5050505050565b81516001600160401b038111156105f2576105f2610419565b610606816106008454610556565b8461058e565b6020601f821160018114610638575f83156106215750848201515b5f19600385901b1c1916600184901b1784556105d2565b5f84815260208120601f198516915b828110156106675787850151825560209485019460019092019101610647565b508482101561068457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156106e2578085048111156106c6576106c6610693565b60018416156106d457908102905b60019390931c9280026106ab565b935093915050565b5f826106f857506001610786565b8161070457505f610786565b816001811461071a576002811461072457610740565b6001915050610786565b60ff84111561073557610735610693565b50506001821b610786565b5060208310610133831016604e8410600b8410161715610763575081810a610786565b61076f5f1984846106a7565b805f190482111561078257610782610693565b0290505b92915050565b5f61079a60ff8416836106ea565b9392505050565b808202811582820484141761078657610786610693565b5f826107d257634e487b7160e01b5f52601260045260245ffd5b500490565b8082018082111561078657610786610693565b610a05806107f75f395ff3fe608060405234801561000f575f5ffd5b50600436106100e5575f3560e01c806342966c681161008857806379cc67901161006357806379cc6790146101dd57806395d89b41146101f0578063a9059cbb146101f8578063dd62ed3e1461020b575f5ffd5b806342966c681461018d5780634bde38c8146101a257806370a08231146101b5575f5ffd5b806318160ddd116100c357806318160ddd1461015157806323b872dd146101635780632f4237c014610176578063313ce5671461017e575f5ffd5b806302d05d3f146100e957806306fdde0314610119578063095ea7b31461012e575b5f5ffd5b6006546100fc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610121610243565b604051610110919061085e565b61014161013c3660046108ae565b6102d3565b6040519015158152602001610110565b6002545b604051908152602001610110565b6101416101713660046108d6565b6102ec565b61014161030f565b60405160128152602001610110565b6101a061019b366004610910565b610326565b005b6005546100fc906001600160a01b031681565b6101556101c3366004610927565b6001600160a01b03165f9081526020819052604090205490565b6101a06101eb3660046108ae565b610333565b61012161034c565b6101416102063660046108ae565b61035b565b610155610219366004610947565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b60606003805461025290610978565b80601f016020809104026020016040519081016040528092919081815260200182805461027e90610978565b80156102c95780601f106102a0576101008083540402835291602001916102c9565b820191905f5260205f20905b8154815290600101906020018083116102ac57829003601f168201915b5050505050905090565b5f336102e0818585610368565b60019150505b92915050565b5f336102f985828561037a565b6103048585856103fb565b506001949350505050565b5f603c60075461031f91906109b0565b4210905090565b6103303382610458565b50565b61033e82338361037a565b6103488282610458565b5050565b60606004805461025290610978565b5f336102e08185856103fb565b610375838383600161048c565b505050565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f198110156103f557818110156103e757604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b6103f584848484035f61048c565b50505050565b6001600160a01b03831661042457604051634b637e8f60e11b81525f60048201526024016103de565b6001600160a01b03821661044d5760405163ec442f0560e01b81525f60048201526024016103de565b61037583838361055e565b6001600160a01b03821661048157604051634b637e8f60e11b81525f60048201526024016103de565b610348825f8361055e565b6001600160a01b0384166104b55760405163e602df0560e01b81525f60048201526024016103de565b6001600160a01b0383166104de57604051634a1406b160e11b81525f60048201526024016103de565b6001600160a01b038085165f90815260016020908152604080832093871683529290522082905580156103f557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161055091815260200190565b60405180910390a350505050565b603c60075461056d91906109b0565b42101561065e576001600160a01b0383161580159061059457506001600160a01b03821615155b80156105ae57506006546001600160a01b03838116911614155b80156105c857506005546001600160a01b03848116911614155b1561065e57600854816105ef846001600160a01b03165f9081526020819052604090205490565b6105f991906109b0565b111561065e5760405162461bcd60e51b815260206004820152602e60248201527f4d61782077616c6c6574206c696d697420657863656564656420647572696e6760448201526d081b185d5b98da081c195c9a5bd960921b60648201526084016103de565b6007544214801561067757506001600160a01b03831615155b801561068b57506001600160a01b03821615155b80156106a557506006546001600160a01b03838116911614155b80156106bf57506005546001600160a01b03838116911614155b80156106d957506005546001600160a01b03848116911614155b156107325760405162461bcd60e51b8152602060048201526024808201527f4e6f206275797320616c6c6f77656420647572696e67206c61756e636820626c6044820152636f636b2160e01b60648201526084016103de565b6103758383836001600160a01b038316610762578060025f82825461075791906109b0565b909155506107d29050565b6001600160a01b0383165f90815260208190526040902054818110156107b45760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016103de565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166107ee5760028054829003905561080c565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161085191815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b03811681146108a9575f5ffd5b919050565b5f5f604083850312156108bf575f5ffd5b6108c883610893565b946020939093013593505050565b5f5f5f606084860312156108e8575f5ffd5b6108f184610893565b92506108ff60208501610893565b929592945050506040919091013590565b5f60208284031215610920575f5ffd5b5035919050565b5f60208284031215610937575f5ffd5b61094082610893565b9392505050565b5f5f60408385031215610958575f5ffd5b61096183610893565b915061096f60208401610893565b90509250929050565b600181811c9082168061098c57607f821691505b6020821081036109aa57634e487b7160e01b5f52602260045260245ffd5b50919050565b808201808211156102e657634e487b7160e01b5f52601160045260245ffdfea26469706673582212207e1050c6735ee9c907d64762b44be0c7c67882ced2bbac095574d1b9d0b334d664736f6c634300081e0033a2646970667358221220420e84ce3b58fc97934d9b72bdf91cb5596455ba7cbb11e58258bee9117a1f3a64736f6c634300081e0033

Verified Source Code Full Match

Compiler: v0.8.30+commit.73712a01 EVM: prague Optimization: Yes (200 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 472 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;
    bool public deployCoinEnabled = true;
    uint256 private penaltyMultiplier = 100; // 100% (100 = 100%, 50 = 50%, 200 = 200%)

    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 {
        require(deployCoinEnabled, "Token deployment is currently disabled");
        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 basePenalty = getPenalty(msg.value); // in basis points (e.g., 2500 = 25%)
            uint256 taxBps = (basePenalty * penaltyMultiplier) / 100; // Apply multiplier
            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.05 ether) return 0;
        if (ethAmount >= 0.30 ether) return 5000; // max 50%

        uint256 slope = 18000;
        uint256 delta = ethAmount - 0.05 ether;
        uint256 penalty = 500 + (delta * slope) / 1 ether;

        return penalty;
    }


    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 toggleDeployCoin() external {
        require(msg.sender == platformController, "Caller is not controller");
        deployCoinEnabled = !deployCoinEnabled;
    }

    function setPenaltyMultiplier(uint256 _multiplier) external {
        require(msg.sender == platformController, "Caller is not controller");
        require(_multiplier <= 100, "Multiplier cannot exceed 100%");
        penaltyMultiplier = _multiplier;
    }


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

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

        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;

            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
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;
    uint256 private launchTime;
    uint256 private maxTxAmount;
    uint256 private constant LAUNCH_PERIOD = 60; // 60 seconds
    uint256 private constant MAX_WALLET_PERCENTAGE = 2; // 2% of total supply

    constructor(
        string memory _name,
        string memory _symbol,
        address _creator,
        address _platform
    ) ERC20(_name, _symbol) {
        platform = _platform;
        creator = _creator;
        launchTime = block.timestamp;
        
        uint256 totalTokens = 1000000000 * 10 ** decimals();
        maxTxAmount = (totalTokens * MAX_WALLET_PERCENTAGE) / 100;
        
        _mint(_platform, totalTokens);
    }

    function _update(address from, address to, uint256 value) internal override {
        // Check max wallet limit for buys during launch period
        if (block.timestamp < launchTime + LAUNCH_PERIOD) {
            // Only apply restriction to buys (when 'to' is receiving tokens)
            // and only if the recipient is not the creator, platform, or liquidity-related addresses
            // Skip check for minting (from == address(0)) and burning (to == address(0))
            if (from != address(0) && to != address(0) && to != creator && from != platform) {
                require(
                    balanceOf(to) + value <= maxTxAmount,
                    "Max wallet limit exceeded during launch period"
                );
            }
        }
        
        // Block all buys at launch block
        if (block.timestamp == launchTime && 
            from != address(0) && 
            to != address(0) && 
            to != creator && 
            to != platform && 
            from != platform) {
            
            revert("No buys allowed during launch block!");
        }
        
        super._update(from, to, value);
    }
    
    function isLaunchPeriodActive() public view returns (bool) {
        return block.timestamp < launchTime + LAUNCH_PERIOD;
    }
}

Read Contract

POSITION_MANAGER 0x1bea83fe → address
SWAP_ROUTER 0xc6005893 → address
WETH 0xad5c4648 → address
deployCoinEnabled 0x67587046 → bool
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 6 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
setPenaltyMultiplier 0xfe6b9454
uint256 _multiplier
toggleDeployCoin 0xf7b64c83
No parameters
withdrawFeesETH 0x9f9baaaa
No parameters
withdrawFeesWETH 0x5a3afecf
No parameters

Recent Transactions

No transactions found for this address