@defisaver/sdk 0.1.21 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/ACTIONS.md +20 -254
  2. package/AccessLists/DyDxAccessLists.js +0 -4
  3. package/AccessLists/InstaAccessLists.js +0 -8
  4. package/AccessLists/UtilsAccessLists.js +0 -5
  5. package/DEV.md +0 -7
  6. package/index.js +15 -2
  7. package/package.json +1 -1
  8. package/src/Action.js +52 -12
  9. package/src/L2Action.js +44 -0
  10. package/src/Recipe.js +5 -4
  11. package/src/Strategy.js +63 -0
  12. package/src/abis/Action.json +157 -11
  13. package/src/abis/Recipe.json +92 -47
  14. package/src/actions/aave/AaveBorrowAction.js +11 -2
  15. package/src/actions/aave/AavePaybackAction.js +11 -2
  16. package/src/actions/aave/AaveSupplyAction.js +9 -1
  17. package/src/actions/aave/AaveWithdrawAction.js +8 -1
  18. package/src/actions/aaveV3/AaveV3ATokenPaybackAction.js +53 -0
  19. package/src/actions/aaveV3/AaveV3BorrowAction.js +54 -0
  20. package/src/actions/aaveV3/AaveV3CollateralSwitchAction.js +41 -0
  21. package/src/actions/aaveV3/AaveV3PaybackAction.js +63 -0
  22. package/src/actions/aaveV3/AaveV3SetEModeAction.js +35 -0
  23. package/src/actions/aaveV3/AaveV3SupplyAction.js +64 -0
  24. package/src/actions/aaveV3/AaveV3WithdrawAction.js +41 -0
  25. package/src/actions/aaveV3/index.js +17 -0
  26. package/src/actions/basic/GasFeeAction.js +27 -0
  27. package/src/actions/basic/PullTokenAction.js +9 -3
  28. package/src/actions/basic/SellAction.js +6 -5
  29. package/src/actions/basic/SendTokenAction.js +9 -3
  30. package/src/actions/basic/SumInputsAction.js +8 -3
  31. package/src/actions/basic/UnwrapEthAction.js +8 -3
  32. package/src/actions/basic/WrapEthAction.js +5 -1
  33. package/src/actions/basic/index.js +2 -2
  34. package/src/actions/checkers/MakerRatioCheckAction.js +29 -0
  35. package/src/actions/checkers/index.js +5 -0
  36. package/src/actions/compound/CompoundBorrowAction.js +7 -1
  37. package/src/actions/compound/CompoundClaimAction.js +6 -1
  38. package/src/actions/compound/CompoundPaybackAction.js +7 -1
  39. package/src/actions/compound/CompoundSupplyAction.js +7 -1
  40. package/src/actions/compound/CompoundWithdrawAction.js +7 -1
  41. package/src/actions/dydx/DyDxWithdrawAction.js +7 -1
  42. package/src/actions/dydx/index.js +0 -2
  43. package/src/actions/flashloan/AaveV2FlashLoanAction.js +2 -2
  44. package/src/actions/flashloan/BalancerFlashLoanAction.js +2 -2
  45. package/src/actions/flashloan/DyDxFlashLoanAction.js +1 -1
  46. package/src/actions/flashloan/MakerFlashLoanAction.js +2 -2
  47. package/src/actions/index.js +4 -0
  48. package/src/actions/insta/index.js +0 -2
  49. package/src/actions/liquity/LiquityClaimAction.js +6 -2
  50. package/src/actions/liquity/LiquityCloseAction.js +7 -2
  51. package/src/actions/maker/MakerGenerateAction.js +8 -1
  52. package/src/actions/maker/MakerGiveAction.js +7 -1
  53. package/src/actions/maker/MakerMergeAction.js +7 -1
  54. package/src/actions/maker/MakerOpenVaultAction.js +6 -1
  55. package/src/actions/maker/MakerPaybackAction.js +1 -0
  56. package/src/actions/maker/MakerRatioAction.js +20 -0
  57. package/src/actions/maker/MakerSupplyAction.js +9 -1
  58. package/src/actions/maker/MakerWithdrawAction.js +10 -2
  59. package/src/actions/maker/index.js +2 -0
  60. package/src/actions/mstable/MStableDepositAction.js +2 -2
  61. package/src/actions/mstable/MStableWithdrawAction.js +2 -2
  62. package/src/actions/reflexer/ReflexerGenerateAction.js +7 -1
  63. package/src/actions/reflexer/ReflexerOpenSafeAction.js +5 -1
  64. package/src/actions/reflexer/ReflexerPaybackAction.js +7 -1
  65. package/src/actions/reflexer/ReflexerSupplyAction.js +8 -1
  66. package/src/actions/reflexer/ReflexerWithdrawAction.js +8 -1
  67. package/src/addresses.js +179 -143
  68. package/src/config.js +74 -0
  69. package/src/triggers/ChainLinkPriceTrigger.js +12 -0
  70. package/src/triggers/CompoundRatioTrigger.js +11 -0
  71. package/src/triggers/GasPriceTrigger.js +11 -0
  72. package/src/triggers/LiquityRatioTrigger.js +16 -0
  73. package/src/triggers/MakerRatioTrigger.js +15 -0
  74. package/src/triggers/ReflexerRatioTrigger.js +11 -0
  75. package/src/triggers/TimestampTrigger.js +11 -0
  76. package/src/triggers/UniV3CurrentTickTrigger.js +12 -0
  77. package/src/triggers/index.js +19 -0
  78. package/src/types.js +33 -0
  79. package/src/utils/general.js +2 -0
  80. package/src/utils/zeroExExchange.js +2 -40
  81. package/test/accessLists/MockAccessLists.json +0 -72
  82. package/test/accessLists/Recipe.js +3 -3
  83. package/test/actions/insta/InstPullTokensAction.js +2 -2
  84. package/test/index.js +4 -1
  85. package/test/utils/zeroExExchange.js +0 -8
  86. package/src/actions/basic/BuyAction.js +0 -53
  87. package/src/actions/dydx/DyDxSupplyAction.js +0 -25
  88. package/src/actions/insta/ClaimInstMakerAction.js +0 -21
  89. package/test/actions/basic/BuyAction.js +0 -100
  90. package/test/actions/dydx/DyDxSupplyAction.js +0 -78
  91. package/test/actions/insta/ClaimInstMakerAction.js +0 -46
@@ -0,0 +1,41 @@
1
+ const L2Action = require("../../L2Action");
2
+ const { getAddr } = require('../../addresses.js');
3
+
4
+ /**
5
+ * AaveV3CollateralSwitchAction - Aave enable/disable token usage as collateral for AaveV3 position
6
+ */
7
+ class AaveV3CollateralSwitchAction extends L2Action {
8
+ /**
9
+ * @param market {EthAddress} Address provider for specific market
10
+ * @param arrayLength {number} length of two arrays
11
+ * @param assetIds {Array<number>}
12
+ * @param useAsCollateral {Array<boolean>}
13
+ */
14
+ constructor(market, arrayLength, assetIds, useAsCollateral) {
15
+ super(
16
+ 'AaveV3CollateralSwitch',
17
+ getAddr('AaveV3CollateralSwitch'),
18
+ [['address', 'uint8', 'uint16[]', 'bool[]']],
19
+ [[market, arrayLength, assetIds, useAsCollateral]],
20
+ );
21
+ }
22
+ encodeInputs() {
23
+ // executeActionDirectL2
24
+ let encodedInput = "0x2895f3aa";
25
+ // market
26
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][0]));
27
+ // arrayLength
28
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0][1]));
29
+ const arrayLength = this.args[0][1];
30
+ for (let i = 0; i < arrayLength; i++){
31
+ // assetIds[i]
32
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][2][i]));
33
+ // useAsCollateral[i]
34
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][3][i]));
35
+ }
36
+
37
+ return encodedInput;
38
+ }
39
+ }
40
+
41
+ module.exports = AaveV3CollateralSwitchAction;
@@ -0,0 +1,63 @@
1
+ const L2Action = require("../../L2Action");
2
+ const {getAssetInfoByAddress} = require("@defisaver/tokens");
3
+ const { getAddr } = require('../../addresses.js');
4
+
5
+ /**
6
+ * AaveV3PaybackAction - Payback debt on Aave using underlying token
7
+ */
8
+ class AaveV3PaybackAction extends L2Action {
9
+ /**
10
+ * @param market {EthAddress} Address provider for specific market
11
+ * @param amount {string} Amount of tokens to be payed back
12
+ * @param from {EthAddress} Tokens will be supplied from this address
13
+ * @param rateMode {number} Type of borrow debt [Stable: 1, Variable: 2]
14
+ * @param tokenAddr {EthAddress} Address of underlying asset
15
+ * @param assetId {number} The id of the underlying asset to be repaid
16
+ * @param useOnBehalf {boolean} use on behalf param or default to proxy
17
+ * @param onBehalf {EthAddress} For what user we are paying back the debt, defaults to proxy
18
+ */
19
+ constructor(market, amount, from, rateMode, tokenAddr, assetId, useOnBehalf , onBehalf = getAddr('Empty')) {
20
+ super('AaveV3Payback', getAddr('AaveV3Payback'),
21
+ [['address','uint256','address','uint8','uint16','bool', 'address']],
22
+ [[market, amount, from, rateMode, assetId, useOnBehalf, onBehalf]]
23
+ );
24
+
25
+ this.mappableArgs = [
26
+ this.args[0][0],
27
+ this.args[0][1],
28
+ this.args[0][2],
29
+ this.args[0][6],
30
+ ];
31
+ this.tokenForApproval = tokenAddr;
32
+ }
33
+
34
+ async getAssetsToApprove() {
35
+ const asset = getAssetInfoByAddress(this.tokenForApproval);
36
+ if (asset.symbol !== 'ETH') return [{asset: this.tokenForApproval, owner: this.args[3]}];
37
+ return [];
38
+ }
39
+
40
+ encodeInputs() {
41
+ // executeActionDirectL2
42
+ let encodedInput = "0x2895f3aa";
43
+ // market
44
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][0]));
45
+ // amount
46
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][1]));
47
+ // from
48
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][2]));
49
+ // rateMode
50
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0][3]));
51
+ // assetId
52
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][4]));
53
+ // useOnBehalf
54
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][5]));
55
+ if (this.args[0][5]) {
56
+ // onBehalf
57
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][6]));
58
+ }
59
+ return encodedInput;
60
+ }
61
+ }
62
+
63
+ module.exports = AaveV3PaybackAction;
@@ -0,0 +1,35 @@
1
+ const L2Action = require("../../L2Action");
2
+ const { getAddr } = require('../../addresses.js');
3
+
4
+ /**
5
+ * AaveV3SetEModeAction - Set EMode for the proxy AaveV3 position
6
+ */
7
+ class AaveV3SetEModeAction extends L2Action {
8
+ /**
9
+ * @param market {EthAddress} Address provider for specific market
10
+ * @param categoryId {number} ID of the category emode
11
+ */
12
+ constructor(market, categoryId) {
13
+ super('AaveV3SetEMode', getAddr('AaveV3SetEMode'),
14
+ [['address','uint8']],
15
+ [[market, categoryId]]
16
+ );
17
+
18
+ this.mappableArgs = [
19
+ this.args[0][0],
20
+ ];
21
+ }
22
+ encodeInputs() {
23
+ // executeActionDirectL2
24
+ let encodedInput = "0x2895f3aa";
25
+ // market
26
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][0]));
27
+ // assetId
28
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0][1]));
29
+ // amount
30
+ return encodedInput;
31
+ }
32
+
33
+ }
34
+
35
+ module.exports = AaveV3SetEModeAction;
@@ -0,0 +1,64 @@
1
+ const L2Action = require("../../L2Action");
2
+ const {getAssetInfoByAddress} = require("@defisaver/tokens");
3
+ const { getAddr } = require('../../addresses.js');
4
+
5
+ /**
6
+ * AaveV3SupplyAction - Supply token to an aave position on Aave V3
7
+ */
8
+ class AaveV3SupplyAction extends L2Action {
9
+
10
+ /**
11
+ * @param market {EthAddress} Address provider for specific market
12
+ * @param amount {string} Amount of tokens to be deposited
13
+ * @param from {EthAddress} Tokens will be supplied from this address
14
+ * @param tokenAddress {EthAddress} Address of the token
15
+ * @param assetId {number} The id of the token to be deposited
16
+ * @param enableAsColl {boolean} If we need to enable asset as collateral
17
+ * @param useOnBehalf {boolean}
18
+ * @param onBehalf {EthAddress} For what user we are supplying the tokens, defaults to proxy
19
+ */
20
+ constructor(market, amount, from, tokenAddress, assetId, enableAsColl, useOnBehalf , onBehalf = getAddr('Empty')) {
21
+ super('AaveV3Supply', getAddr('AaveV3Supply'),
22
+ [['address','uint256','address','uint16','bool','bool', 'address']],
23
+ [[market, amount, from, assetId, enableAsColl, useOnBehalf, onBehalf]]
24
+ );
25
+
26
+ this.mappableArgs = [
27
+ this.args[0][0],
28
+ this.args[0][1],
29
+ this.args[0][2],
30
+ this.args[0][6],
31
+ ];
32
+ this.tokenForApproval = tokenAddress;
33
+ }
34
+
35
+ async getAssetsToApprove() {
36
+ const asset = getAssetInfoByAddress(this.tokenForApproval);
37
+ if (asset.symbol !== 'ETH') return [{asset: this.tokenForApproval, owner: this.args[0][2]}];
38
+ return [];
39
+ }
40
+
41
+ encodeInputs() {
42
+ // executeActionDirectL2
43
+ let encodedInput = "0x2895f3aa";
44
+ // market
45
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][0]));
46
+ // assetId
47
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][3]));
48
+ // amount
49
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][1]));
50
+ // from
51
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][2]));
52
+ // enableAsColl
53
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][4]));
54
+ // useOnBehalf
55
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][5]));
56
+ if (this.args[0][5]) {
57
+ // onBehalf
58
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][6]));
59
+ }
60
+ return encodedInput;
61
+ }
62
+ }
63
+
64
+ module.exports = AaveV3SupplyAction;
@@ -0,0 +1,41 @@
1
+ const L2Action = require("../../L2Action");
2
+ const { getAddr } = require('../../addresses.js');
3
+
4
+ /**
5
+ * AaveV3WithdrawAction - Withdraw a previously supplied token from a position in AaveV3
6
+ */
7
+ class AaveV3WithdrawAction extends L2Action {
8
+ /**
9
+ * @param market {EthAddress} Address provider for specific market
10
+ * @param assetId {number} The id of the token to be deposited
11
+ * @param amount {string} Amount of tokens to be withdrawn -> send type(uint).max for whole amount
12
+ * @param to {EthAddress} Where the withdrawn tokens will be sent
13
+ */
14
+ constructor(market, assetId, amount, to) {
15
+ super('AaveV3Withdraw', getAddr('AaveV3Withdraw'),
16
+ [['address','uint16','uint256','address']],
17
+ [[market, assetId, amount, to]]
18
+ );
19
+
20
+ this.mappableArgs = [
21
+ this.args[0][0],
22
+ this.args[0][2],
23
+ this.args[0][3],
24
+ ];
25
+ }
26
+ encodeInputs() {
27
+ // executeActionDirectL2
28
+ let encodedInput = "0x2895f3aa";
29
+ // market
30
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][0]));
31
+ // assetId
32
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][1]));
33
+ // amount
34
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][2]));
35
+ // from
36
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][3]));
37
+ return encodedInput;
38
+ }
39
+ }
40
+
41
+ module.exports = AaveV3WithdrawAction;
@@ -0,0 +1,17 @@
1
+ const AaveV3SupplyAction = require('./AaveV3SupplyAction');
2
+ const AaveV3BorrowAction = require('./AaveV3BorrowAction');
3
+ const AaveV3PaybackAction = require('./AaveV3PaybackAction');
4
+ const AaveV3WithdrawAction = require('./AaveV3WithdrawAction');
5
+ const AaveV3SetEModeAction = require('./AaveV3SetEModeAction');
6
+ const AaveV3ATokenPaybackAction = require('./AaveV3ATokenPaybackAction');
7
+ const AaveV3CollateralSwitchAction = require('./AaveV3CollateralSwitchAction');
8
+
9
+ module.exports = {
10
+ AaveV3SupplyAction,
11
+ AaveV3BorrowAction,
12
+ AaveV3PaybackAction,
13
+ AaveV3WithdrawAction,
14
+ AaveV3SetEModeAction,
15
+ AaveV3ATokenPaybackAction,
16
+ AaveV3CollateralSwitchAction,
17
+ }
@@ -0,0 +1,27 @@
1
+ const Action = require("../../Action");
2
+ const {getAddr} = require("../../addresses.js");
3
+
4
+ class GasFeeAction extends Action {
5
+ /**
6
+ * @param gasStart {string} Always 0 will be inject value
7
+ * @param feeToken {string} Address of the token we are taken the fee in
8
+ * @param availableAmount Amount we have available to pay the gas fee
9
+ * @param dfsFeeDivider Additional fee for DFS, default is 5bps
10
+ */
11
+ constructor(gasStart, feeToken, availableAmount, dfsFeeDivider = 2000) {
12
+ super("GasFeeTaker",
13
+ getAddr("GasFeeTaker"),
14
+ [["uint256", "address", "uint256", "uint256"]],
15
+ [[gasStart, feeToken, availableAmount, dfsFeeDivider]],
16
+ );
17
+
18
+ this.mappableArgs = [
19
+ this.args[0][1],
20
+ this.args[0][2],
21
+ this.args[0][3],
22
+ ];
23
+ }
24
+
25
+ }
26
+
27
+ module.exports = GasFeeAction;
@@ -17,13 +17,19 @@ class PullTokenAction extends Action {
17
17
  super(
18
18
  'PullToken',
19
19
  getAddr('PullToken'),
20
- [
20
+ [[
21
21
  "address",
22
22
  "address",
23
23
  "uint",
24
- ],
25
- [...arguments]
24
+ ]],
25
+ [[...arguments]]
26
26
  );
27
+
28
+ this.mappableArgs = [
29
+ this.args[0][0],
30
+ this.args[0][1],
31
+ this.args[0][2],
32
+ ];
27
33
  }
28
34
 
29
35
  async getAssetsToApprove() {
@@ -19,22 +19,23 @@ class SellAction extends Action {
19
19
  super(
20
20
  'DFSSell',
21
21
  getAddr('DFSSell'),
22
- [
22
+ [[
23
23
  ["address","address","uint256","uint256","uint256","uint256","address","address","bytes",["address","address","address","uint256","uint256","bytes"]],
24
24
  "address",
25
25
  "address",
26
+ ]
26
27
  ],
27
- [exchangeOrder, from, to]
28
+ [[exchangeOrder, from, to]]
28
29
  );
29
30
 
30
31
  this.protocolFee = protocolFee;
31
32
 
32
33
  this.mappableArgs = [
33
- this.args[0][0],
34
+ this.args[0][0][0],
35
+ this.args[0][0][1],
36
+ this.args[0][0][2],
34
37
  this.args[0][1],
35
38
  this.args[0][2],
36
- this.args[1],
37
- this.args[2],
38
39
  ];
39
40
  }
40
41
 
@@ -17,13 +17,19 @@ class SendTokenAction extends Action {
17
17
  super(
18
18
  'SendToken',
19
19
  getAddr('SendToken'),
20
- [
20
+ [[
21
21
  "address",
22
22
  "address",
23
23
  "uint",
24
- ],
25
- [...arguments]
24
+ ]],
25
+ [[...arguments]]
26
26
  );
27
+
28
+ this.mappableArgs = [
29
+ this.args[0][0],
30
+ this.args[0][1],
31
+ this.args[0][2],
32
+ ];
27
33
  }
28
34
  }
29
35
 
@@ -9,12 +9,17 @@ class SumInputsAction extends Action {
9
9
  super(
10
10
  'SumInputs',
11
11
  getAddr('SumInputs'),
12
- [
12
+ [[
13
13
  "uint",
14
14
  "uint",
15
- ],
16
- [...arguments]
15
+ ]],
16
+ [[...arguments]]
17
17
  );
18
+
19
+ this.mappableArgs = [
20
+ this.args[0][0],
21
+ this.args[0][1],
22
+ ];
18
23
  }
19
24
  }
20
25
 
@@ -15,12 +15,17 @@ class UnwrapEthAction extends Action {
15
15
  super(
16
16
  'UnwrapEth',
17
17
  getAddr('UnwrapEth'),
18
- [
18
+ [[
19
19
  "uint256",
20
20
  "address"
21
- ],
22
- [...arguments]
21
+ ]],
22
+ [[...arguments]]
23
23
  );
24
+
25
+ this.mappableArgs = [
26
+ this.args[0][0],
27
+ this.args[0][1],
28
+ ];
24
29
  }
25
30
  }
26
31
 
@@ -9,7 +9,11 @@ class WrapEthAction extends Action {
9
9
  * @param amount {string} Transfer amount
10
10
  */
11
11
  constructor(amount) {
12
- super("WrapEth", getAddr("WrapEth"), ["uint256"], [...arguments]);
12
+ super("WrapEth", getAddr("WrapEth"), [["uint256"]], [[...arguments]]);
13
+
14
+ this.mappableArgs = [
15
+ this.args[0][0],
16
+ ];
13
17
  }
14
18
 
15
19
  async getEthValue() {
@@ -1,5 +1,4 @@
1
1
  const SellAction = require('./SellAction');
2
- const BuyAction = require('./BuyAction');
3
2
  const SendTokenAction = require('./SendTokenAction');
4
3
  const PullTokenAction = require('./PullTokenAction');
5
4
  const WrapEthAction = require('./WrapEthAction');
@@ -9,10 +8,10 @@ const SubInputsAction = require('./SubInputsAction');
9
8
  const ChangeProxyOwnerAction = require('./ChangeProxyOwnerAction');
10
9
  const TokenBalanceAction = require('./TokenBalanceAction');
11
10
  const AutomationV2Unsub = require('./AutomationV2Unsub');
11
+ const GasFeeAction = require('./GasFeeAction');
12
12
 
13
13
  module.exports = {
14
14
  SellAction,
15
- BuyAction,
16
15
  SendTokenAction,
17
16
  PullTokenAction,
18
17
  WrapEthAction,
@@ -22,4 +21,5 @@ module.exports = {
22
21
  ChangeProxyOwnerAction,
23
22
  TokenBalanceAction,
24
23
  AutomationV2Unsub,
24
+ GasFeeAction,
25
25
  };
@@ -0,0 +1,29 @@
1
+ const Action = require("../../Action");
2
+ const {getAddr} = require("../../addresses.js");
3
+
4
+ /**
5
+ * MakerRatioCheckAction - Checks mcd ratio at end of all actions
6
+ */
7
+ class MakerRatioCheckAction extends Action {
8
+ /**
9
+ * @param ratioState {uint8} If it should lower/higher
10
+ * @param checkTarget {}
11
+ * @param targetRatio {string} The ratio user want to be at
12
+ * @param vaultId {string} Id of the vault
13
+ * @param startRatioIndex {uint256} Index in returnValues where ratio before actions is stored
14
+ */
15
+ constructor(ratioState, checkTarget, targetRatio, vaultId, startRatioIndex) {
16
+ super("McdRatioCheck", getAddr("McdRatioCheck"), [["uint8","bool","uint256","uint256","uint256"]], [[ratioState, checkTarget, targetRatio, vaultId, startRatioIndex]]);
17
+
18
+ this.mappableArgs = [
19
+ this.args[0][0],
20
+ this.args[0][2],
21
+ this.args[0][3],
22
+ this.args[0][4],
23
+ ];
24
+ }
25
+
26
+ }
27
+
28
+ module.exports = MakerRatioCheckAction;
29
+
@@ -0,0 +1,5 @@
1
+ const MakerRatioCheckAction = require('./MakerRatioCheckAction');
2
+
3
+ module.exports = {
4
+ MakerRatioCheckAction,
5
+ };
@@ -13,7 +13,13 @@ class CompoundBorrowAction extends Action {
13
13
  */
14
14
  constructor(cTokenAddr, amount, to) {
15
15
  requireAddress(to);
16
- super('CompBorrow', getAddr('CompBorrow'), ['address','uint256','address'], [...arguments]);
16
+ super('CompBorrow', getAddr('CompBorrow'), [['address','uint256','address']], [[...arguments]]);
17
+
18
+ this.mappableArgs = [
19
+ this.args[0][0],
20
+ this.args[0][1],
21
+ this.args[0][2],
22
+ ];
17
23
  }
18
24
  }
19
25
 
@@ -14,7 +14,12 @@ class CompoundClaimAction extends Action {
14
14
  */
15
15
  constructor(cSupplyAddresses, cBorrowAddresses, from, to) {
16
16
  requireAddress(to);
17
- super('CompClaim', getAddr('CompClaim'), ["address[]", "address[]", "address", "address"], [...arguments]);
17
+ super('CompClaim', getAddr('CompClaim'), [["address[]", "address[]", "address", "address"]], [[...arguments]]);
18
+
19
+ this.mappableArgs = [
20
+ this.args[0][2],
21
+ this.args[0][3],
22
+ ];
18
23
  }
19
24
  }
20
25
 
@@ -13,7 +13,13 @@ class CompoundPaybackAction extends Action {
13
13
  * @param onBehalf {EthAddress} Defaults to DsProxy address if 0x0
14
14
  */
15
15
  constructor(cTokenAddr, amount, from, onBehalf = getAddr('Empty')) {
16
- super('CompPayback', getAddr('CompPayback'), ['address', 'uint256', 'address', 'address'], [cTokenAddr, amount, from, onBehalf]);
16
+ super('CompPayback', getAddr('CompPayback'), [['address', 'uint256', 'address', 'address']], [[cTokenAddr, amount, from, onBehalf]]);
17
+ this.mappableArgs = [
18
+ this.args[0][0],
19
+ this.args[0][1],
20
+ this.args[0][2],
21
+ this.args[0][3],
22
+ ];
17
23
  }
18
24
 
19
25
  async getAssetsToApprove() {
@@ -13,7 +13,13 @@ class CompoundSupplyAction extends Action {
13
13
  * @param enableAsColl {boolean} If we need to enable asset as collateral
14
14
  */
15
15
  constructor(cTokenAddr, amount, from, enableAsColl = true) {
16
- super('CompSupply', getAddr('CompSupply'), ['address','uint256','address','bool'], [cTokenAddr, amount, from, enableAsColl]);
16
+ super('CompSupply', getAddr('CompSupply'), [['address','uint256','address','bool']], [[cTokenAddr, amount, from, enableAsColl]]);
17
+
18
+ this.mappableArgs = [
19
+ this.args[0][0],
20
+ this.args[0][1],
21
+ this.args[0][2],
22
+ ];
17
23
  }
18
24
 
19
25
  async getAssetsToApprove() {
@@ -13,7 +13,13 @@ class CompoundWithdrawAction extends Action {
13
13
  */
14
14
  constructor(cTokenAddr, amount, to) {
15
15
  requireAddress(to);
16
- super('CompWithdraw', getAddr('CompWithdraw'), ['address','uint256','address'], [...arguments]);
16
+ super('CompWithdraw', getAddr('CompWithdraw'), [['address','uint256','address']], [[...arguments]]);
17
+
18
+ this.mappableArgs = [
19
+ this.args[0][0],
20
+ this.args[0][1],
21
+ this.args[0][2],
22
+ ];
17
23
  }
18
24
  }
19
25
 
@@ -13,7 +13,13 @@ class DyDxWithdrawAction extends Action {
13
13
  */
14
14
  constructor(tokenAddr, amount, to) {
15
15
  requireAddress(to);
16
- super('DyDxWithdraw', getAddr('DyDxWithdraw'), ['address','uint256','address'], [...arguments]);
16
+ super('DyDxWithdraw', getAddr('DyDxWithdraw'), [['address','uint256','address']], [[...arguments]]);
17
+
18
+ this.mappableArgs = [
19
+ this.args[0][0],
20
+ this.args[0][1],
21
+ this.args[0][2],
22
+ ];
17
23
  }
18
24
  }
19
25
 
@@ -1,7 +1,5 @@
1
1
  const DyDxWithdrawAction = require('./DyDxWithdrawAction');
2
- const DyDxSupplyAction = require('./DyDxSupplyAction');
3
2
 
4
3
  module.exports = {
5
- DyDxSupplyAction,
6
4
  DyDxWithdrawAction,
7
5
  };
@@ -17,8 +17,8 @@ class AaveV2FlashLoanAction extends Action {
17
17
  super(
18
18
  'FLAaveV2',
19
19
  getAddr('FLAaveV2'),
20
- ['uint256[]','address[]', 'uint256[]', 'address', 'address', 'bytes', 'uint256'],
21
- [loanAmounts, tokens, modes, loanPayer, flParamGetterAddr, flParamGetterData, 0]
20
+ [['address[]','uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes']],
21
+ [[tokens, loanAmounts, modes, loanPayer, flParamGetterAddr, flParamGetterData, []]]
22
22
  );
23
23
  }
24
24
  }
@@ -15,8 +15,8 @@ class BalancerFlashLoanAction extends Action {
15
15
  super(
16
16
  'FLBalancer',
17
17
  getAddr('FLBalancer'),
18
- [['address[]', 'uint256[]', 'address', 'bytes'], 'uint256'],
19
- [[... arguments], 0]
18
+ [['address[]','uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes']],
19
+ [[tokens, amounts, [], getAddr('Empty'), flParamGetterAddr, flParamGetterData, []]]
20
20
  );
21
21
  }
22
22
  }
@@ -12,7 +12,7 @@ class DyDxFlashLoanAction extends Action {
12
12
  * @param flParamGetterData {bytes}
13
13
  */
14
14
  constructor(loanAmount, tokenAddr, flParamGetterAddr = getAddr('Empty'), flParamGetterData= []) {
15
- super('FLDyDx', getAddr('FLDyDx'),['uint256','address', 'address', 'bytes','uint256'], [loanAmount, tokenAddr, flParamGetterAddr, flParamGetterData, 0]);
15
+ super('FLDyDx', getAddr('FLDyDx'),[['address[]','uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes']], [[[tokenAddr], [loanAmount], [], getAddr('Empty'),flParamGetterAddr, flParamGetterData, []]]);
16
16
  }
17
17
  }
18
18
 
@@ -14,8 +14,8 @@ class MakerFlashLoanAction extends Action {
14
14
  super(
15
15
  'FLMaker',
16
16
  getAddr('FLMaker'),
17
- [['uint256', 'address', 'bytes'], 'uint256'],
18
- [[amount, flParamGetterAddr, flParamGetterData], 0]
17
+ [['address[]','uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes']],
18
+ [[[], [amount], [], getAddr('Empty'), flParamGetterAddr, flParamGetterData, []]]
19
19
  );
20
20
  }
21
21
  }