Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x05Fc8174050f0A41dEB7e562187911d45cd5e401
Balance 0 ETH
Nonce 1
Code Size 11404 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

11404 bytes
0x608060405234801561001057600080fd5b50600436106102a05760003560e01c80637535d24611610167578063aaf5eb68116100ce578063c863657d11610087578063c863657d14610674578063dbd1a3c51461068f578063e47dff1e146106a2578063e8a04d0f146106b5578063f7dd20f0146106c8578063fcd0251b146106db57600080fd5b8063aaf5eb68146105ff578063abd59d121461060e578063b77758c614610621578063b80433141461062a578063bd650b7314610645578063c2c4029d1461064d57600080fd5b80638ebf2fd6116101205780638ebf2fd61461059257806392e67595146105ad5780639445baac146105c0578063971f8268146105c957806399248ea7146105dc578063a1bfc8fc146105f757600080fd5b80637535d246146104d857806382109ddb146104f3578063849bd86b146104fb578063895eeccb146105595780638a0dac4a1461056c5780638da5cb5b1461057f57600080fd5b80633fb908891161020b5780634f7314f6116101c45780634f7314f614610483578063516b5df11461048b578063520db9061461049e578063581429f3146104b457806361b90476146104bd5780636ea056a9146104c557600080fd5b80633fb908891461040c578063411557d1146104145780634259258d1461042f57806343d4f09a14610442578063452a93201461045d5780634bc8090b1461047057600080fd5b806314af27bf1161025d57806314af27bf1461036d57806316063ec01461037657806319a1eddc146103a957806320a9f274146103b657806322884e2c146103d657806331be2d9b146103f157600080fd5b806303d25bf5146102a557806306ce1992146102ba578063081ca89c146102d5578063096da832146102dd5780630e57d4ce1461031057806313af40351461035a575b600080fd5b6102b86102b336600461272a565b6106ee565b005b6102c2610742565b6040519081526020015b60405180910390f35b6102c2610862565b6103006102eb3660046127dc565b600c6020526000908152604090205460ff1681565b60405190151581526020016102cc565b600354600454600554610330926001600160a01b03908116928116911683565b604080516001600160a01b03948516815292841660208401529216918101919091526060016102cc565b6102b86103683660046127dc565b6108c7565b6102c260065481565b61039173f939e0a03fb07f59a73314e73794be0e57ac1b4e81565b6040516001600160a01b0390911681526020016102cc565b600d546103009060ff1681565b6103c96103c43660046127f9565b6109cc565b6040516102cc919061287d565b610391732f50d538606fa9edd2b11e2446beb18c9d5846bb81565b61039173c5bddf9843308380375a611c18b50fb9341f502a81565b6102c2610a78565b6103917327b5739e22ad9033bcbf192059122d163b60349d81565b61039161043d36600461289e565b610a94565b61039173fcc5c47be19d06bf83eb04298b026f81069ff65b81565b600254610391906001600160a01b031681565b6102b861047e3660046128f1565b610abe565b6102c2610c90565b6102b861049936600461272a565b610d1a565b6104a6610d62565b6040516102cc929190612926565b6102c260075481565b6102c2610dd1565b6102b86104d336600461295f565b610e34565b6103917399f5acc8ec2da2bc0771c32814eff52b712de1e581565b6102c2610e7c565b610503610edf565b6040516102cc9190600060e082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015292915050565b6102b861056736600461272a565b6110f6565b6102b861057a3660046127dc565b61113e565b600154610391906001600160a01b031681565b61039173f147b8125d2ef93fb6965db97d6746952a13393481565b6102b86105bb366004612999565b611243565b6102c260085481565b6102c26105d736600461272a565b611280565b61039173bf319ddc2edc1eb6fdf9910e39b37be221c8805f81565b6102c26113b4565b6102c2670de0b6b3a764000081565b6102b861061c36600461289e565b6114c9565b6102c260005481565b61039173e9a115b77a1057c918f997c32663fdce24fb873f81565b6102b8611645565b6103917f000000000000000000000000b911fcce8d5afcec73e072653107260bb23c1ee881565b610391735f3b5dfeb7b28cdbd7faba78963ee202a494e2a281565b6102b861069d3660046129b6565b611705565b6103c96106b03660046127f9565b61175a565b6103916106c336600461289e565b61187a565b6103916106d636600461289e565b61188a565b6102b86106e93660046129ef565b61189a565b6001546001600160a01b031633148061071157506002546001600160a01b031633145b6107365760405162461bcd60e51b815260040161072d90612a3a565b60405180910390fd5b61073f81611974565b50565b6040516370a0823160e01b81527327b5739e22ad9033bcbf192059122d163b60349d600482015260009073fcc5c47be19d06bf83eb04298b026f81069ff65b906370a0823190602401602060405180830381865afa1580156107a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cc9190612a5a565b6040516370a0823160e01b815273e9a115b77a1057c918f997c32663fdce24fb873f600482015273fcc5c47be19d06bf83eb04298b026f81069ff65b906370a0823190602401602060405180830381865afa15801561082f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108539190612a5a565b61085d9190612a89565b905090565b600061085d600a8054806020026020016040519081016040528092919081815260200182805480156108bd57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161089f575b5050505050611280565b6001546001600160a01b031633146108f15760405162461bcd60e51b815260040161072d90612a9c565b6001600160a01b0381166109365760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015260640161072d565b6001546001600160a01b03908116908216036109825760405162461bcd60e51b815260206004820152600b60248201526a185b1c9958591e481cd95d60aa1b604482015260640161072d565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f50146d0e3c60aa1d17a70635b05494f864e86144a2201275021014fbf08bafe290600090a250565b6109f060405180606001604052806000815260200160008152602001600081525090565b600d5460ff1615610a34578160a001518260c00151610a0f9190612abc565b8251610a2390670de0b6b3a7640000612acf565b610a2d9190612ae6565b8152610a5a565b60c08201518251610a4d90670de0b6b3a7640000612acf565b610a579190612ae6565b81525b8051610a6e90670de0b6b3a7640000612abc565b6040820152919050565b6000610a8762093a8042612ae6565b61085d9062093a80612acf565b600b8181548110610aa457600080fd5b6000918252602090912001546001600160a01b0316905081565b6001546001600160a01b03163314610ae85760405162461bcd60e51b815260040161072d90612a9c565b60208201516040830151835160009291610b0191612a89565b610b0b9190612a89565b9050670de0b6b3a76400008114610b645760405162461bcd60e51b815260206004820152601860248201527f61646d696e46656553706c6974732073756d2021313030250000000000000000604482015260640161072d565b602082015160408301518351610b7a9190612a89565b610b849190612a89565b9050670de0b6b3a76400008114610bdd5760405162461bcd60e51b815260206004820152601d60248201527f766f7465496e63656e7469766553706c6974732073756d202131303025000000604482015260640161072d565b610c8b610be86119bf565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000b911fcce8d5afcec73e072653107260bb23c1ee816600482015273f939e0a03fb07f59a73314e73794be0e57ac1b4e906370a0823190602401602060405180830381865afa158015610c60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c849190612a5a565b8585611a08565b505050565b6040516370a0823160e01b815273f147b8125d2ef93fb6965db97d6746952a1339346004820152600090735f3b5dfeb7b28cdbd7faba78963ee202a494e2a2906370a0823190602401602060405180830381865afa158015610cf6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085d9190612a5a565b6001546001600160a01b0316331480610d3d57506002546001600160a01b031633145b610d595760405162461bcd60e51b815260040161072d90612a3a565b61073f81611bbf565b610d8660405180606001604052806000815260200160008152602001600081525090565b610daa60405180606001604052806000815260200160008152602001600081525090565b6000610db4610edf565b9050610dbf816109cc565b9250610dca8161175a565b9150509091565b600061085d60098054806020026020016040519081016040528092919081815260200182805480156108bd576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161089f575050505050611280565b6001546001600160a01b03163314610e5e5760405162461bcd60e51b815260040161072d90612a9c565b600154610e78906001600160a01b03848116911683611c0a565b5050565b600061085d600b8054806020026020016040519081016040528092919081815260200182805480156108bd576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161089f575050505050611280565b610f1f6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610f27610c90565b60c0820152610f34610742565b81526040516370a0823160e01b81527399f5acc8ec2da2bc0771c32814eff52b712de1e5600482015273fcc5c47be19d06bf83eb04298b026f81069ff65b906370a0823190602401602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd9190612a5a565b6020820152610fca610e7c565b608082018190526020820151825160009291610fe591612a89565b610fef9190612a89565b9050600073fcc5c47be19d06bf83eb04298b026f81069ff65b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611045573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110699190612a5a565b90508082106110b25760405162461bcd60e51b81526020600482015260156024820152740a0c2e4e8dccae484c2d8c2dcc6caa8dede90d2ced605b1b604482015260640161072d565b6110bc8282612abc565b60408401526110c96113b4565b6060840181905260c08401516110e0908390612abc565b6110ea9190612abc565b60a08401525090919050565b6001546001600160a01b031633148061111957506002546001600160a01b031633145b6111355760405162461bcd60e51b815260040161072d90612a3a565b61073f81611c5c565b6001546001600160a01b031633146111685760405162461bcd60e51b815260040161072d90612a9c565b6001600160a01b0381166111ad5760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015260640161072d565b6002546001600160a01b03908116908216036111f95760405162461bcd60e51b815260206004820152600b60248201526a185b1c9958591e481cd95d60aa1b604482015260640161072d565b600280546001600160a01b0319166001600160a01b0383169081179091556040517fe6c09ffe4572dc9ceaa5ddde4ae41befa655d6fdfe8052077af0970f700e942e90600090a250565b6001546001600160a01b0316331461126d5760405162461bcd60e51b815260040161072d90612a9c565b600d805460ff1916911515919091179055565b600080600061128d610a78565b905060005b84518110156113ab576000732f50d538606fa9edd2b11e2446beb18c9d5846bb6001600160a01b0316630f467f9873f147b8125d2ef93fb6965db97d6746952a1339348885815181106112e7576112e7612b08565b60200260200101516040518363ffffffff1660e01b81526004016113219291906001600160a01b0392831681529116602082015260400190565b606060405180830381865afa15801561133e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113629190612b1e565b6040810151909150806113788562093a80612a89565b10156113a1576113888482612abc565b82516113949190612acf565b61139e9086612a89565b94505b5050600101611292565b50909392505050565b6040516370a0823160e01b815273fcc5c47be19d06bf83eb04298b026f81069ff65b6004820152600090819073c5bddf9843308380375a611c18b50fb9341f502a906370a0823190602401602060405180830381865afa15801561141c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114409190612a5a565b90508073c5bddf9843308380375a611c18b50fb9341f502a6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b99190612a5a565b6114c39190612abc565b91505090565b6001546001600160a01b03163314806114ec57506002546001600160a01b031633145b6115085760405162461bcd60e51b815260040161072d90612a3a565b6040516323b872dd60e01b81523360048201523060248201526044810182905273f939e0a03fb07f59a73314e73794be0e57ac1b4e906323b872dd906064016020604051808303816000875af1158015611566573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158a9190612b5a565b50600080611596610d62565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000b911fcce8d5afcec73e072653107260bb23c1ee81660048201529193509150610c8b90849073f939e0a03fb07f59a73314e73794be0e57ac1b4e906370a08231906024015b602060405180830381865afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e9190612a5a565b8484611a08565b336000908152600c602052604090205460ff168061166d57506001546001600160a01b031633145b8061168257506002546001600160a01b031633145b61168b57600080fd5b600080611696610d62565b91509150610e786116a56119bf565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000b911fcce8d5afcec73e072653107260bb23c1ee816600482015273f939e0a03fb07f59a73314e73794be0e57ac1b4e906370a08231906024016115fd565b6001546001600160a01b0316331461172f5760405162461bcd60e51b815260040161072d90612a9c565b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b61177e60405180606001604052806000815260200160008152602001600081525090565b6000611788610e7c565b611790610862565b611798610dd1565b6117a29190612a89565b6117ac9190612a89565b90506000818460c001516117c09190612abc565b9050806000036117f85760405180606001604052806000815260200160008152602001670de0b6b3a764000081525092505050919050565b6000548451829161180891612acf565b6118129190612ae6565b83528061181d610dd1565b8560a0015161182c9190612abc565b61183e90670de0b6b3a7640000612acf565b6118489190612ae6565b60208401819052835161186390670de0b6b3a7640000612abc565b61186d9190612abc565b6040840152509092915050565b60098181548110610aa457600080fd5b600a8181548110610aa457600080fd5b6001546001600160a01b031633146118c45760405162461bcd60e51b815260040161072d90612a9c565b6001600160a01b038316158015906118e457506001600160a01b03821615155b80156118f857506001600160a01b03811615155b6119355760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a59081d185c99d95d60921b604482015260640161072d565b600380546001600160a01b039485166001600160a01b031991821617909155600480549385169382169390931790925560058054919093169116179055565b61197d81611ca7565b6119995760405162461bcd60e51b815260040161072d90612b77565b6119a56009600061260d565b80516119b890600990602084019061262b565b5051600855565b60006119c9611dea565b6001600160a01b031663a345bf436040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610cf6573d6000803e3d6000fd5b670de0b6b3a76400008311611a1e576000611a20565b825b92506000611a2e8585612a89565b905080600003611a3e5750611bb9565b8315611b10576040516323b872dd60e01b81526001600160a01b037f000000000000000000000000b911fcce8d5afcec73e072653107260bb23c1ee81660048201523060248201526044810185905273f939e0a03fb07f59a73314e73794be0e57ac1b4e906323b872dd906064016020604051808303816000875af1158015611acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aef9190612b5a565b5080611b03670de0b6b3a764000086612acf565b611b0d9190612ae6565b93505b8415611b2b57611b2884670de0b6b3a7640000612abc565b94505b611b3481611e62565b604080516060810182526003546001600160a01b039081168252600454811660208301526005541691810191909152909150611b8d670de0b6b3a7640000611b7c8885612acf565b611b869190612ae6565b8583611ef6565b50611bb5670de0b6b3a7640000611ba48785612acf565b611bae9190612ae6565b84836120d3565b5050505b50505050565b611bc881611ca7565b611be45760405162461bcd60e51b815260040161072d90612b77565b611bf0600a600061260d565b8051611c0390600a90602084019061262b565b5051600655565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c8b9084906123a8565b611c6581611ca7565b611c815760405162461bcd60e51b815260040161072d90612b77565b611c8d600b600061260d565b8051611ca090600b90602084019061262b565b5051600755565b6000805b8251811015611de15760005b81811015611d2957808214158015611d125750838181518110611cdc57611cdc612b08565b60200260200101516001600160a01b0316848381518110611cff57611cff612b08565b60200260200101516001600160a01b0316145b15611d21575060009392505050565b600101611cb7565b50732f50d538606fa9edd2b11e2446beb18c9d5846bb6001600160a01b0316633f9095b7848381518110611d5f57611d5f612b08565b60200260200101516040518263ffffffff1660e01b8152600401611d9291906001600160a01b0391909116815260200190565b602060405180830381865afa925050508015611dcb575060408051601f3d908101601f19168201909252611dc891810190612ba3565b60015b611dd85750600092915050565b50600101611cab565b50600192915050565b600073f147b8125d2ef93fb6965db97d6746952a1339346001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e3e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085d9190612bc6565b600081600003611e7457506000919050565b604051636e553f6560e01b81526004810183905230602482015273bf319ddc2edc1eb6fdf9910e39b37be221c8805f90636e553f65906044016020604051808303816000875af1158015611ecc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef09190612a5a565b92915050565b600083600003611f08575060006120cc565b825115611fbe578251670de0b6b3a764000090611f26908690612acf565b611f309190612ae6565b808452825160405163a9059cbb60e01b81526001600160a01b039091166004820152602481019190915273bf319ddc2edc1eb6fdf9910e39b37be221c8805f9063a9059cbb906044016020604051808303816000875af1158015611f98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fbc9190612b5a565b505b60408301511561207f57670de0b6b3a7640000848460400151611fe19190612acf565b611feb9190612ae6565b604084810182905283810151905163a9059cbb60e01b81526001600160a01b039091166004820152602481019190915273bf319ddc2edc1eb6fdf9910e39b37be221c8805f9063a9059cbb906044016020604051808303816000875af1158015612059573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061207d9190612b5a565b505b82516020808501516040808701518151948552928401919091528201527f1643b2f0e05bac7799b6c5f55f60c7fc0000c2e5851ea330955b85e16ad131869060600160405180910390a150825b9392505050565b6000836000036120e5575060006120cc565b82511561219b578251670de0b6b3a764000090612103908690612acf565b61210d9190612ae6565b808452825160405163a9059cbb60e01b81526001600160a01b039091166004820152602481019190915273bf319ddc2edc1eb6fdf9910e39b37be221c8805f9063a9059cbb906044016020604051808303816000875af1158015612175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121999190612b5a565b505b60208301511561225c57670de0b6b3a76400008484602001516121be9190612acf565b6121c89190612ae6565b602084810182905283015160405163a9059cbb60e01b81526001600160a01b039091166004820152602481019190915273bf319ddc2edc1eb6fdf9910e39b37be221c8805f9063a9059cbb906044016020604051808303816000875af1158015612236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225a9190612b5a565b505b6040830151156123575760408281015190516370a0823160e01b815230600482015273bf319ddc2edc1eb6fdf9910e39b37be221c8805f9163a9059cbb9183906370a0823190602401602060405180830381865afa1580156122c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122e69190612a5a565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015612331573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123559190612b5a565b505b82516020808501516040808701518151948552928401919091528201527ff6ab4ba99b9a696d5b66388f9de7d890cf0abf5a82e0c2a26aaa11840a11a43a9060600160405180910390a19392505050565b60006123fd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661247d9092919063ffffffff16565b905080516000148061241e57508080602001905181019061241e9190612b5a565b610c8b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161072d565b606061248c8484600085612494565b949350505050565b6060824710156124f55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161072d565b600080866001600160a01b031685876040516125119190612c07565b60006040518083038185875af1925050503d806000811461254e576040519150601f19603f3d011682016040523d82523d6000602084013e612553565b606091505b50915091506125648783838761256f565b979650505050505050565b606083156125de5782516000036125d7576001600160a01b0385163b6125d75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161072d565b508161248c565b61248c83838151156125f35781518083602001fd5b8060405162461bcd60e51b815260040161072d9190612c23565b508054600082559060005260206000209081019061073f9190612690565b828054828255906000526020600020908101928215612680579160200282015b8281111561268057825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061264b565b5061268c929150612690565b5090565b5b8082111561268c5760008155600101612691565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156126de576126de6126a5565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561270d5761270d6126a5565b604052919050565b6001600160a01b038116811461073f57600080fd5b6000602080838503121561273d57600080fd5b823567ffffffffffffffff8082111561275557600080fd5b818501915085601f83011261276957600080fd5b81358181111561277b5761277b6126a5565b8060051b915061278c8483016126e4565b81815291830184019184810190888411156127a657600080fd5b938501935b838510156127d057843592506127c083612715565b82825293850193908501906127ab565b98975050505050505050565b6000602082840312156127ee57600080fd5b81356120cc81612715565b600060e0828403121561280b57600080fd5b60405160e0810181811067ffffffffffffffff8211171561282e5761282e6126a5565b8060405250823581526020830135602082015260408301356040820152606083013560608201526080830135608082015260a083013560a082015260c083013560c08201528091505092915050565b81518152602080830151908201526040808301519082015260608101611ef0565b6000602082840312156128b057600080fd5b5035919050565b6000606082840312156128c957600080fd5b6128d16126bb565b905081358152602082013560208201526040820135604082015292915050565b60008060c0838503121561290457600080fd5b61290e84846128b7565b915061291d84606085016128b7565b90509250929050565b8251815260208084015181830152604080850151818401528351606084015290830151608083015282015160a082015260c081016120cc565b6000806040838503121561297257600080fd5b823561297d81612715565b946020939093013593505050565b801515811461073f57600080fd5b6000602082840312156129ab57600080fd5b81356120cc8161298b565b600080604083850312156129c957600080fd5b82356129d481612715565b915060208301356129e48161298b565b809150509250929050565b600080600060608486031215612a0457600080fd5b8335612a0f81612715565b92506020840135612a1f81612715565b91506040840135612a2f81612715565b809150509250925092565b60208082526006908201526510a0b236b4b760d11b604082015260600190565b600060208284031215612a6c57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611ef057611ef0612a73565b60208082526006908201526510a7bbb732b960d11b604082015260600190565b81810381811115611ef057611ef0612a73565b8082028115828204841417611ef057611ef0612a73565b600082612b0357634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060608284031215612b3057600080fd5b612b386126bb565b8251815260208301516020820152604083015160408201528091505092915050565b600060208284031215612b6c57600080fd5b81516120cc8161298b565b602080825260129082015271125b9d985b1a590819d85d59d9481b1a5cdd60721b604082015260600190565b600060208284031215612bb557600080fd5b815180600f0b81146120cc57600080fd5b600060208284031215612bd857600080fd5b81516120cc81612715565b60005b83811015612bfe578181015183820152602001612be6565b50506000910152565b60008251612c19818460208701612be3565b9190910192915050565b6020815260008251806020840152612c42816040850160208701612be3565b601f01601f1916919091016040019291505056fea2646970667358221220cae5ce22a918bf492a9fc306013c7c210349bf57b47a59ea6f1828555e882ac064736f6c63430008190033

Verified Source Code Partial Match

Compiler: v0.8.25+commit.b61c2a91 EVM: istanbul Optimization: Yes (200 runs)
Splitter.sol 498 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {IERC20, SafeERC20} from "contracts/token/ERC20/utils/SafeERC20.sol";

interface IGaugeController {
    struct VotedSlope {
        uint slope;
        uint power;
        uint end;
    }

    function vote_user_slopes(
        address user,
        address gauge
    ) external view returns (VotedSlope memory);

    function gauge_types(address gauge) external view returns (int128);
}

interface IProxy {
    function claimAdminFees() external returns (uint);

    function canClaim() external view returns (bool);
}

interface IVoter {
    function strategy() external view returns (IProxy);
}

interface IVault {
    function deposit(uint amount, address receiver) external returns (uint);

    function asset() external view returns (IERC20);

    function approve(address, uint) external returns (bool);

    function transfer(address, uint) external returns (bool);

    function balanceOf(address) external view returns (uint);
}

contract YCRVSplitter {
    using SafeERC20 for IERC20;

    uint public constant PRECISION = 1e18;
    address public constant VOTER = 0xF147b8125d2ef93FB6965Db97D6746952a133934;
    address public constant POOL = 0x99f5aCc8EC2Da2BC0771c32814EFF52b712de1E5;
    address public constant VE = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2;
    address public constant VAULT = 0x27B5739e22ad9033bcBf192059122d163b60349D;
    IGaugeController public constant GAUGE_CONTROLLER =
        IGaugeController(0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB);
    address public constant YBS = 0xE9A115b77A1057C918F997c32663FdcE24FB873f;
    IERC20 public constant YCRV =
        IERC20(0xFCc5c47bE19d06BF83eB04298b026F81069ff65b);
    IERC20 public constant YVECRV =
        IERC20(0xc5bDdf9843308380375a611c18B50Fb9341f502A);
    IERC20 public constant CRVUSD =
        IERC20(0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E);
    IVault public constant REWARD_TOKEN =
        IVault(0xBF319dDC2Edc1Eb6FDf9910E39b37Be221C8805F); // V3 vault

    address public immutable FEE_BURNER;
    uint public ybsVoteIncentiveRatio = 9e17;
    address public owner = 0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52;
    address public guardian = 0x4444AAAACDBa5580282365e25b16309Bd770ce4a;
    Recipients public recipients;
    uint public ycrvGaugesLength;
    uint public partnerGaugesLength;
    uint public discretionaryGaugesLength;
    address[] public discretionaryGauges;
    address[] public ycrvGauges;
    address[] public partnerGauges;
    mapping(address caller => bool approved) public approvedSplitCallers;
    bool public onlyTokenized = true;

    event AdminFeeSplit(uint ybs, uint treasury, uint remainder);
    event VoteIncentiveSplit(uint ybs, uint treasury, uint remainder);
    event OwnerSet(address indexed owner);
    event GuardianSet(address indexed guardian);

    struct BaseBalances {
        uint ybs;
        uint lp;
        uint loose;
        uint unmigrated;
        uint partners;
        uint untokenized;
        uint veTotal;
    }

    struct Split {
        uint ybsRatio;
        uint treasuryRatio;
        uint remainderRatio;
    }

    struct Recipients {
        address ybs;
        address treasury;
        address remainderTarget;
    }

    constructor(
        address _feeBurner,
        address _receiver2,
        address[] memory ycrvGauges,
        address[] memory partnerGauges,
        address[] memory discretionaryGauges
    ) public {
        _setYCrvGauges(ycrvGauges);
        _setPartnerGauges(partnerGauges);
        _setDiscretionaryGauges(discretionaryGauges);

        recipients.ybs = _receiver2;
        recipients.treasury = 0x93A62dA5a14C80f265DAbC077fCEE437B1a0Efde;
        recipients.remainderTarget = 0x794f80E899c772de9E326eC83cCfD8D94e208B49;
        FEE_BURNER = _feeBurner;

        CRVUSD.approve(address(REWARD_TOKEN), type(uint).max);
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "!Owner");
        _;
    }

    modifier onlyAdmins() {
        require(msg.sender == owner || msg.sender == guardian, "!Admin");
        _;
    }

    /// @notice Split according to on-chain calculations.
    function executeSplit() external {
        require(
            approvedSplitCallers[msg.sender] ||
                msg.sender == owner ||
                msg.sender == guardian
        );
        (
            Split memory adminFeeSplits,
            Split memory voteIncentiveSplits
        ) = getSplits();
        _splitDepositAndSend(
            _claimAdminFees(),
            CRVUSD.balanceOf(FEE_BURNER),
            adminFeeSplits,
            voteIncentiveSplits
        );
    }

    /// @notice Supply manual split values to override on-chain claculations.
    function executeManualSplit(
        Split memory adminFeeSplits,
        Split memory voteIncentiveSplits
    ) external onlyOwner {
        uint total = adminFeeSplits.ybsRatio +
            adminFeeSplits.remainderRatio +
            adminFeeSplits.treasuryRatio;
        require(total == PRECISION, "adminFeeSplits sum !100%");
        total =
            voteIncentiveSplits.ybsRatio +
            voteIncentiveSplits.remainderRatio +
            voteIncentiveSplits.treasuryRatio;
        require(total == PRECISION, "voteIncentiveSplits sum !100%");

        _splitDepositAndSend(
            _claimAdminFees(),
            CRVUSD.balanceOf(FEE_BURNER),
            adminFeeSplits,
            voteIncentiveSplits
        );
    }

    /// @dev Allow admins to manually push crvUSD as admin fees. Nice to have in event
    ///      where admin fees might flow to old receiver.
    function depositAdminFeesAndSplit(
        uint _adminFeeAmount
    ) external onlyAdmins {
        CRVUSD.transferFrom(msg.sender, address(this), _adminFeeAmount);
        (
            Split memory adminFeeSplits,
            Split memory voteIncentiveSplits
        ) = getSplits();

        _splitDepositAndSend(
            _adminFeeAmount,
            CRVUSD.balanceOf(FEE_BURNER),
            adminFeeSplits,
            voteIncentiveSplits
        );
    }

    function _splitDepositAndSend(
        uint adminFeeAmount,
        uint incentiveAmount,
        Split memory adminFeeSplits,
        Split memory voteIncentiveSplits
    ) internal {
        incentiveAmount = incentiveAmount > PRECISION ? incentiveAmount : 0;
        uint total = incentiveAmount + adminFeeAmount;

        if (total == 0) return;
        if (incentiveAmount != 0) {
            CRVUSD.transferFrom(FEE_BURNER, address(this), incentiveAmount);
            incentiveAmount = (incentiveAmount * PRECISION) / total; // Ratio
        }
        if (adminFeeAmount != 0) adminFeeAmount = PRECISION - incentiveAmount; // Ratio
        total = _depositToVault(total);

        Recipients memory _recipients = recipients;
        _sendAdminFees(
            (total * adminFeeAmount) / PRECISION,
            adminFeeSplits,
            _recipients
        );
        _sendVoteIncentives(
            (total * incentiveAmount) / PRECISION,
            voteIncentiveSplits,
            _recipients
        );
    }

    function _sendVoteIncentives(
        uint _amount,
        Split memory splits,
        Recipients memory _recipients
    ) internal returns (uint amount) {
        if (_amount == 0) return 0;
        if (splits.ybsRatio > 0) {
            splits.ybsRatio = (splits.ybsRatio * _amount) / PRECISION;
            REWARD_TOKEN.transfer(_recipients.ybs, splits.ybsRatio);
        }
        if (splits.treasuryRatio > 0) {
            splits.treasuryRatio = (splits.treasuryRatio * _amount) / PRECISION;
            REWARD_TOKEN.transfer(_recipients.treasury, splits.treasuryRatio);
        }
        if (splits.remainderRatio > 0) {
            REWARD_TOKEN.transfer(
                _recipients.remainderTarget,
                REWARD_TOKEN.balanceOf(address(this))
            );
        }
        emit VoteIncentiveSplit(
            splits.ybsRatio,
            splits.treasuryRatio,
            splits.remainderRatio
        );
        return amount;
    }

    function _claimAdminFees() internal returns (uint) {
        return _getProxy().claimAdminFees();
    }

    function _sendAdminFees(
        uint _amount,
        Split memory splits,
        Recipients memory _recipients
    ) internal returns (uint) {
        if (_amount == 0) return 0;
        if (splits.ybsRatio > 0) {
            splits.ybsRatio = (splits.ybsRatio * _amount) / PRECISION;
            REWARD_TOKEN.transfer(_recipients.ybs, splits.ybsRatio);
        }
        // Note: Skip splits.treasuryRatio since it is effectively always hardcoded to 0.
        if (splits.remainderRatio > 0) {
            splits.remainderRatio =
                (splits.remainderRatio * _amount) /
                PRECISION;
            REWARD_TOKEN.transfer(
                _recipients.remainderTarget,
                splits.remainderRatio
            );
        }
        emit AdminFeeSplit(
            splits.ybsRatio,
            splits.treasuryRatio,
            splits.remainderRatio
        );
        return _amount;
    }

    function getBaseBalances() public view returns (BaseBalances memory base) {
        base.veTotal = yearnVeBalance();
        base.ybs = ybsBalance();
        base.lp = YCRV.balanceOf(POOL);
        base.partners = getPartnerVotes();
        uint recognizedPositions = base.ybs + base.lp + base.partners;
        uint ycrvTotalSupply = YCRV.totalSupply();
        require(recognizedPositions < ycrvTotalSupply, "PartnerBalanceTooHigh");
        base.loose = ycrvTotalSupply - recognizedPositions;
        base.unmigrated = unmigrated();
        base.untokenized = base.veTotal - ycrvTotalSupply - base.unmigrated;
        return base;
    }

    function getAdminFeeSplitRatios(
        BaseBalances memory base
    ) public view returns (Split memory splits) {
        if (onlyTokenized) {
            splits.ybsRatio =
                (PRECISION * base.ybs) /
                (base.veTotal - base.untokenized);
        } else {
            splits.ybsRatio = (PRECISION * base.ybs) / (base.veTotal);
        }
        splits.remainderRatio = PRECISION - (splits.ybsRatio);
    }

    function getVoteIncentiveSplitRatios(
        BaseBalances memory base
    ) public view returns (Split memory splits) {
        uint nonVoteIncentiveVotes = getDiscretionaryVotes() +
            getYcrvVotes() +
            getPartnerVotes();
        uint totalVoteIncentiveVotes = base.veTotal - nonVoteIncentiveVotes;
        if (totalVoteIncentiveVotes == 0) return Split(0, 0, PRECISION);
        splits.ybsRatio =
            (base.ybs * ybsVoteIncentiveRatio) /
            totalVoteIncentiveVotes;
        splits.treasuryRatio =
            (PRECISION * (base.untokenized - getDiscretionaryVotes())) /
            totalVoteIncentiveVotes;
        splits.remainderRatio =
            PRECISION -
            splits.ybsRatio -
            splits.treasuryRatio;
    }

    /// @notice Preview split ratios.
    function getSplits()
        public
        view
        returns (Split memory adminFeeSplits, Split memory voteIncentiveSplits)
    {
        BaseBalances memory base = getBaseBalances();
        adminFeeSplits = getAdminFeeSplitRatios(base);
        voteIncentiveSplits = getVoteIncentiveSplitRatios(base);
    }

    /// @dev Deposits full balance of crvUSD.
    /// @param _amount Amount to deposit.
    /// @return amount Total balance of reward token.
    function _depositToVault(uint _amount) internal returns (uint) {
        if (_amount == 0) return 0;
        return REWARD_TOKEN.deposit(_amount, address(this));
    }

    function getDiscretionaryVotes() public view returns (uint) {
        return sumGaugeBias(discretionaryGauges);
    }

    function getPartnerVotes() public view returns (uint) {
        return sumGaugeBias(partnerGauges);
    }

    function getYcrvVotes() public view returns (uint) {
        return sumGaugeBias(ycrvGauges);
    }

    function unmigrated() public view returns (uint) {
        uint migrated = YVECRV.balanceOf(address(YCRV));
        return YVECRV.totalSupply() - migrated;
    }

    function ybsBalance() public view returns (uint) {
        return (YCRV.balanceOf(address(YBS)) + YCRV.balanceOf(address(VAULT)));
    }

    function yearnVeBalance() public view returns (uint) {
        return IERC20(VE).balanceOf(VOTER);
    }

    /// @dev Sum all active bias (veCRV contributed by Yearn) for a list of gauges.
    function sumGaugeBias(address[] memory gauges) public view returns (uint) {
        uint biasTotal;
        uint currentWeekTimestamp = getCurrentWeekStartTime();
        for (uint i; i < gauges.length; i++) {
            IGaugeController.VotedSlope memory slopeData = GAUGE_CONTROLLER
                .vote_user_slopes(VOTER, gauges[i]);
            uint end = slopeData.end;
            if (currentWeekTimestamp + 1 weeks < end)
                biasTotal += slopeData.slope * (end - currentWeekTimestamp);
        }
        return biasTotal;
    }

    function getCurrentWeekStartTime() public view returns (uint) {
        return (block.timestamp / 1 weeks) * 1 weeks;
    }

    /// @notice Manually specify gauges used for yCRV voting.
    function setYCrvGauges(address[] memory _gauges) external onlyAdmins {
        _setYCrvGauges(_gauges);
    }

    function _setYCrvGauges(address[] memory _gauges) internal {
        require(_validateGaugeList(_gauges), "Invalid gauge list");
        delete ycrvGauges;
        ycrvGauges = _gauges;
        ycrvGaugesLength = _gauges.length;
    }

    /// @notice Manually specify gauges used for partner voting.
    function setPartnerGauges(address[] memory _gauges) external onlyAdmins {
        _setPartnerGauges(_gauges);
    }

    function _setPartnerGauges(address[] memory _gauges) internal {
        require(_validateGaugeList(_gauges), "Invalid gauge list");
        delete partnerGauges;
        partnerGauges = _gauges;
        partnerGaugesLength = _gauges.length;
    }

    /// @notice Manually specify gauges that Yearn elects to use its own veCRV balance to vote for.
    function setDiscretionaryGauges(
        address[] memory _gauges
    ) external onlyAdmins {
        _setDiscretionaryGauges(_gauges);
    }

    function _setDiscretionaryGauges(address[] memory _gauges) internal {
        require(_validateGaugeList(_gauges), "Invalid gauge list");
        delete discretionaryGauges;
        discretionaryGauges = _gauges;
        discretionaryGaugesLength = _gauges.length;
    }

    function sweep(IERC20 token, uint amount) external onlyOwner {
        token.safeTransfer(owner, amount);
    }

    function setRecipients(
        address _ybs,
        address _treasury,
        address _remainderTarget
    ) external onlyOwner {
        require(
            _ybs != address(0) &&
                _treasury != address(0) &&
                _remainderTarget != address(0),
            "Invalid target"
        );
        recipients.ybs = _ybs;
        recipients.treasury = _treasury;
        recipients.remainderTarget = _remainderTarget;
    }

    function setApprovedSplitCaller(
        address _caller,
        bool _approved
    ) external onlyOwner {
        approvedSplitCallers[_caller] = _approved;
    }

    function setOnlyTokenized(bool _onlyTokenized) external onlyOwner {
        onlyTokenized = _onlyTokenized;
    }

    function setOwner(address _owner) external onlyOwner {
        require(_owner != address(0), "zero address");
        require(_owner != owner, "already set");
        owner = _owner;
        emit OwnerSet(_owner);
    }

    function setGuardian(address _guardian) external onlyOwner {
        require(_guardian != address(0), "zero address");
        require(_guardian != guardian, "already set");
        guardian = _guardian;
        emit GuardianSet(_guardian);
    }

    function _getProxy() internal returns (IProxy) {
        return IVoter(VOTER).strategy();
    }

    /// @dev Prevents duplicates and unapproved gauges
    function _validateGaugeList(
        address[] memory _gauges
    ) internal returns (bool) {
        for (uint i = 0; i < _gauges.length; i++) {
            for (uint k = 0; k < i; k++) {
                // Loop through only the part of the array that has been processed
                if (i != k && _gauges[i] == _gauges[k]) {
                    return false;
                }
            }
            // Reverts if Curve gov has not approved this address.
            try GAUGE_CONTROLLER.gauge_types(_gauges[i]) {} catch {
                return false;
            }
        }
        return true;
    }
}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount) external returns (bool);
}
SafeERC20.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "contracts/token/ERC20/IERC20.sol";
import "contracts/token/ERC20/extensions/IERC20Permit.sol";
import "contracts/utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 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 {
    using Address for address;

    /**
     * @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @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.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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 silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}
IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

Read Contract

CRVUSD 0x16063ec0 → address
FEE_BURNER 0xc2c4029d → address
GAUGE_CONTROLLER 0x22884e2c → address
POOL 0x7535d246 → address
PRECISION 0xaaf5eb68 → uint256
REWARD_TOKEN 0x99248ea7 → address
VAULT 0x411557d1 → address
VE 0xc863657d → address
VOTER 0x8ebf2fd6 → address
YBS 0xb8043314 → address
YCRV 0x43d4f09a → address
YVECRV 0x31be2d9b → address
approvedSplitCallers 0x096da832 → bool
discretionaryGauges 0xe8a04d0f → address
discretionaryGaugesLength 0x9445baac → uint256
getAdminFeeSplitRatios 0xccb6599a → tuple
getBaseBalances 0x849bd86b → tuple
getCurrentWeekStartTime 0x3fb90889 → uint256
getDiscretionaryVotes 0x61b90476 → uint256
getPartnerVotes 0x82109ddb → uint256
getSplits 0x520db906 → tuple, tuple
getVoteIncentiveSplitRatios 0x2d9586ec → tuple
getYcrvVotes 0x081ca89c → uint256
guardian 0x452a9320 → address
onlyTokenized 0x19a1eddc → bool
owner 0x8da5cb5b → address
partnerGauges 0x4259258d → address
partnerGaugesLength 0x581429f3 → uint256
recipients 0x0e57d4ce → address, address, address
sumGaugeBias 0x971f8268 → uint256
unmigrated 0xa1bfc8fc → uint256
ybsBalance 0x06ce1992 → uint256
ybsVoteIncentiveRatio 0xb77758c6 → uint256
ycrvGauges 0xf7dd20f0 → address
ycrvGaugesLength 0x14af27bf → uint256
yearnVeBalance 0x4f7314f6 → uint256

Write Contract 12 functions

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

depositAdminFeesAndSplit 0xabd59d12
uint256 _adminFeeAmount
executeManualSplit 0x808e7370
tuple adminFeeSplits
tuple voteIncentiveSplits
executeSplit 0xbd650b73
No parameters
setApprovedSplitCaller 0xdbd1a3c5
address _caller
bool _approved
setDiscretionaryGauges 0x03d25bf5
address[] _gauges
setGuardian 0x8a0dac4a
address _guardian
setOnlyTokenized 0x92e67595
bool _onlyTokenized
setOwner 0x13af4035
address _owner
setPartnerGauges 0x895eeccb
address[] _gauges
setRecipients 0xfcd0251b
address _ybs
address _treasury
address _remainderTarget
setYCrvGauges 0x516b5df1
address[] _gauges
sweep 0x6ea056a9
address token
uint256 amount

Recent Transactions

No transactions found for this address