Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x370635199596e0BC64B058120CE7161aDFbDA1B0
Balance 0 ETH
Nonce 100
Code Size 12199 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

12199 bytes
0x6080604052600436106100a8575f3560e01c8063ad5c464811610062578063ad5c46481461018e578063b17acdcd146101b5578063c6005893146101e9578063d3a81ab014610210578063ec81aadb1461022f578063ed5691ec14610261575f5ffd5b80631bea83fe146100b35780632505098e146100f75780633bcc75f61461010c578063476343ee1461012b5780639f181b5e1461013f578063aced8d8114610162575f5ffd5b366100af57005b5f5ffd5b3480156100be575f5ffd5b506100da73c36442b4a4522e871399cd717abdd847ab11fe8881565b6040516001600160a01b0390911681526020015b60405180910390f35b61010a610105366004611a5f565b610280565b005b348015610117575f5ffd5b506002546100da906001600160a01b031681565b348015610136575f5ffd5b5061010a61051c565b34801561014a575f5ffd5b5061015460015481565b6040519081526020016100ee565b34801561016d575f5ffd5b5061018161017c366004611aed565b610724565b6040516100ee9190611b3b565b348015610199575f5ffd5b506100da73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b3480156101c0575f5ffd5b506101d46101cf366004611c1b565b610f09565b604080519283526020830191909152016100ee565b3480156101f4575f5ffd5b506100da7368b3465833fb72a70ecdf485e0e4c7bd8665fc4581565b34801561021b575f5ffd5b506100da61022a366004611c1b565b6113f0565b34801561023a575f5ffd5b5061024e610249366004611c1b565b611477565b6040516100ee9796959493929190611c32565b34801561026c575f5ffd5b5061010a61027b366004611cbd565b61165b565b5f83833330604051610291906119b3565b61029e9493929190611cf4565b604051809103905ff0801580156102b7573d5f5f3e3d5ffd5b506040516001600160a01b03821681529091507f60122e78030aba0a2e4a67adb3e52b411343cc51778f919095d3fe394090c1b29060200160405180910390a1806103168173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc261165b565b3415610421576040805160e08101825273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281526001600160a01b0383811660208301908152612710838501908152336060850190815234608086018181525f60a0880181815260c0890191825298516304e45aaf60e01b8152975187166004890152945186166024880152925162ffffff16604487015290518416606486015290516084850152935160a4840152511660c48201527368b3465833fb72a70ecdf485e0e4c7bd8665fc45916304e45aaf9160e40160206040518083038185885af11580156103fa573d5f5f3e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061041f9190611d3d565b505b6040805160e0810182526001600160a01b038381168252602080830189815283850189905233606085015242608085015260a084018890525f60c085018190526001805482529281905294909420835181546001600160a01b0319169316929092178255925191929091908201906104999082611dd8565b50604082015160028201906104ae9082611dd8565b5060608201516003820180546001600160a01b0319166001600160a01b039092169190911790556080820151600482015560a082015160058201906104f39082611dd8565b5060c0919091015160069091015560018054905f61051083611ea7565b91905055505050505050565b6002546001600160a01b0316331461057b5760405162461bcd60e51b815260206004820152601860248201527f43616c6c6572206973206e6f7420636f6e74726f6c6c6572000000000000000060448201526064015b60405180910390fd5b6040516370a0823160e01b81523060048201525f9073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190602401602060405180830381865afa1580156105ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ee9190611d3d565b90505f81116106355760405162461bcd60e51b81526020600482015260136024820152724e6f205745544820746f20776974686472617760681b6044820152606401610572565b604051632e1a7d4d60e01b81526004810182905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d906024015f604051808303815f87803b15801561067f575f5ffd5b505af1158015610691573d5f5f3e3d5ffd5b50506040515f925033915083908381818185875af1925050503d805f81146106d4576040519150601f19603f3d011682016040523d82523d5f602084013e6106d9565b606091505b50509050806107205760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610572565b5050565b60015460609060329061076e5760405162461bcd60e51b8152602060048201526012602482015271139bc81d1bdad95b9cc819195c1b1bde595960721b6044820152606401610572565b5f816001836001546107809190611ebf565b61078a9190611ed2565b6107949190611ee5565b90508085106107d95760405162461bcd60e51b815260206004820152601160248201527050616765206f7574206f662072616e676560781b6044820152606401610572565b5f808086810361085a57846107ef896001611ebf565b6107f99190611f04565b60015411610807575f61082a565b84610813896001611ebf565b61081d9190611f04565b60015461082a9190611ed2565b92506108368589611f04565b6001546108439190611ed2565b91506001548211156108555760015491505b610882565b6108648589611f04565b92506108708584611ebf565b91506001548211156108825760015491505b5f61088d8484611ed2565b67ffffffffffffffff8111156108a5576108a56119c0565b60405190808252806020026020018201604052801561092457816020015b6109116040518060e001604052805f6001600160a01b0316815260200160608152602001606081526020015f6001600160a01b031681526020015f8152602001606081526020015f81525090565b8152602001906001900390816108c35790505b5090505f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610978573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099c9190611f2b565b90505f73c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109ef573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a139190611f2b565b9050855b85811015610ef7575f8b15610a2c5781610a4b565b610a368883611ed2565b610a41600189611ed2565b610a4b9190611ed2565b5f81815260208181526040808320815160e0810190925280546001600160a01b03168252600181018054959650939491939092840191610a8a90611d54565b80601f0160208091040260200160405190810160405280929190818152602001828054610ab690611d54565b8015610b015780601f10610ad857610100808354040283529160200191610b01565b820191905f5260205f20905b815481529060010190602001808311610ae457829003601f168201915b50505050508152602001600282018054610b1a90611d54565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4690611d54565b8015610b915780601f10610b6857610100808354040283529160200191610b91565b820191905f5260205f20905b815481529060010190602001808311610b7457829003601f168201915b505050918352505060038201546001600160a01b0316602082015260048201546040820152600582018054606090920191610bcb90611d54565b80601f0160208091040260200160405190810160405280929190818152602001828054610bf790611d54565b8015610c425780601f10610c1957610100808354040283529160200191610c42565b820191905f5260205f20905b815481529060010190602001808311610c2557829003601f168201915b5050509183525050600691909101546020909101528051604051630b4c774160e11b81526001600160a01b039182166004820152878216602482015261271060448201529192505f918291871690631698ee8290606401602060405180830381865afa158015610cb4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cd89190611f2b565b90506001600160a01b03811615610e61576040516370a0823160e01b81526001600160a01b0382811660048301525f91908916906370a0823190602401602060405180830381865afa158015610d30573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d549190611d3d565b84516040516370a0823160e01b81526001600160a01b0385811660048301529293505f92909116906370a0823190602401602060405180830381865afa158015610da0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610dc49190611d3d565b90505f855f01516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e06573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e2a9190611d3d565b90508115610e5d578181610e46856714d1120d7b160000611ebf565b610e509190611f04565b610e5a9190611ee5565b94505b5050505b6040518060e00160405280845f01516001600160a01b03168152602001846020015181526020018460400151815260200184606001516001600160a01b03168152602001846080015181526020018460a00151815260200183815250888a80610ec990611ea7565b9b5081518110610edb57610edb611f4d565b6020026020010181905250505050508080600101915050610a17565b50919750505050505050505b92915050565b5f5f5f610f15846113f0565b60405163133f757160e31b8152600481018690529091505f9073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab889060240161018060405180830381865afa158015610f69573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f8d9190611f9a565b50505050505050509350505050336001600160a01b0316826001600160a01b03166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fe0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110049190611f2b565b6001600160a01b03161461105a5760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f742063726561746f72206f6620746f6b656e30006044820152606401610572565b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa15801561109e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110c29190611d3d565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038416906370a0823190602401602060405180830381865afa158015611109573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061112d9190611d3d565b6040805160808101825289815230602082019081526001600160801b0382840181815260608401828152945163fc6f786560e01b81528451600482015292516001600160a01b0316602484015251811660448301529251909216606483015291925073c36442b4a4522e871399cd717abdd847ab11fe889063fc6f78659060840160408051808303815f875af11580156111c9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111ed919061206f565b50506040516370a0823160e01b81523060048201525f9084906001600160a01b038816906370a0823190602401602060405180830381865afa158015611235573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112599190611d3d565b6112639190611ed2565b6040516370a0823160e01b81523060048201529091505f9084906001600160a01b038816906370a0823190602401602060405180830381865afa1580156112ac573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112d09190611d3d565b6112da9190611ed2565b905081156113525760405163a9059cbb60e01b8152336004820152602481018390526001600160a01b0388169063a9059cbb906044016020604051808303815f875af115801561132c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113509190612091565b505b80156113e1576001600160a01b03861663a9059cbb33611373600285611ee5565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303815f875af11580156113bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113df9190612091565b505b90999098509650505050505050565b60405163133f757160e31b8152600481018290525f9073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab889060240161018060405180830381865afa158015611441573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114659190611f9a565b50979c9b505050505050505050505050565b5f60208190529081526040902080546001820180546001600160a01b0390921692916114a290611d54565b80601f01602080910402602001604051908101604052809291908181526020018280546114ce90611d54565b80156115195780601f106114f057610100808354040283529160200191611519565b820191905f5260205f20905b8154815290600101906020018083116114fc57829003601f168201915b50505050509080600201805461152e90611d54565b80601f016020809104026020016040519081016040528092919081815260200182805461155a90611d54565b80156115a55780601f1061157c576101008083540402835291602001916115a5565b820191905f5260205f20905b81548152906001019060200180831161158857829003601f168201915b505050506003830154600484015460058501805494956001600160a01b0390931694919350906115d490611d54565b80601f016020809104026020016040519081016040528092919081815260200182805461160090611d54565b801561164b5780601f106116225761010080835404028352916020019161164b565b820191905f5260205f20905b81548152906001019060200180831161162e57829003601f168201915b5050505050908060060154905087565b6001600160a01b03808216908316105f816116765782611678565b835b90505f826116865784611688565b835b60405163095ea7b360e01b815273c36442b4a4522e871399cd717abdd847ab11fe8860048201525f1960248201529091506001600160a01b0383169063095ea7b3906044016020604051808303815f875af11580156116e9573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061170d9190612091565b5060405163095ea7b360e01b815273c36442b4a4522e871399cd717abdd847ab11fe8860048201525f1960248201526001600160a01b0382169063095ea7b3906044016020604051808303815f875af115801561176c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117909190612091565b5073c36442b4a4522e871399cd717abdd847ab11fe885f846117c0576d64dbacb643e10eedf7378a0b5df76117cd565b6a0289c06ea6df5a36ae398a5b6dffffffffffffffffffffffffffff1690505f856117ef57620d899f196117f5565b620318f7195b90505f8661180657620318f861180b565b620d89a05b90505f87611819575f611827565b6b033b2e3c9fd0803ce80000005b6001600160601b031690505f8861184a576b033b2e3c9fd0803ce800000061184c565b5f5b6040516309f56ab160e11b81526001600160a01b038a811660048301528981166024830152612710604483015287811660648301526001600160601b03929092169250908716906313ead562906084016020604051808303815f875af11580156118b8573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118dc9190611f2b565b5060408051610160810182526001600160a01b038a81168252898116602083015261271082840152600287810b606084015286900b608083015260a0820185905260c082018490525f60e0830181905261010083015230610120830152426101408301529151634418b22b60e11b815291881691638831645691611962916004016120b0565b6080604051808303815f875af115801561197e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119a29190612174565b505050505050505050505050505050565b610dc4806121ae83390190565b634e487b7160e01b5f52604160045260245ffd5b5f82601f8301126119e3575f5ffd5b813567ffffffffffffffff8111156119fd576119fd6119c0565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715611a2c57611a2c6119c0565b604052818152838201602001851015611a43575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f5f60608486031215611a71575f5ffd5b833567ffffffffffffffff811115611a87575f5ffd5b611a93868287016119d4565b935050602084013567ffffffffffffffff811115611aaf575f5ffd5b611abb868287016119d4565b925050604084013567ffffffffffffffff811115611ad7575f5ffd5b611ae3868287016119d4565b9150509250925092565b5f5f60408385031215611afe575f5ffd5b50508035926020909101359150565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b82811015611c0f57868503603f19018452815180516001600160a01b0316865260208082015160e091880182905290611b9c90880182611b0d565b905060408201518782036040890152611bb58282611b0d565b91505060018060a01b0360608301511660608801526080820151608088015260a082015187820360a0890152611beb8282611b0d565b60c09384015198909301979097525094506020938401939190910190600101611b61565b50929695505050505050565b5f60208284031215611c2b575f5ffd5b5035919050565b6001600160a01b038816815260e0602082018190525f90611c5590830189611b0d565b8281036040840152611c678189611b0d565b6001600160a01b03881660608501526080840187905283810360a08501529050611c918186611b0d565b9150508260c083015298975050505050505050565b6001600160a01b0381168114611cba575f5ffd5b50565b5f5f60408385031215611cce575f5ffd5b8235611cd981611ca6565b91506020830135611ce981611ca6565b809150509250929050565b608081525f611d066080830187611b0d565b8281036020840152611d188187611b0d565b6001600160a01b03958616604085015293909416606090920191909152509392505050565b5f60208284031215611d4d575f5ffd5b5051919050565b600181811c90821680611d6857607f821691505b602082108103611d8657634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115611dd357805f5260205f20601f840160051c81016020851015611db15750805b601f840160051c820191505b81811015611dd0575f8155600101611dbd565b50505b505050565b815167ffffffffffffffff811115611df257611df26119c0565b611e0681611e008454611d54565b84611d8c565b6020601f821160018114611e38575f8315611e215750848201515b5f19600385901b1c1916600184901b178455611dd0565b5f84815260208120601f198516915b82811015611e675787850151825560209485019460019092019101611e47565b5084821015611e8457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b5f60018201611eb857611eb8611e93565b5060010190565b80820180821115610f0357610f03611e93565b81810381811115610f0357610f03611e93565b5f82611eff57634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610f0357610f03611e93565b8051611f2681611ca6565b919050565b5f60208284031215611f3b575f5ffd5b8151611f4681611ca6565b9392505050565b634e487b7160e01b5f52603260045260245ffd5b805162ffffff81168114611f26575f5ffd5b8051600281900b8114611f26575f5ffd5b80516001600160801b0381168114611f26575f5ffd5b5f5f5f5f5f5f5f5f5f5f5f5f6101808d8f031215611fb6575f5ffd5b8c516001600160601b0381168114611fcc575f5ffd5b9b50611fda60208e01611f1b565b9a50611fe860408e01611f1b565b9950611ff660608e01611f1b565b985061200460808e01611f61565b975061201260a08e01611f73565b965061202060c08e01611f73565b955061202e60e08e01611f84565b6101008e01516101208f01519196509450925061204e6101408e01611f84565b915061205d6101608e01611f84565b90509295989b509295989b509295989b565b5f5f60408385031215612080575f5ffd5b505080516020909101519092909150565b5f602082840312156120a1575f5ffd5b81518015158114611f46575f5ffd5b81516001600160a01b03168152610160810160208301516120dc60208401826001600160a01b03169052565b5060408301516120f3604084018262ffffff169052565b506060830151612108606084018260020b9052565b50608083015161211d608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008301516101008301526101208301516121646101208401826001600160a01b03169052565b5061014092830151919092015290565b5f5f5f5f60808587031215612187575f5ffd5b8451935061219760208601611f84565b604086015160609096015194979096509250505056fe608060405234801561000f575f5ffd5b50604051610dc4380380610dc483398101604081905261002e916102ca565b8383600361003c83826103d3565b50600461004982826103d3565b5050600580546001600160a01b038085166001600160a01b0319928316179092556006805492861692909116919091179055506100a681610088601290565b61009390600a610586565b6100a190633b9aca0061059b565b6100af565b505050506105c5565b6001600160a01b0382166100dd5760405163ec442f0560e01b81525f60048201526024015b60405180910390fd5b6100e85f83836100ec565b5050565b6001600160a01b038316610116578060025f82825461010b91906105b2565b909155506101869050565b6001600160a01b0383165f90815260208190526040902054818110156101685760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016100d4565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166101a2576002805482900390556101c0565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161020591815260200190565b60405180910390a3505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610235575f5ffd5b81516001600160401b0381111561024e5761024e610212565b604051601f8201601f19908116603f011681016001600160401b038111828210171561027c5761027c610212565b604052818152838201602001851015610293575f5ffd5b8160208501602083015e5f918101602001919091529392505050565b80516001600160a01b03811681146102c5575f5ffd5b919050565b5f5f5f5f608085870312156102dd575f5ffd5b84516001600160401b038111156102f2575f5ffd5b6102fe87828801610226565b602087015190955090506001600160401b0381111561031b575f5ffd5b61032787828801610226565b935050610336604086016102af565b9150610344606086016102af565b905092959194509250565b600181811c9082168061036357607f821691505b60208210810361038157634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156103ce57805f5260205f20601f840160051c810160208510156103ac5750805b601f840160051c820191505b818110156103cb575f81556001016103b8565b50505b505050565b81516001600160401b038111156103ec576103ec610212565b610400816103fa845461034f565b84610387565b6020601f821160018114610432575f831561041b5750848201515b5f19600385901b1c1916600184901b1784556103cb565b5f84815260208120601f198516915b828110156104615787850151825560209485019460019092019101610441565b508482101561047e57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156104dc578085048111156104c0576104c061048d565b60018416156104ce57908102905b60019390931c9280026104a5565b935093915050565b5f826104f257506001610580565b816104fe57505f610580565b8160018114610514576002811461051e5761053a565b6001915050610580565b60ff84111561052f5761052f61048d565b50506001821b610580565b5060208310610133831016604e8410600b841016171561055d575081810a610580565b6105695f1984846104a1565b805f190482111561057c5761057c61048d565b0290505b92915050565b5f61059460ff8416836104e4565b9392505050565b80820281158282048414176105805761058061048d565b808201808211156105805761058061048d565b6107f2806105d25f395ff3fe608060405234801561000f575f5ffd5b50600436106100cb575f3560e01c806342966c681161008857806379cc67901161006357806379cc6790146101bb57806395d89b41146101ce578063a9059cbb146101d6578063dd62ed3e146101e9575f5ffd5b806342966c681461016b5780634bde38c81461018057806370a0823114610193575f5ffd5b806302d05d3f146100cf57806306fdde03146100ff578063095ea7b31461011457806318160ddd1461013757806323b872dd14610149578063313ce5671461015c575b5f5ffd5b6006546100e2906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610107610221565b6040516100f6919061064b565b61012761012236600461069b565b6102b1565b60405190151581526020016100f6565b6002545b6040519081526020016100f6565b6101276101573660046106c3565b6102ca565b604051601281526020016100f6565b61017e6101793660046106fd565b6102ed565b005b6005546100e2906001600160a01b031681565b61013b6101a1366004610714565b6001600160a01b03165f9081526020819052604090205490565b61017e6101c936600461069b565b6102fa565b610107610313565b6101276101e436600461069b565b610322565b61013b6101f7366004610734565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b60606003805461023090610765565b80601f016020809104026020016040519081016040528092919081815260200182805461025c90610765565b80156102a75780601f1061027e576101008083540402835291602001916102a7565b820191905f5260205f20905b81548152906001019060200180831161028a57829003601f168201915b5050505050905090565b5f336102be81858561032f565b60019150505b92915050565b5f336102d7858285610341565b6102e28585856103c2565b506001949350505050565b6102f7338261041f565b50565b610305823383610341565b61030f828261041f565b5050565b60606004805461023090610765565b5f336102be8185856103c2565b61033c8383836001610453565b505050565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f198110156103bc57818110156103ae57604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b6103bc84848484035f610453565b50505050565b6001600160a01b0383166103eb57604051634b637e8f60e11b81525f60048201526024016103a5565b6001600160a01b0382166104145760405163ec442f0560e01b81525f60048201526024016103a5565b61033c838383610525565b6001600160a01b03821661044857604051634b637e8f60e11b81525f60048201526024016103a5565b61030f825f83610525565b6001600160a01b03841661047c5760405163e602df0560e01b81525f60048201526024016103a5565b6001600160a01b0383166104a557604051634a1406b160e11b81525f60048201526024016103a5565b6001600160a01b038085165f90815260016020908152604080832093871683529290522082905580156103bc57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161051791815260200190565b60405180910390a350505050565b6001600160a01b03831661054f578060025f828254610544919061079d565b909155506105bf9050565b6001600160a01b0383165f90815260208190526040902054818110156105a15760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016103a5565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b0382166105db576002805482900390556105f9565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161063e91815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b0381168114610696575f5ffd5b919050565b5f5f604083850312156106ac575f5ffd5b6106b583610680565b946020939093013593505050565b5f5f5f606084860312156106d5575f5ffd5b6106de84610680565b92506106ec60208501610680565b929592945050506040919091013590565b5f6020828403121561070d575f5ffd5b5035919050565b5f60208284031215610724575f5ffd5b61072d82610680565b9392505050565b5f5f60408385031215610745575f5ffd5b61074e83610680565b915061075c60208401610680565b90509250929050565b600181811c9082168061077957607f821691505b60208210810361079757634e487b7160e01b5f52602260045260245ffd5b50919050565b808201808211156102c457634e487b7160e01b5f52601160045260245ffdfea26469706673582212204409be27627348141f00c83ea11478a1ac932bc117bacc031102a0dd15bdbb8164736f6c634300081e0033a2646970667358221220bd7dff42ede6cd44b0842eb3a4cbfe66acce28233b535fbc475d63046e47c50164736f6c634300081e0033

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 359 lines
pragma solidity >=0.8.9;

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

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

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

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

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

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

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

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

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

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

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

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

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


contract Factory {
    event ERC20TokenCreated(address tokenAddress);

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

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

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

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

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

    constructor() {
        platformController = msg.sender;
    }

    receive() external payable {}

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

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

        if(msg.value>0){
            ISwapRouter02(SWAP_ROUTER).exactInputSingle{ value: msg.value }(
                ISwapRouter02.ExactInputSingleParams({
                    tokenIn: WETH,
                    tokenOut: coin_address,
                    fee: 10000,
                    recipient: msg.sender,
                    amountIn: msg.value,
                    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 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 withdrawFees() 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 uint2str(uint256 _i) internal pure returns (string memory) {
        if (_i == 0) return "0";
        uint256 j = _i;
        uint256 length;
        while (j != 0) {
            length++;
            j /= 10;
        }
        bytes memory bstr = new bytes(length);
        uint256 k = length;
        j = _i;
        while (j != 0) {
            bstr[--k] = bytes1(uint8(48 + j % 10));
            j /= 10;
        }
        return string(bstr);
    }

    function provideLiquidity(address tokenA, address tokenB) public {
        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) {
        address token0 = getToken0Address(tokenId);
        (, , , address token1, , , , , , , , ) =
            INonfungiblePositionManager(POSITION_MANAGER).positions(tokenId);

        require(IToken(token0).creator() == msg.sender, "Caller is not creator of token0");

        // Record balances before
        uint256 beforeToken0 = IERC20(token0).balanceOf(address(this));
        uint256 beforeToken1 = IERC20(token1).balanceOf(address(this));

        // Collect fees to contract itself
        INonfungiblePositionManager.CollectParams memory params = INonfungiblePositionManager.CollectParams({
            tokenId: tokenId,
            recipient: address(this),
            amount0Max: type(uint128).max,
            amount1Max: type(uint128).max
        });

        INonfungiblePositionManager(POSITION_MANAGER).collect(params);

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

        if (collected0 > 0) {
            IERC20(token0).transfer(msg.sender, collected0);
        }
        if (collected1 > 0) {
            IERC20(token1).transfer(msg.sender, collected1/2);
        }

        return (collected0, collected1);
    }


    function getToken0Address(uint256 tokenId) public view returns (address token0) {
        ( , , token0, , , , , , , , , ) =
            INonfungiblePositionManager(POSITION_MANAGER).positions(tokenId);
    }

}


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

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

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

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

Read Contract

POSITION_MANAGER 0x1bea83fe → address
SWAP_ROUTER 0xc6005893 → address
WETH 0xad5c4648 → address
deployedTokens 0xec81aadb → address, string, string, address, uint256, string, uint256
getDeploysByPage 0xaced8d81 → tuple[]
getToken0Address 0xd3a81ab0 → address
platformController 0x3bcc75f6 → address
tokenCount 0x9f181b5e → uint256

Write Contract 4 functions

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

collectFees 0xb17acdcd
uint256 tokenId
returns: uint256, uint256
deployCoin 0x2505098e
string _name
string _symbol
string _metadata
provideLiquidity 0xed5691ec
address tokenA
address tokenB
withdrawFees 0x476343ee
No parameters

Recent Transactions

No transactions found for this address