@defisaver/sdk 1.0.1 → 1.0.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 (170) hide show
  1. package/.babelrc +3 -0
  2. package/.eslintrc.js +100 -0
  3. package/package.json +8 -3
  4. package/src/Action.ts +47 -42
  5. package/src/ActionWithL2.ts +6 -6
  6. package/src/DfsWeb3.ts +20 -25
  7. package/src/Recipe.ts +18 -16
  8. package/src/Strategy.ts +10 -8
  9. package/src/actions/aave/AaveBorrowAction.ts +4 -4
  10. package/src/actions/aave/AaveClaimStkAaveAction.ts +5 -5
  11. package/src/actions/aave/AaveCollateralSwitchAction.ts +7 -7
  12. package/src/actions/aave/AavePaybackAction.ts +6 -6
  13. package/src/actions/aave/AaveSupplyAction.ts +7 -7
  14. package/src/actions/aave/AaveWithdrawAction.ts +6 -6
  15. package/src/actions/aaveV3/AaveV3ATokenPaybackAction.ts +13 -11
  16. package/src/actions/aaveV3/AaveV3BorrowAction.ts +11 -9
  17. package/src/actions/aaveV3/AaveV3ClaimRewardsAction.ts +7 -6
  18. package/src/actions/aaveV3/AaveV3CollateralSwitchAction.ts +8 -7
  19. package/src/actions/aaveV3/AaveV3PaybackAction.ts +20 -19
  20. package/src/actions/aaveV3/AaveV3SetEModeAction.ts +6 -6
  21. package/src/actions/aaveV3/AaveV3SupplyAction.ts +17 -18
  22. package/src/actions/aaveV3/AaveV3SwapBorrowRateModeAction.ts +10 -9
  23. package/src/actions/aaveV3/AaveV3WithdrawAction.ts +14 -13
  24. package/src/actions/balancer/BalancerV2ClaimAction.ts +14 -15
  25. package/src/actions/balancer/BalancerV2SupplyAction.ts +16 -14
  26. package/src/actions/balancer/BalancerV2WithdrawAction.ts +16 -14
  27. package/src/actions/balancer/index.ts +3 -3
  28. package/src/actions/basic/AutomationV2Unsub.ts +6 -6
  29. package/src/actions/basic/ChangeProxyOwnerAction.ts +5 -5
  30. package/src/actions/basic/GasFeeAction.ts +6 -7
  31. package/src/actions/basic/GasFeeActionL2.ts +6 -6
  32. package/src/actions/basic/PullTokenAction.ts +11 -11
  33. package/src/actions/basic/SellAction.ts +11 -12
  34. package/src/actions/basic/SendTokenAction.ts +8 -8
  35. package/src/actions/basic/SendTokenAndUnwrapAction.ts +8 -8
  36. package/src/actions/basic/SubInputsAction.ts +6 -6
  37. package/src/actions/basic/SumInputsAction.ts +6 -6
  38. package/src/actions/basic/ToggleSubAction.ts +5 -7
  39. package/src/actions/basic/TokenBalanceAction.ts +5 -5
  40. package/src/actions/basic/TransferNFTAction.ts +8 -8
  41. package/src/actions/basic/UnwrapEthAction.ts +11 -10
  42. package/src/actions/basic/UpdateSubAction.ts +8 -8
  43. package/src/actions/basic/WrapEthAction.ts +6 -6
  44. package/src/actions/checkers/AaveV3RatioCheckAction.ts +5 -5
  45. package/src/actions/checkers/CompoundV3RatioCheckAction.ts +6 -6
  46. package/src/actions/checkers/MakerRatioCheckAction.ts +5 -5
  47. package/src/actions/chickenBonds/CBChickenInAction.ts +6 -6
  48. package/src/actions/chickenBonds/CBChickenOutAction.ts +7 -7
  49. package/src/actions/chickenBonds/CBCreateAction.ts +6 -6
  50. package/src/actions/chickenBonds/CBRedeemAction.ts +6 -7
  51. package/src/actions/compound/CompoundBorrowAction.ts +5 -5
  52. package/src/actions/compound/CompoundClaimAction.ts +6 -6
  53. package/src/actions/compound/CompoundCollateralSwitchAction.ts +4 -4
  54. package/src/actions/compound/CompoundGetDebtAction.ts +5 -5
  55. package/src/actions/compound/CompoundPaybackAction.ts +8 -9
  56. package/src/actions/compound/CompoundSupplyAction.ts +8 -9
  57. package/src/actions/compound/CompoundWithdrawAction.ts +5 -5
  58. package/src/actions/compoundV3/CompoundV3AllowAction.ts +16 -16
  59. package/src/actions/compoundV3/CompoundV3BorrowAction.ts +17 -17
  60. package/src/actions/compoundV3/CompoundV3ClaimAction.ts +9 -9
  61. package/src/actions/compoundV3/CompoundV3PaybackAction.ts +32 -33
  62. package/src/actions/compoundV3/CompoundV3SupplyAction.ts +24 -25
  63. package/src/actions/compoundV3/CompoundV3TransferAction.ts +25 -25
  64. package/src/actions/compoundV3/CompoundV3WithdrawAction.ts +9 -9
  65. package/src/actions/compoundV3/index.ts +1 -1
  66. package/src/actions/convex/ConvexClaimAction.ts +51 -52
  67. package/src/actions/convex/ConvexDepositAction.ts +58 -59
  68. package/src/actions/convex/ConvexWithdrawAction.ts +55 -56
  69. package/src/actions/curve/CurveClaimFeesAction.ts +18 -19
  70. package/src/actions/curve/CurveDepositAction.ts +61 -62
  71. package/src/actions/curve/CurveGaugeDepositAction.ts +20 -21
  72. package/src/actions/curve/CurveGaugeWithdrawAction.ts +15 -16
  73. package/src/actions/curve/CurveMintCrvAction.ts +14 -15
  74. package/src/actions/curve/CurveStethPoolDepositAction.ts +27 -27
  75. package/src/actions/curve/CurveStethPoolWithdrawAction.ts +26 -26
  76. package/src/actions/curve/CurveSwapAction.ts +20 -21
  77. package/src/actions/curve/CurveWithdrawAction.ts +56 -57
  78. package/src/actions/dydx/DyDxWithdrawAction.ts +6 -6
  79. package/src/actions/flashloan/AaveV2FlashLoanAction.ts +6 -6
  80. package/src/actions/flashloan/AaveV2FlashLoanPaybackAction.ts +5 -5
  81. package/src/actions/flashloan/AaveV3FlashLoanAction.ts +6 -6
  82. package/src/actions/flashloan/AaveV3FlashLoanPaybackAction.ts +5 -5
  83. package/src/actions/flashloan/BalancerFlashLoanAction.ts +6 -6
  84. package/src/actions/flashloan/BalancerFlashLoanPaybackAction.ts +8 -8
  85. package/src/actions/flashloan/DyDxFlashLoanAction.ts +7 -7
  86. package/src/actions/flashloan/DyDxFlashLoanPaybackAction.ts +5 -5
  87. package/src/actions/flashloan/EulerFlashLoanAction.ts +6 -6
  88. package/src/actions/flashloan/EulerFlashLoanPaybackAction.ts +6 -5
  89. package/src/actions/flashloan/FLAction.ts +51 -0
  90. package/src/actions/flashloan/MakerFlashLoanAction.ts +6 -6
  91. package/src/actions/flashloan/MakerFlashLoanPaybackAction.ts +4 -4
  92. package/src/actions/flashloan/index.ts +3 -2
  93. package/src/actions/guni/GUniDeposit.ts +15 -15
  94. package/src/actions/guni/GUniWithdraw.ts +11 -11
  95. package/src/actions/index.ts +24 -24
  96. package/src/actions/insta/InstPullTokensAction.ts +9 -9
  97. package/src/actions/lido/LidoStakeAction.ts +7 -7
  98. package/src/actions/lido/LidoUnwrapAction.ts +6 -6
  99. package/src/actions/lido/LidoWrapAction.ts +9 -10
  100. package/src/actions/liquity/LiquityBorrowAction.ts +19 -17
  101. package/src/actions/liquity/LiquityClaimAction.ts +14 -14
  102. package/src/actions/liquity/LiquityClaimSPRewardsAction.ts +9 -9
  103. package/src/actions/liquity/LiquityClaimStakingRewardsAction.ts +9 -9
  104. package/src/actions/liquity/LiquityCloseAction.ts +19 -19
  105. package/src/actions/liquity/LiquityEthGainToTroveAction.ts +19 -17
  106. package/src/actions/liquity/LiquityOpenAction.ts +25 -23
  107. package/src/actions/liquity/LiquityPaybackAction.ts +21 -19
  108. package/src/actions/liquity/LiquityRedeemAction.ts +42 -37
  109. package/src/actions/liquity/LiquitySPDepositAction.ts +22 -22
  110. package/src/actions/liquity/LiquitySPWithdrawAction.ts +19 -19
  111. package/src/actions/liquity/LiquityStakeAction.ts +22 -22
  112. package/src/actions/liquity/LiquitySupplyAction.ts +21 -19
  113. package/src/actions/liquity/LiquityUnstakeAction.ts +19 -19
  114. package/src/actions/liquity/LiquityWithdrawAction.ts +18 -16
  115. package/src/actions/maker/MakerClaimAction.ts +8 -8
  116. package/src/actions/maker/MakerGenerateAction.ts +5 -5
  117. package/src/actions/maker/MakerGiveAction.ts +6 -6
  118. package/src/actions/maker/MakerMergeAction.ts +4 -4
  119. package/src/actions/maker/MakerOpenVaultAction.ts +4 -4
  120. package/src/actions/maker/MakerPaybackAction.ts +6 -6
  121. package/src/actions/maker/MakerRatioAction.ts +3 -3
  122. package/src/actions/maker/MakerSupplyAction.ts +6 -6
  123. package/src/actions/maker/MakerWithdrawAction.ts +5 -5
  124. package/src/actions/mstable/MStableClaimAction.ts +23 -23
  125. package/src/actions/mstable/MStableDepositAction.ts +60 -60
  126. package/src/actions/mstable/MStableWithdrawAction.ts +59 -59
  127. package/src/actions/rari/RariDepositAction.ts +4 -4
  128. package/src/actions/rari/RariWithdrawAction.ts +4 -4
  129. package/src/actions/reflexer/ReflexerGenerateAction.ts +6 -6
  130. package/src/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.ts +10 -11
  131. package/src/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.ts +7 -7
  132. package/src/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.ts +8 -8
  133. package/src/actions/reflexer/ReflexerOpenSafeAction.ts +3 -3
  134. package/src/actions/reflexer/ReflexerPaybackAction.ts +6 -6
  135. package/src/actions/reflexer/ReflexerSupplyAction.ts +6 -6
  136. package/src/actions/reflexer/ReflexerWithdrawAction.ts +5 -5
  137. package/src/actions/uniswap/UniswapSupplyAction.ts +18 -18
  138. package/src/actions/uniswap/UniswapWithdrawAction.ts +16 -16
  139. package/src/actions/uniswapV3/UniswapV3CollectAction.ts +9 -10
  140. package/src/actions/uniswapV3/UniswapV3CreatePoolAction.ts +22 -20
  141. package/src/actions/uniswapV3/UniswapV3MintAction.ts +21 -19
  142. package/src/actions/uniswapV3/UniswapV3SupplyAction.ts +15 -15
  143. package/src/actions/uniswapV3/UniswapV3WithdrawAction.ts +14 -15
  144. package/src/actions/yearn/YearnSupplyAction.ts +7 -7
  145. package/src/actions/yearn/YearnWithdrawAction.ts +7 -7
  146. package/src/addresses.ts +10 -7
  147. package/src/config.ts +6 -6
  148. package/src/index.ts +30 -15
  149. package/src/triggers/AaveV3RatioTrigger.ts +6 -7
  150. package/src/triggers/ChainLinkPriceTrigger.ts +6 -8
  151. package/src/triggers/CompV3RatioTrigger.ts +6 -7
  152. package/src/triggers/CompoundRatioTrigger.ts +6 -7
  153. package/src/triggers/GasPriceTrigger.ts +6 -7
  154. package/src/triggers/LiquityRatioTrigger.ts +9 -10
  155. package/src/triggers/MakerRatioTrigger.ts +6 -7
  156. package/src/triggers/ReflexerRatioTrigger.ts +6 -7
  157. package/src/triggers/TimestampTrigger.ts +6 -7
  158. package/src/triggers/TrailingStopTrigger.ts +6 -7
  159. package/src/triggers/UniV3CurrentTickTrigger.ts +6 -6
  160. package/src/types.ts +9 -7
  161. package/src/utils/convex-utils.ts +9 -9
  162. package/src/utils/curve-utils.ts +11 -8
  163. package/src/utils/general.ts +4 -5
  164. package/src/utils/index.ts +7 -5
  165. package/src/utils/mstableAssetPairs.ts +6 -6
  166. package/src/utils/uniswapLP.ts +14 -16
  167. package/src/utils/uniswapV3LP.ts +5 -4
  168. package/src/utils/zeroExExchange.ts +9 -8
  169. package/.eslintrc +0 -14
  170. package/src/triggers/CompV3Trigger.ts +0 -15
@@ -1,18 +1,17 @@
1
1
  import { getAssetInfo } from '@defisaver/tokens';
2
- import {Action} from '../../Action';
2
+ import { Action } from '../../Action';
3
3
  import { requireAddress } from '../../utils/general';
4
4
  import { getAddr } from '../../addresses';
5
5
  import { poolInfo, makeFlags } from '../../utils/curve-utils';
6
- import {EthAddress,uint256} from '../../types';
6
+ import { EthAddress, uint256 } from '../../types';
7
7
 
8
8
  /**
9
9
  * @category Curve
10
10
  */
11
11
  export class CurveDepositAction extends Action {
12
+ tokensForApproval:Array<EthAddress>;
12
13
 
13
- tokensForApproval:Array<EthAddress>;
14
-
15
- /**
14
+ /**
16
15
  * @param sender
17
16
  * @param receiver
18
17
  * @param poolAddr
@@ -20,66 +19,66 @@ export class CurveDepositAction extends Action {
20
19
  * @param useUnderlying
21
20
  * @param amounts
22
21
  */
23
- constructor(
24
- sender:EthAddress,
25
- receiver:EthAddress,
26
- poolAddr:EthAddress,
27
- minMintAmount:uint256,
28
- useUnderlying:boolean,
29
- amounts:Array<uint256> = [],
30
- ) {
31
- requireAddress(sender);
32
- requireAddress(receiver);
22
+ constructor(
23
+ sender:EthAddress,
24
+ receiver:EthAddress,
25
+ poolAddr:EthAddress,
26
+ minMintAmount:uint256,
27
+ useUnderlying:boolean,
28
+ amounts:Array<uint256> = [],
29
+ ) {
30
+ requireAddress(sender);
31
+ requireAddress(receiver);
33
32
 
34
- let depositTarget;
35
- let depositTargetType = 0;
36
- let explicitUnderlying = false;
37
- let tokensForApproval;
33
+ let depositTarget;
34
+ let depositTargetType = 0;
35
+ let explicitUnderlying = false;
36
+ let tokensForApproval;
38
37
 
39
- const pool = poolInfo.find((e) => e.swapAddr.toLowerCase() === poolAddr.toLowerCase())!;
40
- if (useUnderlying) {
41
- if (pool.depositContract) {
42
- depositTarget = pool.depositContract;
43
- depositTargetType = pool.zapType + 1;
44
- } else {
45
- depositTarget = pool.swapAddr;
46
- explicitUnderlying = pool.underlyingFlag!;
47
- if (!explicitUnderlying) throw Error('pool has no underlying deposit mechanism');
48
- }
49
- tokensForApproval = pool.underlyingCoins;
50
- } else {
51
- depositTarget = pool.swapAddr;
52
- tokensForApproval = pool.coins;
53
- }
38
+ const pool = poolInfo.find((e) => e.swapAddr.toLowerCase() === poolAddr.toLowerCase())!;
39
+ if (useUnderlying) {
40
+ if (pool.depositContract) {
41
+ depositTarget = pool.depositContract;
42
+ depositTargetType = pool.zapType + 1;
43
+ } else {
44
+ depositTarget = pool.swapAddr;
45
+ explicitUnderlying = pool.underlyingFlag!;
46
+ if (!explicitUnderlying) throw Error('pool has no underlying deposit mechanism');
47
+ }
48
+ tokensForApproval = pool.underlyingCoins;
49
+ } else {
50
+ depositTarget = pool.swapAddr;
51
+ tokensForApproval = pool.coins;
52
+ }
54
53
 
55
- super('CurveDeposit',
56
- getAddr('CurveDeposit'),
57
- ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'],
58
- [
59
- sender,
60
- receiver,
61
- depositTarget,
62
- minMintAmount,
63
- makeFlags(depositTargetType, explicitUnderlying, 0),
64
- amounts,
65
- ],
66
- );
67
- this.tokensForApproval = tokensForApproval;
54
+ super('CurveDeposit',
55
+ getAddr('CurveDeposit'),
56
+ ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'],
57
+ [
58
+ sender,
59
+ receiver,
60
+ depositTarget,
61
+ minMintAmount,
62
+ makeFlags(depositTargetType, explicitUnderlying, 0),
63
+ amounts,
64
+ ],
65
+ );
66
+ this.tokensForApproval = tokensForApproval;
68
67
 
69
- this.mappableArgs = [
70
- this.args[0],
71
- this.args[1],
72
- this.args[2],
73
- this.args[3],
74
- this.args[4],
75
- ...this.args[5],
76
- ];
77
- }
68
+ this.mappableArgs = [
69
+ this.args[0],
70
+ this.args[1],
71
+ this.args[2],
72
+ this.args[3],
73
+ this.args[4],
74
+ ...this.args[5],
75
+ ];
76
+ }
78
77
 
79
- async getAssetsToApprove() {
80
- return this.tokensForApproval.map((e) => Object({
81
- asset: e.toLowerCase() !== getAssetInfo('ETH').address.toLowerCase() ? e : getAssetInfo('WETH').address,
82
- owner: this.args[0],
83
- }));
84
- }
78
+ async getAssetsToApprove() {
79
+ return this.tokensForApproval.map((e) => Object({
80
+ asset: e.toLowerCase() !== getAssetInfo('ETH').address.toLowerCase() ? e : getAssetInfo('WETH').address,
81
+ owner: this.args[0],
82
+ }));
83
+ }
85
84
  }
@@ -1,14 +1,13 @@
1
- import {Action} from '../../Action';
1
+ import { Action } from '../../Action';
2
2
  import { requireAddress } from '../../utils/general';
3
3
  import { getAddr } from '../../addresses';
4
- import {EthAddress,uint256} from '../../types';
4
+ import { EthAddress, uint256 } from '../../types';
5
5
 
6
6
  /**
7
7
  * @category Curve
8
8
  */
9
9
  export class CurveGaugeDepositAction extends Action {
10
-
11
- /**
10
+ /**
12
11
  *
13
12
  * @param gaugeAddr
14
13
  * @param lpToken
@@ -16,23 +15,23 @@ export class CurveGaugeDepositAction extends Action {
16
15
  * @param onBehalfOf
17
16
  * @param amount
18
17
  */
19
- constructor(gaugeAddr:EthAddress, lpToken:EthAddress, sender:EthAddress, onBehalfOf:EthAddress, amount:uint256) {
20
- requireAddress(sender);
21
- requireAddress(onBehalfOf);
22
- super('CurveGaugeDeposit',
23
- getAddr('CurveGaugeDeposit'),
24
- ['address', 'address', 'address', 'address', 'uint256'],
25
- [gaugeAddr, lpToken, sender, onBehalfOf, amount],
26
- );
18
+ constructor(gaugeAddr:EthAddress, lpToken:EthAddress, sender:EthAddress, onBehalfOf:EthAddress, amount:uint256) {
19
+ requireAddress(sender);
20
+ requireAddress(onBehalfOf);
21
+ super('CurveGaugeDeposit',
22
+ getAddr('CurveGaugeDeposit'),
23
+ ['address', 'address', 'address', 'address', 'uint256'],
24
+ [gaugeAddr, lpToken, sender, onBehalfOf, amount],
25
+ );
27
26
 
28
- this.mappableArgs = [
29
- this.args[2],
30
- this.args[3],
31
- this.args[4],
32
- ];
33
- }
27
+ this.mappableArgs = [
28
+ this.args[2],
29
+ this.args[3],
30
+ this.args[4],
31
+ ];
32
+ }
34
33
 
35
- async getAssetsToApprove() {
36
- return [{ asset: this.args[1], owner: this.args[2] }];
37
- }
34
+ async getAssetsToApprove() {
35
+ return [{ asset: this.args[1], owner: this.args[2] }];
36
+ }
38
37
  }
@@ -1,30 +1,29 @@
1
- import {Action} from '../../Action';
1
+ import { Action } from '../../Action';
2
2
  import { requireAddress } from '../../utils/general';
3
3
  import { getAddr } from '../../addresses';
4
- import {EthAddress,uint256} from '../../types';
4
+ import { EthAddress, uint256 } from '../../types';
5
5
 
6
6
  /**
7
7
  * @category Curve
8
8
  */
9
9
  export class CurveGaugeWithdrawAction extends Action {
10
-
11
- /**
10
+ /**
12
11
  * @param gaugeAddr
13
12
  * @param lpToken
14
13
  * @param receiver
15
14
  * @param amount
16
15
  */
17
- constructor(gaugeAddr:EthAddress, lpToken:EthAddress, receiver:EthAddress, amount:uint256) {
18
- requireAddress(receiver);
19
- super('CurveGaugeWithdraw',
20
- getAddr('CurveGaugeWithdraw'),
21
- ['address', 'address', 'address', 'uint256'],
22
- [gaugeAddr, lpToken, receiver, amount],
23
- );
16
+ constructor(gaugeAddr:EthAddress, lpToken:EthAddress, receiver:EthAddress, amount:uint256) {
17
+ requireAddress(receiver);
18
+ super('CurveGaugeWithdraw',
19
+ getAddr('CurveGaugeWithdraw'),
20
+ ['address', 'address', 'address', 'uint256'],
21
+ [gaugeAddr, lpToken, receiver, amount],
22
+ );
24
23
 
25
- this.mappableArgs = [
26
- this.args[2],
27
- this.args[3],
28
- ];
29
- }
24
+ this.mappableArgs = [
25
+ this.args[2],
26
+ this.args[3],
27
+ ];
28
+ }
30
29
  }
@@ -1,27 +1,26 @@
1
- import {Action} from '../../Action';
1
+ import { Action } from '../../Action';
2
2
  import { requireAddress } from '../../utils/general';
3
3
  import { getAddr } from '../../addresses';
4
- import {EthAddress} from '../../types';
4
+ import { EthAddress } from '../../types';
5
5
 
6
6
  /**
7
7
  * @category Curve
8
8
  */
9
9
  export class CurveMintCrvAction extends Action {
10
-
11
- /**
10
+ /**
12
11
  * @param gaugeAddrs
13
12
  * @param receiver
14
13
  */
15
- constructor(gaugeAddrs:EthAddress[8], receiver:EthAddress) {
16
- requireAddress(receiver);
17
- super('CurveMintCrv',
18
- getAddr('CurveMintCrv'),
19
- ['address[8]', 'address'],
20
- [gaugeAddrs, receiver],
21
- );
14
+ constructor(gaugeAddrs:EthAddress[8], receiver:EthAddress) {
15
+ requireAddress(receiver);
16
+ super('CurveMintCrv',
17
+ getAddr('CurveMintCrv'),
18
+ ['address[8]', 'address'],
19
+ [gaugeAddrs, receiver],
20
+ );
22
21
 
23
- this.mappableArgs = [
24
- this.args[8],
25
- ];
26
- }
22
+ this.mappableArgs = [
23
+ this.args[8],
24
+ ];
25
+ }
27
26
  }
@@ -1,41 +1,41 @@
1
- import {Action} from '../../Action';
1
+ import { Action } from '../../Action';
2
2
  import { requireAddress } from '../../utils/general';
3
3
  import { getAddr } from '../../addresses';
4
- import {EthAddress,uint256} from '../../types';
4
+ import { EthAddress, uint256 } from '../../types';
5
5
 
6
6
  /**
7
7
  * CurveStethPoolDepositAction - Deposits tokens into curve steth pool
8
- *
8
+ *
9
9
  * @category Curve
10
10
  */
11
11
  export class CurveStethPoolDepositAction extends Action {
12
- /**
13
- * @param from
14
- * @param to
12
+ /**
13
+ * @param from
14
+ * @param to
15
15
  * @param amounts
16
16
  * @param minMintAmount
17
17
  */
18
- constructor(
19
- from:EthAddress,
20
- to:EthAddress,
21
- amounts:uint256[2],
22
- minMintAmount:uint256,
23
- ) {
24
- requireAddress(to);
18
+ constructor(
19
+ from:EthAddress,
20
+ to:EthAddress,
21
+ amounts:uint256[2],
22
+ minMintAmount:uint256,
23
+ ) {
24
+ requireAddress(to);
25
25
 
26
- super(
27
- 'CurveStethPoolDeposit',
28
- getAddr('CurveStethPoolDeposit'),
29
- ['address', 'address', 'uint256[2]', 'uint256'],
30
- [from,to,amounts,minMintAmount],
31
- );
26
+ super(
27
+ 'CurveStethPoolDeposit',
28
+ getAddr('CurveStethPoolDeposit'),
29
+ ['address', 'address', 'uint256[2]', 'uint256'],
30
+ [from, to, amounts, minMintAmount],
31
+ );
32
32
 
33
- this.mappableArgs = [
34
- this.args[0],
35
- this.args[1],
36
- this.args[2][0],
37
- this.args[2][1],
38
- this.args[3],
39
- ];
40
- }
33
+ this.mappableArgs = [
34
+ this.args[0],
35
+ this.args[1],
36
+ this.args[2][0],
37
+ this.args[2][1],
38
+ this.args[3],
39
+ ];
40
+ }
41
41
  }
@@ -1,43 +1,43 @@
1
- import {Action} from '../../Action';
1
+ import { Action } from '../../Action';
2
2
  import { requireAddress } from '../../utils/general';
3
3
  import { getAddr } from '../../addresses';
4
- import {EthAddress,uint256} from '../../types';
4
+ import { EthAddress, uint256 } from '../../types';
5
5
 
6
6
  /**
7
7
  * CurveStethPoolWithdrawAction - Withdraws tokens from curve steth pool
8
- *
8
+ *
9
9
  * @category Curve
10
10
  */
11
11
  export class CurveStethPoolWithdrawAction extends Action {
12
- /**
12
+ /**
13
13
  * @param from
14
14
  * @param to
15
15
  * @param amounts
16
16
  * @param maxBurnAmount
17
17
  * @param returnValue
18
18
  */
19
- constructor(
20
- from:EthAddress,
21
- to:EthAddress,
22
- amounts:uint256[2],
23
- maxBurnAmount:uint256,
24
- returnValue:uint256,
25
- ) {
26
- requireAddress(to);
19
+ constructor(
20
+ from:EthAddress,
21
+ to:EthAddress,
22
+ amounts:uint256[2],
23
+ maxBurnAmount:uint256,
24
+ returnValue:uint256,
25
+ ) {
26
+ requireAddress(to);
27
27
 
28
- super(
29
- 'CurveStethPoolWithdraw',
30
- getAddr('CurveStethPoolWithdraw'),
31
- ['address', 'address', 'uint256[2]', 'uint256', 'uint256'],
32
- [from,to,amounts,maxBurnAmount,returnValue],
33
- );
28
+ super(
29
+ 'CurveStethPoolWithdraw',
30
+ getAddr('CurveStethPoolWithdraw'),
31
+ ['address', 'address', 'uint256[2]', 'uint256', 'uint256'],
32
+ [from, to, amounts, maxBurnAmount, returnValue],
33
+ );
34
34
 
35
- this.mappableArgs = [
36
- this.args[0],
37
- this.args[1],
38
- this.args[2][0],
39
- this.args[2][1],
40
- this.args[3],
41
- ];
42
- }
35
+ this.mappableArgs = [
36
+ this.args[0],
37
+ this.args[1],
38
+ this.args[2][0],
39
+ this.args[2][1],
40
+ this.args[3],
41
+ ];
42
+ }
43
43
  }
@@ -1,14 +1,13 @@
1
- import {Action} from '../../Action';
1
+ import { Action } from '../../Action';
2
2
  import { requireAddress } from '../../utils/general';
3
3
  import { getAddr } from '../../addresses';
4
- import {EthAddress,uint256} from '../../types';
4
+ import { EthAddress, uint256 } from '../../types';
5
5
 
6
6
  /**
7
7
  * @category Curve
8
8
  */
9
9
  export class CurveSwapAction extends Action {
10
-
11
- /**
10
+ /**
12
11
  *
13
12
  * @param sender
14
13
  * @param receiver
@@ -18,23 +17,23 @@ export class CurveSwapAction extends Action {
18
17
  * @param amount
19
18
  * @param expected
20
19
  */
21
- constructor(sender:EthAddress, receiver:EthAddress, pool:EthAddress, tokenA:EthAddress, tokenB:EthAddress, amount:uint256, expected:uint256) {
22
- requireAddress(sender);
23
- requireAddress(receiver);
24
- super('CurveSwap',
25
- getAddr('CurveSwap'),
26
- ['address', 'address', 'address', 'address', 'address', 'uint256', 'uint256'],
27
- [sender, receiver, pool, tokenA, tokenB, amount, expected]);
20
+ constructor(sender:EthAddress, receiver:EthAddress, pool:EthAddress, tokenA:EthAddress, tokenB:EthAddress, amount:uint256, expected:uint256) {
21
+ requireAddress(sender);
22
+ requireAddress(receiver);
23
+ super('CurveSwap',
24
+ getAddr('CurveSwap'),
25
+ ['address', 'address', 'address', 'address', 'address', 'uint256', 'uint256'],
26
+ [sender, receiver, pool, tokenA, tokenB, amount, expected]);
28
27
 
29
- this.mappableArgs = [
30
- this.args[0],
31
- this.args[1],
32
- this.args[5],
33
- this.args[6],
34
- ];
35
- }
28
+ this.mappableArgs = [
29
+ this.args[0],
30
+ this.args[1],
31
+ this.args[5],
32
+ this.args[6],
33
+ ];
34
+ }
36
35
 
37
- async getAssetsToApprove() {
38
- return [{ asset: this.args[3], owner: this.args[0] }];
39
- }
36
+ async getAssetsToApprove() {
37
+ return [{ asset: this.args[3], owner: this.args[0] }];
38
+ }
40
39
  }
@@ -1,18 +1,17 @@
1
- import {Action} from '../../Action';
1
+ import { Action } from '../../Action';
2
2
  import { requireAddress } from '../../utils/general';
3
3
  import { getAddr } from '../../addresses';
4
4
  import { poolInfo, makeFlags } from '../../utils/curve-utils';
5
- import {EthAddress,uint256} from '../../types';
5
+ import { EthAddress, uint256 } from '../../types';
6
6
 
7
7
 
8
8
  /**
9
9
  * @category Curve
10
10
  */
11
11
  export class CurveWithdrawAction extends Action {
12
+ lpToken:EthAddress;
12
13
 
13
- lpToken:EthAddress;
14
-
15
- /**
14
+ /**
16
15
  * @param sender
17
16
  * @param receiver
18
17
  * @param poolAddr
@@ -21,61 +20,61 @@ export class CurveWithdrawAction extends Action {
21
20
  * @param withdrawExact
22
21
  * @param minAmounts
23
22
  */
24
- constructor(
25
- sender:EthAddress,
26
- receiver:EthAddress,
27
- poolAddr:EthAddress,
28
- burnAmount:uint256,
29
- useUnderlying:boolean,
30
- withdrawExact:boolean,
31
- minAmounts:Array<uint256> = [],
32
- ) {
33
- requireAddress(sender);
34
- requireAddress(receiver);
23
+ constructor(
24
+ sender:EthAddress,
25
+ receiver:EthAddress,
26
+ poolAddr:EthAddress,
27
+ burnAmount:uint256,
28
+ useUnderlying:boolean,
29
+ withdrawExact:boolean,
30
+ minAmounts:Array<uint256> = [],
31
+ ) {
32
+ requireAddress(sender);
33
+ requireAddress(receiver);
35
34
 
36
- let depositTarget;
37
- let depositTargetType = 0;
38
- let explicitUnderlying = false;
35
+ let depositTarget;
36
+ let depositTargetType = 0;
37
+ let explicitUnderlying = false;
39
38
 
40
- const pool = poolInfo.find((e:any) => e.swapAddr.toLowerCase() === poolAddr.toLowerCase())!;
41
- if (useUnderlying) {
42
- if (pool.depositContract) {
43
- depositTarget = pool.depositContract;
44
- depositTargetType = pool.zapType + 1;
45
- } else {
46
- depositTarget = pool.swapAddr;
47
- explicitUnderlying = pool.underlyingFlag!;
48
- if (!explicitUnderlying) throw Error('pool has no underlying deposit mechanism');
49
- }
50
- } else {
51
- depositTarget = pool.swapAddr;
52
- }
39
+ const pool = poolInfo.find((e:any) => e.swapAddr.toLowerCase() === poolAddr.toLowerCase())!;
40
+ if (useUnderlying) {
41
+ if (pool.depositContract) {
42
+ depositTarget = pool.depositContract;
43
+ depositTargetType = pool.zapType + 1;
44
+ } else {
45
+ depositTarget = pool.swapAddr;
46
+ explicitUnderlying = pool.underlyingFlag!;
47
+ if (!explicitUnderlying) throw Error('pool has no underlying deposit mechanism');
48
+ }
49
+ } else {
50
+ depositTarget = pool.swapAddr;
51
+ }
53
52
 
54
- super('CurveWithdraw',
55
- getAddr('CurveWithdraw'),
56
- ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'],
57
- [
58
- sender,
59
- receiver,
60
- depositTarget,
61
- burnAmount,
62
- makeFlags(depositTargetType, explicitUnderlying, withdrawExact),
63
- minAmounts,
64
- ],
65
- );
66
- this.lpToken = pool.lpToken;
53
+ super('CurveWithdraw',
54
+ getAddr('CurveWithdraw'),
55
+ ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'],
56
+ [
57
+ sender,
58
+ receiver,
59
+ depositTarget,
60
+ burnAmount,
61
+ makeFlags(depositTargetType, explicitUnderlying, withdrawExact),
62
+ minAmounts,
63
+ ],
64
+ );
65
+ this.lpToken = pool.lpToken;
67
66
 
68
- this.mappableArgs = [
69
- this.args[0],
70
- this.args[1],
71
- this.args[2],
72
- this.args[3],
73
- this.args[4],
74
- ...this.args[5],
75
- ];
76
- }
67
+ this.mappableArgs = [
68
+ this.args[0],
69
+ this.args[1],
70
+ this.args[2],
71
+ this.args[3],
72
+ this.args[4],
73
+ ...this.args[5],
74
+ ];
75
+ }
77
76
 
78
- async getAssetsToApprove() {
79
- return [{ asset: this.lpToken, owner: this.args[0] }];
80
- }
77
+ async getAssetsToApprove() {
78
+ return [{ asset: this.lpToken, owner: this.args[0] }];
79
+ }
81
80
  }
@@ -1,21 +1,21 @@
1
- import {Action} from "../../Action";
2
- import { requireAddress } from "../../utils/general";
1
+ import { Action } from '../../Action';
2
+ import { requireAddress } from '../../utils/general';
3
3
  import { getAddr } from '../../addresses';
4
- import {EthAddress,uint256} from '../../types';
4
+ import { EthAddress, uint256 } from '../../types';
5
5
 
6
6
  /**
7
7
  * DyDxWithdrawAction - Withdraw token from an DyDx position
8
- *
8
+ *
9
9
  * @category DyDx
10
10
  */
11
11
  export class DyDxWithdrawAction extends Action {
12
12
  /**
13
13
  * @param tokenAddr
14
- * @param amount
14
+ * @param amount
15
15
  * @param to Tokens will be withdrawn to this address
16
16
  */
17
17
  constructor(tokenAddr:EthAddress, amount:uint256, to:EthAddress) {
18
18
  requireAddress(to);
19
- super('DyDxWithdraw', getAddr('DyDxWithdraw'), ['address','uint256','address'], [tokenAddr, amount, to]);
19
+ super('DyDxWithdraw', getAddr('DyDxWithdraw'), ['address', 'uint256', 'address'], [tokenAddr, amount, to]);
20
20
  }
21
21
  }