Forkchoice Ethereum Mainnet

Address Contract Verified

Address 0x3B57258C94Cc5535010f6b96Cac3C29552Bf3a3b
Balance 0 ETH
Nonce 1
Code Size 20868 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

20868 bytes
0x608060405260043610610212575f3560e01c8063787a08a611610117578063bd49497c1161009f578063d31d5fe91161006e578063d31d5fe9146107bb578063d38bcdee146107e3578063e84d26961461080b578063f2fde38b14610835578063fe51d76f1461085d57610267565b8063bd49497c14610703578063c0f6d9a71461072b578063c31ee12e14610753578063c9c105051461077d57610267565b806391f5b01b116100e657806391f5b01b146106395780639ab4a44514610661578063ad6c2c3f1461068b578063b511f73a146106b3578063b8906199146106db57610267565b8063787a08a6146105955780637b2eb35c146105bf5780637e673f7a146105e75780638da5cb5b1461060f57610267565b8063357291301161019a5780634fc3f41a116101695780634fc3f41a146104cb5780635d46fa18146104f3578063620396d01461052f578063637e09be14610557578063715018a61461057f57610267565b806335729130146104015780633aecd0e3146104295780633c84ef451461046557806340b7f9781461048d57610267565b806312065fe0116101e157806312065fe01461030f578063194840ce14610339578063200a9dff146103615780632f3c7bc114610389578063339d54af146103c557610267565b806302d454571461026b57806306292f2b1461029557806306e08856146102bf5780630cb46b75146102e757610267565b36610267573373ffffffffffffffffffffffffffffffffffffffff167f85177f287940f2f05425a4029951af0e047a7f9c4eaa9a6e6917bcd869f866953460405161025d91906137f7565b60405180910390a2005b5f5ffd5b348015610276575f5ffd5b5061027f610899565b60405161028c919061384f565b60405180910390f35b3480156102a0575f5ffd5b506102a96108be565b6040516102b691906137f7565b60405180910390f35b3480156102ca575f5ffd5b506102e560048036038101906102e091906138de565b610962565b005b3480156102f2575f5ffd5b5061030d60048036038101906103089190613946565b610ade565b005b34801561031a575f5ffd5b50610323610bda565b60405161033091906137f7565b60405180910390f35b348015610344575f5ffd5b5061035f600480360381019061035a91906139d2565b610be1565b005b34801561036c575f5ffd5b5061038760048036038101906103829190613a76565b610f2d565b005b348015610394575f5ffd5b506103af60048036038101906103aa9190613c0b565b610fae565b6040516103bc9190613cb2565b60405180910390f35b3480156103d0575f5ffd5b506103eb60048036038101906103e69190613cd2565b611061565b6040516103f89190613cb2565b60405180910390f35b34801561040c575f5ffd5b5061042760048036038101906104229190613d1d565b611112565b005b348015610434575f5ffd5b5061044f600480360381019061044a9190613946565b611365565b60405161045c91906137f7565b60405180910390f35b348015610470575f5ffd5b5061048b60048036038101906104869190613d5b565b6113ea565b005b348015610498575f5ffd5b506104b360048036038101906104ae9190613c0b565b611578565b6040516104c293929190613da0565b60405180910390f35b3480156104d6575f5ffd5b506104f160048036038101906104ec9190613d5b565b6119e1565b005b3480156104fe575f5ffd5b5061051960048036038101906105149190613cd2565b611a2a565b6040516105269190613deb565b60405180910390f35b34801561053a575f5ffd5b5061055560048036038101906105509190613e2e565b611a54565b005b348015610562575f5ffd5b5061057d600480360381019061057891906139d2565b611bd5565b005b34801561058a575f5ffd5b50610593611f21565b005b3480156105a0575f5ffd5b506105a9611f34565b6040516105b691906137f7565b60405180910390f35b3480156105ca575f5ffd5b506105e560048036038101906105e09190613efe565b611f3a565b005b3480156105f2575f5ffd5b5061060d60048036038101906106089190613d1d565b61225c565b005b34801561061a575f5ffd5b50610623612465565b604051610630919061384f565b60405180910390f35b348015610644575f5ffd5b5061065f600480360381019061065a9190613f82565b61248c565b005b34801561066c575f5ffd5b50610675612683565b604051610682919061384f565b60405180910390f35b348015610696575f5ffd5b506106b160048036038101906106ac9190613fd2565b6126a8565b005b3480156106be575f5ffd5b506106d960048036038101906106d4919061402f565b6127eb565b005b3480156106e6575f5ffd5b5061070160048036038101906106fc91906140a0565b612a92565b005b34801561070e575f5ffd5b5061072960048036038101906107249190614111565b612c50565b005b348015610736575f5ffd5b50610751600480360381019061074c9190613efe565b612d24565b005b34801561075e575f5ffd5b50610767612edf565b60405161077491906137f7565b60405180910390f35b348015610788575f5ffd5b506107a3600480360381019061079e9190613c0b565b612f83565b6040516107b29392919061418f565b60405180910390f35b3480156107c6575f5ffd5b506107e160048036038101906107dc919061402f565b612fec565b005b3480156107ee575f5ffd5b5061080960048036038101906108049190613946565b61312c565b005b348015610816575f5ffd5b5061081f613228565b60405161082c91906137f7565b60405180910390f35b348015610840575f5ffd5b5061085b60048036038101906108569190613946565b61322e565b005b348015610868575f5ffd5b50610883600480360381019061087e9190613c0b565b6132b2565b6040516108909190613deb565b60405180910390f35b60045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161091d919061384f565b602060405180830381865afa158015610938573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061095c91906141d8565b91505090565b61096a6132df565b60025460015461097a9190614230565b4210156109bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b3906142ad565b60405180910390fd5b804710156109ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f690614315565b60405180910390fd5b5f8111610a41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a389061437d565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015610a84573d5f5f3e3d5ffd5b50426001819055508173ffffffffffffffffffffffffffffffffffffffff167f16d2226c59f32f83baafbd6a9a39d48f4095e86cc06634025d9bb5c3a8657d1f82604051610ad291906137f7565b60405180910390a25050565b610ae66132df565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610b54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4b906143e5565b60405180910390fd5b8060035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fa9402888f69cf682794d26b87870625e0211a2b5b4935291e1fee35c4e1d026560405160405180910390a250565b5f47905090565b610be96132df565b600254600154610bf99190614230565b421015610c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c32906142ad565b60405180910390fd5b5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050838173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610c9a919061384f565b602060405180830381865afa158015610cb5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cd991906141d8565b1015610d1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d119061444d565b60405180910390fd5b5f60078484604051610d2d929190614499565b9081526020016040518091039020905060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de590614521565b60405180910390fd5b84816001015414610e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2b906145af565b60405180910390fd5b806002015f9054906101000a900460ff1615610e85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7c90614617565b60405180910390fd5b610eb086868473ffffffffffffffffffffffffffffffffffffffff166133669092919063ffffffff16565b6001816002015f6101000a81548160ff021916908315150217905550426001819055508573ffffffffffffffffffffffffffffffffffffffff167ff9ab401aabf82b32f6d9522c02ab115a9028c0dd1c4d5eebb66d72ac8e8656a9868686604051610f1d93929190614661565b60405180910390a2505050505050565b610f356132df565b8060058484604051610f48929190614499565b9081526020016040518091039020819055508282604051610f6a929190614499565b60405180910390207f0cfb7cdee31717af9f9d024254406dd59e55d0a60476e36976bfbd4abc32c6c482604051610fa19190613deb565b60405180910390a2505050565b6006818051602081018201805184825260208301602085012081835280955050505050505f915090508054610fe2906146be565b80601f016020809104026020016040519081016040528092919081815260200182805461100e906146be565b80156110595780601f1061103057610100808354040283529160200191611059565b820191905f5260205f20905b81548152906001019060200180831161103c57829003601f168201915b505050505081565b606060068383604051611075929190614499565b9081526020016040518091039020805461108e906146be565b80601f01602080910402602001604051908101604052809291908181526020018280546110ba906146be565b80156111055780601f106110dc57610100808354040283529160200191611105565b820191905f5260205f20905b8154815290600101906020018083116110e857829003601f168201915b5050505050905092915050565b5f8111611154576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114b9061437d565b60405180910390fd5b5f829050818173ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401611192919061384f565b602060405180830381865afa1580156111ad573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111d191906141d8565b1015611212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120990614738565b60405180910390fd5b818173ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b815260040161124e929190614756565b602060405180830381865afa158015611269573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061128d91906141d8565b10156112ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c5906147c7565b60405180910390fd5b6112fb3330848473ffffffffffffffffffffffffffffffffffffffff166133e5909392919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f0af1239547617509a79d1ff0ee4be9ca943bc8410cb0b282dda97d27995a0acd8460405161135891906137f7565b60405180910390a3505050565b5f5f8290508073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016113a3919061384f565b602060405180830381865afa1580156113be573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113e291906141d8565b915050919050565b6113f26132df565b6002546001546114029190614230565b421015611444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143b906142ad565b60405180910390fd5b5f4790508181101561148b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148290614315565b60405180910390fd5b5f82116114cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c49061437d565b60405180910390fd5b6114d5612465565b73ffffffffffffffffffffffffffffffffffffffff166108fc8390811502906040515f60405180830381858888f19350505050158015611517573d5f5f3e3d5ffd5b5042600181905550611527612465565b73ffffffffffffffffffffffffffffffffffffffff167f87283d5d9cc55da87d93677f62213e64cd3f79aecf0ab4569fbca7b4bbbb35e68360405161156c9190614808565b60405180910390a25050565b5f60605f5f60078560405161158d9190614864565b90815260200160405180910390206040518060600160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015f9054906101000a900460ff161515151581525050905060605f73ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff1614806116ae575060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff16145b80611708575060045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff16145b8061171657505f8260200151145b15611910575f73ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff16036117d4575f670de0b6b3a7640000836020015161176a91906148a7565b90505f662386f26fc10000670de0b6b3a7640000856020015161178d91906148d7565b61179791906148a7565b90506117a282613467565b6117ab82613467565b6040516020016117bc929190614951565b6040516020818303038152906040529250505061190b565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff161480611881575060045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff16145b156118fa575f620f4240836020015161189a91906148a7565b90505f612710620f424085602001516118b391906148d7565b6118bd91906148a7565b90506118c882613467565b6118d182613467565b6040516020016118e2929190614951565b6040516020818303038152906040529250505061190a565b6119078260200151613467565b90505b5b6119c8565b5f61191d835f01516135c0565b905060028160ff161161193e576119378360200151613467565b91506119c6565b5f8160ff16600a61194f9190614aae565b90505f81856020015161196291906148a7565b90505f60648361197291906148a7565b83876020015161198291906148d7565b61198c91906148a7565b905061199782613467565b6119a082613467565b6040516020016119b1929190614951565b60405160208183030381529060405294505050505b505b815f015181836040015194509450945050509193909250565b6119e96132df565b806002819055507f583d8b24c5439ab7d810e51e37e8db41ba66f1168fd7b752ceae0c7681c5272c81604051611a1f91906137f7565b60405180910390a150565b5f60058383604051611a3d929190614499565b908152602001604051809103902054905092915050565b611a5c6132df565b60405180606001604052808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020015f151581525060078a8a604051611aa1929190614499565b90815260200160405180910390205f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002015f6101000a81548160ff0219169083151502179055509050508888604051611b2f929190614499565b60405180910390207f35381e30077877bbad0302abfded2bc652cd327b785f0c3dc21ff72554350d0d8888888888604051611b6e959493929190614af8565b60405180910390a28888604051611b86929190614499565b60405180910390207f3be5748c07706ecb95afda6b98e9bb0386178156e8277fbbdd1f6fe014335ac883836001604051611bc29392919061418f565b60405180910390a2505050505050505050565b611bdd6132df565b600254600154611bed9190614230565b421015611c2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c26906142ad565b60405180910390fd5b5f60045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050838173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611c8e919061384f565b602060405180830381865afa158015611ca9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ccd91906141d8565b1015611d0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0590614b93565b60405180910390fd5b5f60078484604051611d21929190614499565b9081526020016040518091039020905060045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd990614521565b60405180910390fd5b84816001015414611e28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1f906145af565b60405180910390fd5b806002015f9054906101000a900460ff1615611e79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7090614617565b60405180910390fd5b611ea486868473ffffffffffffffffffffffffffffffffffffffff166133669092919063ffffffff16565b6001816002015f6101000a81548160ff021916908315150217905550426001819055508573ffffffffffffffffffffffffffffffffffffffff167fdef249c7769c428fe57314cdf1452ca093a5cc7f6ffa565b78f058badea4ae25868686604051611f1193929190614661565b60405180910390a2505050505050565b611f296132df565b611f325f61367c565b565b60025481565b611f426132df565b600254600154611f529190614230565b421015611f94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f8b906142ad565b60405180910390fd5b5f859050838173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611fd2919061384f565b602060405180830381865afa158015611fed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061201191906141d8565b1015612052576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204990614738565b60405180910390fd5b5f60078484604051612065929190614499565b908152602001604051809103902090508673ffffffffffffffffffffffffffffffffffffffff16815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612105576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120fc90614521565b60405180910390fd5b8481600101541461214b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612142906145af565b60405180910390fd5b806002015f9054906101000a900460ff161561219c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161219390614617565b60405180910390fd5b6121c786868473ffffffffffffffffffffffffffffffffffffffff166133669092919063ffffffff16565b6001816002015f6101000a81548160ff021916908315150217905550426001819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f19f6abba490ace21aadb469d01ecea7ffa4acfac88ac35a6ae8dee5fe6f3e93887878760405161224b93929190614661565b60405180910390a350505050505050565b6122646132df565b6002546001546122749190614230565b4210156122b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ad906142ad565b60405180910390fd5b5f8290505f8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016122f4919061384f565b602060405180830381865afa15801561230f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061233391906141d8565b905082811015612378576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236f90614738565b60405180910390fd5b5f83116123ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123b19061437d565b60405180910390fd5b6123ec6123c5612465565b848473ffffffffffffffffffffffffffffffffffffffff166133669092919063ffffffff16565b426001819055506123fb612465565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f3e23f1045423568fa2317a6e811e433f0757425d92b04811231dfb1fc6d8b475856040516124579190614808565b60405180910390a350505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6124946132df565b6002546001546124a49190614230565b4210156124e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124dd906142ad565b60405180910390fd5b5f839050818173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612524919061384f565b602060405180830381865afa15801561253f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061256391906141d8565b10156125a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161259b90614738565b60405180910390fd5b5f82116125e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125dd9061437d565b60405180910390fd5b61261183838373ffffffffffffffffffffffffffffffffffffffff166133669092919063ffffffff16565b426001819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167ff0b1cd7f43b98811d282b14b10beacc7d71d44bcb55b99b26e6bf4df3551e8b58460405161267591906137f7565b60405180910390a350505050565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6126b06132df565b6002546001546126c09190614230565b421015612702576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126f9906142ad565b60405180910390fd5b5f4790505f8111612748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273f90614bfb565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f1935050505015801561278b573d5f5f3e3d5ffd5b50426001819055508373ffffffffffffffffffffffffffffffffffffffff167f45491102c2d23ca196ff5c1e33e539e22ae5f1e70d798e0591dd657aaa4597058285856040516127dd93929190614661565b60405180910390a250505050565b6127f36132df565b6002546001546128039190614230565b421015612845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283c906142ad565b60405180910390fd5b82471015612888576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161287f90614315565b60405180910390fd5b5f6007838360405161289b929190614499565b908152602001604051809103902090505f73ffffffffffffffffffffffffffffffffffffffff16815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461293b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293290614521565b60405180910390fd5b83816001015414612981576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612978906145af565b60405180910390fd5b806002015f9054906101000a900460ff16156129d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129c990614617565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff166108fc8590811502906040515f60405180830381858888f19350505050158015612a15573d5f5f3e3d5ffd5b506001816002015f6101000a81548160ff021916908315150217905550426001819055508473ffffffffffffffffffffffffffffffffffffffff167facf19dd73fb636c45444af86fa755207a6956a607806d6c202b361a07ee66530858585604051612a8393929190614661565b60405180910390a25050505050565b612a9a6132df565b600254600154612aaa9190614230565b421015612aec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ae3906142ad565b60405180910390fd5b5f8490505f8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612b2a919061384f565b602060405180830381865afa158015612b45573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b6991906141d8565b90505f8111612bad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ba490614c63565b60405180910390fd5b612bd885828473ffffffffffffffffffffffffffffffffffffffff166133669092919063ffffffff16565b426001819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f750739aa6eef195bcb132a1433a4442885fc06429fb9042e4fff819b26d1d561838787604051612c4093929190614661565b60405180910390a3505050505050565b612c586132df565b5f8282905011612c9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c9490614ccb565b60405180910390fd5b818160068686604051612cb1929190614499565b90815260200160405180910390209182612ccc929190614e93565b508383604051612cdd929190614499565b60405180910390207fe3cf4472153d98cce868092ae77d0956d0743abef483f46fd44d90764df9481d8383604051612d16929190614f60565b60405180910390a250505050565b612d2c6132df565b600254600154612d3c9190614230565b421015612d7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d75906142ad565b60405180910390fd5b5f859050838173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612dbc919061384f565b602060405180830381865afa158015612dd7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612dfb91906141d8565b1015612e3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e3390614738565b60405180910390fd5b612e6785858373ffffffffffffffffffffffffffffffffffffffff166133669092919063ffffffff16565b426001819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f3e23f1045423568fa2317a6e811e433f0757425d92b04811231dfb1fc6d8b475868686604051612ecf93929190614661565b60405180910390a3505050505050565b5f5f60045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612f3e919061384f565b602060405180830381865afa158015612f59573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f7d91906141d8565b91505090565b6007818051602081018201805184825260208301602085012081835280955050505050505f91509050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002015f9054906101000a900460ff16905083565b612ff46132df565b6002546001546130049190614230565b421015613046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161303d906142ad565b60405180910390fd5b82471015613089576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161308090614315565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff166108fc8490811502906040515f60405180830381858888f193505050501580156130cc573d5f5f3e3d5ffd5b50426001819055508373ffffffffffffffffffffffffffffffffffffffff167f87283d5d9cc55da87d93677f62213e64cd3f79aecf0ab4569fbca7b4bbbb35e684848460405161311e93929190614661565b60405180910390a250505050565b6131346132df565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036131a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161319990614fcc565b60405180910390fd5b8060045f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f452d65e59c35db88e7a1f5b3da4583c2cff8c834228e93830035dfd9e36d137b60405160405180910390a250565b60015481565b6132366132df565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036132a6575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161329d919061384f565b60405180910390fd5b6132af8161367c565b50565b6005818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b6132e761373d565b73ffffffffffffffffffffffffffffffffffffffff16613305612465565b73ffffffffffffffffffffffffffffffffffffffff16146133645761332861373d565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161335b919061384f565b60405180910390fd5b565b6133e0838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401613399929190614fea565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613744565b505050565b613461848573ffffffffffffffffffffffffffffffffffffffff166323b872dd86868660405160240161341a93929190615011565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613744565b50505050565b60605f82036134ad576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506135bb565b5f8290505f5b5f82146134dc5780806134c590615046565b915050600a826134d591906148a7565b91506134b3565b5f8167ffffffffffffffff8111156134f7576134f6613ae7565b5b6040519080825280601f01601f1916602001820160405280156135295781602001600182028036833780820191505090505b5090505b5f85146135b457600182613541919061508d565b9150600a8561355091906148d7565b603061355c9190614230565b60f81b818381518110613572576135716150c0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a905350600a856135ad91906148a7565b945061352d565b8093505050505b919050565b5f5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036135fd5760129050613677565b8173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561366557506040513d601f19601f820116820180604052508101906136629190615123565b60015b6136725760129050613677565b809150505b919050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f5f60205f8451602086015f885af180613763576040513d5f823e3d81fd5b3d92505f519150505f821461377c576001811415613797565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b156137d957836040517f5274afe70000000000000000000000000000000000000000000000000000000081526004016137d0919061384f565b60405180910390fd5b50505050565b5f819050919050565b6137f1816137df565b82525050565b5f60208201905061380a5f8301846137e8565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61383982613810565b9050919050565b6138498161382f565b82525050565b5f6020820190506138625f830184613840565b92915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f61388382613810565b9050919050565b61389381613879565b811461389d575f5ffd5b50565b5f813590506138ae8161388a565b92915050565b6138bd816137df565b81146138c7575f5ffd5b50565b5f813590506138d8816138b4565b92915050565b5f5f604083850312156138f4576138f3613871565b5b5f613901858286016138a0565b9250506020613912858286016138ca565b9150509250929050565b6139258161382f565b811461392f575f5ffd5b50565b5f813590506139408161391c565b92915050565b5f6020828403121561395b5761395a613871565b5b5f61396884828501613932565b91505092915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261399257613991613971565b5b8235905067ffffffffffffffff8111156139af576139ae613975565b5b6020830191508360018202830111156139cb576139ca613979565b5b9250929050565b5f5f5f5f606085870312156139ea576139e9613871565b5b5f6139f787828801613932565b9450506020613a08878288016138ca565b935050604085013567ffffffffffffffff811115613a2957613a28613875565b5b613a358782880161397d565b925092505092959194509250565b5f819050919050565b613a5581613a43565b8114613a5f575f5ffd5b50565b5f81359050613a7081613a4c565b92915050565b5f5f5f60408486031215613a8d57613a8c613871565b5b5f84013567ffffffffffffffff811115613aaa57613aa9613875565b5b613ab68682870161397d565b93509350506020613ac986828701613a62565b9150509250925092565b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b613b1d82613ad7565b810181811067ffffffffffffffff82111715613b3c57613b3b613ae7565b5b80604052505050565b5f613b4e613868565b9050613b5a8282613b14565b919050565b5f67ffffffffffffffff821115613b7957613b78613ae7565b5b613b8282613ad7565b9050602081019050919050565b828183375f83830152505050565b5f613baf613baa84613b5f565b613b45565b905082815260208101848484011115613bcb57613bca613ad3565b5b613bd6848285613b8f565b509392505050565b5f82601f830112613bf257613bf1613971565b5b8135613c02848260208601613b9d565b91505092915050565b5f60208284031215613c2057613c1f613871565b5b5f82013567ffffffffffffffff811115613c3d57613c3c613875565b5b613c4984828501613bde565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f613c8482613c52565b613c8e8185613c5c565b9350613c9e818560208601613c6c565b613ca781613ad7565b840191505092915050565b5f6020820190508181035f830152613cca8184613c7a565b905092915050565b5f5f60208385031215613ce857613ce7613871565b5b5f83013567ffffffffffffffff811115613d0557613d04613875565b5b613d118582860161397d565b92509250509250929050565b5f5f60408385031215613d3357613d32613871565b5b5f613d4085828601613932565b9250506020613d51858286016138ca565b9150509250929050565b5f60208284031215613d7057613d6f613871565b5b5f613d7d848285016138ca565b91505092915050565b5f8115159050919050565b613d9a81613d86565b82525050565b5f606082019050613db35f830186613840565b8181036020830152613dc58185613c7a565b9050613dd46040830184613d91565b949350505050565b613de581613a43565b82525050565b5f602082019050613dfe5f830184613ddc565b92915050565b613e0d81613d86565b8114613e17575f5ffd5b50565b5f81359050613e2881613e04565b92915050565b5f5f5f5f5f5f5f5f5f6101008a8c031215613e4c57613e4b613871565b5b5f8a013567ffffffffffffffff811115613e6957613e68613875565b5b613e758c828d0161397d565b99509950506020613e888c828d016138ca565b9750506040613e998c828d01613e1a565b9650506060613eaa8c828d01613e1a565b9550506080613ebb8c828d01613e1a565b94505060a0613ecc8c828d01613e1a565b93505060c0613edd8c828d01613932565b92505060e0613eee8c828d016138ca565b9150509295985092959850929598565b5f5f5f5f5f60808688031215613f1757613f16613871565b5b5f613f2488828901613932565b9550506020613f3588828901613932565b9450506040613f46888289016138ca565b935050606086013567ffffffffffffffff811115613f6757613f66613875565b5b613f738882890161397d565b92509250509295509295909350565b5f5f5f60608486031215613f9957613f98613871565b5b5f613fa686828701613932565b9350506020613fb786828701613932565b9250506040613fc8868287016138ca565b9150509250925092565b5f5f5f60408486031215613fe957613fe8613871565b5b5f613ff6868287016138a0565b935050602084013567ffffffffffffffff81111561401757614016613875565b5b6140238682870161397d565b92509250509250925092565b5f5f5f5f6060858703121561404757614046613871565b5b5f614054878288016138a0565b9450506020614065878288016138ca565b935050604085013567ffffffffffffffff81111561408657614085613875565b5b6140928782880161397d565b925092505092959194509250565b5f5f5f5f606085870312156140b8576140b7613871565b5b5f6140c587828801613932565b94505060206140d687828801613932565b935050604085013567ffffffffffffffff8111156140f7576140f6613875565b5b6141038782880161397d565b925092505092959194509250565b5f5f5f5f6040858703121561412957614128613871565b5b5f85013567ffffffffffffffff81111561414657614145613875565b5b6141528782880161397d565b9450945050602085013567ffffffffffffffff81111561417557614174613875565b5b6141818782880161397d565b925092505092959194509250565b5f6060820190506141a25f830186613840565b6141af60208301856137e8565b6141bc6040830184613d91565b949350505050565b5f815190506141d2816138b4565b92915050565b5f602082840312156141ed576141ec613871565b5b5f6141fa848285016141c4565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61423a826137df565b9150614245836137df565b925082820190508082111561425d5761425c614203565b5b92915050565b7f436f6f6c646f776e20706572696f6420616374697665000000000000000000005f82015250565b5f614297601683613c5c565b91506142a282614263565b602082019050919050565b5f6020820190508181035f8301526142c48161428b565b9050919050565b7f496e73756666696369656e74204554482062616c616e636500000000000000005f82015250565b5f6142ff601883613c5c565b915061430a826142cb565b602082019050919050565b5f6020820190508181035f83015261432c816142f3565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e207a65726f5f82015250565b5f614367602083613c5c565b915061437282614333565b602082019050919050565b5f6020820190508181035f8301526143948161435b565b9050919050565b7f496e76616c6964205553445420616464726573730000000000000000000000005f82015250565b5f6143cf601483613c5c565b91506143da8261439b565b602082019050919050565b5f6020820190508181035f8301526143fc816143c3565b9050919050565b7f496e73756666696369656e7420555344542062616c616e6365000000000000005f82015250565b5f614437601983613c5c565b915061444282614403565b602082019050919050565b5f6020820190508181035f8301526144648161442b565b9050919050565b5f81905092915050565b5f614480838561446b565b935061448d838584613b8f565b82840190509392505050565b5f6144a5828486614475565b91508190509392505050565b7f50656e64696e67207472616e73616374696f6e206173736574206d69736d61745f8201527f6368000000000000000000000000000000000000000000000000000000000000602082015250565b5f61450b602283613c5c565b9150614516826144b1565b604082019050919050565b5f6020820190508181035f830152614538816144ff565b9050919050565b7f50656e64696e67207472616e73616374696f6e20616d6f756e74206d69736d615f8201527f7463680000000000000000000000000000000000000000000000000000000000602082015250565b5f614599602383613c5c565b91506145a48261453f565b604082019050919050565b5f6020820190508181035f8301526145c68161458d565b9050919050565b7f5472616e73616374696f6e20616c7265616479206578656375746564000000005f82015250565b5f614601601c83613c5c565b915061460c826145cd565b602082019050919050565b5f6020820190508181035f83015261462e816145f5565b9050919050565b5f6146408385613c5c565b935061464d838584613b8f565b61465683613ad7565b840190509392505050565b5f6040820190506146745f8301866137e8565b8181036020830152614687818486614635565b9050949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806146d557607f821691505b6020821081036146e8576146e7614691565b5b50919050565b7f496e73756666696369656e7420746f6b656e2062616c616e63650000000000005f82015250565b5f614722601a83613c5c565b915061472d826146ee565b602082019050919050565b5f6020820190508181035f83015261474f81614716565b9050919050565b5f6040820190506147695f830185613840565b6147766020830184613840565b9392505050565b7f496e73756666696369656e7420616c6c6f77616e6365000000000000000000005f82015250565b5f6147b1601683613c5c565b91506147bc8261477d565b602082019050919050565b5f6020820190508181035f8301526147de816147a5565b9050919050565b50565b5f6147f35f83613c5c565b91506147fe826147e5565b5f82019050919050565b5f60408201905061481b5f8301846137e8565b818103602083015261482c816147e8565b905092915050565b5f61483e82613c52565b614848818561446b565b9350614858818560208601613c6c565b80840191505092915050565b5f61486f8284614834565b915081905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6148b1826137df565b91506148bc836137df565b9250826148cc576148cb61487a565b5b828204905092915050565b5f6148e1826137df565b91506148ec836137df565b9250826148fc576148fb61487a565b5b828206905092915050565b7f2e000000000000000000000000000000000000000000000000000000000000005f82015250565b5f61493b60018361446b565b915061494682614907565b600182019050919050565b5f61495c8285614834565b91506149678261492f565b91506149738284614834565b91508190509392505050565b5f8160011c9050919050565b5f5f8291508390505b60018511156149d4578086048111156149b0576149af614203565b5b60018516156149bf5780820291505b80810290506149cd8561497f565b9450614994565b94509492505050565b5f826149ec5760019050614aa7565b816149f9575f9050614aa7565b8160018114614a0f5760028114614a1957614a48565b6001915050614aa7565b60ff841115614a2b57614a2a614203565b5b8360020a915084821115614a4257614a41614203565b5b50614aa7565b5060208310610133831016604e8410600b8410161715614a7d5782820a905083811115614a7857614a77614203565b5b614aa7565b614a8a848484600161498b565b92509050818404811115614aa157614aa0614203565b5b81810290505b9392505050565b5f614ab8826137df565b9150614ac3836137df565b9250614af07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846149dd565b905092915050565b5f60a082019050614b0b5f8301886137e8565b614b186020830187613d91565b614b256040830186613d91565b614b326060830185613d91565b614b3f6080830184613d91565b9695505050505050565b7f496e73756666696369656e7420555344432062616c616e6365000000000000005f82015250565b5f614b7d601983613c5c565b9150614b8882614b49565b602082019050919050565b5f6020820190508181035f830152614baa81614b71565b9050919050565b7f4e6f204554482062616c616e636520746f2077697468647261770000000000005f82015250565b5f614be5601a83613c5c565b9150614bf082614bb1565b602082019050919050565b5f6020820190508181035f830152614c1281614bd9565b9050919050565b7f4e6f20746f6b656e2062616c616e636520746f207769746864726177000000005f82015250565b5f614c4d601c83613c5c565b9150614c5882614c19565b602082019050919050565b5f6020820190508181035f830152614c7a81614c41565b9050919050565b7f496e76616c6964204950465320434944000000000000000000000000000000005f82015250565b5f614cb5601083613c5c565b9150614cc082614c81565b602082019050919050565b5f6020820190508181035f830152614ce281614ca9565b9050919050565b5f82905092915050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302614d4f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614d14565b614d598683614d14565b95508019841693508086168417925050509392505050565b5f819050919050565b5f614d94614d8f614d8a846137df565b614d71565b6137df565b9050919050565b5f819050919050565b614dad83614d7a565b614dc1614db982614d9b565b848454614d20565b825550505050565b5f5f905090565b614dd8614dc9565b614de3818484614da4565b505050565b5b81811015614e0657614dfb5f82614dd0565b600181019050614de9565b5050565b601f821115614e4b57614e1c81614cf3565b614e2584614d05565b81016020851015614e34578190505b614e48614e4085614d05565b830182614de8565b50505b505050565b5f82821c905092915050565b5f614e6b5f1984600802614e50565b1980831691505092915050565b5f614e838383614e5c565b9150826002028217905092915050565b614e9d8383614ce9565b67ffffffffffffffff811115614eb657614eb5613ae7565b5b614ec082546146be565b614ecb828285614e0a565b5f601f831160018114614ef8575f8415614ee6578287013590505b614ef08582614e78565b865550614f57565b601f198416614f0686614cf3565b5f5b82811015614f2d57848901358255600182019150602085019450602081019050614f08565b86831015614f4a5784890135614f46601f891682614e5c565b8355505b6001600288020188555050505b50505050505050565b5f6020820190508181035f830152614f79818486614635565b90509392505050565b7f496e76616c6964205553444320616464726573730000000000000000000000005f82015250565b5f614fb6601483613c5c565b9150614fc182614f82565b602082019050919050565b5f6020820190508181035f830152614fe381614faa565b9050919050565b5f604082019050614ffd5f830185613840565b61500a60208301846137e8565b9392505050565b5f6060820190506150245f830186613840565b6150316020830185613840565b61503e60408301846137e8565b949350505050565b5f615050826137df565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361508257615081614203565b5b600182019050919050565b5f615097826137df565b91506150a2836137df565b92508282039050818111156150ba576150b9614203565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60ff82169050919050565b615102816150ed565b811461510c575f5ffd5b50565b5f8151905061511d816150f9565b92915050565b5f6020828403121561513857615137613871565b5b5f6151458482850161510f565b9150509291505056fea264697066735822122085c77728e133777a35b2e75f56605c1169142401b73e209cf3255663a58df4df64736f6c634300081e0033

Verified Source Code Full Match

Compiler: v0.8.30+commit.73712a01 EVM: prague Optimization: No
E-ZETTA_FundManager.sol 378 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

// Extended IERC20 interface to include decimals()
interface IERC20Extended is IERC20 {
    function decimals() external view returns (uint8);
}

contract FundManager is Ownable {
    uint256 public lastTransfer;
    uint256 public cooldown = 5 minutes; // Initial 5-minute cooldown
    address public usdtAddress; // USDT contract address, set via constructor
    address public usdcAddress; // USDC contract address, set via constructor
    mapping(string => bytes32) public transactionHashes;
    mapping(string => string) public ipfsCids; // Mapping to store IPFS CIDs for transactions

    // Structure to hold pending transaction details
    struct PendingTransaction {
        address asset; // address(0) for ETH, token address for ERC-20
        uint256 amount;
        bool executed;
    }
    mapping(string => PendingTransaction) public pendingTransactions;

    event TransactionStored(string indexed trn, uint256 eurAmount, bool isDelivered, bool isReceived, bool isAuthenticated, bool isTransactionCheckSuccessful);
    event TransactionHashStored(string indexed trn, bytes32 txHash);
    event PendingTransactionStored(string indexed trn, address asset, uint256 amount, bool isPending);
    event EthTransferred(address indexed to, uint256 amount, string trn);
    event TokenTransferred(address indexed token, address indexed to, uint256 amount, string trn);
    event UsdtTransferred(address indexed to, uint256 amount, string trn);
    event UsdcTransferred(address indexed to, uint256 amount, string trn);
    event AllEthWithdrawn(address indexed to, uint256 amount, string trn);
    event AllTokenWithdrawn(address indexed token, address indexed to, uint256 amount, string trn);
    event EthPartialWithdrawn(address indexed to, uint256 amount, string trn);
    event TokenPartialWithdrawn(address indexed token, address indexed to, uint256 amount, string trn);
    event TokensReceived(address indexed token, address indexed from, uint256 amount);
    event EthReceived(address indexed from, uint256 amount);
    event UntrackedEthWithdrawn(address indexed to, uint256 amount);
    event UntrackedTokenWithdrawn(address indexed token, address indexed to, uint256 amount);
    event UsdtAddressUpdated(address indexed newUsdtAddress);
    event UsdcAddressUpdated(address indexed newUsdcAddress);
    event CooldownUpdated(uint256 newCooldown);
    event IpfsCidStored(string indexed trn, string cid); // Event for IPFS CID storage

    // Use SafeERC20 for safe token operations
    using SafeERC20 for IERC20;

    constructor(address initialOwner, address _usdtAddress, address _usdcAddress) Ownable(initialOwner) {
        require(_usdtAddress != address(0), "Invalid USDT address");
        require(_usdcAddress != address(0), "Invalid USDC address");
        usdtAddress = _usdtAddress;
        usdcAddress = _usdcAddress;
        emit UsdtAddressUpdated(_usdtAddress);
        emit UsdcAddressUpdated(_usdcAddress);
    }

    // Helper function to convert uint to string
    function uintToString(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 + value % 10));
            value /= 10;
        }
        return string(buffer);
    }

    // Helper function to get token decimals (returns 18 for ETH, fetches from token contract for ERC20)
    function getTokenDecimals(address asset) internal view returns (uint8) {
        if (asset == address(0)) {
            return 18; // ETH has 18 decimals
        }
        // Use try-catch to handle tokens that don't implement decimals() or revert
        try IERC20Extended(asset).decimals() returns (uint8 decimals) {
            return decimals;
        } catch {
            return 18; // Default to 18 if decimals() fails
        }
    }

    // View function to get pending transaction details in human-readable format
    function getPendingTransaction(string memory trn) external view returns (address asset, string memory amount, bool executed) {
        PendingTransaction memory pending = pendingTransactions[trn];
        string memory amountStr;
        if (pending.asset == address(0) || pending.asset == usdtAddress || pending.asset == usdcAddress || pending.amount == 0) {
            // Handle ETH, USDT, and USDC as before
            if (pending.asset == address(0)) { // ETH
                uint256 ethAmount = pending.amount / 1e18;
                uint256 decimalPart = (pending.amount % 1e18) / 1e16; // First 2 decimal places
                amountStr = string(abi.encodePacked(uintToString(ethAmount), ".", uintToString(decimalPart)));
            } else if (pending.asset == usdtAddress || pending.asset == usdcAddress) { // USDT or USDC
                uint256 tokenAmount = pending.amount / 1e6;
                uint256 decimalPart = (pending.amount % 1e6) / 1e4; // First 2 decimal places
                amountStr = string(abi.encodePacked(uintToString(tokenAmount), ".", uintToString(decimalPart)));
            } else {
                amountStr = uintToString(pending.amount);
            }
        } else {
            // Handle other ERC20 tokens with dynamic decimals
            uint8 decimals = getTokenDecimals(pending.asset);
            if (decimals <= 2) {
                amountStr = uintToString(pending.amount);
            } else {
                uint256 divisor = 10 ** uint256(decimals);
                uint256 wholePart = pending.amount / divisor;
                uint256 decimalPart = (pending.amount % divisor) / (divisor / 100); // First 2 decimal places
                amountStr = string(abi.encodePacked(uintToString(wholePart), ".", uintToString(decimalPart)));
            }
        }
        return (pending.asset, amountStr, pending.executed);
    }

    // Store transaction details and pending amount on-chain
    function storeTransactionDetails(
        string calldata trn,
        uint256 eurAmount,
        bool isDelivered,
        bool isReceived,
        bool isAuthenticated,
        bool isTransactionCheckSuccessful,
        address asset,
        uint256 amount
    ) external onlyOwner {
        pendingTransactions[trn] = PendingTransaction(asset, amount, false);
        emit TransactionStored(trn, eurAmount, isDelivered, isReceived, isAuthenticated, isTransactionCheckSuccessful);
        emit PendingTransactionStored(trn, asset, amount, true);
    }

    // Store transaction hash
    function storeTransactionHash(string calldata trn, bytes32 txHash) external onlyOwner {
        transactionHashes[trn] = txHash;
        emit TransactionHashStored(trn, txHash);
    }

    // Store IPFS CID for a transaction (e.g., uploaded via https://console.storacha.network/)
    function storeIpfsCid(string calldata trn, string calldata cid) external onlyOwner {
        require(bytes(cid).length > 0, "Invalid IPFS CID");
        ipfsCids[trn] = cid;
        emit IpfsCidStored(trn, cid);
    }

    // View function to get IPFS CID for a transaction
    function getIpfsCid(string calldata trn) external view returns (string memory) {
        return ipfsCids[trn];
    }

    // Transfer specific amount of ETH and mark as executed
    function transferEth(address payable target, uint256 amount, string calldata trn) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        require(address(this).balance >= amount, "Insufficient ETH balance");
        PendingTransaction storage pending = pendingTransactions[trn];
        require(pending.asset == address(0), "Pending transaction asset mismatch");
        require(pending.amount == amount, "Pending transaction amount mismatch");
        require(!pending.executed, "Transaction already executed");

        target.transfer(amount);
        pending.executed = true;
        lastTransfer = block.timestamp;
        emit EthTransferred(target, amount, trn);
    }

    // Transfer specific amount of USDT and mark as executed
    function transferUsdt(address target, uint256 amount, string calldata trn) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        IERC20 usdtContract = IERC20(usdtAddress);
        require(usdtContract.balanceOf(address(this)) >= amount, "Insufficient USDT balance");
        PendingTransaction storage pending = pendingTransactions[trn];
        require(pending.asset == usdtAddress, "Pending transaction asset mismatch");
        require(pending.amount == amount, "Pending transaction amount mismatch");
        require(!pending.executed, "Transaction already executed");

        usdtContract.safeTransfer(target, amount);
        pending.executed = true;
        lastTransfer = block.timestamp;
        emit UsdtTransferred(target, amount, trn);
    }

    // Transfer specific amount of USDC and mark as executed
    function transferUsdc(address target, uint256 amount, string calldata trn) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        IERC20 usdcContract = IERC20(usdcAddress);
        require(usdcContract.balanceOf(address(this)) >= amount, "Insufficient USDC balance");
        PendingTransaction storage pending = pendingTransactions[trn];
        require(pending.asset == usdcAddress, "Pending transaction asset mismatch");
        require(pending.amount == amount, "Pending transaction amount mismatch");
        require(!pending.executed, "Transaction already executed");

        usdcContract.safeTransfer(target, amount);
        pending.executed = true;
        lastTransfer = block.timestamp;
        emit UsdcTransferred(target, amount, trn);
    }

    // Transfer specific amount of any ERC-20 token and mark as executed
    function transferToken(address token, address target, uint256 amount, string calldata trn) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        IERC20 tokenContract = IERC20(token);
        require(tokenContract.balanceOf(address(this)) >= amount, "Insufficient token balance");
        PendingTransaction storage pending = pendingTransactions[trn];
        require(pending.asset == token, "Pending transaction asset mismatch");
        require(pending.amount == amount, "Pending transaction amount mismatch");
        require(!pending.executed, "Transaction already executed");

        tokenContract.safeTransfer(target, amount);
        pending.executed = true;
        lastTransfer = block.timestamp;
        emit TokenTransferred(token, target, amount, trn);
    }

    // Withdraw all ETH
    function withdrawAllEth(address payable target, string calldata trn) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        uint256 balance = address(this).balance;
        require(balance > 0, "No ETH balance to withdraw");

        target.transfer(balance);
        lastTransfer = block.timestamp;
        emit AllEthWithdrawn(target, balance, trn);
    }

    // Withdraw all of any ERC-20 token
    function withdrawAllToken(address token, address target, string calldata trn) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        IERC20 tokenContract = IERC20(token);
        uint256 balance = tokenContract.balanceOf(address(this));
        require(balance > 0, "No token balance to withdraw");

        tokenContract.safeTransfer(target, balance);
        lastTransfer = block.timestamp;
        emit AllTokenWithdrawn(token, target, balance, trn);
    }

    // Withdraw partial ETH
    function withdrawEthPartial(address payable target, uint256 amount, string calldata trn) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        require(address(this).balance >= amount, "Insufficient ETH balance");

        target.transfer(amount);
        lastTransfer = block.timestamp;
        emit EthPartialWithdrawn(target, amount, trn);
    }

    // Withdraw partial amount of any ERC-20 token
    function withdrawTokenPartial(address token, address target, uint256 amount, string calldata trn) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        IERC20 tokenContract = IERC20(token);
        require(tokenContract.balanceOf(address(this)) >= amount, "Insufficient token balance");

        tokenContract.safeTransfer(target, amount);
        lastTransfer = block.timestamp;
        emit TokenPartialWithdrawn(token, target, amount, trn);
    }

    // Check ETH balance
    function getBalance() external view returns (uint256) {
        return address(this).balance;
    }

    // Check USDT balance
    function getUsdtBalance() external view returns (uint256) {
        IERC20 usdtContract = IERC20(usdtAddress);
        return usdtContract.balanceOf(address(this));
    }

    // Check USDC balance
    function getUsdcBalance() external view returns (uint256) {
        IERC20 usdcContract = IERC20(usdcAddress);
        return usdcContract.balanceOf(address(this));
    }

    // Check any ERC-20 token balance
    function getTokenBalance(address token) external view returns (uint256) {
        IERC20 tokenContract = IERC20(token);
        return tokenContract.balanceOf(address(this));
    }

    // Receive ETH with event emission
    receive() external payable {
        emit EthReceived(msg.sender, msg.value);
    }

    // Set USDT address (only owner)
    function setUsdtAddress(address _usdtAddress) external onlyOwner {
        require(_usdtAddress != address(0), "Invalid USDT address");
        usdtAddress = _usdtAddress;
        emit UsdtAddressUpdated(_usdtAddress);
    }

    // Set USDC address (only owner)
    function setUsdcAddress(address _usdcAddress) external onlyOwner {
        require(_usdcAddress != address(0), "Invalid USDC address");
        usdcAddress = _usdcAddress;
        emit UsdcAddressUpdated(_usdcAddress);
    }

    // Receive ERC20 tokens with event emission
    function receiveTokens(address token, uint256 amount) external {
        require(amount > 0, "Amount must be greater than zero");
        IERC20 tokenContract = IERC20(token);
        require(tokenContract.balanceOf(msg.sender) >= amount, "Insufficient token balance");
        require(tokenContract.allowance(msg.sender, address(this)) >= amount, "Insufficient allowance");

        tokenContract.safeTransferFrom(msg.sender, address(this), amount);
        emit TokensReceived(token, msg.sender, amount);
    }

    // View function to get transaction hash
    function getTransactionHash(string calldata trn) external view returns (bytes32) {
        return transactionHashes[trn];
    }

    // Withdraw ETH to owner wallet (full or partial)
    function withdrawToOwnerEth(uint256 amount) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        uint256 balance = address(this).balance;
        require(balance >= amount, "Insufficient ETH balance");
        require(amount > 0, "Amount must be greater than zero");

        payable(owner()).transfer(amount);
        lastTransfer = block.timestamp;
        emit EthPartialWithdrawn(owner(), amount, "");
    }

    // Withdraw ERC20 token to owner wallet (full or partial)
    function withdrawToOwnerToken(address token, uint256 amount) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        IERC20 tokenContract = IERC20(token);
        uint256 balance = tokenContract.balanceOf(address(this));
        require(balance >= amount, "Insufficient token balance");
        require(amount > 0, "Amount must be greater than zero");

        tokenContract.safeTransfer(owner(), amount);
        lastTransfer = block.timestamp;
        emit TokenPartialWithdrawn(token, owner(), amount, "");
    }

    // Withdraw untracked ETH (not tied to pending transactions)
    function withdrawUntrackedEth(address payable target, uint256 amount) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        require(address(this).balance >= amount, "Insufficient ETH balance");
        require(amount > 0, "Amount must be greater than zero");

        target.transfer(amount);
        lastTransfer = block.timestamp;
        emit UntrackedEthWithdrawn(target, amount);
    }

    // Withdraw untracked ERC20 token (not tied to pending transactions)
    function withdrawUntrackedToken(address token, address target, uint256 amount) external onlyOwner {
        require(block.timestamp >= lastTransfer + cooldown, "Cooldown period active");
        IERC20 tokenContract = IERC20(token);
        require(tokenContract.balanceOf(address(this)) >= amount, "Insufficient token balance");
        require(amount > 0, "Amount must be greater than zero");

        tokenContract.safeTransfer(target, amount);
        lastTransfer = block.timestamp;
        emit UntrackedTokenWithdrawn(token, target, amount);
    }

    // Set cooldown period (only owner)
    function setCooldown(uint256 newCooldown) external onlyOwner {
        cooldown = newCooldown;
        emit CooldownUpdated(newCooldown);
    }
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

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

pragma solidity ^0.8.20;

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

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Read Contract

cooldown 0x787a08a6 → uint256
getBalance 0x12065fe0 → uint256
getIpfsCid 0x339d54af → string
getPendingTransaction 0x40b7f978 → address, string, bool
getTokenBalance 0x3aecd0e3 → uint256
getTransactionHash 0x5d46fa18 → bytes32
getUsdcBalance 0xc31ee12e → uint256
getUsdtBalance 0x06292f2b → uint256
ipfsCids 0x2f3c7bc1 → string
lastTransfer 0xe84d2696 → uint256
owner 0x8da5cb5b → address
pendingTransactions 0xc9c10505 → address, uint256, bool
transactionHashes 0xfe51d76f → bytes32
usdcAddress 0x02d45457 → address
usdtAddress 0x9ab4a445 → address

Write Contract 21 functions

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

receiveTokens 0x35729130
address token
uint256 amount
renounceOwnership 0x715018a6
No parameters
setCooldown 0x4fc3f41a
uint256 newCooldown
setUsdcAddress 0xd38bcdee
address _usdcAddress
setUsdtAddress 0x0cb46b75
address _usdtAddress
storeIpfsCid 0xbd49497c
string trn
string cid
storeTransactionDetails 0x620396d0
string trn
uint256 eurAmount
bool isDelivered
bool isReceived
bool isAuthenticated
bool isTransactionCheckSuccessful
address asset
uint256 amount
storeTransactionHash 0x200a9dff
string trn
bytes32 txHash
transferEth 0xb511f73a
address target
uint256 amount
string trn
transferOwnership 0xf2fde38b
address newOwner
transferToken 0x7b2eb35c
address token
address target
uint256 amount
string trn
transferUsdc 0x637e09be
address target
uint256 amount
string trn
transferUsdt 0x194840ce
address target
uint256 amount
string trn
withdrawAllEth 0xad6c2c3f
address target
string trn
withdrawAllToken 0xb8906199
address token
address target
string trn
withdrawEthPartial 0xd31d5fe9
address target
uint256 amount
string trn
withdrawToOwnerEth 0x3c84ef45
uint256 amount
withdrawToOwnerToken 0x7e673f7a
address token
uint256 amount
withdrawTokenPartial 0xc0f6d9a7
address token
address target
uint256 amount
string trn
withdrawUntrackedEth 0x06e08856
address target
uint256 amount
withdrawUntrackedToken 0x91f5b01b
address token
address target
uint256 amount

Recent Transactions

No transactions found for this address