Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x42ab138f7DCCCCb253DC6c0803C13c703890C203
Balance 0.006350 ETH
Nonce 45
Code Size 20738 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

20738 bytes
0x60806040526004361061017e575f3560e01c80639bea0919116100cd578063bf107b5211610087578063ec81aadb11610062578063ec81aadb146104df578063f7b64c83146104fe578063f861063c14610512578063fe6b945414610531575f5ffd5b8063bf107b521461046e578063c600589314610499578063db3fa4cc146104c0575f5ffd5b80639bea09191461039f5780639f181b5e146103be5780639f9baaaa146103d3578063aced8d81146103e7578063ad5c464814610413578063b17acdcd1461043a575f5ffd5b80635bdb9d6a116101385780638d99aeb0116101135780638d99aeb0146103225780638e0e68041461034e578063964a04951461036157806396e5968214610380575f5ffd5b80635bdb9d6a1461029f57806367587046146102d35780637ff4cffb14610303575f5ffd5b80631bea83fe146101895780632ef780d4146101cd5780633bcc75f614610206578063521078b5146102255780635442a67f146102515780635a3afecf14610289575f5ffd5b3661018557005b5f5ffd5b348015610194575f5ffd5b506101b073c36442b4a4522e871399cd717abdd847ab11fe8881565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101d8575f5ffd5b506101f86101e7366004612d99565b60086020525f908152604090205481565b6040519081526020016101c4565b348015610211575f5ffd5b506003546101b0906001600160a01b031681565b348015610230575f5ffd5b5061024461023f366004612d99565b610550565b6040516101c49190612dbb565b34801561025c575f5ffd5b5061027061026b366004612d99565b6105c3565b6040516101c49d9c9b9a99989796959493929190612e34565b348015610294575f5ffd5b5061029d610860565b005b3480156102aa575f5ffd5b506101f86102b9366004612d99565b6001600160a01b03165f9081526008602052604090205490565b3480156102de575f5ffd5b506003546102f390600160a01b900460ff1681565b60405190151581526020016101c4565b34801561030e575f5ffd5b5061029d61031d366004612ef3565b610a47565b34801561032d575f5ffd5b5061034161033c366004612fa9565b610b30565b6040516101c49190613021565b61029d61035c366004613033565b610ba1565b34801561036c575f5ffd5b5061029d61037b366004613111565b6111f1565b34801561038b575f5ffd5b506101f861039a366004612ef3565b61131a565b3480156103aa575f5ffd5b506102446103b9366004612d99565b611393565b3480156103c9575f5ffd5b506101f860025481565b3480156103de575f5ffd5b5061029d611404565b3480156103f2575f5ffd5b50610406610401366004613148565b611485565b6040516101c49190613168565b34801561041e575f5ffd5b506101b073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b348015610445575f5ffd5b50610459610454366004612ef3565b611e55565b604080519283526020830191909152016101c4565b348015610479575f5ffd5b506101f8610488366004612d99565b60096020525f908152604090205481565b3480156104a4575f5ffd5b506101b07368b3465833fb72a70ecdf485e0e4c7bd8665fc4581565b3480156104cb575f5ffd5b506101b06104da3660046132b3565b6127e1565b3480156104ea575f5ffd5b506102706104f9366004612ef3565b612815565b348015610509575f5ffd5b5061029d612840565b34801561051d575f5ffd5b506101b061052c3660046132b3565b61288b565b34801561053c575f5ffd5b5061029d61054b366004612ef3565b6128a4565b6001600160a01b0381165f908152600760209081526040918290208054835181840281018401909452808452606093928301828280156105b757602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610599575b50505050509050919050565b600160208190525f9182526040909120805491810180546001600160a01b03909316926105ef906132dd565b80601f016020809104026020016040519081016040528092919081815260200182805461061b906132dd565b80156106665780601f1061063d57610100808354040283529160200191610666565b820191905f5260205f20905b81548152906001019060200180831161064957829003601f168201915b50505050509080600201805461067b906132dd565b80601f01602080910402602001604051908101604052809291908181526020018280546106a7906132dd565b80156106f25780601f106106c9576101008083540402835291602001916106f2565b820191905f5260205f20905b8154815290600101906020018083116106d557829003601f168201915b505050506003830154600484015460058501805494956001600160a01b039093169491935090610721906132dd565b80601f016020809104026020016040519081016040528092919081815260200182805461074d906132dd565b80156107985780601f1061076f57610100808354040283529160200191610798565b820191905f5260205f20905b81548152906001019060200180831161077b57829003601f168201915b5050505060068301546007840154600885018054949592946001600160a01b039092169350906107c7906132dd565b80601f01602080910402602001604051908101604052809291908181526020018280546107f3906132dd565b801561083e5780601f106108155761010080835404028352916020019161083e565b820191905f5260205f20905b81548152906001019060200180831161082157829003601f168201915b50505050509080600901549080600a01549080600b01549080600c015490508d565b6003546001600160a01b031633146108935760405162461bcd60e51b815260040161088a90613315565b60405180910390fd5b6040516370a0823160e01b81523060048201525f9073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190602401602060405180830381865afa1580156108e2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610906919061334c565b90505f811161094d5760405162461bcd60e51b81526020600482015260136024820152724e6f205745544820746f20776974686472617760681b604482015260640161088a565b604051632e1a7d4d60e01b81526004810182905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d906024015f604051808303815f87803b158015610997575f5ffd5b505af11580156109a9573d5f5f3e3d5ffd5b505050505f336001600160a01b0316826040515b5f6040518083038185875af1925050503d805f81146109f7576040519150601f19603f3d011682016040523d82523d5f602084013e6109fc565b606091505b5050905080610a435760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b604482015260640161088a565b5050565b6003546001600160a01b03163314610abc5760405162461bcd60e51b815260206004820152603260248201527f4f6e6c7920706c6174666f726d20636f6e74726f6c6c65722063616e206368616044820152716e6765206974656d7320706572207061676560701b606482015260840161088a565b5f81118015610acd57506103e88111155b610b2b5760405162461bcd60e51b815260206004820152602960248201527f4974656d73207065722070616765206d757374206265206265747765656e2031604482015268020616e6420313030360bc1b606482015260840161088a565b600555565b606060405180602001610b4290612d65565b601f1982820381018352601f909101166040819052610b6b908690869086903090602001613363565b60408051601f1981840301815290829052610b8992916020016133c3565b60405160208183030381529060405290509392505050565b600354600160a01b900460ff16610c095760405162461bcd60e51b815260206004820152602660248201527f546f6b656e206465706c6f796d656e742069732063757272656e746c792064696044820152651cd8589b195960d21b606482015260840161088a565b5f8488883330604051610c1b90612d65565b610c289493929190613363565b8190604051809103905ff5905080158015610c45573d5f5f3e3d5ffd5b506040516001600160a01b03821681529091507f60122e78030aba0a2e4a67adb3e52b411343cc51778f919095d3fe394090c1b29060200160405180910390a180610ca48173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2612924565b3415610ee4575f610cb43461131a565b90505f606460045483610cc791906133f3565b610cd1919061340a565b90505f612710610ce183346133f3565b610ceb919061340a565b90505f610cf88234613429565b6040805160e08101825273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281526001600160a01b03888116602083019081526127108385019081523060608501908152608085018781525f60a0870181815260c0880191825297516304e45aaf60e01b8152965186166004880152935185166024870152915162ffffff1660448601525183166064850152516084840152925160a4830152915190911660c48201529091507368b3465833fb72a70ecdf485e0e4c7bd8665fc45906304e45aaf90839060e40160206040518083038185885af1158015610ddb573d5f5f3e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610e00919061334c565b506040516370a0823160e01b815230600482015285905f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610e47573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e6b919061334c565b60405163a9059cbb60e01b8152336004820152602481018290529091506001600160a01b0383169063a9059cbb906044016020604051808303815f875af1158015610eb8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610edc919061343c565b505050505050505b604080516101a0810182526001600160a01b03838116825260208083018d81528385018d905233606085015242608085015260a084018c90525f60c085018190528a841660e086015261010085018a90526101208501899052610140850181905261016085018190526101808501819052600254815291829052939020825181546001600160a01b03191692169190911781559151909182916001820190610f8c90826134a6565b5060408201516002820190610fa190826134a6565b5060608201516003820180546001600160a01b0319166001600160a01b039092169190911790556080820151600482015560a08201516005820190610fe690826134a6565b5060c0820151600682015560e08201516007820180546001600160a01b0319166001600160a01b03909216919091179055610100820151600882019061102c90826134a6565b506101208201516009820155610140820151600a820155610160820151600b82015561018090910151600c909101556001600160a01b038281165f908152600160208181526040909220845181546001600160a01b0319169416939093178355908301518392918201906110a090826134a6565b50604082015160028201906110b590826134a6565b5060608201516003820180546001600160a01b0319166001600160a01b039092169190911790556080820151600482015560a082015160058201906110fa90826134a6565b5060c0820151600682015560e08201516007820180546001600160a01b0319166001600160a01b03909216919091179055610100820151600882019061114090826134a6565b506101208201516009820155610140820151600a820155610160820151600b82015561018090910151600c909101556001600160a01b038087165f9081526006602090815260408083208054600181810183559185528385200180549588166001600160a01b031996871681179091553385526007845291842080549182018155845291832090910180549093161790915560028054916111e083613561565b919050555050505050505050505050565b6003546001600160a01b0316331461125f5760405162461bcd60e51b815260206004820152602b60248201527f4f6e6c7920706c6174666f726d20636f6e74726f6c6c65722063616e2063686160448201526a3733b29031b932b0ba37b960a91b606482015260840161088a565b6001600160a01b0381166112c05760405162461bcd60e51b815260206004820152602260248201527f4e65772063726561746f722063616e6e6f74206265207a65726f206164647265604482015261737360f01b606482015260840161088a565b6040516374580e2f60e01b81526001600160a01b0382811660048301528316906374580e2f906024015f604051808303815f87803b158015611300575f5ffd5b505af1158015611312573d5f5f3e3d5ffd5b505050505050565b5f66b1a2bc2ec5000082101561133157505f919050565b670429d069189e000082106113495750611388919050565b6146505f61135e66b1a2bc2ec5000085613429565b90505f670de0b6b3a764000061137484846133f3565b61137e919061340a565b61138a906101f4613579565b95945050505050565b6001600160a01b0381165f908152600660209081526040918290208054835181840281018401909452808452606093928301828280156105b757602002820191905f5260205f209081546001600160a01b031681526001909101906020018083116105995750505050509050919050565b6003546001600160a01b0316331461142e5760405162461bcd60e51b815260040161088a90613315565b47806114715760405162461bcd60e51b81526020600482015260126024820152714e6f2045544820746f20776974686472617760701b604482015260640161088a565b5f336001600160a01b0316826040516109bd565b60605f600254116114cd5760405162461bcd60e51b8152602060048201526012602482015271139bc81d1bdad95b9cc819195c1b1bde595960721b604482015260640161088a565b5f60055460016005546002546114e39190613579565b6114ed9190613429565b6114f7919061340a565b905080841061153c5760405162461bcd60e51b815260206004820152601160248201527050616765206f7574206f662072616e676560781b604482015260640161088a565b5f80808581036115c557600554611554886001613579565b61155e91906133f3565b6002541161156c575f611591565b60055461157a886001613579565b61158491906133f3565b6002546115919190613429565b9250600554876115a191906133f3565b6002546115ae9190613429565b91506002548211156115c05760025491505b6115f4565b6005546115d290886133f3565b9250600554836115e29190613579565b91506002548211156115f45760025491505b5f6115ff8484613429565b67ffffffffffffffff81111561161757611617612f0a565b6040519080825280602002602001820160405280156116c557816020015b6116b2604051806101a001604052805f6001600160a01b0316815260200160608152602001606081526020015f6001600160a01b031681526020015f8152602001606081526020015f81526020015f6001600160a01b03168152602001606081526020015f81526020015f81526020015f81526020015f81525090565b8152602001906001900390816116355790505b5090505f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611719573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061173d9190613597565b90505f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611790573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117b49190613597565b9050855b85811015611e44575f8a156117cd57816117ec565b6117d78883613429565b6117e2600189613429565b6117ec9190613429565b5f8181526020818152604080832081516101a0810190925280546001600160a01b0316825260018101805495965093949193909284019161182c906132dd565b80601f0160208091040260200160405190810160405280929190818152602001828054611858906132dd565b80156118a35780601f1061187a576101008083540402835291602001916118a3565b820191905f5260205f20905b81548152906001019060200180831161188657829003601f168201915b505050505081526020016002820180546118bc906132dd565b80601f01602080910402602001604051908101604052809291908181526020018280546118e8906132dd565b80156119335780601f1061190a57610100808354040283529160200191611933565b820191905f5260205f20905b81548152906001019060200180831161191657829003601f168201915b505050918352505060038201546001600160a01b031660208201526004820154604082015260058201805460609092019161196d906132dd565b80601f0160208091040260200160405190810160405280929190818152602001828054611999906132dd565b80156119e45780601f106119bb576101008083540402835291602001916119e4565b820191905f5260205f20905b8154815290600101906020018083116119c757829003601f168201915b50505091835250506006820154602082015260078201546001600160a01b03166040820152600882018054606090920191611a1e906132dd565b80601f0160208091040260200160405190810160405280929190818152602001828054611a4a906132dd565b8015611a955780601f10611a6c57610100808354040283529160200191611a95565b820191905f5260205f20905b815481529060010190602001808311611a7857829003601f168201915b505050918352505060098201546020820152600a820154604080830191909152600b8301546060830152600c9092015460809091015281519051630b4c774160e11b81526001600160a01b039182166004820152878216602482015261271060448201529192505f918291871690631698ee8290606401602060405180830381865afa158015611b27573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b4b9190613597565b90506001600160a01b03811615611cd4576040516370a0823160e01b81526001600160a01b0382811660048301525f91908916906370a0823190602401602060405180830381865afa158015611ba3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bc7919061334c565b84516040516370a0823160e01b81526001600160a01b0385811660048301529293505f92909116906370a0823190602401602060405180830381865afa158015611c13573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c37919061334c565b90505f855f01516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c79573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c9d919061334c565b90508115611cd0578181611cb9856714d1120d7b160000613579565b611cc391906133f3565b611ccd919061340a565b94505b5050505b60e083015183516040516370a0823160e01b81526001600160a01b039283166004820181905231925f9216906370a0823190602401602060405180830381865afa158015611d24573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d48919061334c565b9050604051806101a00160405280865f01516001600160a01b03168152602001866020015181526020018660400151815260200186606001516001600160a01b03168152602001866080015181526020018660a0015181526020018581526020018660e001516001600160a01b031681526020018661010001518152602001866101200151815260200183815260200182815260200160085f885f01516001600160a01b03166001600160a01b031681526020019081526020015f20548152508a8c80611e1490613561565b9d5081518110611e2657611e266135b2565b602002602001018190525050505050505080806001019150506117b8565b509196505050505050505b92915050565b60405163133f757160e31b8152600481018290525f9081908190819073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab889060240161018060405180830381865afa158015611eac573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ed091906135ff565b50979b509599508a985089975050506001600160a01b03871673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21494505083159250611f3091505057506001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214155b15611f3b5750819050825b5f826001600160a01b03166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f78573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f9c9190613597565b9050336001600160a01b0382161480611fbf57506003546001600160a01b031633145b611ffc5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b604482015260640161088a565b6040516370a0823160e01b81523060048201525f906001600160a01b038516906370a0823190602401602060405180830381865afa158015612040573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612064919061334c565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038516906370a0823190602401602060405180830381865afa1580156120ab573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120cf919061334c565b604080516080810182528c81523060208201526001600160801b0391810182905260608101919091529091506001600160a01b03851673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21461215d5760405162461bcd60e51b81526020600482015260136024820152720e8ded6cadc6240daeae6e840c4ca40ae8aa89606b1b604482015260640161088a565b6040805163fc6f786560e01b81528251600482015260208301516001600160a01b03166024820152908201516001600160801b039081166044830152606083015116606482015273c36442b4a4522e871399cd717abdd847ab11fe889063fc6f78659060840160408051808303815f875af11580156121de573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061220291906136d4565b50506040516370a0823160e01b81523060048201525f9084906001600160a01b038916906370a0823190602401602060405180830381865afa15801561224a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061226e919061334c565b6122789190613429565b6040516370a0823160e01b81523060048201529091505f9084906001600160a01b038916906370a0823190602401602060405180830381865afa1580156122c1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122e5919061334c565b6122ef9190613429565b6001600160a01b03808a165f90815260016020818152604080842081516101a08101909252805490951681529184018054959650929491939290840191612335906132dd565b80601f0160208091040260200160405190810160405280929190818152602001828054612361906132dd565b80156123ac5780601f10612383576101008083540402835291602001916123ac565b820191905f5260205f20905b81548152906001019060200180831161238f57829003601f168201915b505050505081526020016002820180546123c5906132dd565b80601f01602080910402602001604051908101604052809291908181526020018280546123f1906132dd565b801561243c5780601f106124135761010080835404028352916020019161243c565b820191905f5260205f20905b81548152906001019060200180831161241f57829003601f168201915b505050918352505060038201546001600160a01b0316602082015260048201546040820152600582018054606090920191612476906132dd565b80601f01602080910402602001604051908101604052809291908181526020018280546124a2906132dd565b80156124ed5780601f106124c4576101008083540402835291602001916124ed565b820191905f5260205f20905b8154815290600101906020018083116124d057829003601f168201915b50505091835250506006820154602082015260078201546001600160a01b03166040820152600882018054606090920191612527906132dd565b80601f0160208091040260200160405190810160405280929190818152602001828054612553906132dd565b801561259e5780601f106125755761010080835404028352916020019161259e565b820191905f5260205f20905b81548152906001019060200180831161258157829003601f168201915b505050918352505060098201546020820152600a8201546040820152600b8201546060820152600c9091015460809091015260e0810151610120820151919250906001600160a01b0382166126355760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088a565b60648111156126865760405162461bcd60e51b815260206004820152601f60248201527f53706c6974206d757374206265206265747765656e203020616e642031303000604482015260640161088a565b84156126fe5760405163a9059cbb60e01b81526001600160a01b038381166004830152602482018790528c169063a9059cbb906044016020604051808303815f875af11580156126d8573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126fc919061343c565b505b83156127cb57604051632e1a7d4d60e01b8152600481018590526001600160a01b038b1690632e1a7d4d906024015f604051808303815f87803b158015612743575f5ffd5b505af1158015612755573d5f5f3e3d5ffd5b505050505f600285612767919061340a565b90505f6127748287613429565b90505f606461278385846133f3565b61278d919061340a565b90505f61279a8284613429565b905081156127b6576127ac8683612c9b565b6127b68f83612d35565b80156127c6576127c68d82612c9b565b505050505b50929e919d50909b505050505050505050505050565b6007602052815f5260405f2081815481106127fa575f80fd5b5f918252602090912001546001600160a01b03169150829050565b5f60208190529081526040902080546001820180546001600160a01b0390921692916105ef906132dd565b6003546001600160a01b0316331461286a5760405162461bcd60e51b815260040161088a90613315565b6003805460ff60a01b198116600160a01b9182900460ff1615909102179055565b6006602052815f5260405f2081815481106127fa575f80fd5b6003546001600160a01b031633146128ce5760405162461bcd60e51b815260040161088a90613315565b606481111561291f5760405162461bcd60e51b815260206004820152601d60248201527f4d756c7469706c6965722063616e6e6f74206578636565642031303025000000604482015260640161088a565b600455565b6001600160a01b03808216908316105f8161293f5782612941565b835b90505f8261294f5784612951565b835b60405163095ea7b360e01b815273c36442b4a4522e871399cd717abdd847ab11fe8860048201525f1960248201529091506001600160a01b0383169063095ea7b3906044016020604051808303815f875af11580156129b2573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129d6919061343c565b5060405163095ea7b360e01b815273c36442b4a4522e871399cd717abdd847ab11fe8860048201525f1960248201526001600160a01b0382169063095ea7b3906044016020604051808303815f875af1158015612a35573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a59919061343c565b5073c36442b4a4522e871399cd717abdd847ab11fe885f84612a89576d64dbacb643e10eedf7378a0b5df7612a96565b6a0289c06ea6df5a36ae398a5b6dffffffffffffffffffffffffffff1690505f85612ab857620d899f19612abe565b620318f7195b90505f86612acf57620318f8612ad4565b620d89a05b90505f87612ae2575f612af0565b6b033b2e3c9fd0803ce80000005b6001600160601b031690505f88612b13576b033b2e3c9fd0803ce8000000612b15565b5f5b6040516309f56ab160e11b81526001600160a01b038a811660048301528981166024830152612710604483015287811660648301526001600160601b03929092169250908716906313ead562906084016020604051808303815f875af1158015612b81573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ba59190613597565b5060408051610160810182526001600160a01b038a81168252898116602083015261271082840152600287810b606084015286900b608083015260a0820185905260c082018490525f60e08301819052610100830181905230610120840152426101408401529251634418b22b60e11b815290891691638831645691612c2e91906004016136f6565b6080604051808303815f875af1158015612c4a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c6e91906137ba565b5050506001600160a01b038d165f9081526009602052604090208190559050505050505050505050505050565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612ce4576040519150601f19603f3d011682016040523d82523d5f602084013e612ce9565b606091505b5050905080612d305760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b604482015260640161088a565b505050565b6001600160a01b0382165f9081526008602052604081208054839290612d5c908490613579565b90915550505050565b6118d9806137f483390190565b6001600160a01b0381168114612d86575f5ffd5b50565b8035612d9481612d72565b919050565b5f60208284031215612da9575f5ffd5b8135612db481612d72565b9392505050565b602080825282518282018190525f918401906040840190835b81811015612dfb5783516001600160a01b0316835260209384019390920191600101612dd4565b509095945050505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b6001600160a01b038e1681526101a060208201525f612e576101a083018f612e06565b8281036040840152612e69818f612e06565b6001600160a01b038e16606085015290508b608084015282810360a0840152612e92818c612e06565b90508960c0840152612eaf60e084018a6001600160a01b03169052565b828103610100840152612ec28189612e06565b915050856101208301528461014083015283610160830152826101808301529e9d5050505050505050505050505050565b5f60208284031215612f03575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112612f2d575f5ffd5b813567ffffffffffffffff811115612f4757612f47612f0a565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715612f7657612f76612f0a565b604052818152838201602001851015612f8d575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f5f60608486031215612fbb575f5ffd5b833567ffffffffffffffff811115612fd1575f5ffd5b612fdd86828701612f1e565b935050602084013567ffffffffffffffff811115612ff9575f5ffd5b61300586828701612f1e565b925050604084013561301681612d72565b809150509250925092565b602081525f612db46020830184612e06565b5f5f5f5f5f5f5f60e0888a031215613049575f5ffd5b873567ffffffffffffffff81111561305f575f5ffd5b61306b8a828b01612f1e565b975050602088013567ffffffffffffffff811115613087575f5ffd5b6130938a828b01612f1e565b965050604088013567ffffffffffffffff8111156130af575f5ffd5b6130bb8a828b01612f1e565b955050606088013593506130d160808901612d89565b925060a088013567ffffffffffffffff8111156130ec575f5ffd5b6130f88a828b01612f1e565b979a969950949793969295929450505060c09091013590565b5f5f60408385031215613122575f5ffd5b823561312d81612d72565b9150602083013561313d81612d72565b809150509250929050565b5f5f60408385031215613159575f5ffd5b50508035926020909101359150565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b828110156132a757868503603f19018452815180516001600160a01b0316865260208101516101a060208801526131c96101a0880182612e06565b9050604082015187820360408901526131e28282612e06565b91505060608201516131ff60608901826001600160a01b03169052565b506080820151608088015260a082015187820360a08901526132218282612e06565b91505060c082015160c088015260e082015161324860e08901826001600160a01b03169052565b506101008201518782036101008901526132628282612e06565b61012084810151908a015261014080850151908a015261016080850151908a01526101809384015193909801929092525050602093840193919091019060010161318e565b50929695505050505050565b5f5f604083850312156132c4575f5ffd5b82356132cf81612d72565b946020939093013593505050565b600181811c908216806132f157607f821691505b60208210810361330f57634e487b7160e01b5f52602260045260245ffd5b50919050565b60208082526018908201527f43616c6c6572206973206e6f7420636f6e74726f6c6c65720000000000000000604082015260600190565b5f6020828403121561335c575f5ffd5b5051919050565b608081525f6133756080830187612e06565b82810360208401526133878187612e06565b6001600160a01b03958616604085015293909416606090920191909152509392505050565b5f81518060208401855e5f93019283525090919050565b5f6133d76133d183866133ac565b846133ac565b949350505050565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417611e4f57611e4f6133df565b5f8261342457634e487b7160e01b5f52601260045260245ffd5b500490565b81810381811115611e4f57611e4f6133df565b5f6020828403121561344c575f5ffd5b81518015158114612db4575f5ffd5b601f821115612d3057805f5260205f20601f840160051c810160208510156134805750805b601f840160051c820191505b8181101561349f575f815560010161348c565b5050505050565b815167ffffffffffffffff8111156134c0576134c0612f0a565b6134d4816134ce84546132dd565b8461345b565b6020601f821160018114613506575f83156134ef5750848201515b5f19600385901b1c1916600184901b17845561349f565b5f84815260208120601f198516915b828110156135355787850151825560209485019460019092019101613515565b508482101561355257868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f60018201613572576135726133df565b5060010190565b80820180821115611e4f57611e4f6133df565b8051612d9481612d72565b5f602082840312156135a7575f5ffd5b8151612db481612d72565b634e487b7160e01b5f52603260045260245ffd5b805162ffffff81168114612d94575f5ffd5b8051600281900b8114612d94575f5ffd5b80516001600160801b0381168114612d94575f5ffd5b5f5f5f5f5f5f5f5f5f5f5f5f6101808d8f03121561361b575f5ffd5b8c516001600160601b0381168114613631575f5ffd5b9b5061363f60208e0161358c565b9a5061364d60408e0161358c565b995061365b60608e0161358c565b985061366960808e016135c6565b975061367760a08e016135d8565b965061368560c08e016135d8565b955061369360e08e016135e9565b6101008e01516101208f0151919650945092506136b36101408e016135e9565b91506136c26101608e016135e9565b90509295989b509295989b509295989b565b5f5f604083850312156136e5575f5ffd5b505080516020909101519092909150565b81516001600160a01b031681526101608101602083015161372260208401826001600160a01b03169052565b506040830151613739604084018262ffffff169052565b50606083015161374e606084018260020b9052565b506080830151613763608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008301516101008301526101208301516137aa6101208401826001600160a01b03169052565b5061014092830151919092015290565b5f5f5f5f608085870312156137cd575f5ffd5b845193506137dd602086016135e9565b604086015160609096015194979096509250505056fe608060405234801561000f575f5ffd5b506040516118d93803806118d983398101604081905261002e916106e8565b8383600361003c83826107f0565b50600461004982826107f0565b5050600580546001600160a01b038085166001600160a01b031992831617909255600680549286169290911691909117905550436007555f610089601290565b61009490600a6109a3565b6100a290633b9aca006109b8565b905060646100b16002836109b8565b6100bb91906109cf565b6008556100c882826100d2565b5050505050610a1a565b6001600160a01b0382166101005760405163ec442f0560e01b81525f60048201526024015b60405180910390fd5b61010b5f838361010f565b5050565b6007544311801561012e5750601e60075461012a91906109ee565b4311155b15610421575f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610184573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101a89190610a01565b604051630b4c774160e11b815230600482015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2602482015261271060448201529091505f906001600160a01b03831690631698ee8290606401602060405180830381865afa158015610211573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102359190610a01565b9050806001600160a01b0316856001600160a01b031614801561026657506005546001600160a01b03858116911614155b801561028057506006546001600160a01b03858116911614155b1561032a57325f90815260096020526040812080548592906102a39084906109ee565b90915550506008546064906102b990606e6109b8565b6102c391906109cf565b325f90815260096020526040902054111561032a5760405162461bcd60e51b815260206004820152602160248201527f4b656570696e6720322520706f6f6c204c696d69747320496e204b6f6e74726f6044820152601b60fa1b60648201526084016100f7565b6006546001600160a01b0385811691161480159061035657506005546001600160a01b03858116911614155b80156103745750806001600160a01b0316846001600160a01b031614155b801561038857506001600160a01b03851615155b1561041e57600854836103af866001600160a01b03165f9081526020819052604090205490565b6103b991906109ee565b111561041e5760405162461bcd60e51b815260206004820152602e60248201527f4d61782077616c6c6574206c696d697420657863656564656420647572696e6760448201526d081b185d5b98da081c195c9a5bd960921b60648201526084016100f7565b50505b6007544314801561043a57506001600160a01b03831615155b801561045457506005546001600160a01b03838116911614155b801561046e57506005546001600160a01b03848116911614155b80156104a157506005546001600160a01b03848116911614801561049f57506006546001600160a01b038381169116145b155b156104fa5760405162461bcd60e51b8152602060048201526024808201527f4e6f206275797320616c6c6f77656420647572696e67206c61756e636820626c6044820152636f636b2160e01b60648201526084016100f7565b61050583838361050a565b505050565b6001600160a01b038316610534578060025f82825461052991906109ee565b909155506105a49050565b6001600160a01b0383165f90815260208190526040902054818110156105865760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016100f7565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166105c0576002805482900390556105de565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161062391815260200190565b60405180910390a3505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610653575f5ffd5b81516001600160401b0381111561066c5761066c610630565b604051601f8201601f19908116603f011681016001600160401b038111828210171561069a5761069a610630565b6040528181528382016020018510156106b1575f5ffd5b8160208501602083015e5f918101602001919091529392505050565b80516001600160a01b03811681146106e3575f5ffd5b919050565b5f5f5f5f608085870312156106fb575f5ffd5b84516001600160401b03811115610710575f5ffd5b61071c87828801610644565b602087015190955090506001600160401b03811115610739575f5ffd5b61074587828801610644565b935050610754604086016106cd565b9150610762606086016106cd565b905092959194509250565b600181811c9082168061078157607f821691505b60208210810361079f57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561050557805f5260205f20601f840160051c810160208510156107ca5750805b601f840160051c820191505b818110156107e9575f81556001016107d6565b5050505050565b81516001600160401b0381111561080957610809610630565b61081d81610817845461076d565b846107a5565b6020601f82116001811461084f575f83156108385750848201515b5f19600385901b1c1916600184901b1784556107e9565b5f84815260208120601f198516915b8281101561087e578785015182556020948501946001909201910161085e565b508482101561089b57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156108f9578085048111156108dd576108dd6108aa565b60018416156108eb57908102905b60019390931c9280026108c2565b935093915050565b5f8261090f5750600161099d565b8161091b57505f61099d565b8160018114610931576002811461093b57610957565b600191505061099d565b60ff84111561094c5761094c6108aa565b50506001821b61099d565b5060208310610133831016604e8410600b841016171561097a575081810a61099d565b6109865f1984846108be565b805f1904821115610999576109996108aa565b0290505b92915050565b5f6109b160ff841683610901565b9392505050565b808202811582820484141761099d5761099d6108aa565b5f826109e957634e487b7160e01b5f52601260045260245ffd5b500490565b8082018082111561099d5761099d6108aa565b5f60208284031215610a11575f5ffd5b6109b1826106cd565b610eb280610a275f395ff3fe608060405234801561000f575f5ffd5b5060043610610111575f3560e01c80634bde38c81161009e57806395d89b411161006e57806395d89b411461024a578063a9059cbb14610252578063ad5c464814610265578063cbbc94cf14610280578063dd62ed3e146102b2575f5ffd5b80634bde38c8146101e957806370a08231146101fc57806374580e2f1461022457806379cc679014610237575f5ffd5b80631bea83fe116100e45780631bea83fe1461018f57806323b872dd146101aa5780632f4237c0146101bd578063313ce567146101c557806342966c68146101d4575f5ffd5b806302d05d3f1461011557806306fdde0314610145578063095ea7b31461015a57806318160ddd1461017d575b5f5ffd5b600654610128906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61014d6102ea565b60405161013c9190610cab565b61016d610168366004610cf4565b61037a565b604051901515815260200161013c565b6002545b60405190815260200161013c565b61012873c36442b4a4522e871399cd717abdd847ab11fe8881565b61016d6101b8366004610d1e565b610393565b61016d6103b6565b6040516012815260200161013c565b6101e76101e2366004610d5c565b6103ce565b005b600554610128906001600160a01b031681565b61018161020a366004610d73565b6001600160a01b03165f9081526020819052604090205490565b6101e7610232366004610d73565b6103db565b6101e7610245366004610cf4565b61045c565b61014d610475565b61016d610260366004610cf4565b610484565b61012873c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b610288610491565b604080516001600160a01b039485168152928416602084015292169181019190915260600161013c565b6101816102c0366004610d95565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6060600380546102f990610dcc565b80601f016020809104026020016040519081016040528092919081815260200182805461032590610dcc565b80156103705780601f1061034757610100808354040283529160200191610370565b820191905f5260205f20905b81548152906001019060200180831161035357829003601f168201915b5050505050905090565b5f336103878185856105a3565b60019150505b92915050565b5f336103a08582856105b5565b6103ab858585610631565b506001949350505050565b5f601e6007546103c69190610e18565b431115905090565b6103d8338261068e565b50565b6005546001600160a01b0316331461043a5760405162461bcd60e51b815260206004820181905260248201527f4f6e6c7920706c6174666f726d2063616e206368616e67652063726561746f7260448201526064015b60405180910390fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6104678233836105b5565b610471828261068e565b5050565b6060600480546102f990610dcc565b5f33610387818585610631565b5f5f5f5f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104e5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105099190610e2b565b604051630b4c774160e11b815230600482015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2602482015261271060448201529091505f906001600160a01b03831690631698ee8290606401602060405180830381865afa158015610572573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105969190610e2b565b9530955091935090915050565b6105b083838360016106c2565b505050565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f1981101561062b578181101561061d57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610431565b61062b84848484035f6106c2565b50505050565b6001600160a01b03831661065a57604051634b637e8f60e11b81525f6004820152602401610431565b6001600160a01b0382166106835760405163ec442f0560e01b81525f6004820152602401610431565b6105b0838383610794565b6001600160a01b0382166106b757604051634b637e8f60e11b81525f6004820152602401610431565b610471825f83610794565b6001600160a01b0384166106eb5760405163e602df0560e01b81525f6004820152602401610431565b6001600160a01b03831661071457604051634a1406b160e11b81525f6004820152602401610431565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561062b57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161078691815260200190565b60405180910390a350505050565b600754431180156107b35750601e6007546107af9190610e18565b4311155b15610aa6575f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610809573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061082d9190610e2b565b604051630b4c774160e11b815230600482015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2602482015261271060448201529091505f906001600160a01b03831690631698ee8290606401602060405180830381865afa158015610896573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108ba9190610e2b565b9050806001600160a01b0316856001600160a01b03161480156108eb57506005546001600160a01b03858116911614155b801561090557506006546001600160a01b03858116911614155b156109af57325f9081526009602052604081208054859290610928908490610e18565b909155505060085460649061093e90606e610e46565b6109489190610e5d565b325f9081526009602052604090205411156109af5760405162461bcd60e51b815260206004820152602160248201527f4b656570696e6720322520706f6f6c204c696d69747320496e204b6f6e74726f6044820152601b60fa1b6064820152608401610431565b6006546001600160a01b038581169116148015906109db57506005546001600160a01b03858116911614155b80156109f95750806001600160a01b0316846001600160a01b031614155b8015610a0d57506001600160a01b03851615155b15610aa35760085483610a34866001600160a01b03165f9081526020819052604090205490565b610a3e9190610e18565b1115610aa35760405162461bcd60e51b815260206004820152602e60248201527f4d61782077616c6c6574206c696d697420657863656564656420647572696e6760448201526d081b185d5b98da081c195c9a5bd960921b6064820152608401610431565b50505b60075443148015610abf57506001600160a01b03831615155b8015610ad957506005546001600160a01b03838116911614155b8015610af357506005546001600160a01b03848116911614155b8015610b2657506005546001600160a01b038481169116148015610b2457506006546001600160a01b038381169116145b155b15610b7f5760405162461bcd60e51b8152602060048201526024808201527f4e6f206275797320616c6c6f77656420647572696e67206c61756e636820626c6044820152636f636b2160e01b6064820152608401610431565b6105b08383836001600160a01b038316610baf578060025f828254610ba49190610e18565b90915550610c1f9050565b6001600160a01b0383165f9081526020819052604090205481811015610c015760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610431565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216610c3b57600280548290039055610c59565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610c9e91815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b03811681146103d8575f5ffd5b5f5f60408385031215610d05575f5ffd5b8235610d1081610ce0565b946020939093013593505050565b5f5f5f60608486031215610d30575f5ffd5b8335610d3b81610ce0565b92506020840135610d4b81610ce0565b929592945050506040919091013590565b5f60208284031215610d6c575f5ffd5b5035919050565b5f60208284031215610d83575f5ffd5b8135610d8e81610ce0565b9392505050565b5f5f60408385031215610da6575f5ffd5b8235610db181610ce0565b91506020830135610dc181610ce0565b809150509250929050565b600181811c90821680610de057607f821691505b602082108103610dfe57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561038d5761038d610e04565b5f60208284031215610e3b575f5ffd5b8151610d8e81610ce0565b808202811582820484141761038d5761038d610e04565b5f82610e7757634e487b7160e01b5f52601260045260245ffd5b50049056fea2646970667358221220e217e9bc5acca2c694a4a58f210daa106a19121ab519d89829772164a4db0b4b64736f6c634300081e0033a264697066735822122060afc71aa92b9b1d654a13efc4e4ff83ce9a9c295c1dec419d976fa62f104cc164736f6c634300081e0033

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_share.sol 640 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;
        address receiver;
        string receiver_handle;
        uint256 split;
        uint256 ethBalance;
        uint256 tokenBalance;
        uint256 totalFeesGenerated;
    }

    mapping(uint256 => TokenInfo) public deployedTokens;
    mapping(address => TokenInfo) public tokenInfoByAddress;
    uint256 public tokenCount = 0;
    address public platformController;
    bool public deployCoinEnabled = false;
    uint256 private penaltyMultiplier = 100; // 100% (100 = 100%, 50 = 50%, 200 = 200%)
    uint256 private itemsPerPage = 500; // Default items per page for pagination
    
    //  mapping to store token addresses by receiver
    mapping(address => address[]) public receiverTokens;
    
    // mapping to store token addresses by creator/deployer
    mapping(address => address[]) public creatorTokens;
    
    // Mapping to track total fees generated per token
    // tokenAddress => total fees generated
    mapping(address => uint256) public tokenFeesGenerated;
    
    // Mapping to store NFT ID for each token
    // tokenAddress => NFT tokenId
    mapping(address => uint256) public tokenToNFTId;

    address public constant POSITION_MANAGER = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88;
    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, address receiver, string memory receiver_handle, uint256 split) 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: address(this), // Factory receives tokens first
                    amountIn: amountAfterTax,
                    amountOutMinimum: 0,
                    sqrtPriceLimitX96: 0
                })
            );
            
            IERC20 token = IERC20(coin_address);
            uint256 tokensReceived = token.balanceOf(address(this));
            token.transfer(msg.sender, tokensReceived);

        }

        TokenInfo memory newTokenInfo = TokenInfo({
            tokenAddress: coin_address,
            name: _name,
            symbol: _symbol,
            deployer: msg.sender,
            time: block.timestamp,
            metadata: _metadata,
            marketCapInETH: 0,
            receiver: receiver,
            receiver_handle: receiver_handle,
            split: split,
            ethBalance: 0,
            tokenBalance: 0,
            totalFeesGenerated: 0
        });
        
        deployedTokens[tokenCount] = newTokenInfo;
        tokenInfoByAddress[coin_address] = newTokenInfo;

        // Add token to receiver's array
        receiverTokens[receiver].push(coin_address);
        
        // Add token to creator's array
        creatorTokens[msg.sender].push(coin_address);

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


    // Get all tokens for a receiver in one call
    function getAllTokensByReceiver(address _receiver) public view returns (address[] memory) {
        return receiverTokens[_receiver];
    }
    
    // Get all tokens for a creator in one call  
    function getAllTokensByCreator(address _creator) public view returns (address[] memory) {
        return creatorTokens[_creator];
    }

    function getDeploysByPage(uint256 page, uint256 order) public view returns (TokenInfo[] memory) {
        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;
                }
            }

            uint256 ethBalance = info.receiver.balance;

            uint256 tokenBalance = IERC20(info.tokenAddress).balanceOf(info.receiver);

            tokens[j++] = TokenInfo({
                tokenAddress: info.tokenAddress,
                name: info.name,
                symbol: info.symbol,
                deployer: info.deployer,
                time: info.time,
                metadata: info.metadata,
                marketCapInETH: marketCap,
                receiver: info.receiver,
                receiver_handle: info.receiver_handle,
                split: info.split,
                ethBalance: ethBalance,
                tokenBalance: tokenBalance,
                totalFeesGenerated: tokenFeesGenerated[info.tokenAddress]
            });
        }

        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;
    }
    
    // Change the number of items per page for pagination
    function setItemsPerPage(uint256 _itemsPerPage) external {
        require(msg.sender == platformController, "Only platform controller can change items per page");
        require(_itemsPerPage > 0 && _itemsPerPage <= 1000, "Items per page must be between 1 and 1000");
        itemsPerPage = _itemsPerPage;
    }


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

        (uint256 tokenId, , , ) = 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
            })
        );
        
        _storeNFTId(tokenA, tokenId);
    }



    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;

        // Get token info to access receiver and split data
        TokenInfo memory tokenInfo = tokenInfoByAddress[token0];
        address receiver = tokenInfo.receiver;
        uint256 split = tokenInfo.split;
        
        require(receiver != address(0), "Invalid receiver address");
        require(split <= 100, "Split must be between 0 and 100");

        if (collected0 > 0) {
            // Send all tokens to receiver instead of burning
            IERC20(token0).transfer(receiver, collected0);
            
        }
        
        if (collected1 > 0) {
            // Convert WETH to ETH
            IWETH(token1).withdraw(collected1);
            
            uint256 platformAmount = collected1 / 2;
            uint256 distributionAmount = collected1 - platformAmount;
            
            uint256 receiverAmount = (distributionAmount * split) / 100;
            uint256 creatorAmount = distributionAmount - receiverAmount;
            
            // Send ETH to receiver
            if (receiverAmount > 0) {
                _transferETH(receiver, receiverAmount);
                _trackTokenFees(token0, receiverAmount);
            }
            
            // Send ETH to creator
            if (creatorAmount > 0) {
                _transferETH(creator, creatorAmount);
            }
        }


        return (collected0, collected1);
    }

    function changeTokenFeeReceiver(address tokenAddress, address newCreator) external {
        require(msg.sender == platformController, "Only platform controller can change creator"); //Updating Fee Receiver
        require(newCreator != address(0), "New creator cannot be zero address");
        
        Token(tokenAddress).changeCreator(newCreator);
    }
    
    
    // Helper function to convert uint to string
    function _toString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }
    
    // Get total fees generated by a specific token
    function getTokenFeesGenerated(address tokenAddress) public view returns (uint256) {
        return tokenFeesGenerated[tokenAddress];
    }
    
    // Helper function to transfer ETH and handle failures
    function _transferETH(address recipient, uint256 amount) internal {
        (bool success, ) = payable(recipient).call{value: amount}("");
        require(success, "ETH transfer failed");
    }
    
    // Helper function to track fees generated by a token
    function _trackTokenFees(address token, uint256 amount) internal {
        tokenFeesGenerated[token] += amount;
    }
    
    // Helper function to store NFT ID for a token
    function _storeNFTId(address token, uint256 nftId) internal {
        tokenToNFTId[token] = nftId;
    }

}


// 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 launchBlock;
    uint256 private maxTxAmount;
    uint256 private constant LAUNCH_PERIOD = 30; // 5 blocks
    uint256 private constant MAX_WALLET_PERCENTAGE = 2; // 2% of total supply

    address public constant POSITION_MANAGER = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88;
    address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
    
    // Track transfers per tx.origin per block to detect multi-swaps  
    mapping(address => uint256) private tokensFromPoolPerOrigin;



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

    function _update(address from, address to, uint256 value) internal override {
        if (block.number > launchBlock && block.number <= launchBlock + LAUNCH_PERIOD) {
            // Get pool address for exemption
            address factory = INonfungiblePositionManager(POSITION_MANAGER).factory();
            address pool = IUniswapV3Factory(factory).getPool(address(this), WETH, 10000);
            
            if (from == pool && to != platform && to != creator) {
                tokensFromPoolPerOrigin[tx.origin] += value;
                require(
                    tokensFromPoolPerOrigin[tx.origin] <= maxTxAmount*110/100,
                    "Keeping 2% pool Limits In Kontrol"
                );
            }
            
            if (to != creator && to != platform && to != pool && from != address(0)) {
                require(
                    balanceOf(to) + value <= maxTxAmount,
                    "Max wallet limit exceeded during launch period"
                );
            }
        }
        
        // Block all buys at launch block except exempted transfers
        if (block.number == launchBlock && 
            from != address(0) && 
            to != platform && 
            from != platform &&
            !(from == platform && to == creator)) { // Only platform can send to creator
            revert("No buys allowed during launch block!");
        }
        
        super._update(from, to, value);
    }

    function getTokenPair() public view returns (address,address,address){
        address find_factory = INonfungiblePositionManager(POSITION_MANAGER).factory();
        address find_pool = IUniswapV3Factory(find_factory).getPool(address(this), WETH, 10000);
        return (find_pool,address(this),find_factory);
    }
    
    function isLaunchPeriodActive() public view returns (bool) {
        return block.number <= launchBlock + LAUNCH_PERIOD;
    }

    function changeCreator(address newCreator) external {
        require(msg.sender == platform, "Only platform can change creator"); //Updating Fee Receiver
        creator = newCreator;
    }
}

Read Contract

POSITION_MANAGER 0x1bea83fe → address
SWAP_ROUTER 0xc6005893 → address
WETH 0xad5c4648 → address
creatorTokens 0xdb3fa4cc → address
deployCoinEnabled 0x67587046 → bool
deployedTokens 0xec81aadb → address, string, string, address, uint256, string, uint256, address, string, uint256, uint256, uint256, uint256
getAllTokensByCreator 0x521078b5 → address[]
getAllTokensByReceiver 0x9bea0919 → address[]
getDeploysByPage 0xaced8d81 → tuple[]
getPenalty 0x96e59682 → uint256
getTokenBytecode 0x8d99aeb0 → bytes
getTokenFeesGenerated 0x5bdb9d6a → uint256
platformController 0x3bcc75f6 → address
receiverTokens 0xf861063c → address
tokenCount 0x9f181b5e → uint256
tokenFeesGenerated 0x2ef780d4 → uint256
tokenInfoByAddress 0x5442a67f → address, string, string, address, uint256, string, uint256, address, string, uint256, uint256, uint256, uint256
tokenToNFTId 0xbf107b52 → uint256

Write Contract 8 functions

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

changeTokenFeeReceiver 0x964a0495
address tokenAddress
address newCreator
collectFees 0xb17acdcd
uint256 tokenId
returns: uint256, uint256
deployCoin 0x8e0e6804
string _name
string _symbol
string _metadata
bytes32 salt
address receiver
string receiver_handle
uint256 split
setItemsPerPage 0x7ff4cffb
uint256 _itemsPerPage
setPenaltyMultiplier 0xfe6b9454
uint256 _multiplier
toggleDeployCoin 0xf7b64c83
No parameters
withdrawFeesETH 0x9f9baaaa
No parameters
withdrawFeesWETH 0x5a3afecf
No parameters

Recent Transactions

No transactions found for this address