@defisaver/sdk 1.2.7-dev-liquity-v2 → 1.2.7-dev-2-liquity-v2

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 (70) hide show
  1. package/esm/src/actions/basic/SendTokensAction.d.ts +1 -1
  2. package/esm/src/actions/basic/SendTokensAction.js +1 -1
  3. package/esm/src/actions/basic/SendTokensAndUnwrapAction.d.ts +15 -0
  4. package/esm/src/actions/basic/SendTokensAndUnwrapAction.js +31 -0
  5. package/esm/src/actions/basic/index.d.ts +1 -0
  6. package/esm/src/actions/basic/index.js +1 -0
  7. package/esm/src/actions/checkers/AaveV3OpenRatioCheckAction.d.ts +16 -0
  8. package/esm/src/actions/checkers/AaveV3OpenRatioCheckAction.js +22 -0
  9. package/esm/src/actions/checkers/LiquityV2RatioCheckAction.js +1 -1
  10. package/esm/src/actions/checkers/index.d.ts +1 -0
  11. package/esm/src/actions/checkers/index.js +1 -0
  12. package/esm/src/actions/eulerV2/EulerV2BorrowAction.d.ts +16 -0
  13. package/esm/src/actions/eulerV2/EulerV2BorrowAction.js +24 -0
  14. package/esm/src/actions/eulerV2/EulerV2CollateralSwitchAction.d.ts +15 -0
  15. package/esm/src/actions/eulerV2/EulerV2CollateralSwitchAction.js +22 -0
  16. package/esm/src/actions/eulerV2/EulerV2PaybackAction.d.ts +22 -0
  17. package/esm/src/actions/eulerV2/EulerV2PaybackAction.js +40 -0
  18. package/esm/src/actions/eulerV2/EulerV2PaybackWithSharesAction.d.ts +16 -0
  19. package/esm/src/actions/eulerV2/EulerV2PaybackWithSharesAction.js +24 -0
  20. package/esm/src/actions/eulerV2/EulerV2PullDebtAction.d.ts +16 -0
  21. package/esm/src/actions/eulerV2/EulerV2PullDebtAction.js +24 -0
  22. package/esm/src/actions/eulerV2/EulerV2ReorderCollateralsAction.d.ts +14 -0
  23. package/esm/src/actions/eulerV2/EulerV2ReorderCollateralsAction.js +20 -0
  24. package/esm/src/actions/eulerV2/EulerV2SupplyAction.d.ts +23 -0
  25. package/esm/src/actions/eulerV2/EulerV2SupplyAction.js +42 -0
  26. package/esm/src/actions/eulerV2/EulerV2WithdrawAction.d.ts +16 -0
  27. package/esm/src/actions/eulerV2/EulerV2WithdrawAction.js +24 -0
  28. package/esm/src/actions/eulerV2/index.d.ts +8 -0
  29. package/esm/src/actions/eulerV2/index.js +8 -0
  30. package/esm/src/actions/index.d.ts +2 -1
  31. package/esm/src/actions/index.js +2 -1
  32. package/esm/src/addresses.d.ts +24 -0
  33. package/esm/src/addresses.js +19 -12
  34. package/esm/src/index.d.ts +96 -0
  35. package/esm/src/triggers/LiquityRatioTrigger.js +1 -1
  36. package/esm/src/triggers/LiquityV2RatioTrigger.js +1 -1
  37. package/esm/src/triggers/ShouldClosePriceTrigger.d.ts +10 -0
  38. package/esm/src/triggers/ShouldClosePriceTrigger.js +12 -0
  39. package/esm/src/triggers/index.d.ts +1 -0
  40. package/esm/src/triggers/index.js +1 -0
  41. package/package.json +1 -1
  42. package/src/actions/basic/SendTokensAction.ts +1 -1
  43. package/src/actions/basic/SendTokensAndUnwrapAction.ts +38 -0
  44. package/src/actions/basic/index.ts +2 -1
  45. package/src/actions/checkers/AaveV3OpenRatioCheckAction.ts +30 -0
  46. package/src/actions/checkers/LiquityV2RatioCheckAction.ts +1 -1
  47. package/src/actions/checkers/index.ts +2 -1
  48. package/src/actions/eulerV2/EulerV2BorrowAction.ts +37 -0
  49. package/src/actions/eulerV2/EulerV2CollateralSwitchAction.ts +34 -0
  50. package/src/actions/eulerV2/EulerV2PaybackAction.ts +47 -0
  51. package/src/actions/eulerV2/EulerV2PaybackWithSharesAction.ts +37 -0
  52. package/src/actions/eulerV2/EulerV2PullDebtAction.ts +37 -0
  53. package/src/actions/eulerV2/EulerV2ReorderCollateralsAction.ts +31 -0
  54. package/src/actions/eulerV2/EulerV2SupplyAction.ts +49 -0
  55. package/src/actions/eulerV2/EulerV2WithdrawAction.ts +37 -0
  56. package/src/actions/eulerV2/index.ts +8 -0
  57. package/src/actions/index.ts +2 -0
  58. package/src/addresses.ts +20 -12
  59. package/src/triggers/LiquityRatioTrigger.ts +1 -1
  60. package/src/triggers/LiquityV2RatioTrigger.ts +1 -1
  61. package/src/triggers/ShouldClosePriceTrigger.ts +19 -0
  62. package/src/triggers/index.ts +1 -0
  63. package/test/actions/basic/SendTokensAndUnwrapAction.js +73 -0
  64. package/test/actions/checkers/AaveV3OpenRatioCheckAction.js +22 -0
  65. package/test/actions/eulerV2/EulerV2BorrowAction.js +31 -0
  66. package/test/actions/eulerV2/EulerV2CollateralSwitchAction.js +28 -0
  67. package/test/actions/eulerV2/EulerV2PaybackAction.js +39 -0
  68. package/test/actions/eulerV2/EulerV2SupplyAction.js +42 -0
  69. package/test/actions/eulerV2/EulerV2WithdrawAction.js +31 -0
  70. package/umd/index.js +980 -566
@@ -0,0 +1,49 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256 } from '../../types';
4
+
5
+ /**
6
+ * EulerV2SupplyAction - Supply assets to a Euler vault and gets eTokens vault shares
7
+ *
8
+ * @category EulerV2
9
+ */
10
+ export class EulerV2SupplyAction extends Action {
11
+ tokenForApproval: EthAddress;
12
+
13
+ /**
14
+ * @param vault The address of the supply vault
15
+ * @param tokenAddress Underlying token address
16
+ * @param account The address of the Euler account, defaults to user's wallet
17
+ * @param from The address from which to pull tokens to be supplied
18
+ * @param amount The amount of assets to supply
19
+ * @param enableAsColl Whether to enable supply vault as collateral
20
+ */
21
+ constructor(
22
+ vault:EthAddress,
23
+ tokenAddress:EthAddress,
24
+ account:EthAddress,
25
+ from:EthAddress,
26
+ amount:uint256,
27
+ enableAsColl:boolean,
28
+ ) {
29
+ super(
30
+ 'EulerV2Supply',
31
+ getAddr('EulerV2Supply'),
32
+ ['address', 'address', 'address', 'uint256', 'bool'],
33
+ [vault, account, from, amount, enableAsColl],
34
+ );
35
+
36
+ this.mappableArgs = [
37
+ this.args[0],
38
+ this.args[1],
39
+ this.args[2],
40
+ this.args[3],
41
+ this.args[4],
42
+ ];
43
+ this.tokenForApproval = tokenAddress;
44
+ }
45
+
46
+ async getAssetsToApprove() {
47
+ return [{ asset: this.tokenForApproval, owner: this.args[2] }];
48
+ }
49
+ }
@@ -0,0 +1,37 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256 } from '../../types';
4
+
5
+ /**
6
+ * EulerV2WithdrawAction - Withdraws assets from Euler vault
7
+ *
8
+ * @category EulerV2
9
+ */
10
+ export class EulerV2WithdrawAction extends Action {
11
+ /**
12
+ * @param vault The address of the Euler vault
13
+ * @param account The address of the Euler account, defaults to user's wallet
14
+ * @param receiver The address to receive the withdrawn assets
15
+ * @param amount The amount of assets to withdraw (uint256.max for max withdrawal)
16
+ */
17
+ constructor(
18
+ vault:EthAddress,
19
+ account:EthAddress,
20
+ receiver:EthAddress,
21
+ amount:uint256,
22
+ ) {
23
+ super(
24
+ 'EulerV2Withdraw',
25
+ getAddr('EulerV2Withdraw'),
26
+ ['address', 'address', 'address', 'uint256'],
27
+ [vault, account, receiver, amount],
28
+ );
29
+
30
+ this.mappableArgs = [
31
+ this.args[0],
32
+ this.args[1],
33
+ this.args[2],
34
+ this.args[3],
35
+ ];
36
+ }
37
+ }
@@ -0,0 +1,8 @@
1
+ export * from './EulerV2SupplyAction';
2
+ export * from './EulerV2WithdrawAction';
3
+ export * from './EulerV2BorrowAction';
4
+ export * from './EulerV2PaybackAction';
5
+ export * from './EulerV2PaybackWithSharesAction';
6
+ export * from './EulerV2PullDebtAction';
7
+ export * from './EulerV2ReorderCollateralsAction';
8
+ export * from './EulerV2CollateralSwitchAction';
@@ -29,6 +29,7 @@ import * as spark from './spark';
29
29
  import * as morphoblue from './morpho-blue';
30
30
  import * as llamalend from './llamalend';
31
31
  import * as merkl from './merkl';
32
+ import * as eulerV2 from './eulerV2';
32
33
  import * as sky from './sky';
33
34
  import * as liquityV2 from './liquityV2';
34
35
 
@@ -64,6 +65,7 @@ export {
64
65
  morphoblue,
65
66
  llamalend,
66
67
  merkl,
68
+ eulerV2,
67
69
  sky,
68
70
  liquityV2,
69
71
  };
package/src/addresses.ts CHANGED
@@ -174,18 +174,18 @@ export const actionAddresses = {
174
174
  LiquityAdjust: '0x0A398f6B97677192A5d5e7Ea8A937383FFf9304c',
175
175
 
176
176
  // liquity v2
177
- LiquityV2Open: '0x270A0C7eBd1C0a98FdA613782b51419300AB6322',
178
- LiquityV2Close: '0xC6C627c63389D8bB7913b55CD62fa451703AD1E1',
179
- LiquityV2Supply: '0x6e31Dd331571209043c8CF997f86b4291F648537',
180
- LiquityV2Withdraw: '0x561013c605A17f5dC5b738C8a3fF9c5F33DbC3d8',
181
- LiquityV2Borrow: '0x26C39FE05466dBA72A98d095d019dC5e067F6b28',
182
- LiquityV2Payback: '0x3B1D0bD618fF8F8c51B11CD676c3384CB2A36C64',
183
- LiquityV2Claim: '0xb3d3dFf3d68539F6a1bb51e56B7dC8d515aE8978',
184
- LiquityV2Adjust: '0x57d6228b5EfC44174701704629A0F3EEa2c25E7f',
185
- LiquityV2AdjustInterestRate: '0x3EFf4EEC06bd75941025fb751407A5de5F456bC6',
186
- LiquityV2SPDeposit: '0x1e533364fE613AaD64B8D46F7A096Ae0c722239D',
187
- LiquityV2SPWithdraw: '0xb080DC160415Ffe1a4b80d75b0Be92EE38a0b426',
188
- LiquityV2SPClaimColl: '0xD50B0295C69e3F77BE7d99e7BdeAc442F37b373b',
177
+ LiquityV2Open: '0x57d6228b5EfC44174701704629A0F3EEa2c25E7f',
178
+ LiquityV2Close: '0x7200F99661a2a379D42dD98218359Df57552EFd9',
179
+ LiquityV2Supply: '0xb080DC160415Ffe1a4b80d75b0Be92EE38a0b426',
180
+ LiquityV2Withdraw: '0xB3b8D20711FF92686ce9F77a2A3bed74d780e78a',
181
+ LiquityV2Borrow: '0xBAc6dc3edB72Bc705Ab4e31F2a2151Fe06550D9B',
182
+ LiquityV2Payback: '0x612C0A45eC4916E7eaCEB475DfBFBd0b3053a63B',
183
+ LiquityV2Claim: '0xea4b417C89917d76727b1a60EE29F7EBA687760A',
184
+ LiquityV2Adjust: '0xFa1a1324b36F25b6b1200B5e62701652ecbdB5d6',
185
+ LiquityV2AdjustInterestRate: '0xBFB1DD9f9609CDeD2E2FdA78611512783A113079',
186
+ LiquityV2SPDeposit: '0xbbbf5e2246DcA33464482d784c97FB908988fcD6',
187
+ LiquityV2SPWithdraw: '0x7DC97868B4b2Fd31c1002E9bfFe9a4aF2b534c06',
188
+ LiquityV2SPClaimColl: '0x0a58710A67837E6d026B83c434519c5f0A0cD7a1',
189
189
 
190
190
  // b.protocol
191
191
  BprotocolLiquitySPDeposit: '0x5A0436c7559e37da8cD24B0f66C155a0a2fd6309',
@@ -297,6 +297,14 @@ export const actionAddresses = {
297
297
  LlamaLendLevCreate: '0x534b704a62385cfe5EEB8d9605419743d4fe105E',
298
298
  LlamaLendSelfLiquidateWithColl: '0xA99DD1D91141cA63C423DB763dE75078336803B2',
299
299
 
300
+ // eulerV2
301
+ EulerV2Supply: '0xa067787D086841437D112e0C847dDB3e5D95173f',
302
+ EulerV2Withdraw: '0x5bf1a54fe1e65B134E7920e53A5eB0D14b9e6aD1',
303
+ EulerV2Borrow: '0x38d66ecD38b7800D8FD0Bc29489c2306170a9Ede',
304
+ EulerV2Payback: '0x738b1df6b6962D8795Bda5bc5EFCd8b0B8c74d01',
305
+ EulerV2CollateralSwitch: '0x38950b50Fb38aC19D06e8CE5AAE632D6dF1EEb1a',
306
+ EulerV2View: '0x8932E46Ecf96b5Fe033F5e27Ab6dC755Cb668967',
307
+
300
308
  MerklClaim: '0xE88036F3F0D7e216D63726356cA2bC334e305fe5',
301
309
  },
302
310
  [NETWORKS.optimism.chainId]: {
@@ -12,7 +12,7 @@ export class LiquityRatioTrigger extends Action {
12
12
  super(
13
13
  'LiquityRatioTrigger',
14
14
  getAddr('Empty'),
15
- ['addresss', 'uint256', 'uint8'],
15
+ ['address', 'uint256', 'uint8'],
16
16
  [troveOwner, ratio, state],
17
17
  );
18
18
  }
@@ -9,7 +9,7 @@ export class LiquityV2RatioTrigger extends Action {
9
9
  constructor(market: EthAddress, troveId: uint256, ratio:uint256, state:uint8) {
10
10
  super(
11
11
  'LiquityV2RatioTrigger',
12
- getAddr('LiquityV2RatioTrigger'),
12
+ getAddr('Empty'),
13
13
  ['address', 'uint256', 'uint256', 'uint8'],
14
14
  [market, troveId, ratio, state],
15
15
  );
@@ -0,0 +1,19 @@
1
+ import { Action } from '../Action';
2
+ import { getAddr } from '../addresses';
3
+ import { EthAddress, uint256 } from '../types';
4
+
5
+ /**
6
+ *
7
+ *
8
+ * @category Triggers
9
+ */
10
+ export class ShouldClosePriceTrigger extends Action {
11
+ constructor(token:EthAddress, lowerPrice:uint256, upperPrice:uint256) {
12
+ super(
13
+ 'ShouldClosePriceTrigger',
14
+ getAddr('Empty'),
15
+ ['address', 'uint256', 'uint256'],
16
+ [token, lowerPrice, upperPrice],
17
+ );
18
+ }
19
+ }
@@ -21,3 +21,4 @@ export * from './CurveUsdHealthRatioTrigger';
21
21
  export * from './MorphoBlueRatioTrigger';
22
22
  export * from './OffchainPriceTrigger';
23
23
  export * from './LiquityV2RatioTrigger';
24
+ export * from './ShouldClosePriceTrigger';
@@ -0,0 +1,73 @@
1
+ const dfs = require('../../../src');
2
+ const {assetAmountInWei} = require("@defisaver/tokens");
3
+ const {getAssetInfo} = require("@defisaver/tokens");
4
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
5
+ const {assert} = require('chai');
6
+
7
+ describe('Action: SendTokensAndUnwrap', () => {
8
+ let action;
9
+ context('Transfer DAI/USDC', () => {
10
+ const tokens = [getAssetInfo('DAI').address, getAssetInfo('USDC').address];
11
+ const amounts = [assetAmountInWei(1, 'DAI'), assetAmountInWei(1, 'USDC')];
12
+ const receivers = ['0x0a80C3C540eEF99811f4579fa7b1A0617294e06f', '0xf0e1a5f7445211E47faa6D267Fc5A214884557aa'];
13
+ it('constructor', () => {
14
+ action = new dfs.actions.basic.SendTokensAndUnwrapAction(
15
+ tokens,
16
+ receivers,
17
+ amounts
18
+ );
19
+ assert.equal(action.mappableArgs[0], getAssetInfo('DAI').address);
20
+ assert.equal(action.mappableArgs[1], getAssetInfo('USDC').address);
21
+ assert.equal(action.mappableArgs[2], receivers[0]);
22
+ assert.equal(action.mappableArgs[3], receivers[1]);
23
+ assert.equal(action.mappableArgs[4], assetAmountInWei(1, 'DAI'));
24
+ assert.equal(action.mappableArgs[5], assetAmountInWei(1, 'USDC'));
25
+ })
26
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
27
+ it('encodeForRecipe', () => encodeForRecipe(action));
28
+ it('getEthValue', async () => {
29
+ const ethValue = await action.getEthValue();
30
+ assert.equal(ethValue, '0');
31
+ })
32
+ })
33
+
34
+ context('Transfer DAI/WETH', () => {
35
+ const tokens = [
36
+ getAssetInfo('DAI').address,
37
+ getAssetInfo('WETH').address,
38
+ getAssetInfo('WETH').address
39
+ ];
40
+ const amounts = [
41
+ assetAmountInWei(1, 'DAI'),
42
+ assetAmountInWei(1, 'WETH'),
43
+ assetAmountInWei(100, 'WETH'),
44
+ ];
45
+ const receivers = [
46
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f',
47
+ '0xf0e1a5f7445211E47faa6D267Fc5A214884557aa',
48
+ '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f'
49
+ ];
50
+ it('constructor', () => {
51
+ action = new dfs.actions.basic.SendTokensAndUnwrapAction(
52
+ tokens,
53
+ receivers,
54
+ amounts
55
+ );
56
+ action.mappableArgs[0] = getAssetInfo('DAI').address;
57
+ action.mappableArgs[1] = getAssetInfo('WETH').address;
58
+ action.mappableArgs[2] = getAssetInfo('WETH').address;
59
+ action.mappableArgs[3] = receivers[0];
60
+ action.mappableArgs[4] = receivers[1];
61
+ action.mappableArgs[5] = receivers[2];
62
+ action.mappableArgs[6] = assetAmountInWei(1, 'DAI');
63
+ action.mappableArgs[7] = assetAmountInWei(1, 'WETH');
64
+ action.mappableArgs[8] = assetAmountInWei(100, 'WETH');
65
+ })
66
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
67
+ it('encodeForRecipe', () => encodeForRecipe(action));
68
+ it('getEthValue', async () => {
69
+ const ethValue = await action.getEthValue();
70
+ assert.equal(ethValue, '0');
71
+ })
72
+ })
73
+ })
@@ -0,0 +1,22 @@
1
+
2
+ const dfs = require('../../../src');
3
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
4
+ const {assert} = require('chai');
5
+
6
+ describe('Action: AaveV3OpenRatioCheckAction', () => {
7
+ let action;
8
+ context('AaveV3OpenRatioCheckAction', () => {
9
+ it('constructor', () => {
10
+ const targetRatio = '150'
11
+ const market = '0x24a42fD28C976A61Df5D00D0599C34c4f90748c8';
12
+ action = new dfs.actions.checkers.AaveV3OpenRatioCheckAction(
13
+ targetRatio,
14
+ market
15
+ );
16
+ assert.equal(action.args[0], targetRatio);
17
+ assert.equal(action.args[1], market);
18
+ })
19
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
20
+ it('encodeForRecipe', () => encodeForRecipe(action));
21
+ })
22
+ })
@@ -0,0 +1,31 @@
1
+ const dfs = require('../../../src');
2
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
3
+ const {assert} = require('chai');
4
+
5
+ describe('Action: EulerV2BorrowAction', () => {
6
+ let action;
7
+ context('Borrow 100 USDC', () => {
8
+ it('constructor', () => {
9
+ const usdcVault = '0x797DD80692c3b2dAdabCe8e30C07fDE5307D48a9';
10
+ const account = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
11
+ const receiver = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
12
+ const amount = 100;
13
+ action = new dfs.actions.eulerV2.EulerV2BorrowAction(
14
+ usdcVault,
15
+ account,
16
+ receiver,
17
+ amount
18
+ );
19
+ assert.equal(action.args[0], usdcVault);
20
+ assert.equal(action.args[1], account);
21
+ assert.equal(action.args[2], receiver);
22
+ assert.equal(action.args[3], amount);
23
+ })
24
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
25
+ it('encodeForRecipe', () => encodeForRecipe(action));
26
+ it('getEthValue', async () => {
27
+ const ethValue = await action.getEthValue();
28
+ assert.equal(ethValue, '0');
29
+ })
30
+ })
31
+ })
@@ -0,0 +1,28 @@
1
+ const dfs = require('../../../src');
2
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
3
+ const {assert} = require('chai');
4
+
5
+ describe('Action: EulerV2CollateralSwitchAction', () => {
6
+ let action;
7
+ context('Enable collateral', () => {
8
+ it('constructor', () => {
9
+ const usdcVault = '0x797DD80692c3b2dAdabCe8e30C07fDE5307D48a9';
10
+ const account = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
11
+ const enableAsCollateral = true;
12
+ action = new dfs.actions.eulerV2.EulerV2CollateralSwitchAction(
13
+ usdcVault,
14
+ account,
15
+ enableAsCollateral
16
+ );
17
+ assert.equal(action.args[0], usdcVault);
18
+ assert.equal(action.args[1], account);
19
+ assert.equal(action.args[2], enableAsCollateral);
20
+ })
21
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
22
+ it('encodeForRecipe', () => encodeForRecipe(action));
23
+ it('getEthValue', async () => {
24
+ const ethValue = await action.getEthValue();
25
+ assert.equal(ethValue, '0');
26
+ })
27
+ })
28
+ })
@@ -0,0 +1,39 @@
1
+ const dfs = require('../../../src');
2
+ const {getAssetInfo} = require("@defisaver/tokens");
3
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
4
+ const {assert} = require('chai');
5
+
6
+ describe('Action: EulerV2PaybackAction', () => {
7
+ let action;
8
+ const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
9
+ context('Payback 100 USDC', () => {
10
+ it('constructor', () => {
11
+ const usdcVault = '0x797DD80692c3b2dAdabCe8e30C07fDE5307D48a9';
12
+ const account = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
13
+ const amount = 100;
14
+ action = new dfs.actions.eulerV2.EulerV2PaybackAction(
15
+ usdcVault,
16
+ getAssetInfo('USDC').address,
17
+ account,
18
+ from,
19
+ amount,
20
+ );
21
+ assert.equal(action.args[0], usdcVault);
22
+ assert.equal(action.args[1], account);
23
+ assert.equal(action.args[2], from);
24
+ assert.equal(action.args[3], amount);
25
+ })
26
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
27
+ it('encodeForRecipe', () => encodeForRecipe(action));
28
+ it('getEthValue', async () => {
29
+ const ethValue = await action.getEthValue();
30
+ assert.equal(ethValue, '0');
31
+ })
32
+ it('getAssetsToApprove', async () => {
33
+ const assetOwnerPairs = await action.getAssetsToApprove();
34
+ assert.lengthOf(assetOwnerPairs, 1);
35
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('USDC').address);
36
+ assert.equal(assetOwnerPairs[0].owner, from);
37
+ })
38
+ })
39
+ })
@@ -0,0 +1,42 @@
1
+ const dfs = require('../../../src');
2
+ const {getAssetInfo} = require("@defisaver/tokens");
3
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
4
+ const {assert} = require('chai');
5
+
6
+ describe('Action: EulerV2SupplyAction', () => {
7
+ let action;
8
+ const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
9
+ context('Supply 100 USDC', () => {
10
+ it('constructor', () => {
11
+ const usdcVault = '0x797DD80692c3b2dAdabCe8e30C07fDE5307D48a9';
12
+ const account = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
13
+ const amount = 100;
14
+ const enableAsCollateral = true;
15
+ action = new dfs.actions.eulerV2.EulerV2SupplyAction(
16
+ usdcVault,
17
+ getAssetInfo('USDC').address,
18
+ account,
19
+ from,
20
+ amount,
21
+ enableAsCollateral
22
+ );
23
+ assert.equal(action.args[0], usdcVault);
24
+ assert.equal(action.args[1], account);
25
+ assert.equal(action.args[2], from);
26
+ assert.equal(action.args[3], amount);
27
+ assert.equal(action.args[4], enableAsCollateral);
28
+ })
29
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
30
+ it('encodeForRecipe', () => encodeForRecipe(action));
31
+ it('getEthValue', async () => {
32
+ const ethValue = await action.getEthValue();
33
+ assert.equal(ethValue, '0');
34
+ })
35
+ it('getAssetsToApprove', async () => {
36
+ const assetOwnerPairs = await action.getAssetsToApprove();
37
+ assert.lengthOf(assetOwnerPairs, 1);
38
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('USDC').address);
39
+ assert.equal(assetOwnerPairs[0].owner, from);
40
+ })
41
+ })
42
+ })
@@ -0,0 +1,31 @@
1
+ const dfs = require('../../../src');
2
+ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
3
+ const {assert} = require('chai');
4
+
5
+ describe('Action: EulerV2WithdrawAction', () => {
6
+ let action;
7
+ context('Withdraw 100 USDC', () => {
8
+ it('constructor', () => {
9
+ const usdcVault = '0x797DD80692c3b2dAdabCe8e30C07fDE5307D48a9';
10
+ const account = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
11
+ const receiver = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
12
+ const amount = 100;
13
+ action = new dfs.actions.eulerV2.EulerV2WithdrawAction(
14
+ usdcVault,
15
+ account,
16
+ receiver,
17
+ amount
18
+ );
19
+ assert.equal(action.args[0], usdcVault);
20
+ assert.equal(action.args[1], account);
21
+ assert.equal(action.args[2], receiver);
22
+ assert.equal(action.args[3], amount);
23
+ })
24
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
25
+ it('encodeForRecipe', () => encodeForRecipe(action));
26
+ it('getEthValue', async () => {
27
+ const ethValue = await action.getEthValue();
28
+ assert.equal(ethValue, '0');
29
+ })
30
+ })
31
+ })