@defisaver/sdk 0.0.26 → 0.1.1

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 (50) hide show
  1. package/.env.example +1 -0
  2. package/ACTIONS.md +41 -2
  3. package/DEV.md +14 -0
  4. package/index.js +2 -0
  5. package/package.json +4 -3
  6. package/src/DfsWeb3.js +20 -7
  7. package/src/actions/aave/AaveCollateralSwitchAction.js +21 -0
  8. package/src/actions/aave/index.js +2 -0
  9. package/src/actions/balancer/BalancerV2ClaimAction.js +48 -0
  10. package/src/actions/balancer/BalancerV2SupplyAction.js +1 -3
  11. package/src/actions/balancer/BalancerV2WithdrawAction.js +3 -0
  12. package/src/actions/balancer/index.js +2 -0
  13. package/src/actions/basic/TokenBalanceAction.js +18 -0
  14. package/src/actions/basic/index.js +2 -0
  15. package/src/actions/compound/CompoundCollateralSwitchAction.js +21 -0
  16. package/src/actions/compound/CompoundGetDebtAction.js +18 -0
  17. package/src/actions/compound/CompoundPaybackAction.js +3 -2
  18. package/src/actions/compound/index.js +4 -0
  19. package/src/actions/insta/InstPullTokensAction.js +24 -0
  20. package/src/actions/insta/index.js +2 -0
  21. package/src/addresses.js +11 -4
  22. package/src/utils/zeroExExchange.js +0 -2
  23. package/test/DfsWeb3.js +7 -2
  24. package/test/Recipe.js +1 -1
  25. package/test/actions/aave/AaveClaimStkAaveAction.js +22 -0
  26. package/test/actions/aave/AaveCollateralSwitchAction.js +21 -0
  27. package/test/actions/balancer/BalancerV2ClaimAction.js +101 -0
  28. package/test/actions/basic/TokenBalanceAction.js +21 -0
  29. package/test/actions/compound/CompoundCollateralSwitchAction.js +20 -0
  30. package/test/actions/compound/CompoundGetDebtAction.js +21 -0
  31. package/test/actions/insta/ClaimInstMakerAction.js +1 -1
  32. package/test/actions/insta/InstPullTokensAction.js +31 -0
  33. package/test/actions/liquity/LiquityBorrowAction.js +28 -0
  34. package/test/actions/liquity/LiquityClaimAction.js +28 -0
  35. package/test/actions/liquity/LiquityClaimSPRewardsAction.js +28 -0
  36. package/test/actions/liquity/LiquityClaimStakingRewardsAction.js +28 -0
  37. package/test/actions/liquity/LiquityCloseAction.js +30 -0
  38. package/test/actions/liquity/LiquityEthGainToTroveAction.js +28 -0
  39. package/test/actions/liquity/LiquityOpenAction.js +30 -0
  40. package/test/actions/liquity/LiquityPaybackAction.js +30 -0
  41. package/test/actions/liquity/LiquityRedeemAction.js +38 -0
  42. package/test/actions/liquity/LiquitySPDepositAction.js +31 -0
  43. package/test/actions/liquity/LiquitySPWithdrawAction.js +29 -0
  44. package/test/actions/liquity/LiquityStakeAction.js +30 -0
  45. package/test/actions/liquity/LiquitySupplyAction.js +30 -0
  46. package/test/actions/liquity/LiquityUnstakeAction.js +28 -0
  47. package/test/actions/liquity/LiquityWithdrawAction.js +28 -0
  48. package/test/actions/maker/MakerSupplyAction.js +2 -2
  49. package/test/index.js +1 -1
  50. package/test/utils/zeroExExchange.js +0 -11
@@ -0,0 +1,101 @@
1
+ const dfs = require('../../../index.js');
2
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
3
+ const {getAssetInfo, assetAmountInWei, assetAmountInEth} = require("@defisaver/tokens");
4
+ const {assert} = require('chai');
5
+
6
+ describe('Action: BalancerV2SupplyAction', () => {
7
+ let action;
8
+
9
+ context('Leave BAL tokens on EOA liquidity provider', () => {
10
+ it('constructor', () => {
11
+ action = new dfs.actions.balancer.BalancerV2ClaimAction(
12
+ '0x7eb510a2d3316dd2cdca937a95ec81cdf140a98d',
13
+ '0x7eb510a2d3316dd2cdca937a95ec81cdf140a98d',
14
+ ['40', '41'],
15
+ ['7206527418624000000', '4956940391238000000'],
16
+ [[
17
+ '0xa1686f1a9dd80ffd016fe4aa5c6b2f256d4af0fb14f1bd064606d7a8e9bd97d6',
18
+ '0xa3739bc09c73d8d9b977cbe2f4e8a686086ce43fab641358b2d371ecfa850a36',
19
+ '0x744edca176c1345418ee7b5ab14fc2c8b89e751662864995f3a6454d98a4a12f',
20
+ '0x22b38144f4bbef7d055dc5ff145f4c8f3837a41aa1c64c0793ba769d16d0d0a5',
21
+ '0x48060bab54ce5e9a1eaeeba0df025b28bc4de4f4a6039147be16bcbf500f6c08',
22
+ '0x7f0ed0663ef5be3f1d204832fe961578d243e8176f9e15271c558f3fbc898791',
23
+ '0x2a01cb4d0689ad424571af14871bdf20fedc0ba5bfa2e50abe8bd330a4f44e41',
24
+ '0xa2f3af06d6cf1a2a222afd7ea88ad0d6da210e9873d64a9f3f94afbd25eebc4f',
25
+ '0xf1d72f1757982c6d58a197f970e4f6bae51833125c0dd1900a2c78af68db89d0',
26
+ '0xd8fc9a69bad0d5e239be5f26d51ab33227dd793294cbcb80a90d34299076c52b',
27
+ '0x308214941e3379b390f8e9766c1abfef885d1a1cd7541dc7e3c2772a5a98b328',
28
+ '0x950b1e6196ba2b5587ed2509ee854230438a895fd332a1ceac8c116f7344fad2',
29
+ ], [
30
+ '0x1206e502394066162f473b6564e23933cd60984bc6dcb4d5c57f399a508ccffb',
31
+ '0x0545d89ae208f0f4254debf26528bdd48ba210c14beff4272a06bf30e8650e73',
32
+ '0x65df5743c79831186f6408894d414864daeabb763cb850a4b056adfd4b8973fe',
33
+ '0xaba7cd047c1e2382a2c867bd10a190ab06d8ed9d88e14dc44f2dac93b61230e2',
34
+ '0x20b752cf4a881642078d1dc55177ea43f80eb2852bbf75d11bb5d077b7dcd68b',
35
+ '0x7997e5e1c2901a0bc344bbee9fae1b74d6326b10ac8687ac1854821a283be8c5',
36
+ '0xacfcfafd23e286a2a75a6ecea65a29b2f099d0bf06c730c3c5f93a5936b160a0',
37
+ '0x8bb6ed30028213403c71ecaa946e1bafb0f6036383904f1e772a7f7856f9b12b',
38
+ '0x404a8fb6a5797aede2647ff9b26be857f088575f363f27308ee94f01f871851b',
39
+ '0x4fa44ce94b1bff7d4dc98657b97a3169c2c936fd6d6816dcfe6bf5d4fdc28247',
40
+ '0xd9bdc288545f8f7b4d201fb70b58817a91292c7d69a3c848fd19aad7278cd2f0',
41
+ '0xfc2a36ece494c459bc02e38c3590876eb35219d0521087fd99c70de08c286117',
42
+ ]],
43
+ );
44
+ })
45
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
46
+ it('encodeForRecipe', () => encodeForRecipe(action));
47
+ it('getAssetsToApprove', async () => {
48
+ const assetOwnerPairs = await action.getAssetsToApprove();
49
+ assert.lengthOf(assetOwnerPairs, 0);
50
+ })
51
+ it('test mappable args', async () => {
52
+ assert.lengthOf(action.mappableArgs, 2);
53
+ })
54
+ })
55
+ context('Send BAL tokens to another account', () => {
56
+ it('constructor', () => {
57
+ action = new dfs.actions.balancer.BalancerV2ClaimAction(
58
+ '0x7eb510a2d3316dd2cdca937a95ec81cdf140a98d',
59
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
60
+ ['40', '41'],
61
+ ['7206527418624000000', '4956940391238000000'],
62
+ [[
63
+ '0xa1686f1a9dd80ffd016fe4aa5c6b2f256d4af0fb14f1bd064606d7a8e9bd97d6',
64
+ '0xa3739bc09c73d8d9b977cbe2f4e8a686086ce43fab641358b2d371ecfa850a36',
65
+ '0x744edca176c1345418ee7b5ab14fc2c8b89e751662864995f3a6454d98a4a12f',
66
+ '0x22b38144f4bbef7d055dc5ff145f4c8f3837a41aa1c64c0793ba769d16d0d0a5',
67
+ '0x48060bab54ce5e9a1eaeeba0df025b28bc4de4f4a6039147be16bcbf500f6c08',
68
+ '0x7f0ed0663ef5be3f1d204832fe961578d243e8176f9e15271c558f3fbc898791',
69
+ '0x2a01cb4d0689ad424571af14871bdf20fedc0ba5bfa2e50abe8bd330a4f44e41',
70
+ '0xa2f3af06d6cf1a2a222afd7ea88ad0d6da210e9873d64a9f3f94afbd25eebc4f',
71
+ '0xf1d72f1757982c6d58a197f970e4f6bae51833125c0dd1900a2c78af68db89d0',
72
+ '0xd8fc9a69bad0d5e239be5f26d51ab33227dd793294cbcb80a90d34299076c52b',
73
+ '0x308214941e3379b390f8e9766c1abfef885d1a1cd7541dc7e3c2772a5a98b328',
74
+ '0x950b1e6196ba2b5587ed2509ee854230438a895fd332a1ceac8c116f7344fad2',
75
+ ], [
76
+ '0x1206e502394066162f473b6564e23933cd60984bc6dcb4d5c57f399a508ccffb',
77
+ '0x0545d89ae208f0f4254debf26528bdd48ba210c14beff4272a06bf30e8650e73',
78
+ '0x65df5743c79831186f6408894d414864daeabb763cb850a4b056adfd4b8973fe',
79
+ '0xaba7cd047c1e2382a2c867bd10a190ab06d8ed9d88e14dc44f2dac93b61230e2',
80
+ '0x20b752cf4a881642078d1dc55177ea43f80eb2852bbf75d11bb5d077b7dcd68b',
81
+ '0x7997e5e1c2901a0bc344bbee9fae1b74d6326b10ac8687ac1854821a283be8c5',
82
+ '0xacfcfafd23e286a2a75a6ecea65a29b2f099d0bf06c730c3c5f93a5936b160a0',
83
+ '0x8bb6ed30028213403c71ecaa946e1bafb0f6036383904f1e772a7f7856f9b12b',
84
+ '0x404a8fb6a5797aede2647ff9b26be857f088575f363f27308ee94f01f871851b',
85
+ '0x4fa44ce94b1bff7d4dc98657b97a3169c2c936fd6d6816dcfe6bf5d4fdc28247',
86
+ '0xd9bdc288545f8f7b4d201fb70b58817a91292c7d69a3c848fd19aad7278cd2f0',
87
+ '0xfc2a36ece494c459bc02e38c3590876eb35219d0521087fd99c70de08c286117',
88
+ ]],
89
+ );
90
+ })
91
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
92
+ it('encodeForRecipe', () => encodeForRecipe(action));
93
+ it('getAssetsToApprove', async () => {
94
+ const assetOwnerPairs = await action.getAssetsToApprove();
95
+ assert.lengthOf(assetOwnerPairs, 1);
96
+ })
97
+ it('test mappable args', async () => {
98
+ assert.lengthOf(action.mappableArgs, 2);
99
+ })
100
+ })
101
+ })
@@ -0,0 +1,21 @@
1
+ const dfs = require('../../../index.js');
2
+ const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
3
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
4
+ const {assert} = require('chai');
5
+ const { getAddr } = require('../../../src/addresses.js');
6
+
7
+ describe('Action: TokenBalanceAction', () => {
8
+ let action;
9
+ const holder = '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f';
10
+
11
+ context('Checks token balance', () => {
12
+ it('constructor', () => {
13
+ action = new dfs.actions.basic.TokenBalanceAction(
14
+ getAddr('BalancerToken'),
15
+ holder,
16
+ )
17
+ })
18
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
19
+ it('encodeForRecipe', () => encodeForRecipe(action));
20
+ })
21
+ })
@@ -0,0 +1,20 @@
1
+ const dfs = require('../../../index.js');
2
+ const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
3
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
4
+ const {assert} = require('chai');
5
+ const { getAddr } = require('../../../src/addresses.js');
6
+
7
+ describe('Action: CompoundCollateralSwitchAction', () => {
8
+ let action;
9
+
10
+ context('Enable one token, disable other token with CompoundCollSwitch Action', () => {
11
+ it('constructor', () => {
12
+ action = new dfs.actions.compound.CompoundCollateralSwitchAction(
13
+ [getAddr('RaiWethUniV2LPToken'), getAddr('BalancerToken')],
14
+ [true, false],
15
+ )
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ })
20
+ })
@@ -0,0 +1,21 @@
1
+ const dfs = require('../../../index.js');
2
+ const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
3
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
4
+ const {assert} = require('chai');
5
+ const { getAddr } = require('../../../src/addresses.js');
6
+
7
+ describe('Action: CompoundGetDebtAction', () => {
8
+ let action;
9
+ const debtor = '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f';
10
+
11
+ context('Checks token balance', () => {
12
+ it('constructor', () => {
13
+ action = new dfs.actions.compound.CompoundGetDebtAction(
14
+ getAddr('BalancerToken'),
15
+ debtor,
16
+ )
17
+ })
18
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
19
+ it('encodeForRecipe', () => encodeForRecipe(action));
20
+ })
21
+ })
@@ -22,7 +22,7 @@ describe('Action: ClaimInstMakerAction', () => {
22
22
  '0xbc145c0be2d3bf27857248519709740701a787a9c3f685534ac0cac578bfe90c',
23
23
  ];
24
24
 
25
- context('Stake 1 ETH', () => {
25
+ context('Claim INST tokens for Maker vault', () => {
26
26
  it('constructor', () => {
27
27
  action = new dfs.actions.insta.ClaimInstMakerAction(
28
28
  '3570',
@@ -0,0 +1,31 @@
1
+ const dfs = require('../../../index.js');
2
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
3
+ const {assert} = require('chai');
4
+ const { getAddr } = require('../../../src/addresses.js');
5
+
6
+ describe('Action: ClaimInstMakerAction', () => {
7
+ let action;
8
+
9
+ const dsaAddress = '0x63bf1D484d7D799722b1BA9c91f5ffa6d416D60A';
10
+ const to = '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f';
11
+
12
+
13
+ context('Claim INST tokens for Maker vault', () => {
14
+ it('constructor', () => {
15
+ action = new dfs.actions.insta.InstPullTokensAction(
16
+ dsaAddress,
17
+ [getAddr('RaiWethUniV2LPToken'), getAddr('BalancerToken')],
18
+ ['10000', '32000'],
19
+ to
20
+ );
21
+ })
22
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
23
+ it('encodeForRecipe', () => encodeForRecipe(action));
24
+ it('getAssetsToApprove', async () => {
25
+ const assetOwnerPairs = await action.getAssetsToApprove();
26
+ assert.lengthOf(assetOwnerPairs, 1);
27
+ })
28
+ })
29
+
30
+
31
+ })
@@ -0,0 +1,28 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityBorrowAction', () => {
8
+ let action;
9
+
10
+ context('Mint lusd from Trove', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityBorrowAction(
14
+ '1234', '1234', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 0);
22
+ })
23
+ it('getEthValue', async () => {
24
+ const ethValue = await action.getEthValue();
25
+ assert.equal(ethValue, '0');
26
+ })
27
+ })
28
+ })
@@ -0,0 +1,28 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityClaimAction', () => {
8
+ let action;
9
+
10
+ context('Claim surplus collateral', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityClaimAction(
14
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 0);
22
+ })
23
+ it('getEthValue', async () => {
24
+ const ethValue = await action.getEthValue();
25
+ assert.equal(ethValue, '0');
26
+ })
27
+ })
28
+ })
@@ -0,0 +1,28 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityClaimSPRewardsAction', () => {
8
+ let action;
9
+
10
+ context('Claim Stability Pool rewards', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityClaimSPRewardsAction(
14
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 0);
22
+ })
23
+ it('getEthValue', async () => {
24
+ const ethValue = await action.getEthValue();
25
+ assert.equal(ethValue, '0');
26
+ })
27
+ })
28
+ })
@@ -0,0 +1,28 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityClaimStakingRewardsAction', () => {
8
+ let action;
9
+
10
+ context('Claim lqty staking rewards', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityClaimStakingRewardsAction(
14
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 0);
22
+ })
23
+ it('getEthValue', async () => {
24
+ const ethValue = await action.getEthValue();
25
+ assert.equal(ethValue, '0');
26
+ })
27
+ })
28
+ })
@@ -0,0 +1,30 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityCloseAction', () => {
8
+ let action;
9
+
10
+ context('Close Trove', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityCloseAction(
14
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 1);
22
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('LUSD').address);
23
+ assert.equal(assetOwnerPairs[0].owner, '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f');
24
+ })
25
+ it('getEthValue', async () => {
26
+ const ethValue = await action.getEthValue();
27
+ assert.equal(ethValue, '0');
28
+ })
29
+ })
30
+ })
@@ -0,0 +1,28 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityEthGainToTroveAction', () => {
8
+ let action;
9
+
10
+ context('Withdraw earned ETH gains to the users Trove', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityEthGainToTroveAction(
14
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 0);
22
+ })
23
+ it('getEthValue', async () => {
24
+ const ethValue = await action.getEthValue();
25
+ assert.equal(ethValue, '0');
26
+ })
27
+ })
28
+ })
@@ -0,0 +1,30 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityOpenAction', () => {
8
+ let action;
9
+
10
+ context('Open Trove', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityOpenAction(
14
+ '1234', '1234', '1234', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 1);
22
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WETH').address);
23
+ assert.equal(assetOwnerPairs[0].owner, '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f');
24
+ })
25
+ it('getEthValue', async () => {
26
+ const ethValue = await action.getEthValue();
27
+ assert.equal(ethValue, '0');
28
+ })
29
+ })
30
+ })
@@ -0,0 +1,30 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityPaybackAction', () => {
8
+ let action;
9
+
10
+ context('Repay debt to Trove', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityPaybackAction(
14
+ '1234', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 1);
22
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('LUSD').address);
23
+ assert.equal(assetOwnerPairs[0].owner, '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f');
24
+ })
25
+ it('getEthValue', async () => {
26
+ const ethValue = await action.getEthValue();
27
+ assert.equal(ethValue, '0');
28
+ })
29
+ })
30
+ })
@@ -0,0 +1,38 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityRedeemAction', () => {
8
+ let action;
9
+
10
+ context('Redeem lusd for weth', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityRedeemAction(
14
+ '1234',
15
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
16
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
17
+ '0x0000000000000000000000000000000000000000',
18
+ '0x0000000000000000000000000000000000000000',
19
+ '0x0000000000000000000000000000000000000000',
20
+ '0x0000000000000000000000000000000000000000',
21
+ '1234',
22
+ '1234',
23
+ );
24
+ })
25
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
26
+ it('encodeForRecipe', () => encodeForRecipe(action));
27
+ it('getAssetsToApprove', async () => {
28
+ const assetOwnerPairs = await action.getAssetsToApprove();
29
+ assert.lengthOf(assetOwnerPairs, 1);
30
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('LUSD').address);
31
+ assert.equal(assetOwnerPairs[0].owner, '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f');
32
+ })
33
+ it('getEthValue', async () => {
34
+ const ethValue = await action.getEthValue();
35
+ assert.equal(ethValue, '0');
36
+ })
37
+ })
38
+ })
@@ -0,0 +1,31 @@
1
+
2
+ const dfs = require('../../../index.js');
3
+ const { getAssetInfo } = require("@defisaver/tokens");
4
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
5
+ const { assert } = require('chai');
6
+
7
+
8
+ describe('Action: LiquitySPDepositAction', () => {
9
+ let action;
10
+
11
+ context('Deposit lusd to Stability Pool', () => {
12
+
13
+ it('constructor', () => {
14
+ action = new dfs.actions.liquity.LiquitySPDepositAction(
15
+ '1234', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
16
+ );
17
+ })
18
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
19
+ it('encodeForRecipe', () => encodeForRecipe(action));
20
+ it('getAssetsToApprove', async () => {
21
+ const assetOwnerPairs = await action.getAssetsToApprove();
22
+ assert.lengthOf(assetOwnerPairs, 1);
23
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('LUSD').address);
24
+ assert.equal(assetOwnerPairs[0].owner, '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f');
25
+ })
26
+ it('getEthValue', async () => {
27
+ const ethValue = await action.getEthValue();
28
+ assert.equal(ethValue, '0');
29
+ })
30
+ })
31
+ })
@@ -0,0 +1,29 @@
1
+
2
+ const dfs = require('../../../index.js');
3
+ const { getAssetInfo } = require("@defisaver/tokens");
4
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
5
+ const { assert } = require('chai');
6
+
7
+
8
+ describe('Action: LiquitySPWithdrawAction', () => {
9
+ let action;
10
+
11
+ context('Withdraw lusd from Stability Pool', () => {
12
+
13
+ it('constructor', () => {
14
+ action = new dfs.actions.liquity.LiquitySPWithdrawAction(
15
+ '1234', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
16
+ );
17
+ })
18
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
19
+ it('encodeForRecipe', () => encodeForRecipe(action));
20
+ it('getAssetsToApprove', async () => {
21
+ const assetOwnerPairs = await action.getAssetsToApprove();
22
+ assert.lengthOf(assetOwnerPairs, 0);
23
+ })
24
+ it('getEthValue', async () => {
25
+ const ethValue = await action.getEthValue();
26
+ assert.equal(ethValue, '0');
27
+ })
28
+ })
29
+ })
@@ -0,0 +1,30 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityStakeAction', () => {
8
+ let action;
9
+
10
+ context('Stake lqty', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityStakeAction(
14
+ '1234', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 1);
22
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('LQTY').address);
23
+ assert.equal(assetOwnerPairs[0].owner, '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f');
24
+ })
25
+ it('getEthValue', async () => {
26
+ const ethValue = await action.getEthValue();
27
+ assert.equal(ethValue, '0');
28
+ })
29
+ })
30
+ })
@@ -0,0 +1,30 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquitySupplyAction', () => {
8
+ let action;
9
+
10
+ context('Supply collateral to Trove', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquitySupplyAction(
14
+ '1234', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 1);
22
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WETH').address);
23
+ assert.equal(assetOwnerPairs[0].owner, '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f');
24
+ })
25
+ it('getEthValue', async () => {
26
+ const ethValue = await action.getEthValue();
27
+ assert.equal(ethValue, '0');
28
+ })
29
+ })
30
+ })
@@ -0,0 +1,28 @@
1
+ const dfs = require('../../../index.js');
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+
7
+ describe('Action: LiquityUnstakeAction', () => {
8
+ let action;
9
+
10
+ context('Unstake lqty', () => {
11
+
12
+ it('constructor', () => {
13
+ action = new dfs.actions.liquity.LiquityUnstakeAction(
14
+ '1234', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
15
+ );
16
+ })
17
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
18
+ it('encodeForRecipe', () => encodeForRecipe(action));
19
+ it('getAssetsToApprove', async () => {
20
+ const assetOwnerPairs = await action.getAssetsToApprove();
21
+ assert.lengthOf(assetOwnerPairs, 0);
22
+ })
23
+ it('getEthValue', async () => {
24
+ const ethValue = await action.getEthValue();
25
+ assert.equal(ethValue, '0');
26
+ })
27
+ })
28
+ })