@defisaver/sdk 1.2.7 → 1.2.9
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.
- package/.mocharc.json +4 -0
- package/.nvmrc +1 -0
- package/README.md +6 -0
- package/esm/src/actions/checkers/AaveV3OpenRatioCheckAction.d.ts +16 -0
- package/esm/src/actions/checkers/AaveV3OpenRatioCheckAction.js +22 -0
- package/esm/src/actions/checkers/index.d.ts +1 -0
- package/esm/src/actions/checkers/index.js +1 -0
- package/esm/src/actions/eulerV2/EulerV2BorrowAction.d.ts +16 -0
- package/esm/src/actions/eulerV2/EulerV2BorrowAction.js +24 -0
- package/esm/src/actions/eulerV2/EulerV2CollateralSwitchAction.d.ts +15 -0
- package/esm/src/actions/eulerV2/EulerV2CollateralSwitchAction.js +22 -0
- package/esm/src/actions/eulerV2/EulerV2PaybackAction.d.ts +22 -0
- package/esm/src/actions/eulerV2/EulerV2PaybackAction.js +40 -0
- package/esm/src/actions/eulerV2/EulerV2PaybackWithSharesAction.d.ts +16 -0
- package/esm/src/actions/eulerV2/EulerV2PaybackWithSharesAction.js +24 -0
- package/esm/src/actions/eulerV2/EulerV2PullDebtAction.d.ts +16 -0
- package/esm/src/actions/eulerV2/EulerV2PullDebtAction.js +24 -0
- package/esm/src/actions/eulerV2/EulerV2ReorderCollateralsAction.d.ts +14 -0
- package/esm/src/actions/eulerV2/EulerV2ReorderCollateralsAction.js +20 -0
- package/esm/src/actions/eulerV2/EulerV2SupplyAction.d.ts +23 -0
- package/esm/src/actions/eulerV2/EulerV2SupplyAction.js +42 -0
- package/esm/src/actions/eulerV2/EulerV2WithdrawAction.d.ts +16 -0
- package/esm/src/actions/eulerV2/EulerV2WithdrawAction.js +24 -0
- package/esm/src/actions/eulerV2/index.d.ts +8 -0
- package/esm/src/actions/eulerV2/index.js +8 -0
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/addresses.d.ts +24 -0
- package/esm/src/addresses.js +11 -7
- package/esm/src/index.d.ts +96 -0
- package/esm/src/triggers/AaveV2RatioTrigger.js +1 -1
- package/esm/src/triggers/AaveV3QuotePriceTrigger.js +1 -1
- package/esm/src/triggers/AaveV3RatioTrigger.js +1 -1
- package/esm/src/triggers/CBRebondTrigger.js +1 -1
- package/esm/src/triggers/ChainLinkPriceTrigger.js +1 -1
- package/esm/src/triggers/CompV3RatioTrigger.js +1 -1
- package/esm/src/triggers/CompoundRatioTrigger.js +1 -1
- package/esm/src/triggers/CurveUsdCollRatioTrigger.js +1 -1
- package/esm/src/triggers/CurveUsdHealthRatioTrigger.js +1 -1
- package/esm/src/triggers/GasPriceTrigger.js +1 -1
- package/esm/src/triggers/LiquityDebtInFrontWithLimitTrigger.js +1 -1
- package/esm/src/triggers/LiquityRatioTrigger.js +1 -1
- package/esm/src/triggers/MakerRatioTrigger.js +1 -1
- package/esm/src/triggers/MorphoAaveV2RatioTrigger.js +1 -1
- package/esm/src/triggers/MorphoBlueRatioTrigger.js +1 -1
- package/esm/src/triggers/OffchainPriceTrigger.js +1 -1
- package/esm/src/triggers/ReflexerRatioTrigger.js +1 -1
- package/esm/src/triggers/SparkQuotePriceTrigger.js +1 -1
- package/esm/src/triggers/SparkRatioTrigger.js +1 -1
- package/esm/src/triggers/TimestampTrigger.js +1 -1
- package/esm/src/triggers/TrailingStopTrigger.js +1 -1
- package/esm/src/triggers/UniV3CurrentTickTrigger.js +1 -1
- package/package.json +8 -5
- package/src/actions/checkers/AaveV3OpenRatioCheckAction.ts +30 -0
- package/src/actions/checkers/index.ts +2 -1
- package/src/actions/eulerV2/EulerV2BorrowAction.ts +37 -0
- package/src/actions/eulerV2/EulerV2CollateralSwitchAction.ts +34 -0
- package/src/actions/eulerV2/EulerV2PaybackAction.ts +47 -0
- package/src/actions/eulerV2/EulerV2PaybackWithSharesAction.ts +37 -0
- package/src/actions/eulerV2/EulerV2PullDebtAction.ts +37 -0
- package/src/actions/eulerV2/EulerV2ReorderCollateralsAction.ts +31 -0
- package/src/actions/eulerV2/EulerV2SupplyAction.ts +49 -0
- package/src/actions/eulerV2/EulerV2WithdrawAction.ts +37 -0
- package/src/actions/eulerV2/index.ts +8 -0
- package/src/actions/index.ts +2 -0
- package/src/addresses.ts +10 -5
- package/src/triggers/AaveV2RatioTrigger.ts +2 -2
- package/src/triggers/AaveV3QuotePriceTrigger.ts +2 -2
- package/src/triggers/AaveV3RatioTrigger.ts +2 -2
- package/src/triggers/CBRebondTrigger.ts +2 -2
- package/src/triggers/ChainLinkPriceTrigger.ts +2 -2
- package/src/triggers/CompV3RatioTrigger.ts +2 -2
- package/src/triggers/CompoundRatioTrigger.ts +2 -2
- package/src/triggers/CurveUsdCollRatioTrigger.ts +2 -2
- package/src/triggers/CurveUsdHealthRatioTrigger.ts +1 -1
- package/src/triggers/GasPriceTrigger.ts +2 -2
- package/src/triggers/LiquityDebtInFrontWithLimitTrigger.ts +2 -2
- package/src/triggers/LiquityRatioTrigger.ts +2 -2
- package/src/triggers/MakerRatioTrigger.ts +2 -2
- package/src/triggers/MorphoAaveV2RatioTrigger.ts +2 -2
- package/src/triggers/MorphoBlueRatioTrigger.ts +2 -2
- package/src/triggers/OffchainPriceTrigger.ts +2 -2
- package/src/triggers/ReflexerRatioTrigger.ts +2 -2
- package/src/triggers/SparkQuotePriceTrigger.ts +2 -2
- package/src/triggers/SparkRatioTrigger.ts +2 -2
- package/src/triggers/TimestampTrigger.ts +2 -2
- package/src/triggers/TrailingStopTrigger.ts +2 -2
- package/src/triggers/UniV3CurrentTickTrigger.ts +2 -2
- package/test/Action.js +1 -1
- package/test/ActionWithL2.js +1 -1
- package/test/DfsWeb3.js +1 -1
- package/test/Recipe.js +1 -1
- package/test/Strategy.js +1 -1
- package/test/accessLists/Recipe.js +1 -1
- package/test/accessLists/access-lists.js +1 -1
- package/test/actions/aave/AaveBorrowAction.js +1 -1
- package/test/actions/aave/AaveClaimStkAaveAction.js +1 -1
- package/test/actions/aave/AaveCollateralSwitchAction.js +1 -1
- package/test/actions/aave/AavePaybackAction.js +1 -1
- package/test/actions/aave/AaveSupplyAction.js +1 -1
- package/test/actions/aave/AaveWithdrawAction.js +1 -1
- package/test/actions/balancer/BalancerV2ClaimAction.js +1 -1
- package/test/actions/balancer/BalancerV2SupplyAction.js +1 -1
- package/test/actions/balancer/BalancerV2WithdrawAction.js +1 -1
- package/test/actions/basic/ChangeProxyOwnerAction.js +1 -1
- package/test/actions/basic/CreateSubAction.js +1 -2
- package/test/actions/basic/SellAction.js +1 -1
- package/test/actions/basic/SendTokenAction.js +1 -1
- package/test/actions/basic/TokenBalanceAction.js +1 -1
- package/test/actions/checkers/AaveV3OpenRatioCheckAction.js +22 -0
- package/test/actions/compound/CompoundBorrowAction.js +1 -1
- package/test/actions/compound/CompoundCollateralSwitchAction.js +1 -1
- package/test/actions/compound/CompoundGetDebtAction.js +1 -1
- package/test/actions/compound/CompoundPaybackAction.js +1 -1
- package/test/actions/compound/CompoundSupplyAction.js +1 -1
- package/test/actions/compound/CompoundWithdrawAction.js +1 -1
- package/test/actions/dydx/DyDxWithdrawAction.js +1 -1
- package/test/actions/eulerV2/EulerV2BorrowAction.js +31 -0
- package/test/actions/eulerV2/EulerV2CollateralSwitchAction.js +28 -0
- package/test/actions/eulerV2/EulerV2PaybackAction.js +39 -0
- package/test/actions/eulerV2/EulerV2SupplyAction.js +42 -0
- package/test/actions/eulerV2/EulerV2WithdrawAction.js +31 -0
- package/test/actions/flashloan/DyDxFlashLoanAction.js +1 -1
- package/test/actions/insta/InstPullTokensAction.js +1 -1
- package/test/actions/lido/LidoStakeAction.js +1 -1
- package/test/actions/liquity/LiquityBorrowAction.js +1 -1
- package/test/actions/liquity/LiquityClaimAction.js +1 -1
- package/test/actions/liquity/LiquityClaimSPRewardsAction.js +1 -1
- package/test/actions/liquity/LiquityClaimStakingRewardsAction.js +1 -1
- package/test/actions/liquity/LiquityCloseAction.js +1 -1
- package/test/actions/liquity/LiquityEthGainToTroveAction.js +1 -1
- package/test/actions/liquity/LiquityOpenAction.js +1 -1
- package/test/actions/liquity/LiquityPaybackAction.js +1 -1
- package/test/actions/liquity/LiquityRedeemAction.js +1 -1
- package/test/actions/liquity/LiquitySPDepositAction.js +1 -1
- package/test/actions/liquity/LiquitySPWithdrawAction.js +1 -1
- package/test/actions/liquity/LiquityStakeAction.js +1 -1
- package/test/actions/liquity/LiquitySupplyAction.js +1 -1
- package/test/actions/liquity/LiquityUnstakeAction.js +1 -1
- package/test/actions/liquity/LiquityWithdrawAction.js +1 -1
- package/test/actions/maker/MakerGenerateAction.js +1 -1
- package/test/actions/maker/MakerGiveAction.js +1 -1
- package/test/actions/maker/MakerMergeAction.js +1 -1
- package/test/actions/maker/MakerOpenVaultAction.js +1 -1
- package/test/actions/maker/MakerPaybackAction.js +1 -1
- package/test/actions/maker/MakerSupplyAction.js +1 -1
- package/test/actions/maker/MakerWithdrawAction.js +1 -1
- package/test/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.js +1 -1
- package/test/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.js +1 -1
- package/test/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.js +1 -1
- package/test/actions/uniswap/UniswapSupplyAction.js +1 -1
- package/test/actions/uniswap/UniswapWithdrawAction.js +1 -1
- package/test/actions/uniswapV3/UniswapV3CollectAction.js +1 -1
- package/test/actions/uniswapV3/UniswapV3CreatePoolAction.js +1 -1
- package/test/actions/uniswapV3/UniswapV3MintAction.js +1 -1
- package/test/actions/uniswapV3/UniswapV3SupplyAction.js +1 -1
- package/test/actions/uniswapV3/UniswapV3WithdrawAction.js +1 -1
- package/test/actions/yearn/YearnSupplyAction.js +1 -1
- package/test/actions/yearn/YearnWithdrawAction.js +1 -1
- package/test/index.js +1 -1
- package/test/utils/uniswapLP.js +1 -1
- package/test/utils/zeroExExchange.js +3 -2
- package/tsconfig.esm.json +11 -0
- package/tsconfig.json +2 -2
- package/umd/index.js +757 -414
- package/yarn-error.log +3976 -0
- package/.env.example +0 -1
|
@@ -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
|
+
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei, getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei, assetAmountInEth, getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei,getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getDyDxV2MarketInfo, assetAmountInWei,getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -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
|
+
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei,getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei,getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei,getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei,getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei,getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getIlkInfo, assetAmountInWei,getAssetInfo} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
3
3
|
const {getAssetInfo, assetAmountInWei, assetAmountInEth} = require("@defisaver/tokens");
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
3
3
|
const {getAssetInfo, assetAmountInWei, assetAmountInEth} = require("@defisaver/tokens");
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
3
3
|
const {getAssetInfo, assetAmountInWei, assetAmountInEth} = require("@defisaver/tokens");
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
3
3
|
const {getAssetInfo, assetAmountInWei, assetAmountInEth} = require("@defisaver/tokens");
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {assetAmountInWei, getAssetInfo, assetAmountInEth} = require("@defisaver/tokens");
|
|
3
3
|
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
4
|
const {assert} = require('chai');
|
package/test/index.js
CHANGED
package/test/utils/uniswapLP.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const {assert} = require('chai');
|
|
2
2
|
const {getAssetInfo, getAssetInfoByAddress} = require("@defisaver/tokens");
|
|
3
3
|
const axios = require("axios");
|
|
4
|
-
const dfs = require('../../
|
|
4
|
+
const dfs = require('../../src');
|
|
5
5
|
const exchangeUtils = dfs.utils.zeroExExchange;
|
|
6
6
|
|
|
7
|
-
describe('Exchange utils', () => {
|
|
7
|
+
describe.skip('Exchange utils', () => {
|
|
8
|
+
|
|
8
9
|
const prices = {};
|
|
9
10
|
|
|
10
11
|
const myAddr = '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f';
|
package/tsconfig.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/* Basic Options */
|
|
6
6
|
// "incremental": true, /* Enable incremental compilation */
|
|
7
7
|
"target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
-
"module": "
|
|
8
|
+
"module": "node16", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
9
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
10
|
"allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
11
|
// "checkJs": true, /* Report errors in .js files. */
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
45
45
|
|
|
46
46
|
/* Module Resolution Options */
|
|
47
|
-
"moduleResolution": "
|
|
47
|
+
"moduleResolution": "node16", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
48
48
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
49
49
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
50
50
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|