Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x0c6D898ac945E493D25751Ea43BE2c8Beb881D8C
Balance 0 ETH
Nonce 1
Code Size 12022 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

12022 bytes
0x6080604052600436106102195760003560e01c8063715018a61161011d578063c34f36aa116100b0578063f2fde38b1161007f578063f77c479111610064578063f77c47911461066b578063f9f94e341461068b578063fea080bc146106ab57610219565b8063f2fde38b1461062b578063f64db0501461064b57610219565b8063c34f36aa14610583578063c6d3afc9146105a3578063cdf76d5a146105db578063e5711ffc146105fb57610219565b80639596844b116100ec5780639596844b146104f65780639bfd8d6114610516578063ad745fbb14610543578063b43121581461056357610219565b8063715018a61461048e57806372cb5d97146104a35780638456cb59146104c35780638da5cb5b146104d857610219565b806339ebf823116101b05780635c975abb1161017f57806360d54d411161016457806360d54d411461043457806364cf33b8146104545780636a5e26501461047857610219565b80635c975abb146103f35780635e30b8a61461041457610219565b806339ebf823146103685780633f4ba83a1461039e57806351cff8d9146103b3578063585cd34b146103d357610219565b8063294091cd116101ec578063294091cd146102d057806329ecec57146102f05780633952c4bb1461031057806339cfe5ff1461034857610219565b806306cb5b661461021e57806312b32156146102405780631e83409a1461029d5780632912f294146102bd575b600080fd5b34801561022a57600080fd5b5061023e610239366004612ae8565b6106cb565b005b34801561024c57600080fd5b5061028861025b366004612b04565b6001600160a01b039182166000908152600a60209081526040808320939094168252919091522054151590565b60405190151581526020015b60405180910390f35b3480156102a957600080fd5b5061023e6102b8366004612ae8565b6107b7565b61023e6102cb366004612b8c565b610927565b3480156102dc57600080fd5b5061023e6102eb366004612be6565b610b41565b3480156102fc57600080fd5b5061023e61030b366004612ae8565b610c3b565b34801561031c57600080fd5b50600554610330906001600160a01b031681565b6040516001600160a01b039091168152602001610294565b34801561035457600080fd5b50600454610330906001600160a01b031681565b34801561037457600080fd5b50610330610383366004612ae8565b6009602052600090815260409020546001600160a01b031681565b3480156103aa57600080fd5b5061023e610d22565b3480156103bf57600080fd5b5061023e6103ce366004612ae8565b610dff565b3480156103df57600080fd5b5061023e6103ee366004612ae8565b610e0c565b3480156103ff57600080fd5b5060065461028890600160a01b900460ff1681565b34801561042057600080fd5b5061023e61042f366004612b04565b610eef565b34801561044057600080fd5b5061023e61044f366004612ae8565b610f57565b34801561046057600080fd5b5061046a60025481565b604051908152602001610294565b34801561048457600080fd5b5061046a60015481565b34801561049a57600080fd5b5061023e61103e565b3480156104af57600080fd5b5061023e6104be366004612b04565b6110ef565b3480156104cf57600080fd5b5061023e6113a0565b3480156104e457600080fd5b506000546001600160a01b0316610330565b34801561050257600080fd5b5061023e610511366004612c27565b61146d565b34801561052257600080fd5b5061046a610531366004612ae8565b60086020526000908152604090205481565b34801561054f57600080fd5b5061023e61055e366004612b3c565b611625565b34801561056f57600080fd5b5061023e61057e366004612ae8565b61170a565b34801561058f57600080fd5b5061023e61059e366004612ae8565b6117f1565b3480156105af57600080fd5b5061046a6105be366004612b04565b600a60209081526000928352604080842090915290825290205481565b3480156105e757600080fd5b50600654610330906001600160a01b031681565b34801561060757600080fd5b50610288610616366004612ae8565b60076020526000908152604090205460ff1681565b34801561063757600080fd5b5061023e610646366004612ae8565b611a33565b34801561065757600080fd5b5061023e610666366004612b04565b611b71565b34801561067757600080fd5b50600354610330906001600160a01b031681565b34801561069757600080fd5b5061023e6106a6366004612ae8565b612017565b3480156106b757600080fd5b5061023e6106c6366004612d17565b6120fe565b6000546001600160a01b0316331461072a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6003546001600160a01b03828116911614156107885760405162461bcd60e51b815260206004820152601960248201527f436f6e74726f6c6c657220616c726561647920657869737473000000000000006044820152606401610721565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600860205260409020541561081d5760405162461bcd60e51b815260206004820152601060248201527f4e6f7420796574206d69677261746564000000000000000000000000000000006044820152606401610721565b336000908152600a602090815260408083206001600160a01b03851684529091529020548061088e5760405162461bcd60e51b815260206004820152600860248201527f4e6f20636c61696d0000000000000000000000000000000000000000000000006044820152606401610721565b336000818152600a602090815260408083206001600160a01b03878116855290835281842084905560099092529091205416906108cd908290846121d4565b60408051600081526001600160a01b0380861660208301528316918101919091523360608201527f415f0af8f5b6deaac4fa61971b0153fa777da7c922b5f0031947b017bd0658d1906080015b60405180910390a1505050565b600654600160a01b900460ff161561096a5760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610721565b60015442106109a65760405162461bcd60e51b8152602060048201526008602482015267155b9b1bd8dad95960c21b6044820152606401610721565b6001600160a01b038416600090815260076020526040902054849060ff16610a105760405162461bcd60e51b815260206004820152600e60248201527f4e6f7420726567697374657265640000000000000000000000000000000000006044820152606401610721565b604051633af32abf60e01b81526001600160a01b03808816600483015286918891831690633af32abf9060240160206040518083038186803b158015610a5557600080fd5b505afa158015610a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8d9190612cf7565b610ad95760405162461bcd60e51b815260206004820152600d60248201527f4e6f742077686974656c697374000000000000000000000000000000000000006044820152606401610721565b60003411610b295760405162461bcd60e51b815260206004820152600860248201527f4e6f2076616c75650000000000000000000000000000000000000000000000006044820152606401610721565b610b37883489898989612282565b5050505050505050565b600654600160a01b900460ff1615610b845760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610721565b6001544210610bc05760405162461bcd60e51b8152602060048201526008602482015267155b9b1bd8dad95960c21b6044820152606401610721565b6001600160a01b038116600090815260076020526040902054819060ff16610c2a5760405162461bcd60e51b815260206004820152600e60248201527f4e6f7420726567697374657265640000000000000000000000000000000000006044820152606401610721565b610c35848385612420565b50505050565b6000546001600160a01b03163314610c955760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6006546001600160a01b0382811691161415610cf35760405162461bcd60e51b815260206004820152601760248201527f526563656976657220616c7265616479206578697374730000000000000000006044820152606401610721565b6006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600654600160a01b900460ff16610d7b5760405162461bcd60e51b815260206004820152600a60248201527f4e6f7420706175736564000000000000000000000000000000000000000000006044820152606401610721565b6000546001600160a01b03163314610dd55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b600680547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b610e09338261255a565b50565b6000546001600160a01b03163314610e665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6001600160a01b03811660009081526007602052604090205460ff16610ece5760405162461bcd60e51b815260206004820152601660248201527f4164617074657220646f6573206e6f74206578697374000000000000000000006044820152606401610721565b6001600160a01b03166000908152600760205260409020805460ff19169055565b6000546001600160a01b03163314610f495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b610f53828261255a565b5050565b6000546001600160a01b03163314610fb15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6001600160a01b03811660009081526007602052604090205460ff161561101a5760405162461bcd60e51b815260206004820152601660248201527f4164617074657220616c726561647920657869737473000000000000000000006044820152606401610721565b6001600160a01b03166000908152600760205260409020805460ff19166001179055565b6000546001600160a01b031633146110985760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031633146111495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b600654600160a01b900460ff161561118c5760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610721565b6003546040517fcbca47db0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301529091169063cbca47db9060240160206040518083038186803b1580156111ea57600080fd5b505afa1580156111fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112229190612cf7565b61126e5760405162461bcd60e51b815260206004820152601160248201527f4e6f7420656e736f2073747261746567790000000000000000000000000000006044820152606401610721565b6001600160a01b038281166000908152600960205260409020541615611365576001600160a01b03828116600090815260096020526040908190205490516370a0823160e01b81523060048201529116906370a082319060240160206040518083038186803b1580156112e057600080fd5b505afa1580156112f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113189190612d2f565b156113655760405162461bcd60e51b815260206004820152600b60248201527f416c7265616479207365740000000000000000000000000000000000000000006044820152606401610721565b6001600160a01b039182166000908152600960205260409020805473ffffffffffffffffffffffffffffffffffffffff191691909216179055565b600654600160a01b900460ff16156113e35760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610721565b6000546001600160a01b0316331461143d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b600680547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b179055565b600654600160a01b900460ff16156114b05760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610721565b60015442106114ec5760405162461bcd60e51b8152602060048201526008602482015267155b9b1bd8dad95960c21b6044820152606401610721565b6001600160a01b038116600090815260076020526040902054819060ff166115565760405162461bcd60e51b815260206004820152600e60248201527f4e6f7420726567697374657265640000000000000000000000000000000000006044820152606401610721565b82518451146115a75760405162461bcd60e51b815260206004820152601060248201527f496e636f727265637420617272617973000000000000000000000000000000006044820152606401610721565b60005b845181101561161e5761160c8582815181106115d657634e487b7160e01b600052603260045260246000fd5b6020026020010151848684815181106115ff57634e487b7160e01b600052603260045260246000fd5b6020026020010151612420565b8061161681612e46565b9150506115aa565b5050505050565b600654600160a01b900460ff16156116685760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610721565b60015442106116a45760405162461bcd60e51b8152602060048201526008602482015267155b9b1bd8dad95960c21b6044820152606401610721565b6005546001600160a01b031633146116fe5760405162461bcd60e51b815260206004820152600c60248201527f57726f6e672073656e64657200000000000000000000000000000000000000006044820152606401610721565b610c35848484846126d8565b6000546001600160a01b031633146117645760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6004546001600160a01b03828116911614156117c25760405162461bcd60e51b815260206004820152601c60248201527f47656e65726963526f7574657220616c726561647920657869737473000000006044820152606401610721565b6004805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600654600160a01b900460ff1661184a5760405162461bcd60e51b815260206004820152600a60248201527f4e6f7420706175736564000000000000000000000000000000000000000000006044820152606401610721565b6000546001600160a01b031633146118a45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6006546001600160a01b03166118fc5760405162461bcd60e51b815260206004820152601a60248201527f456d657267656e6379207265636569766572206e6f74207365740000000000006044820152606401610721565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b15801561193e57600080fd5b505afa158015611952573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119769190612d2f565b9050600081116119c85760405162461bcd60e51b815260206004820152600a60248201527f4e6f2062616c616e6365000000000000000000000000000000000000000000006044820152606401610721565b6006546119e2906001600160a01b038481169116836121d4565b600654604080516001600160a01b0385811682526020820185905290921682820152517fe867888317bf4f4146f3b808c69edefd51fe7ffa0ecc4bab35dbff20db09533e9181900360600190a15050565b6000546001600160a01b03163314611a8d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6001600160a01b038116611b095760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610721565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600654600160a01b900460ff1615611bb45760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610721565b6000546001600160a01b03163314611c0e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b600154421015611c865760405162461bcd60e51b815260206004820152602360248201527f54696d656c6f636b236f6e6c79556e6c6f636b65643a206e6f7420756e6c6f6360448201527f6b656400000000000000000000000000000000000000000000000000000000006064820152608401610721565b6001600160a01b038116600090815260076020526040902054819060ff16611cf05760405162461bcd60e51b815260206004820152600e60248201527f4e6f7420726567697374657265640000000000000000000000000000000000006044820152606401610721565b604051633af32abf60e01b81526001600160a01b03808516600483015283918591831690633af32abf9060240160206040518083038186803b158015611d3557600080fd5b505afa158015611d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6d9190612cf7565b611db95760405162461bcd60e51b815260206004820152600d60248201527f4e6f742077686974656c697374000000000000000000000000000000000000006044820152606401610721565b6001600160a01b038086166000908152600960205260409020541680611e215760405162461bcd60e51b815260206004820152601860248201527f5374726174656779206e6f7420696e697469616c697a656400000000000000006044820152606401610721565b6001600160a01b0386811660009081526008602052604080822080549083905590516370a0823160e01b815230600482015290928416906370a082319060240160206040518083038186803b158015611e7957600080fd5b505afa158015611e8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb19190612d2f565b600454909150611ece906001600160a01b038a81169116846121d4565b600354600480546040517f1ae1bafd0000000000000000000000000000000000000000000000000000000081526001600160a01b038781169382019390935290821660248201528a82166044820152898216606482015260848101859052911690631ae1bafd9060a401600060405180830381600087803b158015611f5257600080fd5b505af1158015611f66573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092506001600160a01b03861691506370a082319060240160206040518083038186803b158015611fac57600080fd5b505afa158015611fc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fe49190612d2f565b905082611ff18383612e03565b1461200c57634e487b7160e01b600052600160045260246000fd5b505050505050505050565b6000546001600160a01b031633146120715760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6005546001600160a01b03828116911614156120cf5760405162461bcd60e51b815260206004820152601a60248201527f436f6f7264696e61746f7220616c7265616479206578697374730000000000006044820152606401610721565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633146121585760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b60025442106121cf5760405162461bcd60e51b815260206004820152602260248201527f54696d656c6f636b236f6e6c794d6f646966793a2063616e6e6f74206d6f646960448201527f66790000000000000000000000000000000000000000000000000000000000006064820152608401610721565b600155565b6040516001600160a01b03831660248201526044810182905261227d9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612799565b505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038816906370a082319060240160206040518083038186803b1580156122c457600080fd5b505afa1580156122d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fc9190612d2f565b6040517fa9d424e20000000000000000000000000000000000000000000000000000000081526001600160a01b038981166004830152868116602483015260448201869052606482018590529192509086169063a9d424e29088906084016000604051808303818588803b15801561237357600080fd5b505af1158015612387573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600093508492506001600160a01b038b1691506370a082319060240160206040518083038186803b1580156123d057600080fd5b505afa1580156123e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124089190612d2f565b6124129190612e03565b9050610b37338988846126d8565b604051633af32abf60e01b81526001600160a01b03808516600483015283918591831690633af32abf9060240160206040518083038186803b15801561246557600080fd5b505afa158015612479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249d9190612cf7565b6124e95760405162461bcd60e51b815260206004820152600d60248201527f4e6f742077686974656c697374000000000000000000000000000000000000006044820152606401610721565b600083116125395760405162461bcd60e51b815260206004820152600960248201527f4e6f20616d6f756e7400000000000000000000000000000000000000000000006044820152606401610721565b61254e6001600160a01b03861633308661287e565b61161e338686866126d8565b6001600160a01b0381166000908152600860205260409020546125bf5760405162461bcd60e51b815260206004820152600e60248201527f4e6f7420726566756e6461626c650000000000000000000000000000000000006044820152606401610721565b6001600160a01b038083166000908152600a6020908152604080832093851683529290522054806126325760405162461bcd60e51b815260206004820152600860248201527f4e6f207374616b650000000000000000000000000000000000000000000000006044820152606401610721565b6001600160a01b038084166000908152600a602090815260408083209386168352928152828220829055600890529081208054839290612673908490612e03565b9091555061268d90506001600160a01b03831684836121d4565b604080516001600160a01b038085168252602082018490528516918101919091527fb44b3631755227290f8fbd7b248fa4be405129d15351313e3c332a3fb99194179060600161091a565b6001600160a01b038085166000908152600a602090815260408083209387168352929052908120805483929061270f908490612deb565b90915550506001600160a01b0383166000908152600860205260408120805483929061273c908490612deb565b9091555050604080516001600160a01b03848116825285811660208301528183018490528616606082015290517f751f7c1e1facd3028e03b5a9e2e34e63fb2f229f99b85eec19864b950ac671d09181900360800190a150505050565b60006127ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128cf9092919063ffffffff16565b80519091501561227d578080602001905181019061280c9190612cf7565b61227d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610721565b6040516001600160a01b0380851660248301528316604482015260648101829052610c359085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612219565b60606128de84846000856128e8565b90505b9392505050565b6060824710156129605760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610721565b61296985612a2e565b6129b55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610721565b600080866001600160a01b031685876040516129d19190612d47565b60006040518083038185875af1925050503d8060008114612a0e576040519150601f19603f3d011682016040523d82523d6000602084013e612a13565b606091505b5091509150612a23828286612a38565b979650505050505050565b803b15155b919050565b60608315612a475750816128e1565b825115612a575782518084602001fd5b8160405162461bcd60e51b81526004016107219190612d63565b8035612a3381612eab565b600082601f830112612a8c578081fd5b81356020612aa1612a9c83612dc7565b612d96565b8281528181019085830183850287018401881015612abd578586fd5b855b85811015612adb57813584529284019290840190600101612abf565b5090979650505050505050565b600060208284031215612af9578081fd5b81356128e181612eab565b60008060408385031215612b16578081fd5b8235612b2181612eab565b91506020830135612b3181612eab565b809150509250929050565b60008060008060808587031215612b51578182fd5b8435612b5c81612eab565b93506020850135612b6c81612eab565b92506040850135612b7c81612eab565b9396929550929360600135925050565b600080600080600060a08688031215612ba3578081fd5b8535612bae81612eab565b94506020860135612bbe81612eab565b93506040860135612bce81612eab565b94979396509394606081013594506080013592915050565b600080600060608486031215612bfa578283fd5b8335612c0581612eab565b9250602084013591506040840135612c1c81612eab565b809150509250925092565b600080600060608486031215612c3b578283fd5b833567ffffffffffffffff80821115612c52578485fd5b818601915086601f830112612c65578485fd5b81356020612c75612a9c83612dc7565b82815281810190858301838502870184018c1015612c9157898afd5b8996505b84871015612cbc578035612ca881612eab565b835260019690960195918301918301612c95565b5097505087013592505080821115612cd2578384fd5b50612cdf86828701612a7c565b925050612cee60408501612a71565b90509250925092565b600060208284031215612d08578081fd5b815180151581146128e1578182fd5b600060208284031215612d28578081fd5b5035919050565b600060208284031215612d40578081fd5b5051919050565b60008251612d59818460208701612e1a565b9190910192915050565b6000602082528251806020840152612d82816040850160208701612e1a565b601f01601f19169190910160400192915050565b604051601f8201601f1916810167ffffffffffffffff81118282101715612dbf57612dbf612e95565b604052919050565b600067ffffffffffffffff821115612de157612de1612e95565b5060209081020190565b60008219821115612dfe57612dfe612e7f565b500190565b600082821015612e1557612e15612e7f565b500390565b60005b83811015612e35578181015183820152602001612e1d565b83811115610c355750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612e7857612e78612e7f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e0957600080fdfea26469706673582212203e7c18497e5b35a346e1fa7e9f5e556c0a91a959302ad865d0142fdb6fbb738364736f6c63430008020033

Verified Source Code Full Match

Compiler: v0.8.2+commit.661d1103 EVM: istanbul Optimization: Yes (2000 runs)
Ownable.sol 70 lines
// SPDX-License-Identifier: WTFPL

pragma solidity ^0.8.0;

import "../ecosystem/openzeppelin/utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function _setOwner(address owner_) 
        internal
    {
        _owner = owner_;
        emit OwnershipTransferred(address(0), owner_);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}
Timelocked.sol 43 lines
// SPDX-License-Identifier: WTFPL
import "./Ownable.sol";
pragma solidity >=0.8.0;


contract Timelocked is Ownable {

    uint256 public unlocked; // timestamp unlock migration
    uint256 public modify;   // timestamp disallow changes

    /**
    * @dev Require unlock time met
    */
    modifier onlyUnlocked() {
        require(block.timestamp >= unlocked, "Timelock#onlyUnlocked: not unlocked");
        _;
    }

    /**
    * @dev Require modifier time not met
    */
    modifier onlyModify() {
        require(block.timestamp < modify, "Timelock#onlyModify: cannot modify");
        _;
    }

    constructor(uint256 unlock_, uint256 modify_, address owner_) {
        require(unlock_ > block.timestamp, 'Timelock#not greater');
        unlocked = unlock_;
        modify = modify_;
        _setOwner(owner_);
    }

    function updateUnlock(
        uint256 unlock_
    ) 
        public
        onlyOwner
        onlyModify
    {
        unlocked = unlock_;
    }
}
IAdapter.sol 23 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;
pragma experimental ABIEncoderV2;

interface IAdapter {
    struct Call {
        address target;
        bytes callData;
    }

    function outputTokens(address inputToken) external view returns (address[] memory outputs);

    function encodeMigration(address _genericRouter, address _strategy, address _lp, uint256 _amount)
        external view returns (Call[] memory calls);

    function encodeWithdraw(address _lp, uint256 _amount) external view returns (Call[] memory calls);

    function buy(address _lp, address _exchange, uint256 _minAmountOut, uint256 _deadline) external payable;

    function getAmountOut(address _lp, address _exchange, uint256 _amountIn) external returns (uint256);

    function isWhitelisted(address _token) external view returns (bool);
}
LiquidityMigrationV2.sol 313 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;

import { SafeERC20, IERC20 } from "../ecosystem/openzeppelin/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IAdapter.sol";
import "./interfaces/IMigrationController.sol";
import "./interfaces/ILiquidityMigrationV2.sol";
import "../helpers/Timelocked.sol";

contract LiquidityMigrationV2 is ILiquidityMigrationV2, Timelocked {
    using SafeERC20 for IERC20;

    address public controller;
    address public genericRouter;
    address public migrationCoordinator;
    address public emergencyReceiver;

    bool public paused;
    mapping (address => bool) public adapters; // adapter -> bool
    mapping (address => uint256) public totalStaked; // lp -> total staked
    mapping (address => address) public strategies; // lp -> enso strategy
    mapping (address => mapping (address => uint256)) public staked; // user -> lp -> stake

    event Staked(address adapter, address strategy, uint256 amount, address account);
    event Migrated(address adapter, address lp, address strategy, address account);
    event Created(address adapter, address lp, address strategy, address account);
    event Refunded(address lp, uint256 amount, address account);
    event EmergencyMigration(address lp, uint256 amount, address receiver);

    /**
    * @dev Require adapter registered
    */
    modifier onlyRegistered(address adapter) {
        require(adapters[adapter], "Not registered");
        _;
    }

    /**
    * @dev Require adapter allows lp
    */
    modifier onlyWhitelisted(address adapter, address lp) {
        require(IAdapter(adapter).isWhitelisted(lp), "Not whitelist");
        _;
    }

    modifier onlyLocked() {
        require(block.timestamp < unlocked, "Unlocked");
        _;
    }

    modifier isPaused() {
        require(paused, "Not paused");
        _;
    }

    modifier notPaused() {
        require(!paused, "Paused");
        _;
    }

    constructor(
        address[] memory adapters_,
        uint256 unlock_,
        uint256 modify_
    )
        Timelocked(unlock_, modify_, msg.sender)
    {
        for (uint256 i = 0; i < adapters_.length; i++) {
            adapters[adapters_[i]] = true;
        }
    }

    function setStrategy(address lp, address strategy) external onlyOwner notPaused {
        require(
            IMigrationController(controller).initialized(strategy),
            "Not enso strategy"
        );
        if (strategies[lp] != address(0)) {
          // This value can be changed as long as no migration is in progress
          require(IERC20(strategies[lp]).balanceOf(address(this)) == 0, "Already set");
        }
        strategies[lp] = strategy;
    }

    function setStake(
        address user,
        address lp,
        address adapter,
        uint256 amount
    )
        external
        override
        notPaused
        onlyLocked
    {
        require(msg.sender == migrationCoordinator, "Wrong sender");
        _stake(user, lp, adapter, amount);
    }

    function stake(
        address lp,
        uint256 amount,
        address adapter
    )
        external
        notPaused
        onlyLocked
        onlyRegistered(adapter)
    {
        _transferFromAndStake(lp, adapter, amount);
    }

    function batchStake(
        address[] memory lps,
        uint256[] memory amounts,
        address adapter
    )
        external
        notPaused
        onlyLocked
        onlyRegistered(adapter)
    {
        require(lps.length == amounts.length, "Incorrect arrays");
        for (uint256 i = 0; i < lps.length; i++) {
            _transferFromAndStake(lps[i], adapter, amounts[i]);
        }
    }

    function buyAndStake(
        address lp,
        address adapter,
        address exchange,
        uint256 minAmountOut,
        uint256 deadline
    )
        external
        payable
        notPaused
        onlyLocked
        onlyRegistered(adapter)
        onlyWhitelisted(adapter, lp)
    {
        require(msg.value > 0, "No value");
        _buyAndStake(lp, msg.value, adapter, exchange, minAmountOut, deadline);
    }

    function migrateAll(
        address lp,
        address adapter
    )
        external
        override
        notPaused
        onlyOwner
        onlyUnlocked
        onlyRegistered(adapter)
        onlyWhitelisted(adapter, lp)
    {
        address strategy = strategies[lp];
        require(strategy != address(0), "Strategy not initialized");
        uint256 totalStake = totalStaked[lp];
        delete totalStaked[lp];
        uint256 strategyBalanceBefore = IStrategy(strategy).balanceOf(address(this));
        IERC20(lp).safeTransfer(genericRouter, totalStake);
        IMigrationController(controller).migrate(IStrategy(strategy), IStrategyRouter(genericRouter), IERC20(lp), IAdapter(adapter), totalStake);
        uint256 strategyBalanceAfter = IStrategy(strategy).balanceOf(address(this));
        assert((strategyBalanceAfter - strategyBalanceBefore) == totalStake);
    }

    function refund(address user, address lp) external onlyOwner {
        _refund(user, lp);
    }

    function withdraw(address lp) external {
        _refund(msg.sender, lp);
    }

    function claim(address lp) external {
        require(totalStaked[lp] == 0, "Not yet migrated");
        uint256 amount = staked[msg.sender][lp];
        require(amount > 0, "No claim");
        delete staked[msg.sender][lp];

        address strategy = strategies[lp];
        IERC20(strategy).safeTransfer(msg.sender, amount);
        emit Migrated(address(0), lp, strategy, msg.sender);
    }

    function emergencyMigrate(IERC20 lp) external isPaused onlyOwner {
        require(emergencyReceiver != address(0), "Emergency receiver not set");
        uint256 balance = lp.balanceOf(address(this));
        require(balance > 0, "No balance");
        lp.safeTransfer(emergencyReceiver, balance);
        emit EmergencyMigration(address(lp), balance, emergencyReceiver);
    }

    function pause() external notPaused onlyOwner {
        paused = true;
    }

    function unpause() external isPaused onlyOwner {
        paused = false;
    }

    function _stake(
        address user,
        address lp,
        address adapter,
        uint256 amount
    )
        internal
    {
        staked[user][lp] += amount;
        totalStaked[lp] += amount;
        emit Staked(adapter, lp, amount, user);
    }

    function _transferFromAndStake(
        address lp,
        address adapter,
        uint256 amount
    )
        internal
        onlyWhitelisted(adapter, lp)
    {
        require(amount > 0, "No amount");
        IERC20(lp).safeTransferFrom(msg.sender, address(this), amount);
        _stake(msg.sender, lp, adapter, amount);
    }

    function _buyAndStake(
        address lp,
        uint256 amount,
        address adapter,
        address exchange,
        uint256 minAmountOut,
        uint256 deadline
    )
        internal
    {
        uint256 balanceBefore = IERC20(lp).balanceOf(address(this));
        IAdapter(adapter).buy{value: amount}(lp, exchange, minAmountOut, deadline);
        uint256 amountAdded = IERC20(lp).balanceOf(address(this)) - balanceBefore;
        _stake(msg.sender, lp, adapter, amountAdded);
    }

    function _refund(address user, address lp) internal {
        require(totalStaked[lp] > 0, "Not refundable");
        uint256 amount = staked[user][lp];
        require(amount > 0, "No stake");
        delete staked[user][lp];
        totalStaked[lp] -= amount;

        IERC20(lp).safeTransfer(user, amount);
        emit Refunded(lp, amount, user);
    }

    function updateController(address newController)
        external
        onlyOwner
    {
        require(controller != newController, "Controller already exists");
        controller = newController;
    }

    function updateGenericRouter(address newGenericRouter)
        external
        onlyOwner
    {
        require(genericRouter != newGenericRouter, "GenericRouter already exists");
        genericRouter = newGenericRouter;
    }

    function updateCoordinator(address newCoordinator)
        external
        onlyOwner
    {
        require(migrationCoordinator != newCoordinator, "Coordinator already exists");
        migrationCoordinator = newCoordinator;
    }

    function updateEmergencyReceiver(address newReceiver)
        external
        onlyOwner
    {
        require(emergencyReceiver != newReceiver, "Receiver already exists");
        emergencyReceiver = newReceiver;
    }

    function addAdapter(address adapter)
        external
        onlyOwner
    {
        require(!adapters[adapter], "Adapter already exists");
        adapters[adapter] = true;
    }

    function removeAdapter(address adapter)
        external
        onlyOwner
    {
        require(adapters[adapter], "Adapter does not exist");
        adapters[adapter] = false;
    }

    function hasStaked(address account, address lp)
        external
        view
        returns(bool)
    {
        return staked[account][lp] > 0;
    }
}
IOracle.sol 21 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "./registries/ITokenRegistry.sol";
import "./IStrategy.sol";

interface IOracle {
    function weth() external view returns (address);

    function susd() external view returns (address);

    function tokenRegistry() external view returns (ITokenRegistry);

    function estimateStrategy(IStrategy strategy) external view returns (uint256, int256[] memory);

    function estimateItem(
        uint256 balance,
        address token
    ) external view returns (int256);
}
IStrategy.sol 88 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "./IStrategyToken.sol";
import "./IOracle.sol";
import "./IWhitelist.sol";
import "../helpers/StrategyTypes.sol";

interface IStrategy is IStrategyToken, StrategyTypes {
    function approveToken(
        address token,
        address account,
        uint256 amount
    ) external;

    function approveDebt(
        address token,
        address account,
        uint256 amount
    ) external;

    function approveSynths(
        address account,
        uint256 amount
    ) external;

    function setStructure(StrategyItem[] memory newItems) external;

    function setCollateral(address token) external;

    function withdrawAll(uint256 amount) external;

    function mint(address account, uint256 amount) external;

    function burn(address account, uint256 amount) external returns (uint256);

    function delegateSwap(
        address adapter,
        uint256 amount,
        address tokenIn,
        address tokenOut
    ) external;

    function settleSynths() external;

    function issueStreamingFee() external;

    function updateTokenValue(uint256 total, uint256 supply) external;

    function updatePerformanceFee(uint16 fee) external;

    function updateRebalanceThreshold(uint16 threshold) external;

    function updateTradeData(address item, TradeData memory data) external;

    function lock() external;

    function unlock() external;

    function locked() external view returns (bool);

    function items() external view returns (address[] memory);

    function synths() external view returns (address[] memory);

    function debt() external view returns (address[] memory);

    function rebalanceThreshold() external view returns (uint256);

    function performanceFee() external view returns (uint256);

    function getPercentage(address item) external view returns (int256);

    function getTradeData(address item) external view returns (TradeData memory);

    function getPerformanceFeeOwed(address account) external view returns (uint256);

    function controller() external view returns (address);

    function manager() external view returns (address);

    function oracle() external view returns (IOracle);

    function whitelist() external view returns (IWhitelist);

    function supportsSynths() external view returns (bool);
}
Address.sol 215 lines
// SPDX-License-Identifier: WTFPL
pragma solidity >=0.6.0 <0.9.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            size := extcodesize(account)
        }
        return size > 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://diligence.consensys.net/posts/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.5.11/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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: WTFPL

pragma solidity ^0.8.0;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}
StrategyTypes.sol 69 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

interface StrategyTypes {

    enum ItemCategory {BASIC, SYNTH, DEBT, RESERVE}
    enum EstimatorCategory {
      DEFAULT_ORACLE,
      CHAINLINK_ORACLE,
      UNISWAP_TWAP_ORACLE,
      SUSHI_TWAP_ORACLE,
      STRATEGY,
      BLOCKED,
      AAVE_V1,
      AAVE_V2,
      AAVE_DEBT,
      BALANCER,
      COMPOUND,
      CURVE,
      CURVE_GAUGE,
      SUSHI_LP,
      SUSHI_FARM,
      UNISWAP_V2_LP,
      UNISWAP_V3_LP,
      YEARN_V1,
      YEARN_V2
    }
    enum TimelockCategory {RESTRUCTURE, THRESHOLD, REBALANCE_SLIPPAGE, RESTRUCTURE_SLIPPAGE, TIMELOCK, PERFORMANCE}

    struct StrategyItem {
        address item;
        int256 percentage;
        TradeData data;
    }

    struct TradeData {
        address[] adapters;
        address[] path;
        bytes cache;
    }

    struct InitialState {
        uint32 timelock;
        uint16 rebalanceThreshold;
        uint16 rebalanceSlippage;
        uint16 restructureSlippage;
        uint16 performanceFee;
        bool social;
        bool set;
    }

    struct StrategyState {
        uint32 timelock;
        uint16 rebalanceSlippage;
        uint16 restructureSlippage;
        bool social;
        bool set;
    }

    /**
        @notice A time lock requirement for changing the state of this Strategy
        @dev WARNING: Only one TimelockCategory can be pending at a time
    */
    struct Timelock {
        TimelockCategory category;
        uint256 timestamp;
        bytes data;
    }
}
IEstimator.sol 9 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

interface IEstimator {
    function estimateItem(
        uint256 balance,
        address token
    ) external view returns (int256);
}
IWhitelist.sol 10 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

interface IWhitelist {
    function approve(address account) external;

    function revoke(address account) external;

    function approved(address account) external view returns (bool);
}
SafeERC20Transfer.sol 54 lines
// SPDX-License-Identifier: WTFPL
pragma solidity >=0.6.0 <0.9.0;

import "../../ecosystem/openzeppelin/token/ERC20/IERC20.sol";
import "../../ecosystem/openzeppelin/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 SafeERC20Transfer {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @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");
        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
IStrategyToken.sol 22 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

import "./IERC20NonStandard.sol";

interface IStrategyToken is IERC20NonStandard {
    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);

    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    function nonces(address owner) external view returns (uint256);
}
IERC20.sol 80 lines
// SPDX-License-Identifier: WTFPL
pragma solidity >=0.6.0 <0.9.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}
IMigrationController.sol 19 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

import "@enso/contracts/contracts/interfaces/IStrategy.sol";
import "@enso/contracts/contracts/interfaces/IStrategyRouter.sol";
import "../../interfaces/IAdapter.sol";
import "../libraries/SafeERC20Transfer.sol";

interface IMigrationController {
    function migrate(
        IStrategy strategy,
        IStrategyRouter genericRouter,
        IERC20 lpToken,
        IAdapter adapter,
        uint256 amount
    ) external;

    function initialized(address strategy) external view returns (bool);
}
IStrategyRouter.sol 20 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

import "../interfaces/IStrategyController.sol";

interface IStrategyRouter {
    enum RouterCategory {GENERIC, LOOP, SYNTH, BATCH}

    function rebalance(address strategy, bytes calldata data) external;

    function restructure(address strategy, bytes calldata data) external;

    function deposit(address strategy, bytes calldata data) external;

    function withdraw(address strategy, bytes calldata) external;

    function controller() external view returns (IStrategyController);

    function category() external view returns (RouterCategory);
}
ILiquidityMigrationV2.sol 8 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

interface ILiquidityMigrationV2 {
    function setStake(address user, address lp, address adapter, uint256 amount) external;

    function migrateAll(address lp, address adapter) external;
}
IERC20NonStandard.sol 31 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

interface IERC20NonStandard {

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    function transfer(address recipient, uint256 amount) external returns (bool);

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(address indexed owner, address indexed spender, uint256 value);
}
IStrategyController.sol 85 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "./IStrategy.sol";
import "./IStrategyRouter.sol";
import "./IOracle.sol";
import "./IWhitelist.sol";
import "../helpers/StrategyTypes.sol";

interface IStrategyController is StrategyTypes {
    function setupStrategy(
        address manager_,
        address strategy_,
        InitialState memory state_,
        address router_,
        bytes memory data_
    ) external payable;

    function deposit(
        IStrategy strategy,
        IStrategyRouter router,
        uint256 amount,
        uint256 slippage,
        bytes memory data
    ) external payable;

    function withdrawETH(
        IStrategy strategy,
        IStrategyRouter router,
        uint256 amount,
        uint256 slippage,
        bytes memory data
    ) external;

    function withdrawWETH(
        IStrategy strategy,
        IStrategyRouter router,
        uint256 amount,
        uint256 slippage,
        bytes memory data
    ) external;

    function rebalance(
        IStrategy strategy,
        IStrategyRouter router,
        bytes memory data
    ) external;

    function restructure(
        IStrategy strategy,
        StrategyItem[] memory strategyItems
    ) external;

    function finalizeStructure(
        IStrategy strategy,
        IStrategyRouter router,
        bytes memory data
    ) external;

    function updateValue(
        IStrategy strategy,
        TimelockCategory category,
        uint256 newValue
    ) external;

    function finalizeValue(address strategy) external;

    function openStrategy(IStrategy strategy) external;

    function setStrategy(IStrategy strategy) external;

    function initialized(address strategy) external view returns (bool);

    function strategyState(address strategy) external view returns (StrategyState memory);

    function verifyStructure(address strategy, StrategyItem[] memory newItems)
        external
        view
        returns (bool);

    function oracle() external view returns (IOracle);

    function whitelist() external view returns (IWhitelist);
}
SafeERC20.sol 100 lines
// SPDX-License-Identifier: WTFPL

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    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'
        // solhint-disable-next-line max-line-length
        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));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    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");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @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");
        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
ITokenRegistry.sol 18 lines
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0 <0.9.0;

import "../IEstimator.sol";

interface ITokenRegistry {
    function itemCategories(address token) external view returns (uint256);

    function estimatorCategories(address token) external view returns (uint256);

    function estimators(uint256 categoryIndex) external view returns (IEstimator);

    function getEstimator(address token) external view returns (IEstimator);

    function addEstimator(uint256 estimatorCategoryIndex, address estimator) external;

    function addItem(uint256 itemCategoryIndex, uint256 estimatorCategoryIndex, address token) external;
}

Read Contract

adapters 0xe5711ffc → bool
controller 0xf77c4791 → address
emergencyReceiver 0xcdf76d5a → address
genericRouter 0x39cfe5ff → address
hasStaked 0x12b32156 → bool
migrationCoordinator 0x3952c4bb → address
modify 0x64cf33b8 → uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
staked 0xc6d3afc9 → uint256
strategies 0x39ebf823 → address
totalStaked 0x9bfd8d61 → uint256
unlocked 0x6a5e2650 → uint256

Write Contract 21 functions

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

addAdapter 0x60d54d41
address adapter
batchStake 0x9596844b
address[] lps
uint256[] amounts
address adapter
buyAndStake 0x2912f294
address lp
address adapter
address exchange
uint256 minAmountOut
uint256 deadline
claim 0x1e83409a
address lp
emergencyMigrate 0xc34f36aa
address lp
migrateAll 0xf64db050
address lp
address adapter
pause 0x8456cb59
No parameters
refund 0x5e30b8a6
address user
address lp
removeAdapter 0x585cd34b
address adapter
renounceOwnership 0x715018a6
No parameters
setStake 0xad745fbb
address user
address lp
address adapter
uint256 amount
setStrategy 0x72cb5d97
address lp
address strategy
stake 0x294091cd
address lp
uint256 amount
address adapter
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateController 0x06cb5b66
address newController
updateCoordinator 0xf9f94e34
address newCoordinator
updateEmergencyReceiver 0x29ecec57
address newReceiver
updateGenericRouter 0xb4312158
address newGenericRouter
updateUnlock 0xfea080bc
uint256 unlock_
withdraw 0x51cff8d9
address lp

Recent Transactions

No transactions found for this address