@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,37 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* EulerV2PullDebtAction - Pull debt from one Euler account to another
|
|
7
|
+
*
|
|
8
|
+
* @category EulerV2
|
|
9
|
+
*/
|
|
10
|
+
export class EulerV2PullDebtAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param vault The address of the Euler vault
|
|
13
|
+
* @param account The address of the Euler account taking the debt, defaults to user's wallet
|
|
14
|
+
* @param from The address of the Euler account from which debt is pulled
|
|
15
|
+
* @param amount The amount of debt to be pulled (uint256.max for full debt pull)
|
|
16
|
+
*/
|
|
17
|
+
constructor(
|
|
18
|
+
vault: EthAddress,
|
|
19
|
+
account: EthAddress,
|
|
20
|
+
from: EthAddress,
|
|
21
|
+
amount: uint256,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'EulerV2PullDebt',
|
|
25
|
+
getAddr('Empty'),
|
|
26
|
+
['address', 'address', 'address', 'uint256'],
|
|
27
|
+
[vault, account, from, 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,31 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint8 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* EulerV2ReorderCollateralsAction - Reorder account collaterals. Can be used to optimize gas costs when checking account health status
|
|
7
|
+
*
|
|
8
|
+
* @category EulerV2
|
|
9
|
+
*/
|
|
10
|
+
export class EulerV2ReorderCollateralsAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param account The address of the Euler account, defaults to user's wallet
|
|
13
|
+
* @param indexes The array of swap steps to reorder collaterals
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
account: EthAddress,
|
|
17
|
+
indexes: Array<Array<uint8>>,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
'EulerV2ReorderCollaterals',
|
|
21
|
+
getAddr('Empty'),
|
|
22
|
+
['address', 'uint8[][]'],
|
|
23
|
+
[account, indexes],
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
this.mappableArgs = [
|
|
27
|
+
this.args[0],
|
|
28
|
+
this.args[1],
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -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';
|
package/src/actions/index.ts
CHANGED
|
@@ -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
|
|
|
34
35
|
export {
|
|
@@ -63,5 +64,6 @@ export {
|
|
|
63
64
|
morphoblue,
|
|
64
65
|
llamalend,
|
|
65
66
|
merkl,
|
|
67
|
+
eulerV2,
|
|
66
68
|
sky,
|
|
67
69
|
};
|
package/src/addresses.ts
CHANGED
|
@@ -283,6 +283,14 @@ export const actionAddresses = {
|
|
|
283
283
|
LlamaLendLevCreate: '0x534b704a62385cfe5EEB8d9605419743d4fe105E',
|
|
284
284
|
LlamaLendSelfLiquidateWithColl: '0xA99DD1D91141cA63C423DB763dE75078336803B2',
|
|
285
285
|
|
|
286
|
+
// eulerV2
|
|
287
|
+
EulerV2Supply: '0xa067787D086841437D112e0C847dDB3e5D95173f',
|
|
288
|
+
EulerV2Withdraw: '0x5bf1a54fe1e65B134E7920e53A5eB0D14b9e6aD1',
|
|
289
|
+
EulerV2Borrow: '0x38d66ecD38b7800D8FD0Bc29489c2306170a9Ede',
|
|
290
|
+
EulerV2Payback: '0x738b1df6b6962D8795Bda5bc5EFCd8b0B8c74d01',
|
|
291
|
+
EulerV2CollateralSwitch: '0x38950b50Fb38aC19D06e8CE5AAE632D6dF1EEb1a',
|
|
292
|
+
EulerV2View: '0x8932E46Ecf96b5Fe033F5e27Ab6dC755Cb668967',
|
|
293
|
+
|
|
286
294
|
MerklClaim: '0xE88036F3F0D7e216D63726356cA2bC334e305fe5',
|
|
287
295
|
},
|
|
288
296
|
[NETWORKS.optimism.chainId]: {
|
|
@@ -540,11 +548,8 @@ export const getAddr = (name: string, chainId:number = CONFIG.chainId) : EthAddr
|
|
|
540
548
|
const actions = actionAddresses[_chainId];
|
|
541
549
|
const other = otherAddresses[_chainId];
|
|
542
550
|
|
|
543
|
-
|
|
544
|
-
if (!
|
|
545
|
-
if (!actions && !other) throw new Error(`Cannot find address for chainId: ${_chainId}.`);
|
|
546
|
-
if (!actions[name as keyof typeof actions] && !other[name as keyof typeof other]) throw new Error(`Cannot find address for name: ${name} (chainId: ${_chainId}).`);
|
|
547
|
-
}
|
|
551
|
+
if (!actions && !other) throw new Error(`Cannot find address for chainId: ${_chainId}.`);
|
|
552
|
+
if (!actions[name as keyof typeof actions] && !other[name as keyof typeof other]) throw new Error(`Cannot find address for name: ${name} (chainId: ${_chainId}).`);
|
|
548
553
|
|
|
549
554
|
if (actions[name as keyof typeof actions]) return actions[name as keyof typeof actions]!;
|
|
550
555
|
return other[name as keyof typeof other]!;
|
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class AaveV2RatioTrigger extends Action {
|
|
11
11
|
constructor(user:EthAddress, market:EthAddress, ratio:uint256, state:uint8) {
|
|
12
|
-
super('AaveV2RatioTrigger', getAddr('
|
|
12
|
+
super('AaveV2RatioTrigger', 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 AaveV3QuotePriceTrigger extends Action {
|
|
11
11
|
constructor(baseTokenAddr:EthAddress, quoteTokenAddr:EthAddress, price:uint256, state:uint8) {
|
|
12
|
-
super('AaveV3QuotePriceTrigger', getAddr('
|
|
12
|
+
super('AaveV3QuotePriceTrigger', 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 AaveV3RatioTrigger extends Action {
|
|
11
11
|
constructor(user:EthAddress, market:EthAddress, ratio:uint256, state:uint8) {
|
|
12
|
-
super('AaveV3RatioTrigger', getAddr('
|
|
12
|
+
super('AaveV3RatioTrigger', 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 CBRebondTrigger extends Action {
|
|
11
11
|
constructor(bondID:uint256) {
|
|
12
|
-
super('CBRebondTrigger', getAddr('
|
|
12
|
+
super('CBRebondTrigger', getAddr('Empty'), ['uint256'], [bondID]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -9,6 +9,6 @@ import { EthAddress, uint256, uint8 } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class ChainLinkPriceTrigger extends Action {
|
|
11
11
|
constructor(tokenAddr:EthAddress, price:uint256, state:uint8) {
|
|
12
|
-
super('ChainLinkPriceTrigger', getAddr('
|
|
12
|
+
super('ChainLinkPriceTrigger', getAddr('Empty'), ['address', 'uint256', 'uint8'], [tokenAddr, price, state]);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -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');
|