diff --git a/.gitignore b/.gitignore index d959af7..cd9932e 100644 --- a/.gitignore +++ b/.gitignore @@ -35,5 +35,8 @@ types/* coverage coverage.json +# IDE config +.vscode/ + # MacOS junk .DS_Store \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..d1ce8f3 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "printWidth": 180 +} \ No newline at end of file diff --git a/.solhint.json b/.solhint.json index 471ff62..6788692 100644 --- a/.solhint.json +++ b/.solhint.json @@ -1,5 +1,6 @@ { "extends": "solhint:default", + "plugins": ["prettier"], "rules": { "avoid-low-level-calls": "off", "avoid-tx-origin": "warn", @@ -16,6 +17,7 @@ "quotes": ["error", "double"], "separate-by-one-line-in-contract": "error", "space-after-comma": "error", - "statement-indent": "error" + "statement-indent": "error", + "prettier/prettier": "error" } } \ No newline at end of file diff --git a/abi/APRWithPoolOracle.json b/abi/APRWithPoolOracle.json new file mode 100644 index 0000000..f96cb62 --- /dev/null +++ b/abi/APRWithPoolOracle.json @@ -0,0 +1,299 @@ +[ + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getDDEXAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getDDEXAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getLENDFAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getLENDFAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getCompoundAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getCompoundAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getFulcrumAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getFulcrumAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "marketId", + "type": "uint256" + } + ], + "name": "getDyDxAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "marketId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getDyDxAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAaveCore", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getAaveAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getAaveAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/APRWithPoolOracleStub.json b/abi/APRWithPoolOracleStub.json new file mode 100644 index 0000000..f96cb62 --- /dev/null +++ b/abi/APRWithPoolOracleStub.json @@ -0,0 +1,299 @@ +[ + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getDDEXAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getDDEXAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getLENDFAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getLENDFAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getCompoundAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getCompoundAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getFulcrumAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getFulcrumAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "marketId", + "type": "uint256" + } + ], + "name": "getDyDxAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "marketId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getDyDxAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAaveCore", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getAaveAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getAaveAPRAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/AToken.json b/abi/AToken.json new file mode 100644 index 0000000..c2696cd --- /dev/null +++ b/abi/AToken.json @@ -0,0 +1,17 @@ +[ + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/ATokenStub.json b/abi/ATokenStub.json new file mode 100644 index 0000000..acbbac0 --- /dev/null +++ b/abi/ATokenStub.json @@ -0,0 +1,466 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_underlying", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ownerMint", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/Aave.json b/abi/Aave.json new file mode 100644 index 0000000..6fd437f --- /dev/null +++ b/abi/Aave.json @@ -0,0 +1,27 @@ +[ + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_reserve", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_referralCode", + "type": "uint16" + } + ], + "name": "deposit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/AaveStub.json b/abi/AaveStub.json new file mode 100644 index 0000000..29e6187 --- /dev/null +++ b/abi/AaveStub.json @@ -0,0 +1,190 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "tokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_underlying", + "type": "address" + } + ], + "name": "createAToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_reserve", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "deposit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getLendingPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getLendingPoolCore", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/AccessModule.json b/abi/AccessModule.json index 71a48bd..0ef0e87 100644 --- a/abi/AccessModule.json +++ b/abi/AccessModule.json @@ -111,14 +111,28 @@ }, { "anonymous": false, - "inputs": [], - "name": "WhitelistDisabled", + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "WhitelistForAllStatusChange", "type": "event" }, { "anonymous": false, - "inputs": [], - "name": "WhitelistEnabled", + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "WhitelistForIntermediateSendersStatusChange", "type": "event" }, { @@ -291,6 +305,27 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "maxGasLeft", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -438,7 +473,22 @@ { "constant": true, "inputs": [], - "name": "whitelistEnabled", + "name": "whitelistEnabledForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "whitelistEnabledForIntermediateSenders", "outputs": [ { "internalType": "bool", @@ -476,8 +526,14 @@ }, { "constant": false, - "inputs": [], - "name": "enableWhitelist", + "inputs": [ + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setWhitelistForAll", "outputs": [], "payable": false, "stateMutability": "nonpayable", @@ -485,13 +541,60 @@ }, { "constant": false, - "inputs": [], - "name": "disableWhitelist", + "inputs": [ + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setWhitelistForIntermediateSenders", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "enum IAccessModule.Operation", + "name": "operation", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "setMaxGasLeft", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "enum IAccessModule.Operation", + "name": "operation", + "type": "uint8" + } + ], + "name": "getMaxGasLeft", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [ diff --git a/abi/CallExecutor.json b/abi/CallExecutor.json new file mode 100644 index 0000000..bd1f1e6 --- /dev/null +++ b/abi/CallExecutor.json @@ -0,0 +1,106 @@ +[ + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "calls", + "outputs": [ + { + "internalType": "address payable", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "clearCalls", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address payable", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "addCall", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "idx", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "setCall", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "execute", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/Compound.json b/abi/Compound.json new file mode 100644 index 0000000..99fca75 --- /dev/null +++ b/abi/Compound.json @@ -0,0 +1,59 @@ +[ + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/DyDx.json b/abi/DyDx.json new file mode 100644 index 0000000..8281de7 --- /dev/null +++ b/abi/DyDx.json @@ -0,0 +1,148 @@ +[ + { + "constant": true, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + } + ], + "internalType": "struct Structs.Info", + "name": "account", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "marketId", + "type": "uint256" + } + ], + "name": "getAccountWei", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "sign", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct Structs.Wei", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + } + ], + "internalType": "struct Structs.Info[]", + "name": "", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum Structs.ActionType", + "name": "actionType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "accountId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "sign", + "type": "bool" + }, + { + "internalType": "enum Structs.AssetDenomination", + "name": "denomination", + "type": "uint8" + }, + { + "internalType": "enum Structs.AssetReference", + "name": "ref", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct Structs.AssetAmount", + "name": "amount", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "primaryMarketId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "secondaryMarketId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "otherAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "otherAccountId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Structs.ActionArgs[]", + "name": "", + "type": "tuple[]" + } + ], + "name": "operate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/DyDxStub.json b/abi/DyDxStub.json new file mode 100644 index 0000000..d8e418b --- /dev/null +++ b/abi/DyDxStub.json @@ -0,0 +1,300 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "market", + "type": "uint256" + } + ], + "name": "MarketAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": false, + "inputs": [], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "markets", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "addMarket", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + } + ], + "internalType": "struct Structs.Info", + "name": "account", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "marketId", + "type": "uint256" + } + ], + "name": "getAccountWei", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "sign", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct Structs.Wei", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + } + ], + "internalType": "struct Structs.Info[]", + "name": "accounts", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "enum Structs.ActionType", + "name": "actionType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "accountId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "sign", + "type": "bool" + }, + { + "internalType": "enum Structs.AssetDenomination", + "name": "denomination", + "type": "uint8" + }, + { + "internalType": "enum Structs.AssetReference", + "name": "ref", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "internalType": "struct Structs.AssetAmount", + "name": "amount", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "primaryMarketId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "secondaryMarketId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "otherAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "otherAccountId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Structs.ActionArgs[]", + "name": "args", + "type": "tuple[]" + } + ], + "name": "operate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/Fulcrum.json b/abi/Fulcrum.json new file mode 100644 index 0000000..562657c --- /dev/null +++ b/abi/Fulcrum.json @@ -0,0 +1,75 @@ +[ + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "burnAmount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "loanAmountPaid", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "assetBalanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/FulcrumStub.json b/abi/FulcrumStub.json new file mode 100644 index 0000000..d73b262 --- /dev/null +++ b/abi/FulcrumStub.json @@ -0,0 +1,504 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_underlying", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "burnAmount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "loanAmountPaid", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "assetBalanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/IAccessModule.json b/abi/IAccessModule.json index 0f98e7c..132e69b 100644 --- a/abi/IAccessModule.json +++ b/abi/IAccessModule.json @@ -24,5 +24,26 @@ "payable": false, "stateMutability": "view", "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "enum IAccessModule.Operation", + "name": "operation", + "type": "uint8" + } + ], + "name": "getMaxGasLeft", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" } ] \ No newline at end of file diff --git a/abi/IEarnAPRWithPool.json b/abi/IEarnAPRWithPool.json new file mode 100644 index 0000000..7a28a1b --- /dev/null +++ b/abi/IEarnAPRWithPool.json @@ -0,0 +1,797 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "APR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "UNI", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "UNIAPR", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "UNIROI", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "aave", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "aaveUni", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "compound", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "dydx", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "fulcrum", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pools", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "yTokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "recommend", + "outputs": [ + { + "internalType": "string", + "name": "choice", + "type": "string" + }, + { + "internalType": "uint256", + "name": "capr", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "iapr", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "aapr", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "dapr", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "getAPROptionsInc", + "outputs": [ + { + "internalType": "uint256", + "name": "_uniswap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_compound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unicompound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_fulcrum", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unifulcrum", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_aave", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_uniaave", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_dydx", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ddex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lendf", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "getAPROptions", + "outputs": [ + { + "internalType": "uint256", + "name": "_uniswap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_compound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unicompound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_fulcrum", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unifulcrum", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_aave", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_uniaave", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_dydx", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ddex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lendf", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_supply", + "type": "uint256" + } + ], + "name": "getAPROptionsAdjusted", + "outputs": [ + { + "internalType": "uint256", + "name": "_uniswap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_compound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unicompound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_fulcrum", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unifulcrum", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_aave", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_uniaave", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_dydx", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ddex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lendf", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "viewPool", + "outputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "unipool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "created", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "created", + "type": "uint256" + } + ], + "name": "addPool", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "cToken", + "type": "address" + } + ], + "name": "addCToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "iToken", + "type": "address" + } + ], + "name": "addIToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "aToken", + "type": "address" + } + ], + "name": "addAToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "aToken", + "type": "address" + } + ], + "name": "addAUniToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "yToken", + "type": "address" + } + ], + "name": "addYToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "dToken", + "type": "uint256" + } + ], + "name": "addDToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_new_UNIROI", + "type": "address" + } + ], + "name": "set_new_UNIROI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_new_UNI", + "type": "address" + } + ], + "name": "set_new_UNI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_new_UNIAPR", + "type": "address" + } + ], + "name": "set_new_UNIAPR", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_new_APR", + "type": "address" + } + ], + "name": "set_new_APR", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_TokenAddress", + "type": "address" + } + ], + "name": "inCaseTokenGetsStuck", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "inCaseETHGetsStuck", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/IIEarnManager.json b/abi/IIEarnManager.json new file mode 100644 index 0000000..1b20490 --- /dev/null +++ b/abi/IIEarnManager.json @@ -0,0 +1,43 @@ +[ + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "recommend", + "outputs": [ + { + "internalType": "string", + "name": "choice", + "type": "string" + }, + { + "internalType": "uint256", + "name": "capr", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "iapr", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "aapr", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "dapr", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/ILendingPoolAddressesProvider.json b/abi/ILendingPoolAddressesProvider.json new file mode 100644 index 0000000..fda289d --- /dev/null +++ b/abi/ILendingPoolAddressesProvider.json @@ -0,0 +1,17 @@ +[ + { + "constant": true, + "inputs": [], + "name": "getLendingPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/IUniswapAPR.json b/abi/IUniswapAPR.json new file mode 100644 index 0000000..47b2cbf --- /dev/null +++ b/abi/IUniswapAPR.json @@ -0,0 +1,69 @@ +[ + { + "constant": true, + "inputs": [], + "name": "getBlocksPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "roi", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "createdAt", + "type": "uint256" + } + ], + "name": "calcUniswapAPRFromROI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "createdAt", + "type": "uint256" + } + ], + "name": "calcUniswapAPR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/IUniswapFactory.json b/abi/IUniswapFactory.json new file mode 100644 index 0000000..3f2b965 --- /dev/null +++ b/abi/IUniswapFactory.json @@ -0,0 +1,23 @@ +[ + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getExchange", + "outputs": [ + { + "internalType": "address", + "name": "exchange", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/IUniswapROI.json b/abi/IUniswapROI.json new file mode 100644 index 0000000..43207d1 --- /dev/null +++ b/abi/IUniswapROI.json @@ -0,0 +1,28 @@ +[ + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "calcUniswapROI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/IYToken.json b/abi/IYToken.json new file mode 100644 index 0000000..04d1233 --- /dev/null +++ b/abi/IYToken.json @@ -0,0 +1,32 @@ +[ + { + "constant": true, + "inputs": [], + "name": "calcPoolValueInToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/InvestingModule.json b/abi/InvestingModule.json index 749cfa8..f654532 100644 --- a/abi/InvestingModule.json +++ b/abi/InvestingModule.json @@ -942,6 +942,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "upgradeGuardCounter", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [ diff --git a/abi/LendingPoolAddressesProvider.json b/abi/LendingPoolAddressesProvider.json new file mode 100644 index 0000000..a0684e9 --- /dev/null +++ b/abi/LendingPoolAddressesProvider.json @@ -0,0 +1,32 @@ +[ + { + "constant": true, + "inputs": [], + "name": "getLendingPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getLendingPoolCore", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/ReentrancyGuard.json b/abi/ReentrancyGuard.json new file mode 100644 index 0000000..be0c43e --- /dev/null +++ b/abi/ReentrancyGuard.json @@ -0,0 +1,8 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + } +] \ No newline at end of file diff --git a/abi/SavingsModule.json b/abi/SavingsModule.json index 73f6e7b..9834cf6 100644 --- a/abi/SavingsModule.json +++ b/abi/SavingsModule.json @@ -626,6 +626,15 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [], + "name": "upgradeGuardCounter", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -795,9 +804,9 @@ "constant": false, "inputs": [ { - "internalType": "address", - "name": "_protocol", - "type": "address" + "internalType": "address[]", + "name": "_protocols", + "type": "address[]" }, { "internalType": "address[]", @@ -813,9 +822,9 @@ "name": "deposit", "outputs": [ { - "internalType": "uint256", + "internalType": "uint256[]", "name": "", - "type": "uint256" + "type": "uint256[]" } ], "payable": false, @@ -826,9 +835,9 @@ "constant": false, "inputs": [ { - "internalType": "address[]", - "name": "_protocols", - "type": "address[]" + "internalType": "address", + "name": "_protocol", + "type": "address" }, { "internalType": "address[]", @@ -844,9 +853,9 @@ "name": "deposit", "outputs": [ { - "internalType": "uint256[]", + "internalType": "uint256", "name": "", - "type": "uint256[]" + "type": "uint256" } ], "payable": false, diff --git a/abi/Structs.json b/abi/Structs.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/abi/Structs.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/abi/yDAI.json b/abi/yDAI.json new file mode 100644 index 0000000..9a789a4 --- /dev/null +++ b/abi/yDAI.json @@ -0,0 +1,807 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "constant": true, + "inputs": [], + "name": "aave", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "aaveToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "apr", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "compound", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "dToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "dydx", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "fulcrum", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pool", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "provider", + "outputs": [ + { + "internalType": "enum yDAI.Lender", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_shares", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "recommend", + "outputs": [ + { + "internalType": "enum yDAI.Lender", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "supplyDydx", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAave", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAaveCore", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "approveToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balanceDydx", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balanceCompound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balanceCompoundInToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balanceFulcrumInToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balanceFulcrum", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balanceAave", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "rebalance", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "supplyAave", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "supplyFulcrum", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "supplyCompound", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "invest", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "calcPoolValueInToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getPricePerFullShare", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_shares", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/contracts/modules/reward/RewardVestingModule.sol b/contracts/modules/reward/RewardVestingModule.sol index 296acd8..9533df8 100644 --- a/contracts/modules/reward/RewardVestingModule.sol +++ b/contracts/modules/reward/RewardVestingModule.sol @@ -104,6 +104,7 @@ contract RewardVestingModule is Module, RewardManagerRole { RewardInfo storage ri = r.rewardInfo[token]; uint256 epochsLength = ri.epochs.length; require(epochsLength > 0, "RewardVesting: protocol or token not registered"); + if(epochsLength == 1) return; // We can never claim from epoch 0 Epoch storage lastEpoch = ri.epochs[epochsLength-1]; uint256 previousClaim = ri.lastClaim; @@ -129,7 +130,7 @@ contract RewardVestingModule is Module, RewardManagerRole { break; } } - if(ep.end > block.timestamp) { + if(i > 0 && ep.end > block.timestamp) { //Half-claim uint256 epStart = ri.epochs[i-1].end; uint256 claimStart = (previousClaim > epStart)?previousClaim:epStart; diff --git a/contracts/modules/staking/StakingPool.sol b/contracts/modules/staking/StakingPool.sol index ab7ae72..0ca003b 100644 --- a/contracts/modules/staking/StakingPool.sol +++ b/contracts/modules/staking/StakingPool.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.12; +pragma solidity ^0.5.12; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; @@ -19,7 +19,7 @@ contract StakingPool is StakingPoolBase { } struct UserRewardInfo { - mapping(address=>uint256) nextDistribution; //Next unclaimed distribution + mapping(address => uint256) nextDistribution; //Next unclaimed distribution } struct RewardData { @@ -29,9 +29,8 @@ contract StakingPool is StakingPoolBase { RewardVestingModule public rewardVesting; address[] internal registeredRewardTokens; - mapping(address=>RewardData) internal rewards; - mapping(address=>UserRewardInfo) internal userRewards; - + mapping(address => RewardData) internal rewards; + mapping(address => UserRewardInfo) internal userRewards; modifier onlyRewardDistributionModule() { require(_msgSender() == getModuleAddress(MODULE_REWARD_DISTR), "StakingPool: calls allowed from RewardDistributionModule only"); @@ -48,26 +47,26 @@ contract StakingPool is StakingPoolBase { emit RewardTokenRegistered(token); } - function claimRewardsFromVesting() public onlyCapper{ + function claimRewardsFromVesting() public onlyCapper { _claimRewardsFromVesting(); } - function isRegisteredRewardToken(address token) public view returns(bool) { - for(uint256 i=0; i 0){ + if (rwrds > 0) { rewards[token].unclaimed = rewards[token].unclaimed.sub(rwrds); IERC20(token).transfer(user, rwrds); emit RewardWithdraw(user, token, rwrds); @@ -116,7 +116,12 @@ contract StakingPool is StakingPoolBase { return rwrds; } - function createStake(address _address, uint256 _amount, uint256 _lockInDuration, bytes memory _data) internal { + function createStake( + address _address, + uint256 _amount, + uint256 _lockInDuration, + bytes memory _data + ) internal { _withdrawRewards(_address); super.createStake(_address, _amount, _lockInDuration, _data); } @@ -126,27 +131,22 @@ contract StakingPool is StakingPoolBase { super.withdrawStake(_amount, _data); } - function _claimRewardsFromVesting() internal { rewardVesting.claimRewards(); - for(uint256 i=0; i < registeredRewardTokens.length; i++){ + for (uint256 i = 0; i < registeredRewardTokens.length; i++) { address rt = registeredRewardTokens[i]; uint256 expectedBalance = rewards[rt].unclaimed; - if(rt == address(stakingToken)){ + if (rt == address(stakingToken)) { expectedBalance = expectedBalance.add(totalStaked()); } uint256 actualBalance = IERC20(rt).balanceOf(address(this)); - uint256 distributionAmount = actualBalance.sub(expectedBalance); - if(actualBalance > expectedBalance) { + if (actualBalance > expectedBalance) { + uint256 distributionAmount = actualBalance.sub(expectedBalance); uint256 totalShares = totalStaked(); - rewards[rt].distributions.push(RewardDistribution({ - totalShares: totalShares, - amount: distributionAmount - })); + rewards[rt].distributions.push(RewardDistribution({totalShares: totalShares, amount: distributionAmount})); rewards[rt].unclaimed = rewards[rt].unclaimed.add(distributionAmount); emit RewardDistributionCreated(rt, distributionAmount, totalShares); } } } - } diff --git a/contracts/modules/staking/StakingPoolBase.sol b/contracts/modules/staking/StakingPoolBase.sol index 6ae7a07..2995a11 100644 --- a/contracts/modules/staking/StakingPoolBase.sol +++ b/contracts/modules/staking/StakingPoolBase.sol @@ -11,496 +11,460 @@ import "@openzeppelin/contracts-ethereum-package/contracts/access/roles/CapperRo * @title ERC900 Simple Staking Interface basic implementation * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-900.md */ -contract StakingPoolBase is Module, IERC900, CapperRole { - // @TODO: deploy this separately so we don't have to deploy it multiple times for each contract - using SafeMath for uint256; - - // Token used for staking - ERC20 stakingToken; +contract StakingPoolBase is Module, IERC900, CapperRole { + // @TODO: deploy this separately so we don't have to deploy it multiple times for each contract + using SafeMath for uint256; + + // Token used for staking + ERC20 stakingToken; + + // The default duration of stake lock-in (in seconds) + uint256 public defaultLockInDuration; + + // To save on gas, rather than create a separate mapping for totalStakedFor & personalStakes, + // both data structures are stored in a single mapping for a given addresses. + // + // It's possible to have a non-existing personalStakes, but have tokens in totalStakedFor + // if other users are staking on behalf of a given address. + mapping(address => StakeContract) public stakeHolders; + + // Struct for personal stakes (i.e., stakes made by this address) + // unlockedTimestamp - when the stake unlocks (in seconds since Unix epoch) + // actualAmount - the amount of tokens in the stake + // stakedFor - the address the stake was staked for + struct Stake { + uint256 unlockedTimestamp; + uint256 actualAmount; + address stakedFor; + } - // The default duration of stake lock-in (in seconds) - uint256 public defaultLockInDuration; + // Struct for all stake metadata at a particular address + // totalStakedFor - the number of tokens staked for this address + // personalStakeIndex - the index in the personalStakes array. + // personalStakes - append only array of stakes made by this address + // exists - whether or not there are stakes that involve this address + struct StakeContract { + uint256 totalStakedFor; + uint256 personalStakeIndex; + Stake[] personalStakes; + bool exists; + } - // To save on gas, rather than create a separate mapping for totalStakedFor & personalStakes, - // both data structures are stored in a single mapping for a given addresses. - // - // It's possible to have a non-existing personalStakes, but have tokens in totalStakedFor - // if other users are staking on behalf of a given address. - mapping (address => StakeContract) public stakeHolders; - - // Struct for personal stakes (i.e., stakes made by this address) - // unlockedTimestamp - when the stake unlocks (in seconds since Unix epoch) - // actualAmount - the amount of tokens in the stake - // stakedFor - the address the stake was staked for - struct Stake { - uint256 unlockedTimestamp; - uint256 actualAmount; - address stakedFor; - } + bool public userCapEnabled; - // Struct for all stake metadata at a particular address - // totalStakedFor - the number of tokens staked for this address - // personalStakeIndex - the index in the personalStakes array. - // personalStakes - append only array of stakes made by this address - // exists - whether or not there are stakes that involve this address - struct StakeContract { - uint256 totalStakedFor; + mapping(address => uint256) public userCap; //Limit of pool tokens which can be minted for a user during deposit - uint256 personalStakeIndex; + uint256 public defaultUserCap; + bool public stakingCapEnabled; + uint256 public stakingCap; - Stake[] personalStakes; + bool public vipUserEnabled; + mapping(address => bool) public isVipUser; - bool exists; - } + uint256 internal totalStakedAmount; - bool public userCapEnabled; + uint256 public coeffScore; - mapping(address => uint256) public userCap; //Limit of pool tokens which can be minted for a user during deposit + uint256 private _guardCounter; // See OpenZeppelin ReentrancyGuard. Copied here to allow upgrade of already deployed contracts - - uint256 public defaultUserCap; - bool public stakingCapEnabled; - uint256 public stakingCap; + event VipUserEnabledChange(bool enabled); + event VipUserChanged(address indexed user, bool isVip); + event StakingCapChanged(uint256 newCap); + event StakingCapEnabledChange(bool enabled); - bool public vipUserEnabled; - mapping(address => bool) public isVipUser; + //global cap + event DefaultUserCapChanged(uint256 newCap); - uint256 internal totalStakedAmount; + event UserCapEnabledChange(bool enabled); - uint256 public coeffScore; - + event UserCapChanged(address indexed user, uint256 newCap); + event Staked(address indexed user, uint256 amount, uint256 totalStacked, bytes data); + event Unstaked(address indexed user, uint256 amount, uint256 totalStacked, bytes data); + event setLockInDuration(uint256 defaultLockInDuration); + event CoeffScoreUpdated(uint256 coeff); - event VipUserEnabledChange(bool enabled); - event VipUserChanged(address indexed user, bool isVip); + /** + * @dev Prevents a contract from calling itself, directly or indirectly. + * See OpenZeppelin ReentrancyGuard + */ + modifier nonReentrant() { + _guardCounter += 1; + uint256 localCounter = _guardCounter; + _; + require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call"); + } - event StakingCapChanged(uint256 newCap); - event StakingCapEnabledChange(bool enabled); + /** + * @dev Modifier that checks that this contract can transfer tokens from the + * balance in the stakingToken contract for the given address. + * @dev This modifier also transfers the tokens. + * @param _address address to transfer tokens from + * @param _amount uint256 the number of tokens + */ + modifier canStake(address _address, uint256 _amount) { + require(stakingToken.transferFrom(_address, address(this), _amount), "Stake required"); + + _; + } - //global cap - event DefaultUserCapChanged(uint256 newCap); + modifier isUserCapEnabledForStakeFor(uint256 stake) { + if (stakingCapEnabled && !(vipUserEnabled && isVipUser[_msgSender()])) { + require((stakingCap > totalStaked() && (stakingCap - totalStaked() >= stake)), "StakingPoolBase: stake exeeds staking cap"); + } - event UserCapEnabledChange(bool enabled); + if (userCapEnabled) { + uint256 cap = userCap[_msgSender()]; + //check default user cap settings + if (defaultUserCap > 0) { + uint256 totalStaked = totalStakedFor(_msgSender()); + //get new cap + if (defaultUserCap >= totalStaked) { + cap = defaultUserCap.sub(totalStaked); + } else { + cap = 0; + } + } + + require(cap >= stake, "StakingPoolBase: stake exeeds cap"); + cap = cap.sub(stake); + userCap[_msgSender()] = cap; + emit UserCapChanged(_msgSender(), cap); + } - event UserCapChanged(address indexed user, uint256 newCap); - event Staked(address indexed user, uint256 amount, uint256 totalStacked, bytes data); - event Unstaked(address indexed user, uint256 amount, uint256 totalStacked, bytes data); - event setLockInDuration(uint256 defaultLockInDuration); + _; + } - event CoeffScoreUpdated(uint256 coeff); - /** - * @dev Modifier that checks that this contract can transfer tokens from the - * balance in the stakingToken contract for the given address. - * @dev This modifier also transfers the tokens. - * @param _address address to transfer tokens from - * @param _amount uint256 the number of tokens - */ - modifier canStake(address _address, uint256 _amount) { - require( - stakingToken.transferFrom(_address, address(this), _amount), - "Stake required"); + modifier isUserCapEnabledForUnStakeFor(uint256 unStake) { + _; - _; - } + if (userCapEnabled) { + uint256 cap = userCap[_msgSender()]; + cap = cap.add(unStake); + if (cap > defaultUserCap) { + cap = defaultUserCap; + } - modifier isUserCapEnabledForStakeFor(uint256 stake) { + userCap[_msgSender()] = cap; + emit UserCapChanged(_msgSender(), cap); + } + } - if (stakingCapEnabled && !(vipUserEnabled && isVipUser[_msgSender()])) { - require((stakingCap > totalStaked() && (stakingCap-totalStaked() >= stake)), "StakingModule: stake exeeds staking cap"); + modifier checkUserCapDisabled() { + require(isUserCapEnabled() == false, "UserCapEnabled"); + _; } - if(userCapEnabled) { - uint256 cap = userCap[_msgSender()]; - //check default user cap settings - if (defaultUserCap > 0) { - uint256 totalStaked = totalStakedFor(_msgSender()); - //get new cap - if (defaultUserCap >= totalStaked) { - cap = defaultUserCap.sub(totalStaked); - } else { - cap = 0; - } - } - - require(cap >= stake, "StakingModule: stake exeeds cap"); - cap = cap.sub(stake); - userCap[_msgSender()] = cap; - emit UserCapChanged(_msgSender(), cap); + modifier checkUserCapEnabled() { + require(isUserCapEnabled(), "UserCapDisabled"); + _; } - - _; - } + function initialize( + address _pool, + ERC20 _stakingToken, + uint256 _defaultLockInDuration + ) public initializer { + stakingToken = _stakingToken; + defaultLockInDuration = _defaultLockInDuration; + Module.initialize(_pool); - modifier isUserCapEnabledForUnStakeFor(uint256 unStake) { - _; + CapperRole.initialize(_msgSender()); + } - if(userCapEnabled){ - uint256 cap = userCap[_msgSender()]; - cap = cap.add(unStake); + function setDefaultLockInDuration(uint256 _defaultLockInDuration) public onlyOwner { + defaultLockInDuration = _defaultLockInDuration; + emit setLockInDuration(_defaultLockInDuration); + } - if (cap > defaultUserCap) { - cap = defaultUserCap; - } + function setUserCapEnabled(bool _userCapEnabled) public onlyCapper { + userCapEnabled = _userCapEnabled; + emit UserCapEnabledChange(userCapEnabled); + } - userCap[_msgSender()] = cap; - emit UserCapChanged(_msgSender(), cap); - } - } + function setStakingCapEnabled(bool _stakingCapEnabled) public onlyCapper { + stakingCapEnabled = _stakingCapEnabled; + emit StakingCapEnabledChange(stakingCapEnabled); + } - modifier checkUserCapDisabled() { - require(isUserCapEnabled() == false, "UserCapEnabled"); - _; - } + function setDefaultUserCap(uint256 _newCap) public onlyCapper { + defaultUserCap = _newCap; + emit DefaultUserCapChanged(_newCap); + } - modifier checkUserCapEnabled() { - require(isUserCapEnabled(), "UserCapDisabled"); - _; - } - + function setStakingCap(uint256 _newCap) public onlyCapper { + stakingCap = _newCap; + emit StakingCapChanged(_newCap); + } - function initialize(address _pool, ERC20 _stakingToken, uint256 _defaultLockInDuration) public initializer { - stakingToken = _stakingToken; - defaultLockInDuration = _defaultLockInDuration; - Module.initialize(_pool); + function setUserCap(address user, uint256 cap) public onlyCapper { + userCap[user] = cap; + emit UserCapChanged(user, cap); + } - CapperRole.initialize(_msgSender()); - } - - function setDefaultLockInDuration(uint256 _defaultLockInDuration) public onlyOwner { - defaultLockInDuration = _defaultLockInDuration; - emit setLockInDuration(_defaultLockInDuration); - } - - function setUserCapEnabled(bool _userCapEnabled) public onlyCapper { - userCapEnabled = _userCapEnabled; - emit UserCapEnabledChange(userCapEnabled); - } - - function setStakingCapEnabled(bool _stakingCapEnabled) public onlyCapper { - stakingCapEnabled= _stakingCapEnabled; - emit StakingCapEnabledChange(stakingCapEnabled); - } - - function setDefaultUserCap(uint256 _newCap) public onlyCapper { - defaultUserCap = _newCap; - emit DefaultUserCapChanged(_newCap); - } - - function setStakingCap(uint256 _newCap) public onlyCapper { - stakingCap = _newCap; - emit StakingCapChanged(_newCap); - } - - function setUserCap(address user, uint256 cap) public onlyCapper { - userCap[user] = cap; - emit UserCapChanged(user, cap); - } - - function setUserCap(address[] memory users, uint256[] memory caps) public onlyCapper { - require(users.length == caps.length, "SavingsModule: arrays length not match"); - for(uint256 i=0; i < users.length; i++) { + function setUserCap(address[] memory users, uint256[] memory caps) public onlyCapper { + require(users.length == caps.length, "StakingPoolBase: arrays length not match"); + for (uint256 i = 0; i < users.length; i++) { userCap[users[i]] = caps[i]; emit UserCapChanged(users[i], caps[i]); } - } - - - function setVipUserEnabled(bool _vipUserEnabled) public onlyCapper { - vipUserEnabled = _vipUserEnabled; - emit VipUserEnabledChange(_vipUserEnabled); - } - - function setVipUser(address user, bool isVip) public onlyCapper { - isVipUser[user] = isVip; - emit VipUserChanged(user, isVip); - } - - - function setCoeffScore(uint256 coeff) public onlyCapper { - coeffScore = coeff; - - emit CoeffScoreUpdated(coeff); - } - - function isUserCapEnabled() public view returns(bool) { - return userCapEnabled; - } - - - function iStakingCapEnabled() public view returns(bool) { - return stakingCapEnabled; - } - - /** - * @dev Returns the timestamps for when active personal stakes for an address will unlock - * @dev These accessors functions are needed until https://github.com/ethereum/web3.js/issues/1241 is solved - * @param _address address that created the stakes - * @return uint256[] array of timestamps - */ - function getPersonalStakeUnlockedTimestamps(address _address) external view returns (uint256[] memory) { - uint256[] memory timestamps; - (timestamps,,) = getPersonalStakes(_address); - - return timestamps; - } - - - - - /** - * @dev Returns the stake actualAmount for active personal stakes for an address - * @dev These accessors functions are needed until https://github.com/ethereum/web3.js/issues/1241 is solved - * @param _address address that created the stakes - * @return uint256[] array of actualAmounts - */ - function getPersonalStakeActualAmounts(address _address) external view returns (uint256[] memory) { - uint256[] memory actualAmounts; - (,actualAmounts,) = getPersonalStakes(_address); - - return actualAmounts; - } - - function getPersonalStakeTotalAmount(address _address) public view returns(uint256) { - uint256[] memory actualAmounts; - (,actualAmounts,) = getPersonalStakes(_address); - uint256 totalStake; - for(uint256 i=0; i