@defisaver/sdk 1.2.8 → 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/EulerV2PaybackWithSharesAction.js +1 -1
- package/esm/src/actions/eulerV2/EulerV2PullDebtAction.js +1 -1
- package/esm/src/actions/eulerV2/EulerV2ReorderCollateralsAction.js +1 -1
- package/esm/src/addresses.d.ts +1 -1
- package/esm/src/addresses.js +6 -8
- package/esm/src/index.d.ts +4 -4
- 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/EulerV2PaybackWithSharesAction.ts +1 -1
- package/src/actions/eulerV2/EulerV2PullDebtAction.ts +1 -1
- package/src/actions/eulerV2/EulerV2ReorderCollateralsAction.ts +1 -1
- package/src/actions/eulerV2/index.ts +1 -2
- package/src/addresses.ts +4 -6
- 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 +465 -435
- package/.env.example +0 -1
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class CompV3RatioTrigger extends Action {
|
|
11
11
|
constructor(user:EthAddress, market:EthAddress, ratio:uint256, state:uint8) {
|
|
12
|
-
super('CompV3RatioTrigger', getAddr('
|
|
12
|
+
super('CompV3RatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class CompoundRatioTrigger extends Action {
|
|
11
11
|
constructor(user:EthAddress, ratio:uint256, state:uint8) {
|
|
12
|
-
super('CompoundRatioTrigger', getAddr('
|
|
12
|
+
super('CompoundRatioTrigger', getAddr('Empty'), ['address', 'uint256', 'uint8'], [user, ratio, state]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class CurveUsdCollRatioTrigger extends Action {
|
|
11
11
|
constructor(user:EthAddress, controller:EthAddress, ratio:uint256, state:uint8) {
|
|
12
|
-
super('CurveUsdCollRatioTrigger', getAddr('
|
|
12
|
+
super('CurveUsdCollRatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[user, controller, ratio, state]]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class CurveUsdHealthRatioTrigger extends Action {
|
|
11
11
|
constructor(user:EthAddress, controller:EthAddress, ratio:uint256) {
|
|
12
|
-
super('CurveUsdHealthRatioTrigger', getAddr('
|
|
12
|
+
super('CurveUsdHealthRatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256']], [[user, controller, ratio]]);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -9,6 +9,6 @@ import { uint256 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class GasPriceTrigger extends Action {
|
|
11
11
|
constructor(maxGasPrice:uint256) {
|
|
12
|
-
super('GasPriceTrigger', getAddr('
|
|
12
|
+
super('GasPriceTrigger', getAddr('Empty'), ['uint256'], [maxGasPrice]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -11,9 +11,9 @@ export class LiquityDebtInFrontWithLimitTrigger extends Action {
|
|
|
11
11
|
constructor(troveOwner:EthAddress, debtInFront:uint256) {
|
|
12
12
|
super(
|
|
13
13
|
'LiquityDebtInFrontWithLimitTrigger',
|
|
14
|
-
getAddr('
|
|
14
|
+
getAddr('Empty'),
|
|
15
15
|
['address', 'uint256'],
|
|
16
16
|
[troveOwner, debtInFront],
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
}
|
|
@@ -11,9 +11,9 @@ export class LiquityRatioTrigger extends Action {
|
|
|
11
11
|
constructor(troveOwner:EthAddress, ratio:uint256, state:uint8) {
|
|
12
12
|
super(
|
|
13
13
|
'LiquityRatioTrigger',
|
|
14
|
-
getAddr('
|
|
14
|
+
getAddr('Empty'),
|
|
15
15
|
['addresss', 'uint256', 'uint8'],
|
|
16
16
|
[troveOwner, ratio, state],
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
}
|
|
@@ -10,6 +10,6 @@ import { uint256, uint8 } from '../types';
|
|
|
10
10
|
*/
|
|
11
11
|
export class MakerRatioTrigger extends Action {
|
|
12
12
|
constructor(vaultId:uint256, ratio:uint256, state:uint8) {
|
|
13
|
-
super('McdRatioTrigger', getAddr('
|
|
13
|
+
super('McdRatioTrigger', getAddr('Empty'), ['uint256', 'uint256', 'uint8'], [vaultId, ratio, state]);
|
|
14
14
|
}
|
|
15
|
-
}
|
|
15
|
+
}
|
|
@@ -10,6 +10,6 @@ import { EthAddress, uint256, uint8 } from '../types';
|
|
|
10
10
|
*/
|
|
11
11
|
export class MorphoAaveV2RatioTrigger extends Action {
|
|
12
12
|
constructor(user:EthAddress, ratio:uint256, state:uint8) {
|
|
13
|
-
super('MorphoAaveV2RatioTrigger', getAddr('
|
|
13
|
+
super('MorphoAaveV2RatioTrigger', getAddr('Empty'), ['address', 'uint256', 'uint8'], [user, ratio, state]);
|
|
14
14
|
}
|
|
15
|
-
}
|
|
15
|
+
}
|
|
@@ -18,8 +18,8 @@ export class MorphoBlueRatioTrigger extends Action {
|
|
|
18
18
|
) {
|
|
19
19
|
super(
|
|
20
20
|
'MorphoBlueRatioTrigger',
|
|
21
|
-
getAddr('
|
|
21
|
+
getAddr('Empty'),
|
|
22
22
|
[['bytes32', 'address', 'uint256', 'uint8']],
|
|
23
23
|
[[marketId, user, ratio, state]]);
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
|
@@ -9,6 +9,6 @@ import { uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class OffchainPriceTrigger extends Action {
|
|
11
11
|
constructor(limitPrice:uint256, limitType: uint8) {
|
|
12
|
-
super('OffchainPriceTrigger', getAddr('
|
|
12
|
+
super('OffchainPriceTrigger', getAddr('Empty'), ['uint256', 'uint8'], [limitPrice, limitType]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class ReflexerRatioTrigger extends Action {
|
|
11
11
|
constructor(vaultId:uint256, ratio:uint256, state:uint8) {
|
|
12
|
-
super('ReflexerRatioTrigger', getAddr('
|
|
12
|
+
super('ReflexerRatioTrigger', getAddr('Empty'), ['uint256', 'uint256', 'uint8'], [vaultId, ratio, state]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class SparkQuotePriceTrigger extends Action {
|
|
11
11
|
constructor(baseTokenAddr:EthAddress, quoteTokenAddr:EthAddress, price:uint256, state:uint8) {
|
|
12
|
-
super('SparkQuotePriceTrigger', getAddr('
|
|
12
|
+
super('SparkQuotePriceTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[baseTokenAddr, quoteTokenAddr, price, state]]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class SparkRatioTrigger extends Action {
|
|
11
11
|
constructor(user:EthAddress, market:EthAddress, ratio:uint256, state:uint8) {
|
|
12
|
-
super('SparkRatioTrigger', getAddr('
|
|
12
|
+
super('SparkRatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { uint256 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class TimestampTrigger extends Action {
|
|
11
11
|
constructor(nextTimestamp:uint256) {
|
|
12
|
-
super('TimestampTrigger', getAddr('
|
|
12
|
+
super('TimestampTrigger', getAddr('Empty'), ['uint256'], [nextTimestamp]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256, uint80 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class TrailingStopTrigger extends Action {
|
|
11
11
|
constructor(tokenAddr:EthAddress, percentage:uint256, roundId:uint80) {
|
|
12
|
-
super('TrailingStopTrigger', getAddr('
|
|
12
|
+
super('TrailingStopTrigger', getAddr('Empty'), ['address', 'uint256', 'uint80'], [tokenAddr, percentage, roundId]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class UniV3CurrentTickTrigger extends Action {
|
|
11
11
|
constructor(tokenId:uint256, state:uint8) {
|
|
12
|
-
super('UniV3CurrentTickTrigger', getAddr('
|
|
12
|
+
super('UniV3CurrentTickTrigger', getAddr('Empty'), ['uint256', 'uint8'], [tokenId, state]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
package/test/Action.js
CHANGED
package/test/ActionWithL2.js
CHANGED
package/test/DfsWeb3.js
CHANGED
package/test/Recipe.js
CHANGED
package/test/Strategy.js
CHANGED
|
@@ -3,7 +3,7 @@ const { BN, padLeft, toHex } = require('web3-utils');
|
|
|
3
3
|
const {getAssetInfo, utils: {compare}} = require("@defisaver/tokens");
|
|
4
4
|
const RecipeAbi = require('../../src/abis/Recipe.json');
|
|
5
5
|
const MockAccessLists = require('./MockAccessLists');
|
|
6
|
-
const dfs = require("../../
|
|
6
|
+
const dfs = require("../../src");
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Set of Actions to be performed sequentially in a single transaction
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const dfs = require('../../../
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
2
|
const {getAaveV2MarketInfo, 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 {getAaveV2MarketInfo, 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 {getAaveV2MarketInfo, 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 {getAaveV2MarketInfo, 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 {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
|
|
|
4
4
|
describe('Action: CreateSubAction', () => {
|
|
@@ -19,7 +19,6 @@ describe('Action: CreateSubAction', () => {
|
|
|
19
19
|
],
|
|
20
20
|
]
|
|
21
21
|
);
|
|
22
|
-
console.log(action);
|
|
23
22
|
});
|
|
24
23
|
|
|
25
24
|
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
@@ -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');
|
|
@@ -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');
|