@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
@@ -19,25 +19,25 @@ class GUniDeposit extends Action {
19
19
  super(
20
20
  'GUniDeposit',
21
21
  getAddr('GUniDeposit'),
22
- [['address', 'address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address']],
23
- [[pool, token0, token1, amount0Max, amount1max, amount0Min, amount1Min, to, from]]
22
+ ['address', 'address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address'],
23
+ [pool, token0, token1, amount0Max, amount1max, amount0Min, amount1Min, to, from]
24
24
  );
25
25
  this.mappableArgs = [
26
- this.args[0][3],
27
- this.args[0][4],
28
- this.args[0][5],
29
- this.args[0][6],
26
+ this.args[3],
27
+ this.args[4],
28
+ this.args[5],
29
+ this.args[6],
30
30
  ];
31
31
  }
32
32
 
33
33
  async getAssetsToApprove() {
34
34
  const approveArr = [];
35
35
 
36
- approveArr.push({asset: this.args[0][1], owner: this.args[0][8]});
37
- approveArr.push({asset: this.args[0][2], owner: this.args[0][8]});
36
+ approveArr.push({asset: this.args[1], owner: this.args[8]});
37
+ approveArr.push({asset: this.args[2], owner: this.args[8]});
38
38
 
39
39
  return approveArr;
40
40
  }
41
41
  }
42
42
 
43
- module.exports = GUniDeposit;
43
+ module.exports = GUniDeposit;
@@ -16,17 +16,17 @@ class GUniWithdraw extends Action {
16
16
  super(
17
17
  'GUniWithdraw',
18
18
  getAddr('GUniWithdraw'),
19
- [['address', 'uint256', 'uint256', 'uint256', 'address', 'address']],
20
- [[pool, burnAmount, amount0Min, amount1Min, to, from]]
19
+ ['address', 'uint256', 'uint256', 'uint256', 'address', 'address'],
20
+ [pool, burnAmount, amount0Min, amount1Min, to, from]
21
21
  );
22
22
  this.mappableArgs = [
23
- this.args[0][1],
23
+ this.args[1],
24
24
  ];
25
25
  }
26
26
 
27
27
  async getAssetsToApprove() {
28
- return [{asset: this.args[0][0], owner: this.args[0][5]}];
28
+ return [{asset: this.args[0], owner: this.args[5]}];
29
29
  }
30
30
  }
31
31
 
32
- module.exports = GUniWithdraw;
32
+ module.exports = GUniWithdraw;
@@ -7,6 +7,7 @@ const uniswap = require('./uniswap');
7
7
  const reflexer = require('./reflexer');
8
8
  const dydx = require('./dydx');
9
9
  const uniswapV3 = require('./uniswapV3');
10
+ const checkers = require('./checkers');
10
11
  const liquity = require('./liquity');
11
12
  const yearn = require('./yearn');
12
13
  const lido = require('./lido');
@@ -27,6 +28,7 @@ module.exports = {
27
28
  uniswapV3,
28
29
  reflexer,
29
30
  dydx,
31
+ checkers,
30
32
  liquity,
31
33
  yearn,
32
34
  lido,
@@ -7,16 +7,16 @@ class InstPullTokensAction extends Action {
7
7
  super(
8
8
  "InstPullTokens",
9
9
  getAddr("InstPullTokens"),
10
- [["address", "address[]", "uint256[]", "address"]],
11
- [[dsaAddress, tokens, amounts, to]]
10
+ ["address", "address[]", "uint256[]", "address"],
11
+ [dsaAddress, tokens, amounts, to]
12
12
  );
13
13
  this.mappableArgs = [];
14
14
  }
15
15
 
16
16
  async getAssetsToApprove() {
17
17
  return [{
18
- dsaAddress: this.args[0][0],
19
- specialApproveLabel: 'Instadapp'
18
+ dsaAddress: this.args[0],
19
+ specialApproveLabel: 'Instadapp'
20
20
  }];
21
21
  }
22
22
  }
@@ -1,6 +1,4 @@
1
- const ClaimInstMakerAction = require('./ClaimInstMakerAction');
2
1
  const InstPullTokensAction = require('./InstPullTokensAction.js');
3
2
  module.exports = {
4
- ClaimInstMakerAction,
5
3
  InstPullTokensAction,
6
4
  }
@@ -12,16 +12,11 @@ class LidoStakeAction extends Action {
12
12
  * @param to {EthAddress} stETH will be sent to this address
13
13
  */
14
14
  constructor(amount, from, to) {
15
- super('LidoStake', getAddr('LidoStake'), [['uint256','address', 'address']], [[amount, from, to]]);
16
- this.mappableArgs = [
17
- this.args[0][0],
18
- this.args[0][1],
19
- this.args[0][2],
20
- ];
15
+ super('LidoStake', getAddr('LidoStake'), ['uint256','address', 'address'], [amount, from, to]);
21
16
  }
22
17
 
23
18
  async getAssetsToApprove() {
24
- return [{asset: getAssetInfo('WETH').address, owner: this.args[0][1]}];
19
+ return [{asset: getAssetInfo('WETH').address, owner: this.args[1]}];
25
20
  }
26
21
  }
27
22
 
@@ -11,16 +11,11 @@ class LidoUnwrapAction extends Action {
11
11
  * @param to {EthAddress} stETH will be sent to this address
12
12
  */
13
13
  constructor(amount, from, to) {
14
- super('LidoUnwrap', getAddr('LidoUnwrap'), [['uint256','address', 'address']], [[amount, from, to]]);
15
- this.mappableArgs = [
16
- this.args[0][0],
17
- this.args[0][1],
18
- this.args[0][2],
19
- ];
14
+ super('LidoUnwrap', getAddr('LidoUnwrap'), ['uint256','address', 'address'], [amount, from, to]);
20
15
  }
21
16
 
22
17
  async getAssetsToApprove() {
23
- return [{asset: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', owner: this.args[0][1]}];
18
+ return [{asset: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', owner: this.args[1]}];
24
19
  }
25
20
  }
26
21
 
@@ -13,19 +13,19 @@ class LidoWrapAction extends Action {
13
13
  * @param useEth {boolean} true for using WETH, false for using stEth
14
14
  */
15
15
  constructor(amount, from, to, useEth) {
16
- super('LidoWrap', getAddr('LidoWrap'), [['uint256','address', 'address', 'bool']], [[amount, from, to, useEth]]);
16
+ super('LidoWrap', getAddr('LidoWrap'), ['uint256','address', 'address', 'bool'], [amount, from, to, useEth]);
17
17
  this.mappableArgs = [
18
- this.args[0][0],
19
- this.args[0][1],
20
- this.args[0][2],
18
+ this.args[0],
19
+ this.args[1],
20
+ this.args[2],
21
21
  ];
22
22
  }
23
23
 
24
24
  async getAssetsToApprove() {
25
- if (this.args[0][3]){
26
- return [{asset: getAssetInfo('WETH').address, owner: this.args[0][1]}];
25
+ if (this.args[3]){
26
+ return [{asset: getAssetInfo('WETH').address, owner: this.args[1]}];
27
27
  }else{
28
- return [{asset: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', owner: this.args[0][1]}];
28
+ return [{asset: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', owner: this.args[1]}];
29
29
  }
30
30
  }
31
31
  }
@@ -15,13 +15,13 @@ class LiquityBorrowAction extends Action {
15
15
  requireAddress(to);
16
16
  super('LiquityBorrow',
17
17
  getAddr('LiquityBorrow'),
18
- [['uint256', 'uint256', 'address', 'address', 'address']],
19
- [[...arguments]]);
18
+ ['uint256', 'uint256', 'address', 'address', 'address'],
19
+ [...arguments]);
20
20
 
21
21
  this.mappableArgs = [
22
- this.args[0][0],
23
- this.args[0][1],
24
- this.args[0][2],
22
+ this.args[0],
23
+ this.args[1],
24
+ this.args[2],
25
25
  ];
26
26
  }
27
27
  }
@@ -15,6 +15,10 @@ class LiquityClaimAction extends Action {
15
15
  getAddr('LiquityClaim'),
16
16
  ['address'],
17
17
  [...arguments]);
18
+
19
+ this.mappableArgs = [
20
+ this.args[0],
21
+ ];
18
22
  }
19
23
  }
20
24
 
@@ -18,6 +18,11 @@ class LiquityCloseAction extends Action {
18
18
  getAddr('LiquityClose'),
19
19
  ['address', 'address'],
20
20
  [from, to]);
21
+
22
+ this.mappableArgs = [
23
+ this.args[0],
24
+ this.args[1],
25
+ ];
21
26
  }
22
27
 
23
28
  async getAssetsToApprove() {
@@ -12,11 +12,11 @@ class LiquityEthGainToTroveAction extends Action {
12
12
  requireAddress(lqtyTo);
13
13
  super('LiquityEthGainToTrove',
14
14
  getAddr('LiquityEthGainToTrove'),
15
- [['address', 'address', 'address']],
16
- [[...arguments]]);
15
+ ['address', 'address', 'address'],
16
+ [...arguments]);
17
17
 
18
18
  this.mappableArgs = [
19
- this.args[0][0],
19
+ this.args[0],
20
20
  ];
21
21
  }
22
22
  }
@@ -19,20 +19,20 @@ class LiquityOpenAction extends Action {
19
19
  requireAddress(to);
20
20
  super('LiquityOpen',
21
21
  getAddr('LiquityOpen'),
22
- [['uint256', 'uint256', 'uint256', 'address', 'address', 'address', 'address']],
23
- [[...arguments]]);
22
+ ['uint256', 'uint256', 'uint256', 'address', 'address', 'address', 'address'],
23
+ [...arguments]);
24
24
 
25
25
  this.mappableArgs = [
26
- this.args[0][0],
27
- this.args[0][1],
28
- this.args[0][2],
29
- this.args[0][3],
30
- this.args[0][4],
26
+ this.args[0],
27
+ this.args[1],
28
+ this.args[2],
29
+ this.args[3],
30
+ this.args[4],
31
31
  ];
32
32
  }
33
33
 
34
34
  async getAssetsToApprove() {
35
- return [{ asset: getAssetInfo('WETH').address, owner: this.args[0][3]}];
35
+ return [{ asset: getAssetInfo('WETH').address, owner: this.args[3]}];
36
36
  }
37
37
  }
38
38
 
@@ -15,17 +15,17 @@ class LiquityPaybackAction extends Action {
15
15
  requireAddress(from);
16
16
  super('LiquityPayback',
17
17
  getAddr('LiquityPayback'),
18
- [['uint256', 'address', 'address', 'address']],
19
- [[...arguments]]);
18
+ ['uint256', 'address', 'address', 'address'],
19
+ [...arguments]);
20
20
 
21
21
  this.mappableArgs = [
22
- this.args[0][0],
23
- this.args[0][1],
22
+ this.args[0],
23
+ this.args[1],
24
24
  ];
25
25
  }
26
26
 
27
27
  async getAssetsToApprove() {
28
- return [{ asset: getAssetInfo('LUSD').address, owner: this.args[0][1]}];
28
+ return [{ asset: getAssetInfo('LUSD').address, owner: this.args[1]}];
29
29
  }
30
30
  }
31
31
 
@@ -28,19 +28,19 @@ class LiquityRedeemAction extends Action {
28
28
  requireAddress(to);
29
29
  super('LiquityRedeem',
30
30
  getAddr('LiquityRedeem'),
31
- [['uint256', 'address', 'address', 'address', 'address', 'address', 'uint256', 'uint256', 'uint256']],
32
- [[...arguments]]);
31
+ ['uint256', 'address', 'address', 'address', 'address', 'address', 'uint256', 'uint256', 'uint256'],
32
+ [...arguments]);
33
33
 
34
34
  this.mappableArgs = [
35
- this.args[0][0],
36
- this.args[0][1],
37
- this.args[0][2],
38
- this.args[0][8],
35
+ this.args[0],
36
+ this.args[1],
37
+ this.args[2],
38
+ this.args[8],
39
39
  ];
40
40
  }
41
41
 
42
42
  async getAssetsToApprove() {
43
- return [{ asset: getAssetInfo('LUSD').address, owner: this.args[0][1]}];
43
+ return [{ asset: getAssetInfo('LUSD').address, owner: this.args[1]}];
44
44
  }
45
45
  }
46
46
 
@@ -18,19 +18,19 @@ class LiquitySPDepositAction extends Action {
18
18
  requireAddress(lqtyTo);
19
19
  super('LiquitySPDeposit',
20
20
  getAddr('LiquitySPDeposit'),
21
- [['uint256', 'address', 'address', 'address']],
22
- [[...arguments]]);
21
+ ['uint256', 'address', 'address', 'address'],
22
+ [...arguments]);
23
23
 
24
24
  this.mappableArgs = [
25
- this.args[0][0],
26
- this.args[0][1],
27
- this.args[0][2],
28
- this.args[0][3],
25
+ this.args[0],
26
+ this.args[1],
27
+ this.args[2],
28
+ this.args[3],
29
29
  ];
30
30
  }
31
31
 
32
32
  async getAssetsToApprove() {
33
- return [{ asset: getAssetInfo('LUSD').address, owner: this.args[0][1]}];
33
+ return [{ asset: getAssetInfo('LUSD').address, owner: this.args[1]}];
34
34
  }
35
35
  }
36
36
 
@@ -18,14 +18,14 @@ class LiquitySPWithdrawAction extends Action {
18
18
  requireAddress(lqtyTo);
19
19
  super('LiquitySPWithdraw',
20
20
  getAddr('LiquitySPWithdraw'),
21
- [['uint256', 'address', 'address', 'address']],
22
- [[...arguments]]);
21
+ ['uint256', 'address', 'address', 'address'],
22
+ [...arguments]);
23
23
 
24
24
  this.mappableArgs = [
25
- this.args[0][0],
26
- this.args[0][1],
27
- this.args[0][2],
28
- this.args[0][3],
25
+ this.args[0],
26
+ this.args[1],
27
+ this.args[2],
28
+ this.args[3],
29
29
  ];
30
30
  }
31
31
  }
@@ -19,19 +19,19 @@ class LiquityStakeAction extends Action {
19
19
  requireAddress(lusdTo);
20
20
  super('LiquityStake',
21
21
  getAddr('LiquityStake'),
22
- [['uint256', 'address', 'address', 'address']],
23
- [[...arguments]]);
22
+ ['uint256', 'address', 'address', 'address'],
23
+ [...arguments]);
24
24
 
25
25
  this.mappableArgs = [
26
- this.args[0][0],
27
- this.args[0][1],
28
- this.args[0][2],
29
- this.args[0][3],
26
+ this.args[0],
27
+ this.args[1],
28
+ this.args[2],
29
+ this.args[3],
30
30
  ];
31
31
  }
32
32
 
33
33
  async getAssetsToApprove() {
34
- return [{ asset: getAssetInfo('LQTY').address, owner: this.args[0][1]}];
34
+ return [{ asset: getAssetInfo('LQTY').address, owner: this.args[1]}];
35
35
  }
36
36
  }
37
37
 
@@ -15,17 +15,17 @@ class LiquitySupplyAction extends Action {
15
15
  requireAddress(from);
16
16
  super('LiquitySupply',
17
17
  getAddr('LiquitySupply'),
18
- [['uint256', 'address', 'address', 'address']],
19
- [[...arguments]]);
18
+ ['uint256', 'address', 'address', 'address'],
19
+ [...arguments]);
20
20
 
21
21
  this.mappableArgs = [
22
- this.args[0][0],
23
- this.args[0][1],
22
+ this.args[0],
23
+ this.args[1],
24
24
  ];
25
25
  }
26
26
 
27
27
  async getAssetsToApprove() {
28
- return [{ asset: getAssetInfo('WETH').address, owner: this.args[0][1]}];
28
+ return [{ asset: getAssetInfo('WETH').address, owner: this.args[1]}];
29
29
  }
30
30
  }
31
31
 
@@ -18,14 +18,14 @@ class LiquityUnstakeAction extends Action {
18
18
  requireAddress(lusdTo);
19
19
  super('LiquityUnstake',
20
20
  getAddr('LiquityUnstake'),
21
- [['uint256', 'address', 'address', 'address']],
22
- [[...arguments]]);
21
+ ['uint256', 'address', 'address', 'address'],
22
+ [...arguments]);
23
23
 
24
24
  this.mappableArgs = [
25
- this.args[0][0],
26
- this.args[0][1],
27
- this.args[0][2],
28
- this.args[0][3],
25
+ this.args[0],
26
+ this.args[1],
27
+ this.args[2],
28
+ this.args[3],
29
29
  ];
30
30
  }
31
31
  }
@@ -14,12 +14,12 @@ class LiquityWithdrawAction extends Action {
14
14
  requireAddress(to);
15
15
  super('LiquityWithdraw',
16
16
  getAddr('LiquityWithdraw'),
17
- [['uint256', 'address', 'address', 'address']],
18
- [[...arguments]]);
17
+ ['uint256', 'address', 'address', 'address'],
18
+ [...arguments]);
19
19
 
20
20
  this.mappableArgs = [
21
- this.args[0][0],
22
- this.args[0][1],
21
+ this.args[0],
22
+ this.args[1],
23
23
  ];
24
24
  }
25
25
  }
@@ -13,12 +13,12 @@ class MakerClaimAction extends Action {
13
13
  * @param to {EthAddress} Tokens will be sent to this address
14
14
  */
15
15
  constructor(vaultId, joinAddr, to) {
16
- super('McdClaim', getAddr('McdClaim'), [['uint256','address','address']], [[vaultId, joinAddr, to]]);
16
+ super('McdClaim', getAddr('McdClaim'), ['uint256','address','address'], [vaultId, joinAddr, to]);
17
17
 
18
18
  this.mappableArgs = [
19
- this.args[0][0],
20
- this.args[0][1],
21
- this.args[0][2],
19
+ this.args[0],
20
+ this.args[1],
21
+ this.args[2],
22
22
  ];
23
23
  }
24
24
  }
@@ -16,6 +16,12 @@ class MakerGiveAction extends Action {
16
16
  constructor(vaultId, newOwner, createProxy, mcdManager= getAddr('McdCdpManager')) {
17
17
  requireAddress(newOwner);
18
18
  super('McdGive', getAddr('McdGive'), ["uint256", "address", "bool", "address"], [vaultId, newOwner, createProxy, mcdManager]);
19
+
20
+ this.mappableArgs = [
21
+ this.args[0],
22
+ this.args[1],
23
+ this.args[2],
24
+ ];
19
25
  }
20
26
  }
21
27
 
@@ -14,17 +14,11 @@ class MakerPaybackAction extends Action {
14
14
  * @param mcdManager {EthAddress}
15
15
  */
16
16
  constructor(vaultId, amount, from, mcdManager = getAddr('McdCdpManager')) {
17
- super('McdPayback', getAddr('McdPayback'), [['uint256','uint256','address','address']], [[vaultId, amount, from, mcdManager]]);
18
-
19
- this.mappableArgs = [
20
- this.args[0][0],
21
- this.args[0][1],
22
- this.args[0][2],
23
- ];
17
+ super('McdPayback', getAddr('McdPayback'), ['uint256','uint256','address','address'], [vaultId, amount, from, mcdManager]);
24
18
  }
25
19
 
26
20
  async getAssetsToApprove() {
27
- return [{asset: getAssetInfo('DAI').address, owner: this.args[0][2]}];
21
+ return [{asset: getAssetInfo('DAI').address, owner: this.args[2]}];
28
22
  }
29
23
  }
30
24
 
@@ -0,0 +1,16 @@
1
+ const Action = require("../../Action");
2
+ const { getAddr } = require('../../addresses.js');
3
+
4
+ /**
5
+ * MakerRatioAction
6
+ */
7
+ class MakerRatioAction extends Action {
8
+ /**
9
+ * @param vaultId {uint256}
10
+ */
11
+ constructor(vaultId) {
12
+ super('McdRatio', getAddr('McdRatio'), ['uint256'], [vaultId]);
13
+ }
14
+ }
15
+
16
+ module.exports = MakerRatioAction;
@@ -11,7 +11,7 @@ class MakerWithdrawAction extends Action {
11
11
  * @param vaultId {VaultId}
12
12
  * @param amount {string}
13
13
  * @param joinAddr {EthAddress}
14
- * @param to {EthAddress}
14
+ * @param to {string}
15
15
  * @param mcdManager {EthAddress}
16
16
  */
17
17
  constructor(vaultId, amount, joinAddr, to, mcdManager = getAddr('McdCdpManager')) {
@@ -5,6 +5,7 @@ const MakerPaybackAction = require('./MakerPaybackAction');
5
5
  const MakerWithdrawAction = require('./MakerWithdrawAction');
6
6
  const MakerGiveAction = require('./MakerGiveAction');
7
7
  const MakerMergeAction = require('./MakerMergeAction');
8
+ const MakerRatioAction = require('./MakerRatioAction');
8
9
  const MakerClaimAction = require('./MakerClaimAction');
9
10
 
10
11
  module.exports = {
@@ -15,5 +16,6 @@ module.exports = {
15
16
  MakerWithdrawAction,
16
17
  MakerGiveAction,
17
18
  MakerMergeAction,
19
+ MakerRatioAction,
18
20
  MakerClaimAction,
19
21
  };
@@ -24,13 +24,13 @@ class MStableClaimAction extends Action {
24
24
  super(
25
25
  'MStableClaim',
26
26
  getAddr('MStableClaim'),
27
- [['address', 'address', 'uint256', 'uint256']],
28
- [[...arguments]],
27
+ ['address', 'address', 'uint256', 'uint256'],
28
+ [...arguments],
29
29
  );
30
30
 
31
31
  this.mappableArgs = [
32
- this.args[0][0],
33
- this.args[0][1],
32
+ this.args[0],
33
+ this.args[1],
34
34
  ];
35
35
  }
36
36
  }
@@ -37,41 +37,41 @@ class MStableDepositAction extends Action {
37
37
  requireAddress(to);
38
38
 
39
39
  super(
40
- 'MStableDepositNew',
41
- getAddr('MStableDepositNew'),
42
- [['address', 'address', 'address', 'address', 'address', 'address', 'uint256', 'uint256', 'uint256']],
43
- [[...arguments]],
40
+ 'MStableDeposit',
41
+ getAddr('MStableDeposit'),
42
+ ['address', 'address', 'address', 'address', 'address', 'address', 'uint256', 'uint256', 'uint256'],
43
+ [...arguments],
44
44
  );
45
45
 
46
46
  this.mappableArgs = [
47
- this.args[0][0],
48
- this.args[0][1],
49
- this.args[0][2],
50
- this.args[0][3],
51
- this.args[0][4],
52
- this.args[0][5],
53
- this.args[0][6],
54
- this.args[0][7],
55
- this.args[0][8],
47
+ this.args[0],
48
+ this.args[1],
49
+ this.args[2],
50
+ this.args[3],
51
+ this.args[4],
52
+ this.args[5],
53
+ this.args[6],
54
+ this.args[7],
55
+ this.args[8],
56
56
  ];
57
57
  }
58
58
 
59
59
  async getAssetsToApprove() {
60
- const assetPair = this.args[0][8];
61
- const owner = this.args[0][4];
60
+ const assetPair = this.args[8];
61
+ const owner = this.args[4];
62
62
  let asset;
63
63
  switch (assetPair) {
64
64
  case mstableAssetPairs.BASSET_MASSET:
65
65
  case mstableAssetPairs.BASSET_IMASSET:
66
66
  case mstableAssetPairs.BASSET_IMASSETVAULT:
67
- asset = this.args[0][0];
67
+ asset = this.args[0];
68
68
  break;
69
69
  case mstableAssetPairs.MASSET_IMASSET:
70
70
  case mstableAssetPairs.MASSET_IMASSETVAULT:
71
- asset = this.args[0][1];
71
+ asset = this.args[1];
72
72
  break;
73
73
  case mstableAssetPairs.IMASSET_IMASSETVAULT:
74
- asset = this.args[0][2];
74
+ asset = this.args[2];
75
75
  break;
76
76
  default:
77
77
  return [];