Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xd85A4aC007cF06a4bF8dAEf180EfE522096bceeD
Balance 0.009596 ETH
Nonce 1
Code Size 11804 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

11804 bytes
0x6080604052600436106101c15760003560e01c80638a77ba1a116100f75780639c9bb1e311610095578063c54e44eb11610064578063c54e44eb146104c1578063de1881a8146104e1578063efdcd974146104f7578063f2fde38b1461051757600080fd5b80639c9bb1e31461044e578063b3f006741461046e578063c34e596f1461048e578063c3d73018146104ae57600080fd5b8063901bd2cc116100d1578063901bd2cc146103d95780639461446d146103f957806395bf75fd1461041957806399d32fc41461043957600080fd5b80638a77ba1a1461037b5780638da5cb5b1461039b5780638f32d59b146103b957600080fd5b8063447f25ef11610164578063647762761161013e578063647762761461030657806369fb107514610326578063715018a6146103465780637944f9441461035b57600080fd5b8063447f25ef146102ae57806355837757146102d15780635af9e7c9146102f157600080fd5b80633500ac41116101a05780633500ac41146102385780633d45b7f3146102685780634061215d1461027b57806342d5350b1461028e57600080fd5b8062ae3bf8146101c65780630660acb4146101e85780632ffda2b414610225575b600080fd5b3480156101d257600080fd5b506101e66101e1366004612676565b610537565b005b3480156101f457600080fd5b50600154610208906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101e661023336600461299a565b610632565b34801561024457600080fd5b50610258610253366004612a5d565b610729565b604051901515815260200161021c565b6101e6610276366004612750565b6107d4565b6101e66102893660046126b7565b610a98565b34801561029a57600080fd5b50600954610208906001600160a01b031681565b3480156102ba57600080fd5b506102c3610b4d565b60405190815260200161021c565b3480156102dd57600080fd5b506101e66102ec366004612676565b610b63565b3480156102fd57600080fd5b506006546102c3565b34801561031257600080fd5b506101e6610321366004612676565b610baf565b34801561033257600080fd5b506101e6610341366004612a2b565b610bfb565b34801561035257600080fd5b506101e6610c2a565b34801561036757600080fd5b50600b54610208906001600160a01b031681565b34801561038757600080fd5b50600a54610208906001600160a01b031681565b3480156103a757600080fd5b506000546001600160a01b0316610208565b3480156103c557600080fd5b506000546001600160a01b03163314610258565b3480156103e557600080fd5b50600254610208906001600160a01b031681565b34801561040557600080fd5b506101e6610414366004612a2b565b610c9e565b34801561042557600080fd5b50600454610208906001600160a01b031681565b34801561044557600080fd5b506102c3610d21565b34801561045a57600080fd5b506101e6610469366004612676565b610db8565b34801561047a57600080fd5b50600854610208906001600160a01b031681565b34801561049a57600080fd5b506101e66104a9366004612676565b610e04565b6101e66104bc3660046127fd565b610e50565b3480156104cd57600080fd5b50600354610208906001600160a01b031681565b3480156104ed57600080fd5b506102c360055481565b34801561050357600080fd5b506101e6610512366004612676565b611247565b34801561052357600080fd5b506101e6610532366004612676565b611293565b6000546001600160a01b0316331461056a5760405162461bcd60e51b815260040161056190612bca565b60405180910390fd5b6001600160a01b0381166105a85760405133904780156108fc02916000818181858888f193505050501580156105a4573d6000803e3d6000fd5b5050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b1580156105ea57600080fd5b505afa1580156105fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106229190612a44565b90506105a48233836112c6565b50565b60005a905060008261064e5760065461064b9042612d09565b92505b60008a600381111561066257610662612d8f565b14156106ad576106728789612d09565b3410156106915760405162461bcd60e51b815260040161056190612bed565b8761069c3483612d09565b6106a69190612d62565b90506106ff565b863410156106cd5760405162461bcd60e51b815260040161056190612c24565b6106d73482612d09565b90506106ff896000815181106106ef576106ef612da5565b602002602001015133308b6113e1565b61070e8a8a8a89338989611511565b5061071d828260008833611da4565b50505050505050505050565b600b546000906001600160a01b031633146107905760405162461bcd60e51b815260206004820152602160248201527f446567656e203a2063616c6c6572206973206e6f742053776170466163746f726044820152607960f81b6064820152608401610561565b816107a5576006546107a29042612d09565b91505b6107c68760038111156107ba576107ba612d8f565b87876000888888611511565b506001979650505050505050565b60005a905060008960038111156107ed576107ed612d8f565b9050600083610806576006546108039042612d09565b93505b60008b600381111561081a5761081a612d8f565b1480610837575060038b600381111561083557610835612d8f565b145b1561087957610846898b612d09565b3410156108655760405162461bcd60e51b815260040161056190612bed565b61086f8a34612d62565b98508990506108b7565b883410156108995760405162461bcd60e51b815260040161056190612c24565b8b513499506108aa9033308d6113e1565b8b516108b790888c612197565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156108fb57600080fd5b505afa15801561090f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109339190612a44565b90506109408883896122ab565b6003546040516370a0823160e01b815230600482015282916001600160a01b0316906370a082319060240160206040518083038186803b15801561098357600080fd5b505afa158015610997573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bb9190612a44565b6109c59190612d62565b600354600b549192506109e5916001600160a01b03918216911683612197565b600b5460035460208f015160405163f73d640d60e01b81526001600160a01b039384169363f73d640d93610a2893911691869033908a908e908e90600401612b51565b602060405180830381600087803b158015610a4257600080fd5b505af1158015610a56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7a9190612978565b50610a89848b60008c33611da4565b50505050505050505050505050565b60005a905060008080896003811115610ab357610ab3612d8f565b1415610af657610ac38789612d09565b341015610ae25760405162461bcd60e51b815260040161056190612bed565b610aec8834612d62565b9150879050610b34565b86341015610b165760405162461bcd60e51b815260040161056190612c24565b8951349250610b279033308b6113e1565b8951610b3490868a612197565b610b3f8582866122ab565b61071d838360008933611da4565b60006001600754610b5e9190612d62565b905090565b6000546001600160a01b03163314610b8d5760405162461bcd60e51b815260040161056190612bca565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610bd95760405162461bcd60e51b815260040161056190612bca565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610c255760405162461bcd60e51b815260040161056190612bca565b600655565b6000546001600160a01b03163314610c545760405162461bcd60e51b815260040161056190612bca565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6004546001600160a01b0316331480610cd0575033610cc56000546001600160a01b031690565b6001600160a01b0316145b610d1c5760405162461bcd60e51b815260206004820152601860248201527f43616c6c6572206973206e6f74207468652073797374656d00000000000000006044820152606401610561565b600555565b6008546000906001600160a01b03163314610d955760405162461bcd60e51b815260206004820152602e60248201527f54686973206665652063616e20626520636c61696d6564206f6e6c792062792060448201526d666565207265636569766572212160901b6064820152608401610561565b6001600754610da49190612d62565b60016007559050610db53382612358565b90565b6000546001600160a01b03163314610de25760405162461bcd60e51b815260040161056190612bca565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610e2e5760405162461bcd60e51b815260040161056190612bca565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b610e586124d7565b5a8152600060208201526040820151610e7e57600654610e789042612d09565b60408301525b6000886003811115610e9257610e92612d8f565b1415610f3557600554610ea58688612d09565b610eaf9190612d09565b341015610f165760405162461bcd60e51b815260206004820152602f60248201527f5061796d656e74203d206173736574496e4f666665726564202b20666565732060448201526e2b2070726f63657373696e6746656560881b6064820152608401610561565b84610f218734612d62565b610f2b9190612d62565b6020820152610f97565b600554610f429086612d09565b341015610f615760405162461bcd60e51b815260040161056190612c24565b610f6b8534612d62565b60208201528851610f97908a90600090610f8757610f87612da5565b60200260200101513330896113e1565b60035489516001600160a01b03909116908a90600090610fb957610fb9612da5565b60200260200101516001600160a01b031614156110cc57600354600b54610fed916001600160a01b03908116911688612197565b600b546003548a516001600160a01b039283169263f73d640d9216908c9061101790600190612d62565b8151811061102757611027612da5565b602002602001015189338c8860016003811061104557611045612da5565b602002015189600260200201516040518863ffffffff1660e01b81526004016110749796959493929190612b51565b602060405180830381600087803b15801561108e57600080fd5b505af11580156110a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c69190612978565b50611227565b60008960018b516110dd9190612d62565b815181106110ed576110ed612da5565b60200260200101519050600360009054906101000a90046001600160a01b03168a60018c5161111c9190612d62565b8151811061112c5761112c612da5565b6001600160a01b039092166020928302919091019091015260006111628a8c8a8930898760200201518a60026020020151611511565b600354600b54919250611182916001600160a01b03918216911683612197565b600b546003546001600160a01b039182169163f73d640d91168484338e8a600160200201518b600260200201516040518863ffffffff1660e01b81526004016111d19796959493929190612b51565b602060405180830381600087803b1580156111eb57600080fd5b505af11580156111ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112239190612978565b5050505b8051602082015161123c919087908633611da4565b505050505050505050565b6000546001600160a01b031633146112715760405162461bcd60e51b815260040161056190612bca565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146112bd5760405162461bcd60e51b815260040161056190612bca565b61062f81612426565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916113229190612b16565b6000604051808303816000865af19150503d806000811461135f576040519150601f19603f3d011682016040523d82523d6000602084013e611364565b606091505b509150915081801561138e57508051158061138e57508080602001905181019061138e9190612978565b6113da5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610561565b5050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916114459190612b16565b6000604051808303816000865af19150503d8060008114611482576040519150601f19603f3d011682016040523d82523d6000602084013e611487565b606091505b50915091508180156114b15750805115806114b15750808060200190518101906114b19190612978565b6115095760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610561565b505050505050565b6000600283106115555760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964204445582049642160881b6044820152606401610561565b428210156115bf5760405162461bcd60e51b815260206004820152603160248201527f455850495245443a20446561646c696e6520666f72207472616e73616374696f604482015270371030b63932b0b23c903830b9b9b2b21760791b6064820152608401610561565b826119ad57606060008960038111156115da576115da612d8f565b141561171c57600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561162e57600080fd5b505afa158015611642573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611666919061269a565b8860008151811061167957611679612da5565b6001600160a01b039283166020918202929092010152600154604051637ff36ab560e01b8152911690637ff36ab59089906116bf906000908d908b904290600401612b95565b6000604051808303818588803b1580156116d857600080fd5b505af11580156116ec573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261171591908101906128e0565b905061197e565b600189600381111561173057611730612d8f565b14156118bd57600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561178457600080fd5b505afa158015611798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117bc919061269a565b8860018a516117cb9190612d62565b815181106117db576117db612da5565b60200260200101906001600160a01b031690816001600160a01b03168152505061182e8860008151811061181157611811612da5565b60209081029190910101516001546001600160a01b031689612197565b6001546040516318cbafe560e01b81526001600160a01b03909116906318cbafe590611867908a906000908d908b904290600401612c4f565b600060405180830381600087803b15801561188157600080fd5b505af1158015611895573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261171591908101906128e0565b60028960038111156118d1576118d1612d8f565b141561197e576118ed8860008151811061181157611811612da5565b6001546040516338ed173960e01b81526001600160a01b03909116906338ed173990611925908a908a908d908b904290600401612c4f565b600060405180830381600087803b15801561193f57600080fd5b505af1158015611953573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261197b91908101906128e0565b90505b806001825161198d9190612d62565b8151811061199d5761199d612da5565b6020026020010151915050611d99565b8260011415611d9957606060008960038111156119cc576119cc612d8f565b1415611b0d57600260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a2057600080fd5b505afa158015611a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a58919061269a565b88600081518110611a6b57611a6b612da5565b6001600160a01b039283166020918202929092010152600254604051637ff36ab560e01b8152911690637ff36ab5908990611ab0908a908d908b904290600401612b95565b6000604051808303818588803b158015611ac957600080fd5b505af1158015611add573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611b0691908101906128e0565b9050611d6e565b6001896003811115611b2157611b21612d8f565b1415611cad57600260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611b7557600080fd5b505afa158015611b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bad919061269a565b8860018a51611bbc9190612d62565b81518110611bcc57611bcc612da5565b60200260200101906001600160a01b031690816001600160a01b031681525050611c1f88600081518110611c0257611c02612da5565b60209081029190910101516002546001600160a01b031689612197565b6002546040516318cbafe560e01b81526001600160a01b03909116906318cbafe590611c57908a908a908d908b904290600401612c4f565b600060405180830381600087803b158015611c7157600080fd5b505af1158015611c85573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b0691908101906128e0565b6002896003811115611cc157611cc1612d8f565b1415611d6e57611cdd88600081518110611c0257611c02612da5565b6002546040516338ed173960e01b81526001600160a01b03909116906338ed173990611d15908a908a908d908b904290600401612c4f565b600060405180830381600087803b158015611d2f57600080fd5b505af1158015611d43573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d6b91908101906128e0565b90505b8060018251611d7d9190612d62565b81518110611d8d57611d8d612da5565b60200260200101519150505b979650505050505050565b6009546001600160a01b0316611df0576040516001600160a01b0382169085156108fc029086906000818181858888f19350505050158015611dea573d6000803e3d6000fd5b506113da565b60006001600160a01b0383161561205b57600954600a5460405163016175dd60e51b81526001600160a01b0391821660048201523060248201526000929190911690632c2ebba09060440160206040518083038186803b158015611e5357600080fd5b505afa158015611e67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8b9190612a44565b60095460405163016175dd60e51b81526001600160a01b03878116600483015230602483015292935060009290911690632c2ebba09060440160206040518083038186803b158015611edc57600080fd5b505afa158015611ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f149190612a44565b90508015611f3d57611f268282612d09565b611f308289612d43565b611f3a9190612d21565b92505b8215612058576009546040516305c2b27f60e21b81526001600160a01b038681166004830152602482018690528781166044830152600092169063170ac9fc90606401602060405180830381600087803b158015611f9a57600080fd5b505af1158015611fae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fd2919061269a565b90506001600160a01b03811661201e576040516001600160a01b0386169085156108fc029086906000818181858888f19350505050158015612018573d6000803e3d6000fd5b50612056565b6040516001600160a01b0382169085156108fc029086906000818181858888f19350505050158015612054573d6000803e3d6000fd5b505b505b50505b6120658186612d62565b945084600760008282546120799190612d09565b909155505083156120c0576004546040516001600160a01b039091169085156108fc029086906000818181858888f193505050501580156120be573d6000803e3d6000fd5b505b5a6120cb9087612d62565b95506120d73a87612d43565b6009549096506001600160a01b031663170ac9fc83866120f78a8a612d09565b6121019190612d09565b600a5460405160e085901b6001600160e01b03191681526001600160a01b0393841660048201526024810192909252919091166044820152606401602060405180830381600087803b15801561215657600080fd5b505af115801561216a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218e919061269a565b50505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b17905291516000928392908716916121f39190612b16565b6000604051808303816000865af19150503d8060008114612230576040519150601f19603f3d011682016040523d82523d6000602084013e612235565b606091505b509150915081801561225f57508051158061225f57508080602001905181019061225f9190612978565b6113da5760405162461bcd60e51b815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c454400006044820152606401610561565b6000836001600160a01b031683836040516122c69190612b16565b60006040518083038185875af1925050503d8060008114612303576040519150601f19603f3d011682016040523d82523d6000602084013e612308565b606091505b50509050806123525760405162461bcd60e51b815260206004820152601660248201527531b0b636103a379031b7b73a3930b1ba1032b93937b960511b6044820152606401610561565b50505050565b604080516000808252602082019092526001600160a01b0384169083906040516123829190612b16565b60006040518083038185875af1925050503d80600081146123bf576040519150601f19603f3d011682016040523d82523d6000602084013e6123c4565b606091505b50509050806124215760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960448201526213115160ea1b6064820152608401610561565b505050565b6001600160a01b03811661247c5760405162461bcd60e51b815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f77656400000000000000006044820152606401610561565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60405180604001604052806002906020820280368337509192915050565b600082601f83011261250657600080fd5b6040516040810181811067ffffffffffffffff8211171561252957612529612dbb565b806040525080838560408601111561254057600080fd5b60005b600281101561256c57813561255781612dd1565b83526020928301929190910190600101612543565b509195945050505050565b600082601f83011261258857600080fd5b8135602061259d61259883612ce5565b612cb4565b80838252828201915082860187848660051b89010111156125bd57600080fd5b60005b858110156125e55781356125d381612dd1565b845292840192908401906001016125c0565b5090979650505050505050565b600082601f83011261260357600080fd5b813567ffffffffffffffff81111561261d5761261d612dbb565b612630601f8201601f1916602001612cb4565b81815284602083860101111561264557600080fd5b816020850160208301376000918101602001919091529392505050565b80356004811061267157600080fd5b919050565b60006020828403121561268857600080fd5b813561269381612dd1565b9392505050565b6000602082840312156126ac57600080fd5b815161269381612dd1565b6000806000806000806000610100888a0312156126d357600080fd5b6126dd89896124f5565b96506126eb60408901612662565b9550606088013594506080880135935060a088013561270981612dd1565b925060c088013561271981612dd1565b915060e088013567ffffffffffffffff81111561273557600080fd5b6127418a828b016125f2565b91505092959891949750929550565b60008060008060008060008060006101408a8c03121561276f57600080fd5b6127798b8b6124f5565b985061278760408b01612662565b975060608a0135965060808a0135955060a08a01356127a581612dd1565b945060c08a01356127b581612dd1565b935060e08a013567ffffffffffffffff8111156127d157600080fd5b6127dd8c828d016125f2565b9350506101008a013591506101208a013590509295985092959850929598565b600080600080600080600080610140808a8c03121561281b57600080fd5b893567ffffffffffffffff81111561283257600080fd5b61283e8c828d01612577565b995050602061284e818c01612662565b985060408b0135975060608b0135965060808b0135955060a08b0135945060c08b013561287a81612dd1565b935060ff8b018c1361288b57600080fd5b612893612c8b565b8060e08d018e858f0111156128a757600080fd5b600094505b60038510156128cb5780358352600194909401939183019183016128ac565b50809450505050509295985092959890939650565b600060208083850312156128f357600080fd5b825167ffffffffffffffff81111561290a57600080fd5b8301601f8101851361291b57600080fd5b805161292961259882612ce5565b80828252848201915084840188868560051b870101111561294957600080fd5b600094505b8385101561296c57805183526001949094019391850191850161294e565b50979650505050505050565b60006020828403121561298a57600080fd5b8151801515811461269357600080fd5b600080600080600080600080610100898b0312156129b757600080fd5b6129c089612662565b9750602089013567ffffffffffffffff8111156129dc57600080fd5b6129e88b828c01612577565b97505060408901359550606089013594506080890135935060a0890135612a0e81612dd1565b979a969950949793969295929450505060c08201359160e0013590565b600060208284031215612a3d57600080fd5b5035919050565b600060208284031215612a5657600080fd5b5051919050565b60008060008060008060c08789031215612a7657600080fd5b86359550602087013567ffffffffffffffff811115612a9457600080fd5b612aa089828a01612577565b955050604087013593506060870135612ab881612dd1565b9598949750929560808101359460a0909101359350915050565b600081518084526020808501945080840160005b83811015612b0b5781516001600160a01b031687529582019590820190600101612ae6565b509495945050505050565b6000825160005b81811015612b375760208186018101518583015201612b1d565b81811115612b46576000828501525b509190910192915050565b6001600160a01b03978816815295871660208701526040860194909452919094166060840152608083019390935260a082019290925260c081019190915260e00190565b848152608060208201526000612bae6080830186612ad2565b6001600160a01b03949094166040830152506060015292915050565b6020808252600990820152682737ba1027bbb732b960b91b604082015260600190565b6020808252601f908201527f5061796d656e74203d206173736574496e4f666665726564202b206665657300604082015260600190565b6020808252601190820152701999595cc81b9bdd081c9958d95a5d9959607a1b604082015260600190565b85815284602082015260a060408201526000612c6e60a0830186612ad2565b6001600160a01b0394909416606083015250608001529392505050565b6040516060810167ffffffffffffffff81118282101715612cae57612cae612dbb565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612cdd57612cdd612dbb565b604052919050565b600067ffffffffffffffff821115612cff57612cff612dbb565b5060051b60200190565b60008219821115612d1c57612d1c612d79565b500190565b600082612d3e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612d5d57612d5d612d79565b500290565b600082821015612d7457612d74612d79565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461062f57600080fdfea26469706673582212206b5958ec2644c0c188a957520a1ebbc050e5468d0ffde221f19c36e3be9a064e64736f6c63430008070033

Verified Source Code Full Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: Yes (200 runs)
degen.sol 490 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


abstract contract Ownable {
    address private _owner;

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

    /**
     * @dev The Ownable constructor sets the original `owner` of the contract to the sender
     * account.
     */
    constructor () {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(isOwner(),"Not Owner");
        _;
    }

    /**
     * @return true if `msg.sender` is the owner of the contract.
     */
    function isOwner() public view returns (bool) {
        return msg.sender == _owner;
    }

    /**
     * @dev Allows the current owner to relinquish control of the contract.
     * @notice Renouncing to ownership will leave the contract without an owner.
     * It will not be possible to call the functions with the `onlyOwner`
     * modifier anymore.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0),"Zero address not allowed");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}


interface ISwapFactory {
    function swap(address tokenA, address tokenB, uint256 amount, address user, uint256 crossOrderType, uint256 dexId, uint256 deadline) 
    external payable returns (bool);
}

library TransferHelper {
    function safeApprove(address token, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address token, address from, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
}

interface IUni {

    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
    external payable
    returns (uint[] memory amounts);
    
    function swapExactTokensForTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) 
    external 
    returns (uint[] memory amounts);

    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
    external
    returns (uint[] memory amounts);

    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);

    function WETH() external pure returns (address);

}

interface IReimbursement {
    function getLicenseeFee(address licenseeVault, address projectContract) external view returns(uint256); // return fee percentage with 2 decimals
    function getVaultOwner(address vault) external view returns(address);
    // returns address of fee receiver or address(0) if licensee can't receive the fee (fee should be returns to user)
    function requestReimbursement(address user, uint256 feeAmount, address licenseeVault) external returns(address);
}

contract Degen is Ownable {
    using TransferHelper for address;
    enum OrderType {EthForTokens, TokensForEth, TokensForTokens, EthForEth}
    
    IUni public Uni = IUni(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); //mainnet network address for uniswap (valid for Ropsten as well)
    IUni public Sushi = IUni(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F); // Mainnet network address for sushiswap
    //address public _sushi = address(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506); // Ropsten network address for sushiswap
    //address public USDT = address(0x47A530f3Fa882502344DC491549cA9c058dbC7Da); // Ropsten test net USDT test token
    address public USDT = address(0xdAC17F958D2ee523a2206206994597C13D831ec7); // USDT Token Address
    address public system;
    uint256 public processingFee = 0 ;
    
    uint256 private deadlineLimit = 20*60;      // 20 minutes by default 
    
    uint256 private collectedFees = 1; // amount of collected fee (starts from 1 to avoid additional gas usage)
    address public feeReceiver; // address which receive the fee (by default is validator)


    IReimbursement public reimbursementContract;      // reimbursement contract address

    address public companyVault;    // the vault address of our company registered in reimbursement contract

    ISwapFactory public swapFactory;
   
    modifier onlySystem() {
        require(msg.sender == system || owner() == msg.sender,"Caller is not the system");
        _;
    }
    
    constructor(address _swapFactory, address _system) 
    {
        swapFactory = ISwapFactory(_swapFactory);
        system = _system;
    }
    

    function setCompanyVault(address _comapnyVault) external onlyOwner {
        companyVault = _comapnyVault;
    }

    function setReimbursementContract(address _reimbursementContarct) external onlyOwner {
        reimbursementContract = IReimbursement(_reimbursementContarct);
    }

    function setProcessingFee(uint256 _processingFees) external onlySystem {
        processingFee = _processingFees;
    }

    function setSwapFactory(address _swapFactory) external onlyOwner {
        swapFactory = ISwapFactory(_swapFactory);
    }
    
    function setSystem(address _system) external onlyOwner {
        system = _system;
    }
    
    function setFeeReceiver(address _addr) external onlyOwner {
        feeReceiver = _addr;
    }
    
    function getDeadlineLimit() public view returns(uint256) {
        return deadlineLimit;
    }
    
    function setDeadlineLimit(uint256 limit) external onlyOwner {
        deadlineLimit = limit;
    }

    // get amount of collected fees that can be claimed
    function getColletedFees() external view returns (uint256) {
        // collectedFees starts from 1 to avoid additional gas usage to initiate storage (when collectedFees = 0)
        return collectedFees - 1;
    }

    // claim fees by feeReceiver
    function claimFee() external returns (uint256 feeAmount) {
        require(msg.sender == feeReceiver, "This fee can be claimed only by fee receiver!!");
        feeAmount = collectedFees - 1;
        collectedFees = 1;        
        TransferHelper.safeTransferETH(msg.sender, feeAmount);
    }
    
    
    // Call function processFee() at the end of main function for correct gas usage calculation.
    // txGas - is gasleft() on start of calling contract. Put `uint256 txGas = gasleft();` as a first command in function
    // feeAmount - fee amount that user paid
    // processing - processing fee (for cross-chain swaping)
    // licenseeVault - address that licensee received on registration and should provide when users comes from their site
    // user - address of user who has to get reimbursement (usually msg.sender)

    function processFee(uint256 txGas, uint256 feeAmount, uint256 processing, address licenseeVault, address user) internal {
        if (address(reimbursementContract) == address(0)) {
            payable(user).transfer(feeAmount); // return fee to sender if no reimbursement contract
            return;
        }
        
        uint256 licenseeFeeAmount;
        if (licenseeVault != address(0)) {
            uint256 companyFeeRate = reimbursementContract.getLicenseeFee(companyVault, address(this));
            uint256 licenseeFeeRate = reimbursementContract.getLicenseeFee(licenseeVault, address(this));
            if (licenseeFeeRate != 0)
                licenseeFeeAmount = (feeAmount * licenseeFeeRate)/(licenseeFeeRate + companyFeeRate);
            if (licenseeFeeAmount != 0) {
                address licenseeFeeTo = reimbursementContract.requestReimbursement(user, licenseeFeeAmount, licenseeVault);
                if (licenseeFeeTo == address(0)) {
                    payable(user).transfer(licenseeFeeAmount);    // refund to user
                } else {
                    payable(licenseeFeeTo).transfer(licenseeFeeAmount);  // transfer to fee receiver
                }
            }
        }
        feeAmount -= licenseeFeeAmount; // company's part of fee
        collectedFees += feeAmount; 
        
        if (processing != 0) 
            payable(system).transfer(processing);  // transfer to fee receiver
        
        txGas -= gasleft(); // get gas amount that was spent on Licensee fee
        txGas = txGas * tx.gasprice;
        // request reimbursement for user
        reimbursementContract.requestReimbursement(user, feeAmount+txGas+processing, companyVault);
    }
    
    
    function _swap( 
        OrderType orderType, 
        address[] memory path, 
        uint256 assetInOffered,
        uint256 minExpectedAmount, 
        address to,
        uint256 dexId,
        uint256 deadline
    ) internal returns(uint256 amountOut) {
         
        require(dexId < 2, "Invalid DEX Id!");
        require(deadline >= block.timestamp, "EXPIRED: Deadline for transaction already passed.");

       if(dexId == 0){
            uint[] memory swapResult;
            if(orderType == OrderType.EthForTokens) {
                 path[0] = Uni.WETH();
                 swapResult = Uni.swapExactETHForTokens{value:assetInOffered}(0, path, to,block.timestamp);
            }
            else if (orderType == OrderType.TokensForEth) {
                path[path.length-1] = Uni.WETH();
                TransferHelper.safeApprove(path[0], address(Uni), assetInOffered);
                swapResult = Uni.swapExactTokensForETH(assetInOffered, 0, path,to, block.timestamp);
            }
            else if (orderType == OrderType.TokensForTokens) {
                TransferHelper.safeApprove(path[0], address(Uni), assetInOffered);
                swapResult = Uni.swapExactTokensForTokens(assetInOffered, minExpectedAmount, path, to, block.timestamp);
            }
            amountOut = swapResult[swapResult.length - 1];
        } else if(dexId == 1) {
            uint[] memory swapResult;
            if(orderType == OrderType.EthForTokens) {
                 path[0] = Sushi.WETH();
                 swapResult = Sushi.swapExactETHForTokens{value:assetInOffered}(minExpectedAmount, path, to, block.timestamp);
            }
            else if (orderType == OrderType.TokensForEth) {
                path[path.length-1] = Sushi.WETH();
                TransferHelper.safeApprove(path[0], address(Sushi), assetInOffered);
                swapResult = Sushi.swapExactTokensForETH(assetInOffered, minExpectedAmount, path, to, block.timestamp);
            }
            else if (orderType == OrderType.TokensForTokens) {
                TransferHelper.safeApprove(path[0], address(Sushi), assetInOffered);
                swapResult = Sushi.swapExactTokensForTokens(assetInOffered, minExpectedAmount, path, to, block.timestamp);
            }
            amountOut = swapResult[swapResult.length - 1];
        }
    }
    
    function executeSwap(
        OrderType orderType, 
        address[] memory path, 
        uint256 assetInOffered, 
        uint256 fees, 
        uint256 minExpectedAmount,
        address licenseeVault,
        uint256 dexId,
        uint256 deadline
    ) external payable {
        uint256 gasA = gasleft();
        uint256 receivedFees = 0;
        if(deadline == 0) {
            deadline = block.timestamp + deadlineLimit;
        }
        
        if(orderType == OrderType.EthForTokens){
            require(msg.value >= (assetInOffered + fees), "Payment = assetInOffered + fees");
            receivedFees = receivedFees + msg.value - assetInOffered;
        } else {
            require(msg.value >= fees, "fees not received");
            receivedFees = receivedFees + msg.value;
            TransferHelper.safeTransferFrom(path[0], msg.sender, address(this), assetInOffered);
        }
        
        _swap(orderType, path, assetInOffered, minExpectedAmount, msg.sender, dexId, deadline);
   
        processFee(gasA, receivedFees, 0, licenseeVault, msg.sender);
    }
    
    function executeCrossExchange(
        address[] memory path, 
        OrderType orderType,
        uint256 crossOrderType,
        uint256 assetInOffered,
        uint256 fees, 
        uint256 minExpectedAmount,
        address licenseeVault,
        uint256[3] memory dexId_deadline // dexId_deadline[0] - native swap dexId, dexId_deadline[1] - foreign swap dexId, dexId_deadline[2] - deadline
    ) public payable {
        uint256[2] memory feesPrice;
        feesPrice[0] = gasleft();       // equivalent to gasA
        feesPrice[1] = 0;               // processing fees
        
        if (dexId_deadline[2] == 0) {   // if deadline == 0, set deadline to deadlineLimit
            dexId_deadline[2] = block.timestamp + deadlineLimit;
        }

        if(orderType == OrderType.EthForTokens){
            require(msg.value >= (assetInOffered + fees + processingFee), "Payment = assetInOffered + fees + processingFee");
            feesPrice[1] = msg.value - assetInOffered - fees;
        } else {
            require(msg.value >= (fees + processingFee), "fees not received");
            feesPrice[1] = msg.value - fees;
            TransferHelper.safeTransferFrom(path[0], msg.sender, address(this), assetInOffered);
        }
        
        if(path[0] == USDT) {
            TransferHelper.safeApprove(USDT, address(swapFactory), assetInOffered);
            swapFactory.swap(USDT, path[path.length-1], assetInOffered, msg.sender, crossOrderType, dexId_deadline[1], dexId_deadline[2]);
        }
        else {
            address tokenB = path[path.length-1];
            path[path.length-1] = USDT;
            uint256 minAmountExpected = _swap(orderType, path, assetInOffered, minExpectedAmount, address(this), dexId_deadline[0], dexId_deadline[2]);
                
            TransferHelper.safeApprove(USDT, address(swapFactory),minAmountExpected);
            swapFactory.swap(USDT, tokenB, minAmountExpected, msg.sender, crossOrderType, dexId_deadline[1], dexId_deadline[2]);
        }        

        processFee(feesPrice[0], fees, feesPrice[1], licenseeVault, msg.sender);
    }

    function callbackCrossExchange( 
        uint256 orderType, 
        address[] memory path, 
        uint256 assetInOffered, 
        address user,
        uint256 dexId,
        uint256 deadline
    ) public returns(bool) {
        require(msg.sender == address(swapFactory) , "Degen : caller is not SwapFactory");
        if(deadline==0) {
            deadline = block.timestamp + deadlineLimit;
        }
        _swap(OrderType(orderType), path, assetInOffered, uint256(0), user, dexId, deadline);
        return true;
    }

    // user has to approve 1Inch router contract to transfer `assetInOffered` before calling this function 
    // when call `swap` API of 1Inch, you have to set:
    // `fromTokenAddress` - token user want to swap (if user swap ETH use address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
    // `toTokenAddress ` - token user want to receive
    // `amount` - amount of tokens user want to swap
    // `fromAddress` - the user's address. MAY NOT WORK
    // `slippage` - from user's setting
    function executeSwap1Inch(
        address[2] memory path, // path[0] - from token, path[1] - to token
        OrderType orderType, 
        uint256 assetInOffered, // token amount or value of ETH (Form API response).
        uint256 fees, 
        address licenseeVault,
        address to, // 1Inch router. Form API response.
        bytes memory data   // Form API response.
    ) external payable {
        uint256 gasA = gasleft();
        uint256 receivedFees;
        uint256 value;
        
        if(orderType == OrderType.EthForTokens){
            require(msg.value >= (assetInOffered + fees), "Payment = assetInOffered + fees");
            receivedFees = msg.value - assetInOffered;
            value = assetInOffered;
        } else {
            require(msg.value >= fees, "fees not received");
            receivedFees = msg.value;
            TransferHelper.safeTransferFrom(path[0], msg.sender, address(this), assetInOffered);
            TransferHelper.safeApprove(path[0],to,assetInOffered);
        }
        
        callTo(to, value, data);
   
        processFee(gasA, receivedFees, 0, licenseeVault, msg.sender);
    }
    
    // user has to approve 1Inch router contract to transfer `assetInOffered` before calling this function 
    // when call `swap` API of 1Inch, you have to set:
    // `fromTokenAddress` - token user want to swap (if user swap ETH use address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
    // `toTokenAddress ` - token user want to receive
    // `amount` - amount of tokens user want to swap
    // `fromAddress` - the user's address
    // `slippage` - from user's setting
    // `destReceiver` - Degen contract address
    function executeCrossExchange1Inch(
        address[2] memory path, // path[0] - from token, path[1] - to token
        OrderType crossOrderType, 
        uint256 assetInOffered, // token amount or value of ETH (Form API response).
        uint256 fees, 
        address licenseeVault,
        address to, // 1Inch router. Form API response.
        bytes memory data,   // Form API response.
        uint256 toDEX,  // destination dex that will be used on foreign chain.
        uint256 deadline
    ) external payable {
        uint256 gasA = gasleft();
        uint256 _crossOrderType = uint256(crossOrderType);
        uint256 value;
        
        if(deadline==0) {
            deadline = block.timestamp + deadlineLimit;
        }
        
        if(crossOrderType == OrderType.EthForTokens || crossOrderType == OrderType.EthForEth){
            require(msg.value >= (assetInOffered + fees), "Payment = assetInOffered + fees");
            fees = msg.value - assetInOffered;
            value = assetInOffered;
        } else {
            require(msg.value >= fees, "fees not received");
            fees = msg.value;
            TransferHelper.safeTransferFrom(path[0], msg.sender, address(this), assetInOffered);
            TransferHelper.safeApprove(path[0],to,assetInOffered);
        }
               
        uint256 balanceUSDT = IERC20(USDT).balanceOf(address(this));
        callTo(to, value, data);
        balanceUSDT = IERC20(USDT).balanceOf(address(this)) - balanceUSDT;  // USDT amount that received from 1Inch swap
        TransferHelper.safeApprove(USDT, address(swapFactory), balanceUSDT);
        
        swapFactory.swap(USDT, path[1], balanceUSDT, msg.sender, _crossOrderType, toDEX, deadline);

        processFee(gasA, fees, 0, licenseeVault, msg.sender);
    }

    function callTo(address to, uint256 value, bytes memory data) internal {
        (bool success,) = to.call{value: value}(data);
        require(success, "call to contract error");
    }

    // If someone accidentally transfer tokens to this contract, the owner will be able to rescue it and refund sender.
    function rescueTokens(address _token) external onlyOwner {
        if (address(0) == _token) {
            payable(msg.sender).transfer(address(this).balance);
        } else {
            uint256 available = IERC20(_token).balanceOf(address(this));
            TransferHelper.safeTransfer(_token, msg.sender, available);
        }
    }

}

Read Contract

Sushi 0x901bd2cc → address
USDT 0xc54e44eb → address
Uni 0x0660acb4 → address
companyVault 0x8a77ba1a → address
feeReceiver 0xb3f00674 → address
getColletedFees 0x447f25ef → uint256
getDeadlineLimit 0x5af9e7c9 → uint256
isOwner 0x8f32d59b → bool
owner 0x8da5cb5b → address
processingFee 0xde1881a8 → uint256
reimbursementContract 0x42d5350b → address
swapFactory 0x7944f944 → address
system 0x95bf75fd → address

Write Contract 16 functions

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

callbackCrossExchange 0x3500ac41
uint256 orderType
address[] path
uint256 assetInOffered
address user
uint256 dexId
uint256 deadline
returns: bool
claimFee 0x99d32fc4
No parameters
returns: uint256
executeCrossExchange 0xc3d73018
address[] path
uint8 orderType
uint256 crossOrderType
uint256 assetInOffered
uint256 fees
uint256 minExpectedAmount
address licenseeVault
uint256[3] dexId_deadline
executeCrossExchange1Inch 0x3d45b7f3
address[2] path
uint8 crossOrderType
uint256 assetInOffered
uint256 fees
address licenseeVault
address to
bytes data
uint256 toDEX
uint256 deadline
executeSwap 0x2ffda2b4
uint8 orderType
address[] path
uint256 assetInOffered
uint256 fees
uint256 minExpectedAmount
address licenseeVault
uint256 dexId
uint256 deadline
executeSwap1Inch 0x4061215d
address[2] path
uint8 orderType
uint256 assetInOffered
uint256 fees
address licenseeVault
address to
bytes data
renounceOwnership 0x715018a6
No parameters
rescueTokens 0x00ae3bf8
address _token
setCompanyVault 0x9c9bb1e3
address _comapnyVault
setDeadlineLimit 0x69fb1075
uint256 limit
setFeeReceiver 0xefdcd974
address _addr
setProcessingFee 0x9461446d
uint256 _processingFees
setReimbursementContract 0x64776276
address _reimbursementContarct
setSwapFactory 0xc34e596f
address _swapFactory
setSystem 0x55837757
address _system
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address