@defisaver/sdk 0.2.12 → 0.2.13

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 (131) hide show
  1. package/ACTIONS.md +379 -21
  2. package/DEV.md +0 -298
  3. package/package.json +2 -2
  4. package/src/Action.js +3 -6
  5. package/src/actions/aave/AaveBorrowAction.js +2 -11
  6. package/src/actions/aave/AaveClaimStkAaveAction.js +5 -5
  7. package/src/actions/aave/AaveCollateralSwitchAction.js +4 -5
  8. package/src/actions/aave/AavePaybackAction.js +2 -11
  9. package/src/actions/aave/AaveSupplyAction.js +6 -6
  10. package/src/actions/aave/AaveWithdrawAction.js +1 -8
  11. package/src/actions/aaveV3/AaveV3ATokenPaybackAction.js +13 -13
  12. package/src/actions/aaveV3/AaveV3BorrowAction.js +16 -16
  13. package/src/actions/aaveV3/AaveV3ClaimRewardsAction.js +8 -8
  14. package/src/actions/aaveV3/AaveV3CollateralSwitchAction.js +9 -9
  15. package/src/actions/aaveV3/AaveV3PaybackAction.js +16 -16
  16. package/src/actions/aaveV3/AaveV3SetEModeAction.js +7 -7
  17. package/src/actions/aaveV3/AaveV3SupplyAction.js +17 -17
  18. package/src/actions/aaveV3/AaveV3SwapBorrowRateModeAction.js +8 -8
  19. package/src/actions/aaveV3/AaveV3WithdrawAction.js +11 -11
  20. package/src/actions/balancer/BalancerV2ClaimAction.js +10 -12
  21. package/src/actions/balancer/BalancerV2SupplyAction.js +14 -16
  22. package/src/actions/balancer/BalancerV2WithdrawAction.js +15 -17
  23. package/src/actions/basic/AutomationV2Unsub.js +3 -3
  24. package/src/actions/basic/ChangeProxyOwnerAction.js +2 -4
  25. package/src/actions/basic/GasFeeAction.js +6 -6
  26. package/src/actions/basic/PullTokenAction.js +3 -9
  27. package/src/actions/basic/SellAction.js +5 -6
  28. package/src/actions/basic/SendTokenAction.js +3 -9
  29. package/src/actions/basic/SendTokenAndUnwrapAction.js +30 -0
  30. package/src/actions/basic/SubInputsAction.js +3 -8
  31. package/src/actions/basic/SumInputsAction.js +3 -8
  32. package/src/actions/basic/ToggleSubAction.js +19 -0
  33. package/src/actions/basic/TokenBalanceAction.js +3 -3
  34. package/src/actions/basic/UnwrapEthAction.js +3 -8
  35. package/src/actions/basic/UpdateSubAction.js +19 -0
  36. package/src/actions/basic/WrapEthAction.js +5 -8
  37. package/src/actions/basic/index.js +6 -0
  38. package/src/actions/checkers/MakerRatioCheckAction.js +5 -5
  39. package/src/actions/compound/CompoundBorrowAction.js +1 -7
  40. package/src/actions/compound/CompoundClaimAction.js +3 -3
  41. package/src/actions/compound/CompoundCollateralSwitchAction.js +2 -4
  42. package/src/actions/compound/CompoundGetDebtAction.js +3 -3
  43. package/src/actions/compound/CompoundPaybackAction.js +1 -7
  44. package/src/actions/compound/CompoundSupplyAction.js +4 -4
  45. package/src/actions/compound/CompoundWithdrawAction.js +1 -7
  46. package/src/actions/convex/ConvexClaimAction.js +60 -0
  47. package/src/actions/convex/ConvexDepositAction.js +67 -0
  48. package/src/actions/convex/ConvexWithdrawAction.js +65 -0
  49. package/src/actions/convex/index.js +9 -0
  50. package/src/actions/curve/CurveClaimFeesAction.js +4 -4
  51. package/src/actions/curve/CurveDepositAction.js +7 -7
  52. package/src/actions/curve/CurveGaugeDepositAction.js +6 -6
  53. package/src/actions/curve/CurveGaugeWithdrawAction.js +4 -4
  54. package/src/actions/curve/CurveMintCrvAction.js +3 -3
  55. package/src/actions/curve/CurveStethPoolDepositAction.js +9 -9
  56. package/src/actions/curve/CurveStethPoolWithdrawAction.js +11 -9
  57. package/src/actions/curve/CurveSwapAction.js +15 -15
  58. package/src/actions/curve/CurveWithdrawAction.js +7 -7
  59. package/src/actions/dydx/DyDxWithdrawAction.js +1 -7
  60. package/src/actions/flashloan/AaveV2FlashLoanAction.js +2 -2
  61. package/src/actions/flashloan/AaveV3FlashLoanAction.js +2 -2
  62. package/src/actions/flashloan/BalancerFlashLoanAction.js +2 -2
  63. package/src/actions/flashloan/DyDxFlashLoanAction.js +5 -1
  64. package/src/actions/flashloan/MakerFlashLoanAction.js +2 -2
  65. package/src/actions/guni/GUniDeposit.js +9 -9
  66. package/src/actions/guni/GUniWithdraw.js +5 -5
  67. package/src/actions/index.js +2 -0
  68. package/src/actions/insta/InstPullTokensAction.js +4 -4
  69. package/src/actions/lido/LidoStakeAction.js +2 -7
  70. package/src/actions/lido/LidoUnwrapAction.js +2 -7
  71. package/src/actions/lido/LidoWrapAction.js +7 -7
  72. package/src/actions/liquity/LiquityBorrowAction.js +5 -5
  73. package/src/actions/liquity/LiquityClaimAction.js +3 -3
  74. package/src/actions/liquity/LiquityCloseAction.js +4 -4
  75. package/src/actions/liquity/LiquityEthGainToTroveAction.js +3 -3
  76. package/src/actions/liquity/LiquityOpenAction.js +8 -8
  77. package/src/actions/liquity/LiquityPaybackAction.js +5 -5
  78. package/src/actions/liquity/LiquityRedeemAction.js +7 -7
  79. package/src/actions/liquity/LiquitySPDepositAction.js +7 -7
  80. package/src/actions/liquity/LiquitySPWithdrawAction.js +6 -6
  81. package/src/actions/liquity/LiquityStakeAction.js +7 -7
  82. package/src/actions/liquity/LiquitySupplyAction.js +5 -5
  83. package/src/actions/liquity/LiquityUnstakeAction.js +6 -6
  84. package/src/actions/liquity/LiquityWithdrawAction.js +4 -4
  85. package/src/actions/maker/MakerClaimAction.js +4 -4
  86. package/src/actions/maker/MakerGenerateAction.js +1 -8
  87. package/src/actions/maker/MakerGiveAction.js +4 -4
  88. package/src/actions/maker/MakerMergeAction.js +1 -7
  89. package/src/actions/maker/MakerOpenVaultAction.js +1 -6
  90. package/src/actions/maker/MakerPaybackAction.js +2 -9
  91. package/src/actions/maker/MakerRatioAction.js +1 -5
  92. package/src/actions/maker/MakerSupplyAction.js +1 -9
  93. package/src/actions/maker/MakerWithdrawAction.js +1 -9
  94. package/src/actions/mstable/MStableClaimAction.js +4 -4
  95. package/src/actions/mstable/MStableDepositAction.js +16 -16
  96. package/src/actions/mstable/MStableWithdrawAction.js +15 -15
  97. package/src/actions/rari/RariDepositAction.js +5 -5
  98. package/src/actions/rari/RariWithdrawAction.js +6 -6
  99. package/src/actions/reflexer/ReflexerGenerateAction.js +1 -7
  100. package/src/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.js +5 -5
  101. package/src/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.js +3 -8
  102. package/src/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.js +4 -9
  103. package/src/actions/reflexer/ReflexerOpenSafeAction.js +1 -5
  104. package/src/actions/reflexer/ReflexerPaybackAction.js +1 -7
  105. package/src/actions/reflexer/ReflexerSupplyAction.js +1 -8
  106. package/src/actions/reflexer/ReflexerWithdrawAction.js +1 -8
  107. package/src/actions/uniswap/UniswapSupplyAction.js +20 -22
  108. package/src/actions/uniswap/UniswapWithdrawAction.js +16 -18
  109. package/src/actions/uniswapV3/UniswapV3CollectAction.js +7 -9
  110. package/src/actions/uniswapV3/UniswapV3CreatePoolAction.js +20 -22
  111. package/src/actions/uniswapV3/UniswapV3MintAction.js +19 -21
  112. package/src/actions/uniswapV3/UniswapV3SupplyAction.js +17 -19
  113. package/src/actions/uniswapV3/UniswapV3WithdrawAction.js +12 -14
  114. package/src/actions/yearn/YearnSupplyAction.js +6 -6
  115. package/src/actions/yearn/YearnWithdrawAction.js +6 -6
  116. package/src/addresses.js +19 -12
  117. package/src/triggers/ChainLinkPriceTrigger.js +2 -2
  118. package/src/triggers/CompoundRatioTrigger.js +1 -1
  119. package/src/triggers/GasPriceTrigger.js +1 -1
  120. package/src/triggers/LiquityRatioTrigger.js +2 -2
  121. package/src/triggers/MakerRatioTrigger.js +1 -5
  122. package/src/triggers/ReflexerRatioTrigger.js +1 -1
  123. package/src/triggers/TimestampTrigger.js +1 -1
  124. package/src/triggers/UniV3CurrentTickTrigger.js +1 -1
  125. package/src/utils/convex-utils.js +20 -0
  126. package/src/utils/convexPoolInfo.json +1039 -0
  127. package/src/utils/index.js +2 -0
  128. package/test/Action.js +2 -1
  129. package/test/Strategy.js +44 -0
  130. package/test/accessLists/access-lists.js +1 -2
  131. package/test/actions/maker/MakerPaybackAction.js +2 -2
@@ -19,15 +19,15 @@ class AaveV3PaybackAction extends ActionWithL2 {
19
19
  */
20
20
  constructor(useOnDefaultMarket, market, amount, from, rateMode, tokenAddr, assetId, useOnBehalf , onBehalf = getAddr('Empty')) {
21
21
  super('AaveV3Payback', getAddr('AaveV3Payback'),
22
- [['uint256','address','uint8','uint16', 'bool', 'bool','address','address']],
23
- [[amount, from, rateMode, assetId, useOnDefaultMarket, useOnBehalf, market, onBehalf]]
22
+ ['uint256','address','uint8','uint16', 'bool', 'bool','address','address'],
23
+ [amount, from, rateMode, assetId, useOnDefaultMarket, useOnBehalf, market, onBehalf]
24
24
  );
25
25
 
26
26
  this.mappableArgs = [
27
- this.args[0][0],
28
- this.args[0][1],
29
- this.args[0][6],
30
- this.args[0][7],
27
+ this.args[0],
28
+ this.args[1],
29
+ this.args[6],
30
+ this.args[7],
31
31
  ];
32
32
  this.tokenForApproval = tokenAddr;
33
33
  }
@@ -42,24 +42,24 @@ class AaveV3PaybackAction extends ActionWithL2 {
42
42
  // executeActionDirectL2
43
43
  let encodedInput = "0x2895f3aa";
44
44
  // amount
45
- encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][0]));
45
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]));
46
46
  // from
47
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][1]));
47
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[1]));
48
48
  // rateMode
49
- encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0][2]));
49
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[2]));
50
50
  // assetId
51
- encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][3]));
51
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[3]));
52
52
  // useDefaultMarket
53
- encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][4]));
53
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[4]));
54
54
  // useOnBehalf
55
- encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][5]));
56
- if (!this.args[0][4]) {
55
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[5]));
56
+ if (!this.args[4]) {
57
57
  // market
58
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][6]));
58
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[6]));
59
59
  }
60
- if (this.args[0][5]) {
60
+ if (this.args[5]) {
61
61
  // onBehalf
62
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][7]));
62
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[7]));
63
63
  }
64
64
  return encodedInput;
65
65
  }
@@ -12,24 +12,24 @@ class AaveV3SetEModeAction extends ActionWithL2 {
12
12
  */
13
13
  constructor(categoryId, useOnDefaultMarket, market) {
14
14
  super('AaveV3SetEMode', getAddr('AaveV3SetEMode'),
15
- [['uint8', 'bool', 'address']],
16
- [[categoryId, useOnDefaultMarket, market]]
15
+ ['uint8', 'bool', 'address'],
16
+ [categoryId, useOnDefaultMarket, market]
17
17
  );
18
18
 
19
19
  this.mappableArgs = [
20
- this.args[0][2],
20
+ this.args[2],
21
21
  ];
22
22
  }
23
23
  encodeInputs() {
24
24
  // executeActionDirectL2
25
25
  let encodedInput = "0x2895f3aa";
26
26
  // categoryId
27
- encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0][0]));
27
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0]));
28
28
  // useOnDefaultMarket
29
- encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][1]));
30
- if (!this.args[0][1]){
29
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[1]));
30
+ if (!this.args[1]){
31
31
  // market
32
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][2]));
32
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[2]));
33
33
  }
34
34
 
35
35
  return encodedInput;
@@ -20,22 +20,22 @@ class AaveV3SupplyAction extends ActionWithL2 {
20
20
  */
21
21
  constructor(amount, from, tokenAddress, assetId, enableAsColl, useDefaultMarket, useOnBehalf ,market, onBehalf = getAddr('Empty')) {
22
22
  super('AaveV3Supply', getAddr('AaveV3Supply'),
23
- [['uint256','address','uint16','bool','bool','bool','address','address']],
24
- [[amount, from, assetId, enableAsColl, useDefaultMarket, useOnBehalf, market, onBehalf]]
23
+ ['uint256','address','uint16','bool','bool','bool','address','address'],
24
+ [amount, from, assetId, enableAsColl, useDefaultMarket, useOnBehalf, market, onBehalf]
25
25
  );
26
26
 
27
27
  this.mappableArgs = [
28
- this.args[0][0],
29
- this.args[0][1],
30
- this.args[0][6],
31
- this.args[0][7],
28
+ this.args[0],
29
+ this.args[1],
30
+ this.args[6],
31
+ this.args[7],
32
32
  ];
33
33
  this.tokenForApproval = tokenAddress;
34
34
  }
35
35
 
36
36
  async getAssetsToApprove() {
37
37
  const asset = getAssetInfoByAddress(this.tokenForApproval);
38
- if (asset.symbol !== 'ETH') return [{asset: this.tokenForApproval, owner: this.args[0][2]}];
38
+ if (asset.symbol !== 'ETH') return [{asset: this.tokenForApproval, owner: this.args[2]}];
39
39
  return [];
40
40
  }
41
41
 
@@ -43,24 +43,24 @@ class AaveV3SupplyAction extends ActionWithL2 {
43
43
  // executeActionDirectL2
44
44
  let encodedInput = "0x2895f3aa";
45
45
  // amount
46
- encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][0]));
46
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]));
47
47
  // from
48
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][1]));
48
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[1]));
49
49
  // assetId
50
- encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][2]));
50
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[2]));
51
51
  // enableAsColl
52
- encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][3]));
52
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[3]));
53
53
  // useDefaultMarket
54
- encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][4]));
54
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[4]));
55
55
  // useOnBehalf
56
- encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][5]));
57
- if (!this.args[0][4]) {
56
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[5]));
57
+ if (!this.args[4]) {
58
58
  // market
59
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][6]));
59
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[6]));
60
60
  }
61
- if (this.args[0][5]) {
61
+ if (this.args[5]) {
62
62
  // onBehalf
63
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][7]));
63
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[7]));
64
64
  }
65
65
  return encodedInput;
66
66
  }
@@ -14,27 +14,27 @@ class AaveV3SwapBorrowRateModeAction extends ActionWithL2 {
14
14
  */
15
15
  constructor(rateMode, assetId, useDefaultMarket, market) {
16
16
  super('AaveV3SwapBorrowRateMode', getAddr('AaveV3SwapBorrowRateMode'),
17
- [['uint256','uint16','bool','address']],
18
- [[rateMode, assetId, useDefaultMarket, market]]
17
+ ['uint256','uint16','bool','address'],
18
+ [rateMode, assetId, useDefaultMarket, market]
19
19
  );
20
20
 
21
21
  this.mappableArgs = [
22
22
  this.args[0][0],
23
- this.args[0][3],
23
+ this.args[3],
24
24
  ];
25
25
  }
26
26
  encodeInputs() {
27
27
  // executeActionDirectL2
28
28
  let encodedInput = "0x2895f3aa";
29
29
  // rateMode
30
- encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][0]));
30
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]));
31
31
  // assetId
32
- encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][1]))
32
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[1]))
33
33
  // useOnDefaultMarket
34
- encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][2]))
35
- if (!this.args[0][2]){
34
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[2]))
35
+ if (!this.args[2]){
36
36
  // market
37
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][3]));
37
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[3]));
38
38
  }
39
39
  return encodedInput;
40
40
  }
@@ -14,30 +14,30 @@ class AaveV3WithdrawAction extends ActionWithL2 {
14
14
  */
15
15
  constructor(assetId, useDefaultMarket, amount, to, market) {
16
16
  super('AaveV3Withdraw', getAddr('AaveV3Withdraw'),
17
- [['uint16','bool','uint256','address','address']],
18
- [[assetId, useDefaultMarket, amount, to, market]]
17
+ ['uint16','bool','uint256','address','address'],
18
+ [assetId, useDefaultMarket, amount, to, market]
19
19
  );
20
20
 
21
21
  this.mappableArgs = [
22
- this.args[0][2],
23
- this.args[0][3],
24
- this.args[0][4],
22
+ this.args[2],
23
+ this.args[3],
24
+ this.args[4],
25
25
  ];
26
26
  }
27
27
  encodeInputs() {
28
28
  // executeActionDirectL2
29
29
  let encodedInput = "0x2895f3aa";
30
30
  // assetId
31
- encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][0]));
31
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0]));
32
32
  // useOnDefaultMarket
33
- encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][1]))
33
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[1]))
34
34
  // amount
35
- encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][2]));
35
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[2]));
36
36
  // from
37
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][3]));
38
- if (!this.args[0][1]){
37
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[3]));
38
+ if (!this.args[1]){
39
39
  // market
40
- encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][4]));
40
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[4]));
41
41
  }
42
42
  return encodedInput;
43
43
  }
@@ -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
  }
@@ -19,36 +19,34 @@ class BalancerV2WithdrawAction extends Action {
19
19
  'BalancerV2Withdraw',
20
20
  getAddr('BalancerV2Withdraw'),
21
21
  [
22
- [
23
- "bytes32",
24
- "address",
25
- "address",
26
- "uint256",
27
- "address[]",
28
- "uint256[]",
29
- "bytes",
30
- ],
22
+ "bytes32",
23
+ "address",
24
+ "address",
25
+ "uint256",
26
+ "address[]",
27
+ "uint256[]",
28
+ "bytes",
31
29
  ],
32
- [[poolId, from, to, lpTokenAmount, tokens, minAmountsOut, userData]]
30
+ [poolId, from, to, lpTokenAmount, tokens, minAmountsOut, userData]
33
31
  );
34
32
 
35
33
  this.from = from;
36
34
 
37
35
  this.mappableArgs = [
38
- this.args[0][1],
39
- this.args[0][2],
40
- this.args[0][3],
36
+ this.args[1],
37
+ this.args[2],
38
+ this.args[3],
41
39
  ];
42
40
 
43
- for (let i = 0; i < this.args[0][5].length; i++){
44
- this.mappableArgs.push(this.args[0][5][i]);
41
+ for (let i = 0; i < this.args[5].length; i++){
42
+ this.mappableArgs.push(this.args[5][i]);
45
43
  }
46
44
  }
47
45
 
48
46
  async getAssetsToApprove() {
49
47
  const approveArr = [];
50
- const token = this.args[0][0].slice(0,42);
51
- approveArr.push({asset: token, owner: this.args[0][1], specialApproveLabel: 'balancer'});
48
+ const token = this.args[0].slice(0,42);
49
+ approveArr.push({asset: token, owner: this.args[1], specialApproveLabel: 'balancer'});
52
50
  return approveArr;
53
51
  }
54
52
  }
@@ -6,10 +6,10 @@ class AutomationV2Unsub extends Action {
6
6
  super(
7
7
  'AutomationV2Unsub',
8
8
  getAddr('AutomationV2Unsub'),
9
- [["uint256", "uint256"]],
10
- [[cdpId, protocol]]
9
+ ["uint256", "uint256"],
10
+ [cdpId, protocol]
11
11
  );
12
12
  }
13
13
  }
14
14
 
15
- module.exports = AutomationV2Unsub;
15
+ module.exports = AutomationV2Unsub;
@@ -9,10 +9,8 @@ class ChangeProxyOwnerAction extends Action {
9
9
  * @param newOwner {Address} Address of new owner
10
10
  */
11
11
  constructor(newOwner) {
12
- super("ChangeProxyOwner", getAddr("ChangeProxyOwner"), [["address"]], [[...arguments]]);
13
-
14
- this.mappableArgs = [this.args[0][0]];
15
- }
12
+ super("ChangeProxyOwner", getAddr("ChangeProxyOwner"), ["address"], [...arguments]);
13
+ }
16
14
  }
17
15
 
18
16
  module.exports = ChangeProxyOwnerAction;
@@ -11,17 +11,17 @@ class GasFeeAction extends Action {
11
11
  constructor(gasStart, feeToken, availableAmount, dfsFeeDivider = 2000) {
12
12
  super("GasFeeTaker",
13
13
  getAddr("GasFeeTaker"),
14
- [["uint256", "address", "uint256", "uint256"]],
15
- [[gasStart, feeToken, availableAmount, dfsFeeDivider]],
14
+ ["uint256", "address", "uint256", "uint256"],
15
+ [gasStart, feeToken, availableAmount, dfsFeeDivider],
16
16
  );
17
17
 
18
18
  this.mappableArgs = [
19
- this.args[0][1],
20
- this.args[0][2],
21
- this.args[0][3],
19
+ this.args[1],
20
+ this.args[2],
21
+ this.args[3],
22
22
  ];
23
23
  }
24
24
 
25
25
  }
26
26
 
27
- module.exports = GasFeeAction;
27
+ module.exports = GasFeeAction;
@@ -17,19 +17,13 @@ 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
- ];
33
27
  }
34
28
 
35
29
  async getAssetsToApprove() {
@@ -20,23 +20,22 @@ class SellAction extends ActionWithL2 {
20
20
  super(
21
21
  'DFSSell',
22
22
  getAddr('DFSSell'),
23
- [[
23
+ [
24
24
  ["address","address","uint256","uint256","uint256","uint256","address","address","bytes",["address","address","address","uint256","uint256","bytes"]],
25
25
  "address",
26
26
  "address",
27
- ]
28
27
  ],
29
- [[exchangeOrder, from, to]]
28
+ [exchangeOrder, from, to]
30
29
  );
31
30
 
32
31
  this.protocolFee = protocolFee;
33
32
 
34
33
  this.mappableArgs = [
35
- this.args[0][0][0],
36
- this.args[0][0][1],
37
- this.args[0][0][2],
34
+ this.args[0][0],
38
35
  this.args[0][1],
39
36
  this.args[0][2],
37
+ this.args[1],
38
+ this.args[2],
40
39
  ];
41
40
  }
42
41
 
@@ -16,19 +16,13 @@ class SendTokenAction extends Action {
16
16
  super(
17
17
  'SendToken',
18
18
  getAddr('SendToken'),
19
- [[
19
+ [
20
20
  "address",
21
21
  "address",
22
22
  "uint",
23
- ]],
24
- [[...arguments]]
23
+ ],
24
+ [...arguments]
25
25
  );
26
-
27
- this.mappableArgs = [
28
- this.args[0][0],
29
- this.args[0][1],
30
- this.args[0][2],
31
- ];
32
26
  }
33
27
  }
34
28
 
@@ -0,0 +1,30 @@
1
+ const Action = require("../../Action");
2
+ const {requireAddress} = require("../../utils/general");
3
+ const {getAssetInfoByAddress} = require("@defisaver/tokens");
4
+ const { getAddr } = require('../../addresses.js');
5
+
6
+ /**
7
+ * Transfers specified token from recipe (DsProxy) to specified address unwraps if Weth address
8
+ */
9
+ class SendTokenAndUnwrapAction extends Action {
10
+ /**
11
+ * @param token {string} Token address
12
+ * @param to {string} Transfer recipient
13
+ * @param amount {string} Transfer amount (-1 for whole Recipe (DsProxy) balance)
14
+ */
15
+ constructor(token, to, amount) {
16
+ requireAddress(to);
17
+ super(
18
+ 'SendTokenAndUnwrap',
19
+ getAddr('SendTokenAndUnwrap'),
20
+ [
21
+ "address",
22
+ "address",
23
+ "uint",
24
+ ],
25
+ [...arguments]
26
+ );
27
+ }
28
+ }
29
+
30
+ module.exports = SendTokenAndUnwrapAction;
@@ -9,17 +9,12 @@ class SubInputsAction extends Action {
9
9
  super(
10
10
  'SubInputs',
11
11
  getAddr('SubInputs'),
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
- ];
23
18
  }
24
19
  }
25
20
 
@@ -9,17 +9,12 @@ 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
- ];
23
18
  }
24
19
  }
25
20
 
@@ -0,0 +1,19 @@
1
+ const Action = require("../../Action");
2
+ const {getAddr} = require("../../addresses.js");
3
+
4
+ /**
5
+ * Sets the state of the sub to active or deactivated
6
+ */
7
+ class ToggleSubAction extends Action {
8
+ /**
9
+ * @param subId Id of the subscription in the SubStorage contract
10
+ * @param active Set to true to activate action, to false to deactivate
11
+ */
12
+ constructor(subId, active) {
13
+ super("ToggleSub", getAddr("ToggleSub"), ["uint256", "bool"], [...arguments]);
14
+
15
+ }
16
+
17
+ }
18
+
19
+ module.exports = ToggleSubAction;
@@ -6,11 +6,11 @@ class TokenBalanceAction extends Action {
6
6
  super(
7
7
  'TokenBalance',
8
8
  getAddr('TokenBalance'),
9
- [[
9
+ [
10
10
  "address",
11
11
  "address",
12
- ]],
13
- [[...arguments]]
12
+ ],
13
+ [...arguments]
14
14
  );
15
15
  }
16
16
  }
@@ -15,17 +15,12 @@ class UnwrapEthAction extends ActionWithL2 {
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
- ];
29
24
  }
30
25
  encodeInputs(){
31
26
  // executeActionDirectL2
@@ -0,0 +1,19 @@
1
+ const Action = require("../../Action");
2
+ const {getAddr} = require("../../addresses.js");
3
+
4
+ /**
5
+ * Action for updating sub data
6
+ */
7
+ class UpdateSubAction extends Action {
8
+ /**
9
+ * @param subId id of the subscription in the SubStorage contract
10
+ * @param sub object that contains new sub information
11
+ */
12
+ constructor(subId, sub) {
13
+ super("UpdateSub", getAddr("UpdateSub"), ["uint256", "(uint64,bool,bytes[],bytes32[])"], [...arguments]);
14
+
15
+ }
16
+
17
+ }
18
+
19
+ module.exports = UpdateSubAction;