@defisaver/sdk 0.1.23 → 0.2.2

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 (115) hide show
  1. package/ACTIONS.md +20 -311
  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 +4 -0
  7. package/package.json +1 -1
  8. package/src/Action.js +38 -12
  9. package/src/Recipe.js +5 -4
  10. package/src/Strategy.js +63 -0
  11. package/src/abis/Action.json +157 -11
  12. package/src/abis/Recipe.json +92 -47
  13. package/src/actions/aave/AaveClaimStkAaveAction.js +5 -5
  14. package/src/actions/aave/AaveCollateralSwitchAction.js +4 -5
  15. package/src/actions/aave/AaveSupplyAction.js +8 -0
  16. package/src/actions/balancer/BalancerV2ClaimAction.js +10 -12
  17. package/src/actions/balancer/BalancerV2SupplyAction.js +14 -16
  18. package/src/actions/balancer/BalancerV2WithdrawAction.js +15 -17
  19. package/src/actions/basic/AutomationV2Unsub.js +3 -3
  20. package/src/actions/basic/ChangeProxyOwnerAction.js +2 -4
  21. package/src/actions/basic/GasFeeAction.js +27 -0
  22. package/src/actions/basic/SendTokenAndUnwrapAction.js +30 -0
  23. package/src/actions/basic/SubInputsAction.js +3 -8
  24. package/src/actions/basic/TokenBalanceAction.js +3 -3
  25. package/src/actions/basic/UpdateSubAction.js +19 -0
  26. package/src/actions/basic/index.js +6 -2
  27. package/src/actions/checkers/MakerRatioCheckAction.js +29 -0
  28. package/src/actions/checkers/index.js +5 -0
  29. package/src/actions/compound/CompoundClaimAction.js +5 -0
  30. package/src/actions/compound/CompoundCollateralSwitchAction.js +2 -4
  31. package/src/actions/compound/CompoundGetDebtAction.js +3 -3
  32. package/src/actions/compound/CompoundSupplyAction.js +6 -0
  33. package/src/actions/curve/CurveClaimFeesAction.js +4 -4
  34. package/src/actions/curve/CurveDepositAction.js +7 -7
  35. package/src/actions/curve/CurveGaugeDepositAction.js +6 -6
  36. package/src/actions/curve/CurveGaugeWithdrawAction.js +4 -4
  37. package/src/actions/curve/CurveMintCrvAction.js +3 -3
  38. package/src/actions/curve/CurveStethPoolDepositAction.js +9 -9
  39. package/src/actions/curve/CurveStethPoolWithdrawAction.js +9 -11
  40. package/src/actions/curve/CurveSwapAction.js +15 -15
  41. package/src/actions/curve/CurveWithdrawAction.js +7 -7
  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 +5 -1
  46. package/src/actions/flashloan/MakerFlashLoanAction.js +2 -2
  47. package/src/actions/guni/GUniDeposit.js +9 -9
  48. package/src/actions/guni/GUniWithdraw.js +5 -5
  49. package/src/actions/index.js +2 -0
  50. package/src/actions/insta/InstPullTokensAction.js +4 -4
  51. package/src/actions/insta/index.js +0 -2
  52. package/src/actions/lido/LidoStakeAction.js +2 -7
  53. package/src/actions/lido/LidoUnwrapAction.js +2 -7
  54. package/src/actions/lido/LidoWrapAction.js +7 -7
  55. package/src/actions/liquity/LiquityBorrowAction.js +5 -5
  56. package/src/actions/liquity/LiquityClaimAction.js +4 -0
  57. package/src/actions/liquity/LiquityCloseAction.js +5 -0
  58. package/src/actions/liquity/LiquityEthGainToTroveAction.js +3 -3
  59. package/src/actions/liquity/LiquityOpenAction.js +8 -8
  60. package/src/actions/liquity/LiquityPaybackAction.js +5 -5
  61. package/src/actions/liquity/LiquityRedeemAction.js +7 -7
  62. package/src/actions/liquity/LiquitySPDepositAction.js +7 -7
  63. package/src/actions/liquity/LiquitySPWithdrawAction.js +6 -6
  64. package/src/actions/liquity/LiquityStakeAction.js +7 -7
  65. package/src/actions/liquity/LiquitySupplyAction.js +5 -5
  66. package/src/actions/liquity/LiquityUnstakeAction.js +6 -6
  67. package/src/actions/liquity/LiquityWithdrawAction.js +4 -4
  68. package/src/actions/maker/MakerClaimAction.js +4 -4
  69. package/src/actions/maker/MakerGiveAction.js +6 -0
  70. package/src/actions/maker/MakerPaybackAction.js +2 -8
  71. package/src/actions/maker/MakerRatioAction.js +16 -0
  72. package/src/actions/maker/MakerWithdrawAction.js +1 -1
  73. package/src/actions/maker/index.js +2 -0
  74. package/src/actions/mstable/MStableClaimAction.js +4 -4
  75. package/src/actions/mstable/MStableDepositAction.js +18 -18
  76. package/src/actions/mstable/MStableWithdrawAction.js +17 -17
  77. package/src/actions/rari/RariDepositAction.js +5 -5
  78. package/src/actions/rari/RariWithdrawAction.js +6 -6
  79. package/src/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.js +5 -5
  80. package/src/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.js +3 -8
  81. package/src/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.js +4 -9
  82. package/src/actions/uniswap/UniswapSupplyAction.js +20 -22
  83. package/src/actions/uniswap/UniswapWithdrawAction.js +16 -18
  84. package/src/actions/uniswapV3/UniswapV3CollectAction.js +7 -9
  85. package/src/actions/uniswapV3/UniswapV3CreatePoolAction.js +20 -22
  86. package/src/actions/uniswapV3/UniswapV3MintAction.js +19 -21
  87. package/src/actions/uniswapV3/UniswapV3SupplyAction.js +17 -19
  88. package/src/actions/uniswapV3/UniswapV3WithdrawAction.js +12 -14
  89. package/src/actions/yearn/YearnSupplyAction.js +6 -6
  90. package/src/actions/yearn/YearnWithdrawAction.js +6 -6
  91. package/src/addresses.js +90 -90
  92. package/src/triggers/ChainLinkPriceTrigger.js +12 -0
  93. package/src/triggers/CompoundRatioTrigger.js +11 -0
  94. package/src/triggers/GasPriceTrigger.js +11 -0
  95. package/src/triggers/LiquityRatioTrigger.js +16 -0
  96. package/src/triggers/MakerRatioTrigger.js +11 -0
  97. package/src/triggers/ReflexerRatioTrigger.js +11 -0
  98. package/src/triggers/TimestampTrigger.js +11 -0
  99. package/src/triggers/UniV3CurrentTickTrigger.js +12 -0
  100. package/src/triggers/index.js +19 -0
  101. package/src/utils/general.js +2 -0
  102. package/src/utils/zeroExExchange.js +2 -40
  103. package/test/Action.js +2 -1
  104. package/test/accessLists/MockAccessLists.json +0 -72
  105. package/test/accessLists/Recipe.js +3 -3
  106. package/test/accessLists/access-lists.js +1 -2
  107. package/test/actions/insta/InstPullTokensAction.js +2 -2
  108. package/test/actions/maker/MakerPaybackAction.js +2 -2
  109. package/test/utils/zeroExExchange.js +0 -8
  110. package/src/actions/basic/BuyAction.js +0 -53
  111. package/src/actions/dydx/DyDxSupplyAction.js +0 -25
  112. package/src/actions/insta/ClaimInstMakerAction.js +0 -21
  113. package/test/actions/basic/BuyAction.js +0 -100
  114. package/test/actions/dydx/DyDxSupplyAction.js +0 -78
  115. package/test/actions/insta/ClaimInstMakerAction.js +0 -46
@@ -0,0 +1,63 @@
1
+ const Action = require('./Action');
2
+
3
+ // TODO: Code is a prototype should be cleaned up before use in prod.
4
+
5
+ class Strategy {
6
+
7
+ constructor(name) {
8
+ this.name = name;
9
+ this.subSlots = {};
10
+ this.actions = [];
11
+ this.triggers = [];
12
+ this.numSubSlots = 0;
13
+ }
14
+
15
+ addSubSlot(name, type) {
16
+ this.subSlots[name] = { type, index: this.numSubSlots + 128 };
17
+ this.numSubSlots++;
18
+ }
19
+
20
+ addTrigger(newTrigger) {
21
+ this.triggers.push(newTrigger);
22
+ }
23
+
24
+ addAction(newAction) {
25
+ this.actions.push(newAction);
26
+ }
27
+
28
+ print() {
29
+ console.log(`Name: ${this.name }`);
30
+ console.log(`Slots: ${this.subSlots }`);
31
+ console.log(`Action: ${this.actions[0]}`);
32
+ }
33
+
34
+ getSubSlots() {
35
+ return this.subSlots;
36
+ }
37
+
38
+ // TODO: Probably should be tied into Recipe obj. not directly with actions
39
+ encodeForDsProxyCall() {
40
+ const triggerIds = this.triggers.map((trigger) => trigger.getId());
41
+
42
+ const paramMappings = [];
43
+ const actionIds = [];
44
+
45
+ this.actions.forEach(action => {
46
+ const actionEncoded = action.encodeForStrategy(this.subSlots);
47
+
48
+ actionIds.push(actionEncoded[0]);
49
+ paramMappings.push(actionEncoded[1]);
50
+ });
51
+
52
+ return [
53
+ this.name,
54
+ triggerIds,
55
+ actionIds,
56
+ paramMappings
57
+ ];
58
+ }
59
+
60
+ }
61
+
62
+ module.exports = Strategy;
63
+
@@ -1,4 +1,55 @@
1
1
  [
2
+ {
3
+ "inputs": [],
4
+ "name": "NonContractCall",
5
+ "type": "error"
6
+ },
7
+ {
8
+ "inputs": [],
9
+ "name": "ReturnIndexValueError",
10
+ "type": "error"
11
+ },
12
+ {
13
+ "inputs": [],
14
+ "name": "SenderNotAdmin",
15
+ "type": "error"
16
+ },
17
+ {
18
+ "inputs": [],
19
+ "name": "SenderNotOwner",
20
+ "type": "error"
21
+ },
22
+ {
23
+ "inputs": [],
24
+ "name": "SubIndexValueError",
25
+ "type": "error"
26
+ },
27
+ {
28
+ "inputs": [],
29
+ "name": "ADMIN_VAULT_ADDR",
30
+ "outputs": [
31
+ {
32
+ "internalType": "address",
33
+ "name": "",
34
+ "type": "address"
35
+ }
36
+ ],
37
+ "stateMutability": "view",
38
+ "type": "function"
39
+ },
40
+ {
41
+ "inputs": [],
42
+ "name": "NO_PARAM_MAPPING",
43
+ "outputs": [
44
+ {
45
+ "internalType": "uint8",
46
+ "name": "",
47
+ "type": "uint8"
48
+ }
49
+ ],
50
+ "stateMutability": "view",
51
+ "type": "function"
52
+ },
2
53
  {
3
54
  "inputs": [],
4
55
  "name": "REGISTRY_ADDR",
@@ -12,6 +63,58 @@
12
63
  "stateMutability": "view",
13
64
  "type": "function"
14
65
  },
66
+ {
67
+ "inputs": [],
68
+ "name": "RETURN_MAX_INDEX_VALUE",
69
+ "outputs": [
70
+ {
71
+ "internalType": "uint8",
72
+ "name": "",
73
+ "type": "uint8"
74
+ }
75
+ ],
76
+ "stateMutability": "view",
77
+ "type": "function"
78
+ },
79
+ {
80
+ "inputs": [],
81
+ "name": "RETURN_MIN_INDEX_VALUE",
82
+ "outputs": [
83
+ {
84
+ "internalType": "uint8",
85
+ "name": "",
86
+ "type": "uint8"
87
+ }
88
+ ],
89
+ "stateMutability": "view",
90
+ "type": "function"
91
+ },
92
+ {
93
+ "inputs": [],
94
+ "name": "SUB_MAX_INDEX_VALUE",
95
+ "outputs": [
96
+ {
97
+ "internalType": "uint8",
98
+ "name": "",
99
+ "type": "uint8"
100
+ }
101
+ ],
102
+ "stateMutability": "view",
103
+ "type": "function"
104
+ },
105
+ {
106
+ "inputs": [],
107
+ "name": "SUB_MIN_INDEX_VALUE",
108
+ "outputs": [
109
+ {
110
+ "internalType": "uint8",
111
+ "name": "",
112
+ "type": "uint8"
113
+ }
114
+ ],
115
+ "stateMutability": "view",
116
+ "type": "function"
117
+ },
15
118
  {
16
119
  "inputs": [],
17
120
  "name": "actionType",
@@ -26,25 +129,38 @@
26
129
  "type": "function"
27
130
  },
28
131
  {
29
- "inputs": [
132
+ "inputs": [],
133
+ "name": "adminVault",
134
+ "outputs": [
30
135
  {
31
- "internalType": "bytes[]",
136
+ "internalType": "contract AdminVault",
32
137
  "name": "",
33
- "type": "bytes[]"
138
+ "type": "address"
139
+ }
140
+ ],
141
+ "stateMutability": "view",
142
+ "type": "function"
143
+ },
144
+ {
145
+ "inputs": [
146
+ {
147
+ "internalType": "bytes",
148
+ "name": "_callData",
149
+ "type": "bytes"
34
150
  },
35
151
  {
36
- "internalType": "bytes[]",
37
- "name": "",
38
- "type": "bytes[]"
152
+ "internalType": "bytes32[]",
153
+ "name": "_subData",
154
+ "type": "bytes32[]"
39
155
  },
40
156
  {
41
157
  "internalType": "uint8[]",
42
- "name": "",
158
+ "name": "_paramMapping",
43
159
  "type": "uint8[]"
44
160
  },
45
161
  {
46
162
  "internalType": "bytes32[]",
47
- "name": "",
163
+ "name": "_returnValues",
48
164
  "type": "bytes32[]"
49
165
  }
50
166
  ],
@@ -62,9 +178,9 @@
62
178
  {
63
179
  "inputs": [
64
180
  {
65
- "internalType": "bytes[]",
181
+ "internalType": "bytes",
66
182
  "name": "_callData",
67
- "type": "bytes[]"
183
+ "type": "bytes"
68
184
  }
69
185
  ],
70
186
  "name": "executeActionDirect",
@@ -72,6 +188,13 @@
72
188
  "stateMutability": "payable",
73
189
  "type": "function"
74
190
  },
191
+ {
192
+ "inputs": [],
193
+ "name": "kill",
194
+ "outputs": [],
195
+ "stateMutability": "nonpayable",
196
+ "type": "function"
197
+ },
75
198
  {
76
199
  "inputs": [],
77
200
  "name": "logger",
@@ -97,5 +220,28 @@
97
220
  ],
98
221
  "stateMutability": "view",
99
222
  "type": "function"
223
+ },
224
+ {
225
+ "inputs": [
226
+ {
227
+ "internalType": "address",
228
+ "name": "_token",
229
+ "type": "address"
230
+ },
231
+ {
232
+ "internalType": "address",
233
+ "name": "_receiver",
234
+ "type": "address"
235
+ },
236
+ {
237
+ "internalType": "uint256",
238
+ "name": "_amount",
239
+ "type": "uint256"
240
+ }
241
+ ],
242
+ "name": "withdrawStuckFunds",
243
+ "outputs": [],
244
+ "stateMutability": "nonpayable",
245
+ "type": "function"
100
246
  }
101
- ]
247
+ ]
@@ -1,4 +1,32 @@
1
1
  [
2
+ {
3
+ "inputs": [],
4
+ "name": "NonContractCall",
5
+ "type": "error"
6
+ },
7
+ {
8
+ "inputs": [],
9
+ "name": "SenderNotAdmin",
10
+ "type": "error"
11
+ },
12
+ {
13
+ "inputs": [],
14
+ "name": "SenderNotOwner",
15
+ "type": "error"
16
+ },
17
+ {
18
+ "inputs": [],
19
+ "name": "ADMIN_VAULT_ADDR",
20
+ "outputs": [
21
+ {
22
+ "internalType": "address",
23
+ "name": "",
24
+ "type": "address"
25
+ }
26
+ ],
27
+ "stateMutability": "view",
28
+ "type": "function"
29
+ },
2
30
  {
3
31
  "inputs": [],
4
32
  "name": "DEFISAVER_LOGGER",
@@ -48,19 +76,19 @@
48
76
  "type": "string"
49
77
  },
50
78
  {
51
- "internalType": "bytes[][]",
79
+ "internalType": "bytes[]",
52
80
  "name": "callData",
53
- "type": "bytes[][]"
81
+ "type": "bytes[]"
54
82
  },
55
83
  {
56
- "internalType": "bytes[][]",
84
+ "internalType": "bytes32[]",
57
85
  "name": "subData",
58
- "type": "bytes[][]"
86
+ "type": "bytes32[]"
59
87
  },
60
88
  {
61
- "internalType": "bytes32[]",
62
- "name": "ids",
63
- "type": "bytes32[]"
89
+ "internalType": "bytes4[]",
90
+ "name": "actionIds",
91
+ "type": "bytes4[]"
64
92
  },
65
93
  {
66
94
  "internalType": "uint8[][]",
@@ -68,8 +96,8 @@
68
96
  "type": "uint8[][]"
69
97
  }
70
98
  ],
71
- "internalType": "struct StrategyData.Task",
72
- "name": "_currTask",
99
+ "internalType": "struct StrategyModel.Recipe",
100
+ "name": "_currRecipe",
73
101
  "type": "tuple"
74
102
  },
75
103
  {
@@ -85,10 +113,10 @@
85
113
  },
86
114
  {
87
115
  "inputs": [],
88
- "name": "chiToken",
116
+ "name": "adminVault",
89
117
  "outputs": [
90
118
  {
91
- "internalType": "contract IGasToken",
119
+ "internalType": "contract AdminVault",
92
120
  "name": "",
93
121
  "type": "address"
94
122
  }
@@ -96,24 +124,6 @@
96
124
  "stateMutability": "view",
97
125
  "type": "function"
98
126
  },
99
- {
100
- "inputs": [
101
- {
102
- "internalType": "uint256",
103
- "name": "_strategyId",
104
- "type": "uint256"
105
- },
106
- {
107
- "internalType": "bytes[][]",
108
- "name": "_actionCallData",
109
- "type": "bytes[][]"
110
- }
111
- ],
112
- "name": "executeStrategyTask",
113
- "outputs": [],
114
- "stateMutability": "payable",
115
- "type": "function"
116
- },
117
127
  {
118
128
  "inputs": [
119
129
  {
@@ -124,19 +134,19 @@
124
134
  "type": "string"
125
135
  },
126
136
  {
127
- "internalType": "bytes[][]",
137
+ "internalType": "bytes[]",
128
138
  "name": "callData",
129
- "type": "bytes[][]"
139
+ "type": "bytes[]"
130
140
  },
131
141
  {
132
- "internalType": "bytes[][]",
142
+ "internalType": "bytes32[]",
133
143
  "name": "subData",
134
- "type": "bytes[][]"
144
+ "type": "bytes32[]"
135
145
  },
136
146
  {
137
- "internalType": "bytes32[]",
138
- "name": "ids",
139
- "type": "bytes32[]"
147
+ "internalType": "bytes4[]",
148
+ "name": "actionIds",
149
+ "type": "bytes4[]"
140
150
  },
141
151
  {
142
152
  "internalType": "uint8[][]",
@@ -144,27 +154,32 @@
144
154
  "type": "uint8[][]"
145
155
  }
146
156
  ],
147
- "internalType": "struct StrategyData.Task",
148
- "name": "currTask",
157
+ "internalType": "struct StrategyModel.Recipe",
158
+ "name": "_currRecipe",
149
159
  "type": "tuple"
150
160
  }
151
161
  ],
152
- "name": "executeTask",
162
+ "name": "executeRecipe",
153
163
  "outputs": [],
154
164
  "stateMutability": "payable",
155
165
  "type": "function"
156
166
  },
157
167
  {
158
- "inputs": [],
159
- "name": "gasToken",
160
- "outputs": [
168
+ "inputs": [
161
169
  {
162
- "internalType": "contract IGasToken",
163
- "name": "",
164
- "type": "address"
170
+ "internalType": "uint256",
171
+ "name": "_subId",
172
+ "type": "uint256"
173
+ },
174
+ {
175
+ "internalType": "bytes[]",
176
+ "name": "_actionCallData",
177
+ "type": "bytes[]"
165
178
  }
166
179
  ],
167
- "stateMutability": "view",
180
+ "name": "executeRecipeFromStrategy",
181
+ "outputs": [],
182
+ "stateMutability": "payable",
168
183
  "type": "function"
169
184
  },
170
185
  {
@@ -180,6 +195,13 @@
180
195
  "stateMutability": "nonpayable",
181
196
  "type": "function"
182
197
  },
198
+ {
199
+ "inputs": [],
200
+ "name": "kill",
201
+ "outputs": [],
202
+ "stateMutability": "nonpayable",
203
+ "type": "function"
204
+ },
183
205
  {
184
206
  "inputs": [],
185
207
  "name": "registry",
@@ -205,5 +227,28 @@
205
227
  "outputs": [],
206
228
  "stateMutability": "nonpayable",
207
229
  "type": "function"
230
+ },
231
+ {
232
+ "inputs": [
233
+ {
234
+ "internalType": "address",
235
+ "name": "_token",
236
+ "type": "address"
237
+ },
238
+ {
239
+ "internalType": "address",
240
+ "name": "_receiver",
241
+ "type": "address"
242
+ },
243
+ {
244
+ "internalType": "uint256",
245
+ "name": "_amount",
246
+ "type": "uint256"
247
+ }
248
+ ],
249
+ "name": "withdrawStuckFunds",
250
+ "outputs": [],
251
+ "stateMutability": "nonpayable",
252
+ "type": "function"
208
253
  }
209
- ]
254
+ ]
@@ -11,13 +11,13 @@ class AaveClaimStkAaveAction extends Action {
11
11
  super(
12
12
  'AaveClaimStkAave',
13
13
  getAddr('AaveClaimStkAave'),
14
- [['address[]', 'uint256', 'address']],
15
- [[...arguments]],
14
+ ['address[]', 'uint256', 'address'],
15
+ [...arguments],
16
16
  );
17
17
  this.mappableArgs = [
18
- this.args[0][1],
19
- this.args[0][2],
20
- ];
18
+ this.args[1],
19
+ this.args[2],
20
+ ];
21
21
  }
22
22
  }
23
23
 
@@ -1,6 +1,6 @@
1
1
  const Action = require("../../Action");
2
2
  const {requireAddress} = require("../../utils/general.js");
3
- const { getAddr } = require('../../addresses.js');
3
+ const {getAddr} = require('../../addresses.js');
4
4
 
5
5
  /**
6
6
  * AaveCollateralSwitchAction - Aave enable/disable token usage as collateral
@@ -10,11 +10,10 @@ class AaveCollateralSwitchAction extends Action {
10
10
  super(
11
11
  'AaveCollateralSwitch',
12
12
  getAddr('AaveCollateralSwitch'),
13
- [['address', 'address[]', 'bool[]']],
14
- [[...arguments]],
13
+ ['address', 'address[]', 'bool[]'],
14
+ [...arguments],
15
15
  );
16
- this.mappableArgs = [
17
- ];
16
+ this.mappableArgs = [];
18
17
  }
19
18
  }
20
19
 
@@ -16,6 +16,14 @@ class AaveSupplyAction extends Action {
16
16
  */
17
17
  constructor(market, tokenAddr, amount, from, onBehalf = getAddr('Empty'), enableAsColl) {
18
18
  super('AaveSupply', getAddr('AaveSupply'), ['address','address','uint256','address','address','bool'], [market, tokenAddr, amount, from, onBehalf, enableAsColl]);
19
+
20
+ this.mappableArgs = [
21
+ this.args[0],
22
+ this.args[1],
23
+ this.args[2],
24
+ this.args[3],
25
+ this.args[4],
26
+ ];
19
27
  }
20
28
 
21
29
  async getAssetsToApprove() {
@@ -17,29 +17,27 @@ class BalancerV2ClaimAction extends Action {
17
17
  'BalancerV2Claim',
18
18
  getAddr('BalancerV2Claim'),
19
19
  [
20
- [
21
- "address",
22
- "address",
23
- "uint256[]",
24
- "uint256[]",
25
- "bytes32[][]",
26
- ],
20
+ "address",
21
+ "address",
22
+ "uint256[]",
23
+ "uint256[]",
24
+ "bytes32[][]",
27
25
  ],
28
- [[liquidityProvider, to, weeks, balances, merkleProofs]]
26
+ [liquidityProvider, to, weeks, balances, merkleProofs]
29
27
  );
30
28
 
31
29
  this.mappableArgs = [
32
- this.args[0][0],
33
- this.args[0][1],
30
+ this.args[0],
31
+ this.args[1],
34
32
  ];
35
33
  }
36
34
 
37
35
  async getAssetsToApprove() {
38
36
 
39
37
  const approveArr = [];
40
- if (this.args[0][0] !== this.args[0][1]){
38
+ if (this.args[0] !== this.args[1]){
41
39
  const tokenAddress = getAddr('BalancerToken');
42
- approveArr.push({asset: tokenAddress, owner: this.args[0][0]});
40
+ approveArr.push({asset: tokenAddress, owner: this.args[0]});
43
41
  }
44
42
  return approveArr;
45
43
  }
@@ -18,32 +18,30 @@ class BalancerV2SupplyAction extends Action {
18
18
  'BalancerV2Supply',
19
19
  getAddr('BalancerV2Supply'),
20
20
  [
21
- [
22
- "bytes32",
23
- "address",
24
- "address",
25
- "address[]",
26
- "uint256[]",
27
- "bytes",
28
- ],
21
+ "bytes32",
22
+ "address",
23
+ "address",
24
+ "address[]",
25
+ "uint256[]",
26
+ "bytes",
29
27
  ],
30
- [[poolId, from, to, tokens, maxAmountsIn, userData]]
28
+ [poolId, from, to, tokens, maxAmountsIn, userData]
31
29
  );
32
30
 
33
31
  this.mappableArgs = [
34
- this.args[0][1],
35
- this.args[0][2],
32
+ this.args[1],
33
+ this.args[2],
36
34
  ];
37
- for (let i = 0; i < this.args[0][4].length; i++){
38
- this.mappableArgs.push(this.args[0][4][i]);
35
+ for (let i = 0; i < this.args[4].length; i++){
36
+ this.mappableArgs.push(this.args[4][i]);
39
37
  }
40
38
  }
41
39
 
42
40
  async getAssetsToApprove() {
43
41
  const approveArr = [];
44
- const tokens = this.args[0][3];
45
- tokens.forEach(token => approveArr.push({asset: token, owner: this.args[0][1], specialApproveLabel: 'balancer'}));
46
-
42
+ const tokens = this.args[3];
43
+ tokens.forEach(token => approveArr.push({asset: token, owner: this.args[1], specialApproveLabel: 'balancer'}));
44
+
47
45
  return approveArr;
48
46
  }
49
47
  }