Address Contract Verified
Address
0x7583D7f36635E5642713ACCBdEd717ca59fdad07
Balance
0 ETH
Nonce
1
Code Size
13179 bytes
Creator
0x6a74649a...5Aa2 at tx 0xc6c7db6d...eb5ee2
Indexed Transactions
0
Contract Bytecode
13179 bytes
0x608060405234801561001057600080fd5b50600436106103425760003560e01c806367fe2cb9116101b8578063a2f61af611610104578063d8db022f116100a2578063f33e232f1161007c578063f33e232f1461086f578063f5441a7414610877578063f62a1a981461089d578063f706bf281461094057610342565b8063d8db022f14610824578063da8ae1601461082c578063e43252d71461084957610342565b8063b60f151a116100de578063b60f151a146107c8578063b8393eaf146107d0578063c1f68fd3146107f6578063d73792a91461081c57610342565b8063a2f61af6146107b0578063a8365693146107b8578063a98e929c146107c057610342565b80638401f8d11161017157806392d6475e1161014b57806392d6475e1461076657806393815eae1461076e578063975057e71461078b578063977de3a71461079357610342565b80638401f8d1146106775780638ab1d6811461071a5780639137c1a71461074057610342565b806367fe2cb9146106295780636da9abed14610631578063727875f7146106395780637c3723cf146106415780637f635cc01461066757806383cf10811461066f57610342565b80632ec1acbb1161029257806339a51be51161023057806358d94fbc1161020a57806358d94fbc146105db5780635aa6e675146106115780635ba36d661461061957806362775b7a1461062157610342565b806339a51be5146105815780633e3309cc1461058957806346877b1a146105b557610342565b80633259eeb61161026c5780633259eeb614610507578063327107f71461052d57806333d95f411461053557806339189c9f1461055b57610342565b80632ec1acbb14610481578063301153f1146104a757806330e412ad146104cd57610342565b80631a636704116102ff5780631dad61b4116102d95780631dad61b41461044357806320d1ceaf1461044b5780632848efd4146104535780632da624a31461045b57610342565b80631a636704146103ef5780631b66cb00146103f75780631b815e261461041d57610342565b806303140ff41461034757806306974e8d1461036157806307e2f713146103855780630af210a1146103a457806316a66c11146103ca578063180b0d7e146103e7575b600080fd5b61034f61096c565b60408051918252519081900360200190f35b610369610972565b604080516001600160a01b039092168252519081900360200190f35b6103a26004803603602081101561039b57600080fd5b5035610981565b005b6103a2600480360360208110156103ba57600080fd5b50356001600160a01b0316610adb565b6103a2600480360360208110156103e057600080fd5b5035610d44565b61034f610e9e565b6103a2610ea4565b6103a26004803603602081101561040d57600080fd5b50356001600160a01b0316611057565b6103a26004803603602081101561043357600080fd5b50356001600160a01b0316611177565b6103a2611295565b61034f611448565b61034f61144e565b61034f6004803603602081101561047157600080fd5b50356001600160a01b0316611454565b6103a26004803603602081101561049757600080fd5b50356001600160a01b03166114c1565b6103a2600480360360208110156104bd57600080fd5b50356001600160a01b03166115e1565b6104f3600480360360208110156104e357600080fd5b50356001600160a01b0316611713565b604080519115158252519081900360200190f35b6103a26004803603602081101561051d57600080fd5b50356001600160a01b0316611760565b61036961188f565b6103a26004803603602081101561054b57600080fd5b50356001600160a01b031661189e565b6104f36004803603602081101561057157600080fd5b50356001600160a01b03166119be565b6103696119d3565b6103a26004803603604081101561059f57600080fd5b506001600160a01b0381351690602001356119e2565b6103a2600480360360208110156105cb57600080fd5b50356001600160a01b0316611abb565b6103a2600480360360608110156105f157600080fd5b506001600160a01b03813581169160208101359091169060400135611bdb565b610369611d20565b61034f611da0565b61034f611da6565b61034f611dac565b61034f611db2565b61034f611db8565b6103a26004803603602081101561065757600080fd5b50356001600160a01b0316611dbe565b61034f611ede565b610369611ee4565b6103a26004803603602081101561068d57600080fd5b8101906020810181356401000000008111156106a857600080fd5b8201836020820111156106ba57600080fd5b803590602001918460208302840111640100000000831117156106dc57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611ef3945050505050565b6103a26004803603602081101561073057600080fd5b50356001600160a01b0316612004565b6103a26004803603602081101561075657600080fd5b50356001600160a01b0316612106565b61034f61223c565b6103a26004803603602081101561078457600080fd5b5035612242565b61036961239d565b6104f3600480360360208110156107a957600080fd5b50356123ac565b61034f6123c1565b61034f6123c7565b6103696123cd565b61034f6123dc565b6104f3600480360360208110156107e657600080fd5b50356001600160a01b03166123e2565b6103a26004803603602081101561080c57600080fd5b50356001600160a01b03166123f7565b61034f612515565b6103a261251b565b6103a26004803603602081101561084257600080fd5b50356126ce565b6103a26004803603602081101561085f57600080fd5b50356001600160a01b0316612828565b6103a261292d565b61034f6004803603602081101561088d57600080fd5b50356001600160a01b0316612a7d565b6103a2600480360360208110156108b357600080fd5b8101906020810181356401000000008111156108ce57600080fd5b8201836020820111156108e057600080fd5b8035906020019184602083028401116401000000008311171561090257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550612a81945050505050565b6103a26004803603604081101561095657600080fd5b506001600160a01b038135169060200135612b92565b600a5481565b6005546001600160a01b031681565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156109cc57600080fd5b505afa1580156109e0573d6000803e3d6000fd5b505050506040513d60208110156109f657600080fd5b5051610a3a576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b610bb8600d54600a548301011115610a8e576040805162461bcd60e51b81526020600482015260126024820152710e8dee8c2d840cccaca40e8dede40d0d2ced60731b604482015290519081900360640190fd5b60088190556006544201600981905560408051838152602081019290925280517f8dc37a759b4fe53e0d7aef85633604180948f0d9a86db34cfb844e69594280289281900390910190a150565b3360009081526014602052604090205460ff1680610b115750610afc611d20565b6001600160a01b0316336001600160a01b0316145b610b62576040805162461bcd60e51b815260206004820152601e60248201527f6f6e6c79206861726420776f726b65722063616e2063616c6c20746869730000604482015290519081900360640190fd5b6000816001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b9d57600080fd5b505afa158015610bb1573d6000803e3d6000fd5b505050506040513d6020811015610bc757600080fd5b5051604080516313e9761560e21b815290519192506001600160a01b03841691634fa5d8549160048082019260009290919082900301818387803b158015610c0e57600080fd5b505af1158015610c22573d6000803e3d6000fd5b50505050816001600160a01b031663a8c62e766040518163ffffffff1660e01b815260040160206040518083038186803b158015610c5f57600080fd5b505afa158015610c73573d6000803e3d6000fd5b505050506040513d6020811015610c8957600080fd5b505160408051631df1ee3f60e21b815290516001600160a01b03928316928516917f43ffccb0abea5304f42c5d67d56e479f21f76ecc142c39a770725e99125243bc91859184916377c7b8fc91600480820192602092909190829003018186803b158015610cf657600080fd5b505afa158015610d0a573d6000803e3d6000fd5b505050506040513d6020811015610d2057600080fd5b50516040805192835260208301919091524282820152519081900360600190a35050565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d6020811015610db957600080fd5b5051610dfd576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b610bb8600754600a548301011115610e51576040805162461bcd60e51b81526020600482015260126024820152710e8dee8c2d840cccaca40e8dede40d0d2ced60731b604482015290519081900360640190fd5b600e8190556006544201600f81905560408051838152602081019290925280517f40dc6f68413532747d4444cde201ac701a71a64b59398a18cde762760622d51a9281900390910190a150565b61271090565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015610eef57600080fd5b505afa158015610f03573d6000803e3d6000fd5b505050506040513d6020811015610f1957600080fd5b5051610f5d576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b600e5415801590610f6f5750600f5415155b8015610f7d5750600f544210155b610fb85760405162461bcd60e51b815260040180806020018281038252603c81526020018061317e603c913960400191505060405180910390fd5b610bb8600754600a54600e540101111561100e576040805162461bcd60e51b81526020600482015260126024820152710e8dee8c2d840cccaca40e8dede40d0d2ced60731b604482015290519081900360640190fd5b600e8054600d819055600091829055600f9190915560408051918252517f04262b44dee31243d35178b2e34b075c981c4d9408348811ddf009f8696dfd209181900360200190a1565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156110a257600080fd5b505afa1580156110b6573d6000803e3d6000fd5b505050506040513d60208110156110cc57600080fd5b5051611110576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b0381166111555760405162461bcd60e51b81526004018080602001828103825260248152602001806131346024913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b5051611230576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b60006013600061123f84612a7d565b8152602081019190915260409081016000908120805460ff191693151593909317909255516001600160a01b038316917facf3e7d9e23312a50b04176a7ded7beaf30e42024d27f9a88b6a6c793681800391a250565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156112e057600080fd5b505afa1580156112f4573d6000803e3d6000fd5b505050506040513d602081101561130a57600080fd5b505161134e576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b600b54158015906113605750600c5415155b801561136e5750600c544210155b6113a95760405162461bcd60e51b815260040180806020018281038252603e81526020018061326a603e913960400191505060405180910390fd5b610bb8600754600d54600b54010111156113ff576040805162461bcd60e51b81526020600482015260126024820152710e8dee8c2d840cccaca40e8dede40d0d2ced60731b604482015290519081900360640190fd5b600b8054600a819055600091829055600c9190915560408051918252517fcffb4391a4070eff6496a138c8b7de446bce4658f35260185a1ab266b9ac0d3f9181900360200190a1565b600d5481565b600f5481565b6000816001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561148f57600080fd5b505afa1580156114a3573d6000803e3d6000fd5b505050506040513d60208110156114b957600080fd5b505192915050565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561150c57600080fd5b505afa158015611520573d6000803e3d6000fd5b505050506040513d602081101561153657600080fd5b505161157a576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b0381166115bf5760405162461bcd60e51b815260040180806020018281038252602c8152602001806131ba602c913960400191505060405180910390fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561162c57600080fd5b505afa158015611640573d6000803e3d6000fd5b505050506040513d602081101561165657600080fd5b505161169a576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b0381166116ef576040805162461bcd60e51b815260206004820152601760248201527617dddbdc9ad95c881b5d5cdd081899481919599a5b9959604a1b604482015290519081900360640190fd5b6001600160a01b03166000908152601460205260409020805460ff19166001179055565b6001600160a01b03811660009081526012602052604081205460ff1615801561175a57506013600061174484612a7d565b815260208101919091526040016000205460ff16155b92915050565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b5051611819576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b03811661186e576040805162461bcd60e51b815260206004820152601760248201527617dddbdc9ad95c881b5d5cdd081899481919599a5b9959604a1b604482015290519081900360640190fd5b6001600160a01b03166000908152601460205260409020805460ff19169055565b6001546001600160a01b031681565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156118e957600080fd5b505afa1580156118fd573d6000803e3d6000fd5b505050506040513d602081101561191357600080fd5b5051611957576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b03811661199c5760405162461bcd60e51b815260040180806020018281038252602f8152602001806131e6602f913960400191505060405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60126020526000908152604090205460ff1681565b6002546001600160a01b031681565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015611a2d57600080fd5b505afa158015611a41573d6000803e3d6000fd5b505050506040513d6020811015611a5757600080fd5b5051611a9b576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b611ab7611aa6611d20565b6001600160a01b0384169083612c63565b5050565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015611b0657600080fd5b505afa158015611b1a573d6000803e3d6000fd5b505050506040513d6020811015611b3057600080fd5b5051611b74576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b038116611bb95760405162461bcd60e51b815260040180806020018281038252602d815260200180613215602d913960400191505060405180910390fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015611c2657600080fd5b505afa158015611c3a573d6000803e3d6000fd5b505050506040513d6020811015611c5057600080fd5b5051611c94576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b826001600160a01b031663bdb1b33e611cab611d20565b84846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015611d0357600080fd5b505af1158015611d17573d6000803e3d6000fd5b50505050505050565b60008060009054906101000a90046001600160a01b03166001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b158015611d6f57600080fd5b505afa158015611d83573d6000803e3d6000fd5b505050506040513d6020811015611d9957600080fd5b5051905090565b600c5481565b60105481565b600b5481565b600e5481565b60115481565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015611e0957600080fd5b505afa158015611e1d573d6000803e3d6000fd5b505050506040513d6020811015611e3357600080fd5b5051611e77576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b038116611ebc5760405162461bcd60e51b81526004018080602001828103825260288152602001806132426028913960400191505060405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b610bb881565b6003546001600160a01b031681565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015611f3e57600080fd5b505afa158015611f52573d6000803e3d6000fd5b505050506040513d6020811015611f6857600080fd5b5051611fac576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b60005b8151811015611ab757600160126000848481518110611fca57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101611faf565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561204f57600080fd5b505afa158015612063573d6000803e3d6000fd5b505050506040513d602081101561207957600080fd5b50516120bd576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b038116600081815260126020526040808220805460ff19169055517f9e1d323a199aba0279351f1936ab2108e5e4ae0e4c2ee5ee8033da419c8b3c699190a250565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561215157600080fd5b505afa158015612165573d6000803e3d6000fd5b505050506040513d602081101561217b57600080fd5b50516121bf576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b03811661221a576040805162461bcd60e51b815260206004820152601e60248201527f6e65772073746f726167652073686f756c646e277420626520656d7074790000604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60095481565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561228d57600080fd5b505afa1580156122a1573d6000803e3d6000fd5b505050506040513d60208110156122b757600080fd5b50516122fb576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b60008111612350576040805162461bcd60e51b815260206004820181905260248201527f696e76616c6964205f6e657874496d706c656d656e746174696f6e44656c6179604482015290519081900360640190fd5b60108190556006544201601181905560408051838152602081019290925280517f50094cf031d78c61151cd4a2ee4b75a70ab0686745d91b602f3a3a55cd82e7e49281900390910190a150565b6000546001600160a01b031681565b60136020526000908152604090205460ff1681565b60085481565b60065481565b6004546001600160a01b031681565b60075481565b60146020526000908152604090205460ff1681565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561244257600080fd5b505afa158015612456573d6000803e3d6000fd5b505050506040513d602081101561246c57600080fd5b50516124b0576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001601360006124bf84612a7d565b8152602081019190915260409081016000908120805460ff191693151593909317909255516001600160a01b038316917f09fbc1f1c6fbaca5160976d30314f70e95c24d2d4ea8b144ae66b02d47471f6e91a250565b61271081565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561256657600080fd5b505afa15801561257a573d6000803e3d6000fd5b505050506040513d602081101561259057600080fd5b50516125d4576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b600854158015906125e6575060095415155b80156125f457506009544210155b61262f5760405162461bcd60e51b815260040180806020018281038252603e8152602001806132d2603e913960400191505060405180910390fd5b610bb8600d54600a5460085401011115612685576040805162461bcd60e51b81526020600482015260126024820152710e8dee8c2d840cccaca40e8dede40d0d2ced60731b604482015290519081900360640190fd5b60088054600781905560009182905560099190915560408051918252517f7be615f62c3640c79f62f1fd0401c7abce6c2cd95a222ccec952fa7a027db7b89181900360200190a1565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561271957600080fd5b505afa15801561272d573d6000803e3d6000fd5b505050506040513d602081101561274357600080fd5b5051612787576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b610bb8600754600d5483010111156127db576040805162461bcd60e51b81526020600482015260126024820152710e8dee8c2d840cccaca40e8dede40d0d2ced60731b604482015290519081900360640190fd5b600b8190556006544201600c81905560408051838152602081019290925280517fbd2b7e9bf23f9caed67e4d5fc39ae248de0a5390092c3cb265f3f91614e70ad49281900390910190a150565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561287357600080fd5b505afa158015612887573d6000803e3d6000fd5b505050506040513d602081101561289d57600080fd5b50516128e1576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b038116600081815260126020526040808220805460ff19166001179055517f3f03e59e57880f11b66319d3e81ef183309630e3153dfb2c6572f10d32cda3929190a250565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561297857600080fd5b505afa15801561298c573d6000803e3d6000fd5b505050506040513d60208110156129a257600080fd5b50516129e6576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b601154158015906129f957506011544210155b612a345760405162461bcd60e51b815260040180806020018281038252603a8152602001806130fa603a913960400191505060405180910390fd5b60108054600681905560009182905560119190915560408051918252517f40d822b056e584aa7a80824c44ea8fcb499c7d6854c938e4c5634fc506d5482e9181900360200190a1565b3f90565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015612acc57600080fd5b505afa158015612ae0573d6000803e3d6000fd5b505050506040513d6020811015612af657600080fd5b5051612b3a576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b60005b8151811015611ab757600060126000848481518110612b5857fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101612b3d565b8015611ab757612bad6001600160a01b038316333084612cba565b600454612bc8906001600160a01b0384811691166000612d1a565b600454612be2906001600160a01b03848116911683612d1a565b6004805460408051631112a1b760e11b81526001600160a01b0386811694820194909452602481018590526000604482018190526064820181905291519390921692632225436e92608480820193929182900301818387803b158015612c4757600080fd5b505af1158015612c5b573d6000803e3d6000fd5b505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612cb5908490612e29565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612d14908590612e29565b50505050565b801580612da0575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612d7257600080fd5b505afa158015612d86573d6000803e3d6000fd5b505050506040513d6020811015612d9c57600080fd5b5051155b612ddb5760405162461bcd60e51b81526004018080602001828103825260368152602001806133106036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612cb59084905b6060612e7e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612eda9092919063ffffffff16565b805190915015612cb557808060200190516020811015612e9d57600080fd5b5051612cb55760405162461bcd60e51b815260040180806020018281038252602a8152602001806132a8602a913960400191505060405180910390fd5b6060612ee98484600085612ef3565b90505b9392505050565b606082471015612f345760405162461bcd60e51b81526004018080602001828103825260268152602001806131586026913960400191505060405180910390fd5b612f3d8561304f565b612f8e576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612fcd5780518252601f199092019160209182019101612fae565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461302f576040519150601f19603f3d011682016040523d82523d6000602084013e613034565b606091505b5091509150613044828286613055565b979650505050505050565b3b151590565b60608315613064575081612eec565b8251156130745782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156130be5781810151838201526020016130a6565b50505050905090810190601f1680156130eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe696e76616c69642074696d657374616d70206f72206e6f206e657720696d706c656d656e746174696f6e2064656c617920636f6e6669726d65646e65772074617267657420746f6b656e2073686f756c64206e6f7420626520656d707479416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c696e76616c69642074696d657374616d70206f72206e6f206e657720706c6174666f726d20666565206e756d657261746f7220636f6e6669726d65646e657720756e6976657273616c206c697175696461746f722073686f756c64206e6f7420626520656d7074796e65772070726f6669742073686172696e672072656365697665722073686f756c64206e6f7420626520656d7074796e65772070726f746f636f6c206665652072656365697665722073686f756c64206e6f7420626520656d7074796e65772072657761726420666f727761726465722073686f756c64206e6f7420626520656d707479696e76616c69642074696d657374616d70206f72206e6f206e6577207374726174656769737420666565206e756d657261746f7220636f6e6669726d65645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564696e76616c69642074696d657374616d70206f72206e6f206e65772070726f6669742073686172696e67206e756d657261746f7220636f6e6669726d65645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a26469706673582212206f6fe64731a7bd4fe571508128cbdd884ac995241d78871cbb3f79b3dec08dd264736f6c634300060c0033
Verified Source Code Full Match
Compiler: v0.6.12+commit.27d51765
EVM: istanbul
Optimization: Yes (200 runs)
Controller.sol 360 lines
// SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./inheritance/Governable.sol";
import "./interface/IController.sol";
import "./interface/IStrategy.sol";
import "./interface/IVault.sol";
import "./interface/IRewardForwarder.sol";
contract Controller is Governable {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
// ========================= Fields =========================
// external parties
address public targetToken;
address public protocolFeeReceiver;
address public profitSharingReceiver;
address public rewardForwarder;
address public universalLiquidator;
uint256 public nextImplementationDelay;
/// 15% of fees captured go to iFARM stakers
uint256 public profitSharingNumerator = 1000;
uint256 public nextProfitSharingNumerator = 0;
uint256 public nextProfitSharingNumeratorTimestamp = 0;
/// 5% of fees captured go to strategists
uint256 public strategistFeeNumerator = 0;
uint256 public nextStrategistFeeNumerator = 0;
uint256 public nextStrategistFeeNumeratorTimestamp = 0;
/// 5% of fees captured go to the devs of the platform
uint256 public platformFeeNumerator = 500;
uint256 public nextPlatformFeeNumerator = 0;
uint256 public nextPlatformFeeNumeratorTimestamp = 0;
/// used for queuing a new delay
uint256 public tempNextImplementationDelay = 0;
uint256 public tempNextImplementationDelayTimestamp = 0;
uint256 public constant MAX_TOTAL_FEE = 3000;
uint256 public constant FEE_DENOMINATOR = 10000;
/// @notice This mapping allows certain contracts to stake on a user's behalf
mapping (address => bool) public addressWhitelist;
mapping (bytes32 => bool) public codeWhitelist;
// All eligible hardWorkers that we have
mapping (address => bool) public hardWorkers;
// ========================= Events =========================
event QueueProfitSharingChange(uint profitSharingNumerator, uint validAtTimestamp);
event ConfirmProfitSharingChange(uint profitSharingNumerator);
event QueueStrategistFeeChange(uint strategistFeeNumerator, uint validAtTimestamp);
event ConfirmStrategistFeeChange(uint strategistFeeNumerator);
event QueuePlatformFeeChange(uint platformFeeNumerator, uint validAtTimestamp);
event ConfirmPlatformFeeChange(uint platformFeeNumerator);
event QueueNextImplementationDelay(uint implementationDelay, uint validAtTimestamp);
event ConfirmNextImplementationDelay(uint implementationDelay);
event AddedAddressToWhitelist(address indexed _address);
event RemovedAddressFromWhitelist(address indexed _address);
event AddedCodeToWhitelist(address indexed _address);
event RemovedCodeFromWhitelist(address indexed _address);
event SharePriceChangeLog(
address indexed vault,
address indexed strategy,
uint256 oldSharePrice,
uint256 newSharePrice,
uint256 timestamp
);
// ========================= Modifiers =========================
modifier onlyHardWorkerOrGovernance() {
require(hardWorkers[msg.sender] || (msg.sender == governance()),
"only hard worker can call this");
_;
}
constructor(
address _storage,
address _targetToken,
address _protocolFeeReceiver,
address _profitSharingReceiver,
address _rewardForwarder,
address _universalLiquidator,
uint _nextImplementationDelay
)
Governable(_storage)
public {
require(_targetToken != address(0), "_targetToken should not be empty");
require(_protocolFeeReceiver != address(0), "_protocolFeeReceiver should not be empty");
require(_profitSharingReceiver != address(0), "_profitSharingReceiver should not be empty");
require(_rewardForwarder != address(0), "_rewardForwarder should not be empty");
require(_nextImplementationDelay > 0, "_nextImplementationDelay should be gt 0");
targetToken = _targetToken;
protocolFeeReceiver = _protocolFeeReceiver;
profitSharingReceiver = _profitSharingReceiver;
rewardForwarder = _rewardForwarder;
universalLiquidator = _universalLiquidator;
nextImplementationDelay = _nextImplementationDelay;
}
// [Grey list]
// An EOA can safely interact with the system no matter what.
// If you're using Metamask, you're using an EOA.
// Only smart contracts may be affected by this grey list.
//
// This contract will not be able to ban any EOA from the system
// even if an EOA is being added to the greyList, he/she will still be able
// to interact with the whole system as if nothing happened.
// Only smart contracts will be affected by being added to the greyList.
function greyList(address _addr) public view returns (bool) {
return !addressWhitelist[_addr] && !codeWhitelist[getContractHash(_addr)];
}
// Only smart contracts will be affected by the whitelist.
function addToWhitelist(address _target) public onlyGovernance {
addressWhitelist[_target] = true;
emit AddedAddressToWhitelist(_target);
}
function addMultipleToWhitelist(address[] memory _targets) public onlyGovernance {
for (uint256 i = 0; i < _targets.length; i++) {
addressWhitelist[_targets[i]] = true;
}
}
function removeFromWhitelist(address _target) public onlyGovernance {
addressWhitelist[_target] = false;
emit RemovedAddressFromWhitelist(_target);
}
function removeMultipleFromWhitelist(address[] memory _targets) public onlyGovernance {
for (uint256 i = 0; i < _targets.length; i++) {
addressWhitelist[_targets[i]] = false;
}
}
function getContractHash(address a) public view returns (bytes32 hash) {
assembly {
hash := extcodehash(a)
}
}
function addCodeToWhitelist(address _target) public onlyGovernance {
codeWhitelist[getContractHash(_target)] = true;
emit AddedCodeToWhitelist(_target);
}
function removeCodeFromWhitelist(address _target) public onlyGovernance {
codeWhitelist[getContractHash(_target)] = false;
emit RemovedCodeFromWhitelist(_target);
}
function setRewardForwarder(address _rewardForwarder) public onlyGovernance {
require(_rewardForwarder != address(0), "new reward forwarder should not be empty");
rewardForwarder = _rewardForwarder;
}
function setTargetToken(address _targetToken) public onlyGovernance {
require(_targetToken != address(0), "new target token should not be empty");
targetToken = _targetToken;
}
function setProfitSharingReceiver(address _profitSharingReceiver) public onlyGovernance {
require(_profitSharingReceiver != address(0), "new profit sharing receiver should not be empty");
profitSharingReceiver = _profitSharingReceiver;
}
function setProtocolFeeReceiver(address _protocolFeeReceiver) public onlyGovernance {
require(_protocolFeeReceiver != address(0), "new protocol fee receiver should not be empty");
protocolFeeReceiver = _protocolFeeReceiver;
}
function setUniversalLiquidator(address _universalLiquidator) public onlyGovernance {
require(_universalLiquidator != address(0), "new universal liquidator should not be empty");
universalLiquidator = _universalLiquidator;
}
function getPricePerFullShare(address _vault) public view returns (uint256) {
return IVault(_vault).getPricePerFullShare();
}
function doHardWork(address _vault) external onlyHardWorkerOrGovernance {
uint256 oldSharePrice = IVault(_vault).getPricePerFullShare();
IVault(_vault).doHardWork();
emit SharePriceChangeLog(
_vault,
IVault(_vault).strategy(),
oldSharePrice,
IVault(_vault).getPricePerFullShare(),
block.timestamp
);
}
function addHardWorker(address _worker) public onlyGovernance {
require(_worker != address(0), "_worker must be defined");
hardWorkers[_worker] = true;
}
function removeHardWorker(address _worker) public onlyGovernance {
require(_worker != address(0), "_worker must be defined");
hardWorkers[_worker] = false;
}
// transfers token in the controller contract to the governance
function salvage(address _token, uint256 _amount) external onlyGovernance {
IERC20(_token).safeTransfer(governance(), _amount);
}
function salvageStrategy(address _strategy, address _token, uint256 _amount) external onlyGovernance {
// the strategy is responsible for maintaining the list of
// salvageable tokens, to make sure that governance cannot come
// in and take away the coins
IStrategy(_strategy).salvageToken(governance(), _token, _amount);
}
function feeDenominator() public pure returns (uint) {
// keep the interface for this function as a `view` for now, in case it changes in the future
return FEE_DENOMINATOR;
}
function setProfitSharingNumerator(uint _profitSharingNumerator) public onlyGovernance {
require(
_profitSharingNumerator + strategistFeeNumerator + platformFeeNumerator <= MAX_TOTAL_FEE,
"total fee too high"
);
nextProfitSharingNumerator = _profitSharingNumerator;
nextProfitSharingNumeratorTimestamp = block.timestamp + nextImplementationDelay;
emit QueueProfitSharingChange(nextProfitSharingNumerator, nextProfitSharingNumeratorTimestamp);
}
function confirmSetProfitSharingNumerator() public onlyGovernance {
require(
nextProfitSharingNumerator != 0
&& nextProfitSharingNumeratorTimestamp != 0
&& block.timestamp >= nextProfitSharingNumeratorTimestamp,
"invalid timestamp or no new profit sharing numerator confirmed"
);
require(
nextProfitSharingNumerator + strategistFeeNumerator + platformFeeNumerator <= MAX_TOTAL_FEE,
"total fee too high"
);
profitSharingNumerator = nextProfitSharingNumerator;
nextProfitSharingNumerator = 0;
nextProfitSharingNumeratorTimestamp = 0;
emit ConfirmProfitSharingChange(profitSharingNumerator);
}
function setStrategistFeeNumerator(uint _strategistFeeNumerator) public onlyGovernance {
require(
_strategistFeeNumerator + platformFeeNumerator + profitSharingNumerator <= MAX_TOTAL_FEE,
"total fee too high"
);
nextStrategistFeeNumerator = _strategistFeeNumerator;
nextStrategistFeeNumeratorTimestamp = block.timestamp + nextImplementationDelay;
emit QueueStrategistFeeChange(nextStrategistFeeNumerator, nextStrategistFeeNumeratorTimestamp);
}
function confirmSetStrategistFeeNumerator() public onlyGovernance {
require(
nextStrategistFeeNumerator != 0
&& nextStrategistFeeNumeratorTimestamp != 0
&& block.timestamp >= nextStrategistFeeNumeratorTimestamp,
"invalid timestamp or no new strategist fee numerator confirmed"
);
require(
nextStrategistFeeNumerator + platformFeeNumerator + profitSharingNumerator <= MAX_TOTAL_FEE,
"total fee too high"
);
strategistFeeNumerator = nextStrategistFeeNumerator;
nextStrategistFeeNumerator = 0;
nextStrategistFeeNumeratorTimestamp = 0;
emit ConfirmStrategistFeeChange(strategistFeeNumerator);
}
function setPlatformFeeNumerator(uint _platformFeeNumerator) public onlyGovernance {
require(
_platformFeeNumerator + strategistFeeNumerator + profitSharingNumerator <= MAX_TOTAL_FEE,
"total fee too high"
);
nextPlatformFeeNumerator = _platformFeeNumerator;
nextPlatformFeeNumeratorTimestamp = block.timestamp + nextImplementationDelay;
emit QueuePlatformFeeChange(nextPlatformFeeNumerator, nextPlatformFeeNumeratorTimestamp);
}
function confirmSetPlatformFeeNumerator() public onlyGovernance {
require(
nextPlatformFeeNumerator != 0
&& nextPlatformFeeNumeratorTimestamp != 0
&& block.timestamp >= nextPlatformFeeNumeratorTimestamp,
"invalid timestamp or no new platform fee numerator confirmed"
);
require(
nextPlatformFeeNumerator + strategistFeeNumerator + profitSharingNumerator <= MAX_TOTAL_FEE,
"total fee too high"
);
platformFeeNumerator = nextPlatformFeeNumerator;
nextPlatformFeeNumerator = 0;
nextPlatformFeeNumeratorTimestamp = 0;
emit ConfirmPlatformFeeChange(platformFeeNumerator);
}
function setNextImplementationDelay(uint256 _nextImplementationDelay) public onlyGovernance {
require(
_nextImplementationDelay > 0,
"invalid _nextImplementationDelay"
);
tempNextImplementationDelay = _nextImplementationDelay;
tempNextImplementationDelayTimestamp = block.timestamp + nextImplementationDelay;
emit QueueNextImplementationDelay(tempNextImplementationDelay, tempNextImplementationDelayTimestamp);
}
function confirmNextImplementationDelay() public onlyGovernance {
require(
tempNextImplementationDelayTimestamp != 0 && block.timestamp >= tempNextImplementationDelayTimestamp,
"invalid timestamp or no new implementation delay confirmed"
);
nextImplementationDelay = tempNextImplementationDelay;
tempNextImplementationDelay = 0;
tempNextImplementationDelayTimestamp = 0;
emit ConfirmNextImplementationDelay(nextImplementationDelay);
}
//backwards compatibility
function notifyFee(address token, uint256 fee) external {
if (fee > 0) {
IERC20(token).safeTransferFrom(msg.sender, address(this), fee);
IERC20(token).safeApprove(rewardForwarder, 0);
IERC20(token).safeApprove(rewardForwarder, fee);
IRewardForwarder(rewardForwarder).notifyFee(token, fee, 0, 0);
}
}
}
IVault.sol 58 lines
// SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
interface IVault {
function initializeVault(
address _storage,
address _underlying,
uint256 _toInvestNumerator,
uint256 _toInvestDenominator
) external;
function balanceOf(address _holder) external view returns (uint256);
function underlyingBalanceInVault() external view returns (uint256);
function underlyingBalanceWithInvestment() external view returns (uint256);
function governance() external view returns (address);
function controller() external view returns (address);
function underlying() external view returns (address);
function underlyingUnit() external view returns (uint);
function strategy() external view returns (address);
function setStrategy(address _strategy) external;
function announceStrategyUpdate(address _strategy) external;
function setVaultFractionToInvest(uint256 _numerator, uint256 _denominator) external;
function deposit(uint256 _amount) external;
function deposit(uint256 _amount, address _receiver) external;
function depositFor(uint256 _amount, address _holder) external;
function withdrawAll() external;
function withdraw(uint256 _numberOfShares) external;
function getPricePerFullShare() external view returns (uint256);
function underlyingBalanceWithInvestmentForHolder(address _holder) view external returns (uint256);
/**
* The total amount available to be deposited from this vault into the strategy, while adhering to the
* `vaultFractionToInvestNumerator` and `vaultFractionToInvestDenominator` rules
*/
function availableToInvestOut() external view returns (uint256);
/**
* This should be callable only by the controller (by the hard worker) or by governance
*/
function doHardWork() external;
}
Storage.sol 35 lines
//SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
contract Storage {
address public governance;
address public controller;
constructor() public {
governance = msg.sender;
}
modifier onlyGovernance() {
require(isGovernance(msg.sender), "Not governance");
_;
}
function setGovernance(address _governance) public onlyGovernance {
require(_governance != address(0), "new governance shouldn't be empty");
governance = _governance;
}
function setController(address _controller) public onlyGovernance {
require(_controller != address(0), "new controller shouldn't be empty");
controller = _controller;
}
function isGovernance(address account) public view returns (bool) {
return account == governance;
}
function isController(address account) public view returns (bool) {
return account == controller;
}
}
IStrategy.sol 37 lines
// SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
interface IStrategy {
/// @notice declared as public so child contract can call it
function isUnsalvageableToken(address token) external view returns (bool);
function salvageToken(address recipient, address token, uint amount) external;
function governance() external view returns (address);
function controller() external view returns (address);
function underlying() external view returns (address);
function vault() external view returns (address);
function withdrawAllToVault() external;
function withdrawToVault(uint256 _amount) external;
function investedUnderlyingBalance() external view returns (uint256);
function doHardWork() external;
function depositArbCheck() external view returns (bool);
function strategist() external view returns (address);
/**
* @return The value of any accumulated rewards that are under control by the strategy. Each index corresponds with
* the tokens in `rewardTokens`. This function is not a `view`, because some protocols, like Curve, need
* writeable functions to get the # of claimable reward tokens
*/
function getRewardPoolValues() external returns (uint256[] memory);
}
IController.sol 133 lines
// SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
interface IController {
// ========================= Events =========================
event QueueProfitSharingChange(uint profitSharingNumerator, uint validAtTimestamp);
event ConfirmProfitSharingChange(uint profitSharingNumerator);
event QueueStrategistFeeChange(uint strategistFeeNumerator, uint validAtTimestamp);
event ConfirmStrategistFeeChange(uint strategistFeeNumerator);
event QueuePlatformFeeChange(uint platformFeeNumerator, uint validAtTimestamp);
event ConfirmPlatformFeeChange(uint platformFeeNumerator);
event QueueNextImplementationDelay(uint implementationDelay, uint validAtTimestamp);
event ConfirmNextImplementationDelay(uint implementationDelay);
event AddedStakingContract(address indexed stakingContract);
event RemovedStakingContract(address indexed stakingContract);
event SharePriceChangeLog(
address indexed vault,
address indexed strategy,
uint256 oldSharePrice,
uint256 newSharePrice,
uint256 timestamp
);
// ==================== Functions ====================
/**
* An EOA can safely interact with the system no matter what. If you're using Metamask, you're using an EOA. Only
* smart contracts may be affected by this grey list. This contract will not be able to ban any EOA from the system
* even if an EOA is being added to the greyList, he/she will still be able to interact with the whole system as if
* nothing happened. Only smart contracts will be affected by being added to the greyList. This grey list is only
* used in VaultV3.sol, see the code there for reference
*/
function greyList(address _target) external view returns (bool);
function addressWhiteList(address _target) external view returns (bool);
function codeWhiteList(address _target) external view returns (bool);
function addToWhitelist(address _target) external;
function addCodeToWhitelist(address _target) external;
function store() external view returns (address);
function governance() external view returns (address);
function doHardWork(address _vault) external;
function addHardWorker(address _worker) external;
function removeHardWorker(address _worker) external;
function salvage(address _token, uint256 amount) external;
function salvageStrategy(address _strategy, address _token, uint256 amount) external;
/**
* @return The targeted profit token to convert all-non-compounding rewards to. Defaults to WETH.
*/
function targetToken() external view returns (address);
function setTargetToken(address _targetToken) external;
function profitSharingReceiver() external view returns (address);
function setProfitSharingReceiver(address _profitSharingReceiver) external;
function protocolFeeReceiver() external view returns (address);
function setProtocolFeeReceiver(address _protocolFeeReceiver) external;
function rewardForwarder() external view returns (address);
function setRewardForwarder(address _rewardForwarder) external;
function universalLiquidator() external view returns (address);
function setUniversalLiquidator(address _universalLiquidator) external;
function dolomiteYieldFarmingRouter() external view returns (address);
function setDolomiteYieldFarmingRouter(address _value) external;
function nextImplementationDelay() external view returns (uint256);
function profitSharingNumerator() external view returns (uint256);
function strategistFeeNumerator() external view returns (uint256);
function platformFeeNumerator() external view returns (uint256);
function feeDenominator() external view returns (uint256);
function setProfitSharingNumerator(uint _profitSharingNumerator) external;
function confirmSetProfitSharingNumerator() external;
function setStrategistFeeNumerator(uint _strategistFeeNumerator) external;
function confirmSetStrategistFeeNumerator() external;
function setPlatformFeeNumerator(uint _platformFeeNumerator) external;
function confirmSetPlatformFeeNumerator() external;
function setNextImplementationDelay(uint256 _nextImplementationDelay) external;
function confirmNextImplementationDelay() external;
function nextProfitSharingNumerator() external view returns (uint256);
function nextProfitSharingNumeratorTimestamp() external view returns (uint256);
function nextStrategistFeeNumerator() external view returns (uint256);
function nextStrategistFeeNumeratorTimestamp() external view returns (uint256);
function nextPlatformFeeNumerator() external view returns (uint256);
function nextPlatformFeeNumeratorTimestamp() external view returns (uint256);
function tempNextImplementationDelay() external view returns (uint256);
function tempNextImplementationDelayTimestamp() external view returns (uint256);
}
SafeMath.sol 214 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
Address.sol 189 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.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);
}
}
}
}
Governable.sol 28 lines
//SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
import "./Storage.sol";
contract Governable {
Storage public store;
constructor(address _store) public {
require(_store != address(0), "new storage shouldn't be empty");
store = Storage(_store);
}
modifier onlyGovernance() {
require(store.isGovernance(msg.sender), "Not governance");
_;
}
function setStorage(address _store) public onlyGovernance {
require(_store != address(0), "new storage shouldn't be empty");
store = Storage(_store);
}
function governance() public view returns (address) {
return store.governance();
}
}
IRewardForwarder.sol 58 lines
// SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
/**
* @dev A routing contract that is responsible for taking the harvested gains and routing them into FARM and additional
* buyback tokens for the corresponding strategy
*/
interface IRewardForwarder {
function store() external view returns (address);
function governance() external view returns (address);
/**
* @dev This function sends converted `_buybackTokens` to `msg.sender`. The returned amounts will match the
* `amounts` return value. The fee amounts are converted to the profit sharing token and sent to the proper
* addresses (profit sharing, strategist, and governance (platform)).
*
* @param _token the token that will be compounded or sold into the profit sharing token for the Harvest
* collective (users that stake iFARM)
* @param _profitSharingFee the amount of `_token` that will be sold into the profit sharing token
* @param _strategistFee the amount of `_token` that will be sold into the profit sharing token for the
* strategist
* @param _platformFee the amount of `_token` that will be sold into the profit sharing token for the Harvest
* treasury
* @param _buybackTokens the output tokens that `_buyBackAmounts` should be swapped to (outputToken)
* @param _buybackAmounts the amounts of `_token` that will be bought into more `_buybackTokens` token
* @return amounts The amounts that were purchased of _buybackTokens
*/
function notifyFeeAndBuybackAmounts(
address _token,
uint256 _profitSharingFee,
uint256 _strategistFee,
uint256 _platformFee,
address[] calldata _buybackTokens,
uint256[] calldata _buybackAmounts
) external returns (uint[] memory amounts);
/**
* @dev This function converts the fee amounts to the profit sharing token and sends them to the proper addresses
* (profit sharing, strategist, and governance (platform)).
*
* @param _token the token that will be compounded or sold into the profit sharing token for the Harvest
* collective (users that stake iFARM)
* @param _profitSharingFee the amount of `_token` that will be sold into the profit sharing token
* @param _strategistFee the amount of `_token` that will be sold into the profit sharing token for the
* strategist
* @param _platformFee the amount of `_token` that will be sold into the profit sharing token for the Harvest
* treasury
*/
function notifyFee(
address _token,
uint256 _profitSharingFee,
uint256 _strategistFee,
uint256 _platformFee
) external;
}
IERC20.sol 77 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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);
}
SafeERC20.sol 75 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
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).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_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");
}
}
}
Read Contract
FEE_DENOMINATOR 0xd73792a9 → uint256
MAX_TOTAL_FEE 0x7f635cc0 → uint256
addressWhitelist 0x39189c9f → bool
codeWhitelist 0x977de3a7 → bool
feeDenominator 0x180b0d7e → uint256
getContractHash 0xf5441a74 → bytes32
getPricePerFullShare 0x2da624a3 → uint256
governance 0x5aa6e675 → address
greyList 0x30e412ad → bool
hardWorkers 0xb8393eaf → bool
nextImplementationDelay 0xa8365693 → uint256
nextPlatformFeeNumerator 0x6da9abed → uint256
nextPlatformFeeNumeratorTimestamp 0x2848efd4 → uint256
nextProfitSharingNumerator 0xa2f61af6 → uint256
nextProfitSharingNumeratorTimestamp 0x92d6475e → uint256
nextStrategistFeeNumerator 0x67fe2cb9 → uint256
nextStrategistFeeNumeratorTimestamp 0x5ba36d66 → uint256
platformFeeNumerator 0x20d1ceaf → uint256
profitSharingNumerator 0xb60f151a → uint256
profitSharingReceiver 0x83cf1081 → address
protocolFeeReceiver 0x39a51be5 → address
rewardForwarder 0xa98e929c → address
store 0x975057e7 → address
strategistFeeNumerator 0x03140ff4 → uint256
targetToken 0x327107f7 → address
tempNextImplementationDelay 0x62775b7a → uint256
tempNextImplementationDelayTimestamp 0x727875f7 → uint256
universalLiquidator 0x06974e8d → address
Write Contract 26 functions
These functions modify contract state and require a wallet transaction to execute.
addCodeToWhitelist 0xc1f68fd3
address _target
addHardWorker 0x301153f1
address _worker
addMultipleToWhitelist 0x8401f8d1
address[] _targets
addToWhitelist 0xe43252d7
address _target
confirmNextImplementationDelay 0xf33e232f
No parameters
confirmSetPlatformFeeNumerator 0x1a636704
No parameters
confirmSetProfitSharingNumerator 0xd8db022f
No parameters
confirmSetStrategistFeeNumerator 0x1dad61b4
No parameters
doHardWork 0x0af210a1
address _vault
notifyFee 0xf706bf28
address token
uint256 fee
removeCodeFromWhitelist 0x1b815e26
address _target
removeFromWhitelist 0x8ab1d681
address _target
removeHardWorker 0x3259eeb6
address _worker
removeMultipleFromWhitelist 0xf62a1a98
address[] _targets
salvage 0x3e3309cc
address _token
uint256 _amount
salvageStrategy 0x58d94fbc
address _strategy
address _token
uint256 _amount
setNextImplementationDelay 0x93815eae
uint256 _nextImplementationDelay
setPlatformFeeNumerator 0x16a66c11
uint256 _platformFeeNumerator
setProfitSharingNumerator 0x07e2f713
uint256 _profitSharingNumerator
setProfitSharingReceiver 0x33d95f41
address _profitSharingReceiver
setProtocolFeeReceiver 0x46877b1a
address _protocolFeeReceiver
setRewardForwarder 0x7c3723cf
address _rewardForwarder
setStorage 0x9137c1a7
address _store
setStrategistFeeNumerator 0xda8ae160
uint256 _strategistFeeNumerator
setTargetToken 0x1b66cb00
address _targetToken
setUniversalLiquidator 0x2ec1acbb
address _universalLiquidator
Recent Transactions
No transactions found for this address