@defisaver/sdk 1.3.28-audit-dev → 1.3.29
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/esm/src/Action.js +23 -5
- package/esm/src/actions/etherfi/EtherFiStakeFromLidoAction.d.ts +20 -0
- package/esm/src/actions/etherfi/EtherFiStakeFromLidoAction.js +41 -0
- package/esm/src/actions/etherfi/index.d.ts +1 -0
- package/esm/src/actions/etherfi/index.js +1 -0
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/midnight/MidnightBorrowFromOrdersAction.d.ts +18 -0
- package/esm/src/actions/midnight/MidnightBorrowFromOrdersAction.js +28 -0
- package/esm/src/actions/midnight/MidnightPaybackDirectAction.d.ts +16 -0
- package/esm/src/actions/midnight/MidnightPaybackDirectAction.js +24 -0
- package/esm/src/actions/midnight/MidnightPaybackFromOrdersAction.d.ts +18 -0
- package/esm/src/actions/midnight/MidnightPaybackFromOrdersAction.js +28 -0
- package/esm/src/actions/midnight/MidnightSupplyCollateralAction.d.ts +17 -0
- package/esm/src/actions/midnight/MidnightSupplyCollateralAction.js +26 -0
- package/esm/src/actions/midnight/MidnightWithdrawCollateralAction.d.ts +17 -0
- package/esm/src/actions/midnight/MidnightWithdrawCollateralAction.js +26 -0
- package/esm/src/actions/midnight/index.d.ts +5 -0
- package/esm/src/actions/midnight/index.js +5 -0
- package/esm/src/addresses.d.ts +42 -0
- package/esm/src/addresses.js +22 -15
- package/esm/src/index.d.ts +168 -0
- package/package.json +4 -30
- package/src/Action.ts +21 -5
- package/src/actions/etherfi/EtherFiStakeFromLidoAction.ts +38 -0
- package/src/actions/etherfi/index.ts +2 -1
- package/src/actions/index.ts +2 -0
- package/src/actions/midnight/MidnightBorrowFromOrdersAction.ts +44 -0
- package/src/actions/midnight/MidnightPaybackDirectAction.ts +36 -0
- package/src/actions/midnight/MidnightPaybackFromOrdersAction.ts +44 -0
- package/src/actions/midnight/MidnightSupplyCollateralAction.ts +39 -0
- package/src/actions/midnight/MidnightWithdrawCollateralAction.ts +39 -0
- package/src/actions/midnight/index.ts +5 -0
- package/src/addresses.ts +23 -15
- package/test/actions/etherFi/EtherFiStakeFromLidoAction.js +40 -0
- package/umd/index.js +942 -676
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MidnightPaybackDirectAction - Payback a debt directly to the Midnight protocol.
|
|
7
|
+
*
|
|
8
|
+
* @category MidnightPaybackDirect
|
|
9
|
+
*/
|
|
10
|
+
export class MidnightPaybackDirectAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param marketId Market id.
|
|
13
|
+
* @param onBehalf Address to payback tokens on behalf of.
|
|
14
|
+
* @param from Address from which to pull the payback tokens.
|
|
15
|
+
* @param amount Amount of tokens to payback. Send type(uint).max to payback whole amount.
|
|
16
|
+
*/
|
|
17
|
+
constructor(
|
|
18
|
+
marketId: bytes32,
|
|
19
|
+
onBehalf: EthAddress,
|
|
20
|
+
from: EthAddress,
|
|
21
|
+
amount: uint256,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'MidnightPaybackDirect',
|
|
25
|
+
getAddr('MidnightPaybackDirect'),
|
|
26
|
+
['bytes32', 'address', 'address', 'uint256'],
|
|
27
|
+
[marketId, onBehalf, from, amount],
|
|
28
|
+
);
|
|
29
|
+
this.mappableArgs = [
|
|
30
|
+
this.args[0],
|
|
31
|
+
this.args[1],
|
|
32
|
+
this.args[2],
|
|
33
|
+
this.args[3],
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
const offerFillsParamType = 'tuple(tuple(tuple(uint256,address,address,tuple(address,uint256,uint256,address)[],uint256,uint256,address,address),bool,address,uint256,uint256,uint256,bytes32,address,bytes,address,address,bool,uint128,uint128,uint256),bytes,uint256)[]';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* MidnightPaybackFromOrdersAction - Pay back debt through one or more Midnight offers.
|
|
9
|
+
*
|
|
10
|
+
* @category MidnightPaybackFromOrders
|
|
11
|
+
*/
|
|
12
|
+
export class MidnightPaybackFromOrdersAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param marketId Market id.
|
|
15
|
+
* @param onBehalf Address whose debt is repaid. Defaults to the user's wallet if not provided.
|
|
16
|
+
* @param from Address from which to pull the payback tokens.
|
|
17
|
+
* @param amount Amount of tokens to spend. Send type(uint).max to pay back the whole debt.
|
|
18
|
+
* @param minUnits Minimum number of debt units to repay (slippage protection).
|
|
19
|
+
* @param offerFills Array of offer fills to pay back from.
|
|
20
|
+
*/
|
|
21
|
+
constructor(
|
|
22
|
+
marketId: bytes32,
|
|
23
|
+
onBehalf: EthAddress,
|
|
24
|
+
from: EthAddress,
|
|
25
|
+
amount: uint256,
|
|
26
|
+
minUnits: uint256,
|
|
27
|
+
offerFills: Array<any>,
|
|
28
|
+
) {
|
|
29
|
+
super(
|
|
30
|
+
'MidnightPaybackFromOrders',
|
|
31
|
+
getAddr('MidnightPaybackFromOrders'),
|
|
32
|
+
['bytes32', 'address', 'address', 'uint256', 'uint256', offerFillsParamType],
|
|
33
|
+
[marketId, onBehalf, from, amount, minUnits, offerFills],
|
|
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
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MidnightSupplyCollateralAction
|
|
7
|
+
*
|
|
8
|
+
* @category MidnightSupplyCollateral
|
|
9
|
+
*/
|
|
10
|
+
export class MidnightSupplyCollateralAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param marketId Market id.
|
|
13
|
+
* @param onBehalf Address to supply tokens on behalf of.
|
|
14
|
+
* @param from Address from which to pull collateral asset.
|
|
15
|
+
* @param amount Amount of tokens to supply.
|
|
16
|
+
* @param collateralIndex Collateral index (0-based).
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
marketId: bytes32,
|
|
20
|
+
onBehalf: EthAddress,
|
|
21
|
+
from: EthAddress,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
collateralIndex: uint256,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'MidnightSupplyCollateral',
|
|
27
|
+
getAddr('MidnightSupplyCollateral'),
|
|
28
|
+
['bytes32', 'address', 'address', 'uint256', 'uint256'],
|
|
29
|
+
[marketId, onBehalf, from, amount, collateralIndex],
|
|
30
|
+
);
|
|
31
|
+
this.mappableArgs = [
|
|
32
|
+
this.args[0],
|
|
33
|
+
this.args[1],
|
|
34
|
+
this.args[2],
|
|
35
|
+
this.args[3],
|
|
36
|
+
this.args[4],
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MidnightWithdrawCollateralAction
|
|
7
|
+
*
|
|
8
|
+
* @category MidnightWithdrawCollateral
|
|
9
|
+
*/
|
|
10
|
+
export class MidnightWithdrawCollateralAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param marketId Market id.
|
|
13
|
+
* @param onBehalf Address to withdraw tokens on behalf of.
|
|
14
|
+
* @param to Address that will receive the withdrawn tokens.
|
|
15
|
+
* @param amount Amount of tokens to withdraw. Send type(uint).max to withdraw whole amount.
|
|
16
|
+
* @param collateralIndex Collateral index (0-based).
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
marketId: bytes32,
|
|
20
|
+
onBehalf: EthAddress,
|
|
21
|
+
to: EthAddress,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
collateralIndex: uint256,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'MidnightWithdrawCollateral',
|
|
27
|
+
getAddr('MidnightWithdrawCollateral'),
|
|
28
|
+
['bytes32', 'address', 'address', 'uint256', 'uint256'],
|
|
29
|
+
[marketId, onBehalf, to, amount, collateralIndex],
|
|
30
|
+
);
|
|
31
|
+
this.mappableArgs = [
|
|
32
|
+
this.args[0],
|
|
33
|
+
this.args[1],
|
|
34
|
+
this.args[2],
|
|
35
|
+
this.args[3],
|
|
36
|
+
this.args[4],
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/addresses.ts
CHANGED
|
@@ -300,7 +300,7 @@ export const actionAddresses = {
|
|
|
300
300
|
CurveUsdSwapper: '0xFA8c594b903651F97b27aCADEa83b720cfD7F80b',
|
|
301
301
|
CurveUsdSwapperTransient:
|
|
302
302
|
'0xcF0298592b8FCB3823d31Bb257b65afFCAcCb8b6',
|
|
303
|
-
CurveUsdSelfLiquidate: '
|
|
303
|
+
CurveUsdSelfLiquidate: '0x0B21996Fc90993f975D8279bE8ff2D34518da79C',
|
|
304
304
|
CurveUsdSelfLiquidateWithColl:
|
|
305
305
|
'0x7cE305FC2A18c6820a533AD418dC0A549aFeDcAF',
|
|
306
306
|
CurveUsdGetDebt: '0x3Bb41d3f300dA758780fe7696bb4fB93cD7172fB',
|
|
@@ -335,7 +335,7 @@ export const actionAddresses = {
|
|
|
335
335
|
LlamaLendBorrow: '0xCF693585C47049F3eACc2285E7Fe4e80123b2520',
|
|
336
336
|
LlamaLendWithdraw: '0x5aEb07Ce4A49b7EaE2A1e5281768cFc0C3e1d8F3',
|
|
337
337
|
LlamaLendPayback: '0x07e31d56E47EE6926892dCd928dF26899F58Ac8E',
|
|
338
|
-
LlamaLendSelfLiquidate: '
|
|
338
|
+
LlamaLendSelfLiquidate: '0xF0D7b730B40b02Ad555E27CFe5FAF43D6a75dfba',
|
|
339
339
|
LlamaLendGetDebt: '0x5625ea9fcd930d5f131b0261ec4dcaf279fea4ed',
|
|
340
340
|
LlamaLendBoost: '0xa21c1ce7318c6d38a10de44c2cd5d80514437d85',
|
|
341
341
|
LlamaLendRepay: '0x57693f72E628A3F7323D31De35Bd158493Aa9CC0',
|
|
@@ -358,6 +358,7 @@ export const actionAddresses = {
|
|
|
358
358
|
|
|
359
359
|
// etherFi
|
|
360
360
|
EtherFiStake: '0xcadB650B6a60C89f7847Cba555A7eeCC220EA2e8',
|
|
361
|
+
EtherFiStakeFromLido: '0xd4815aa46fc39e667fd7ab3194458639b59bcd82',
|
|
361
362
|
EtherFiWrap: '0x086464be5c73f66cfbe6b64ec23aa5a86749ef58',
|
|
362
363
|
EtherFiUnwrap: '0x6Eb09948DDf9332d628d156950b9B1C0c091e8D8',
|
|
363
364
|
|
|
@@ -365,9 +366,9 @@ export const actionAddresses = {
|
|
|
365
366
|
|
|
366
367
|
// fluid
|
|
367
368
|
FluidVaultT1Open: '0x372404335C05C2493Ff156Ef60cC0B286f6f2971',
|
|
368
|
-
FluidVaultT1Adjust: '
|
|
369
|
+
FluidVaultT1Adjust: '0x0Dfe1e40F3DA8687a68824022176bE547Ecc0906',
|
|
369
370
|
FluidVaultT1Borrow: '0x36AF0cE762a016e8b4a80c70Af406DFcBc1FCbD4',
|
|
370
|
-
FluidVaultT1Payback: '
|
|
371
|
+
FluidVaultT1Payback: '0x8D56b267C6a3e5295EFAebC67Ac413483c885C05',
|
|
371
372
|
FluidVaultT1Withdraw: '0x5673b9ab4A035C5C7474C344664Be91DaFafa17E',
|
|
372
373
|
FluidVaultT1Supply: '0x0c6100209D8A0bb14CC7d18e45dA1bd1E7a3a187',
|
|
373
374
|
FluidView: '0xc8df052bD7A8d76a34c09e758Dff3c6298C0115c',
|
|
@@ -376,7 +377,7 @@ export const actionAddresses = {
|
|
|
376
377
|
FluidDexOpen: '0x071e1369E1c9030Aa1a089bDE2F72797a14FE3b3',
|
|
377
378
|
FluidDexSupply: '0xB3BE39850d8939Cceb4Fc49c415c428548FA9f9C',
|
|
378
379
|
FluidDexBorrow: '0x3fa8EF6DA8f5b2BaAee77493a3A3dA68a7Aa75f3',
|
|
379
|
-
FluidDexPayback: '
|
|
380
|
+
FluidDexPayback: '0x12D0D7c4c2c5304E5ba96A019E0F092FdF555123',
|
|
380
381
|
FluidDexWithdraw: '0x14d5bb8E96fbf7C1f9A8E3EFD0eF5fe6832ff3cd',
|
|
381
382
|
|
|
382
383
|
// pendle
|
|
@@ -547,7 +548,7 @@ export const actionAddresses = {
|
|
|
547
548
|
LlamaLendBorrow: '0x4948135f8b3a8f3b51fbd1050f5d0f755accb8e7',
|
|
548
549
|
LlamaLendWithdraw: '0xd7a80e7a2296d75cd1eebc2f0de0cebd14fbe117',
|
|
549
550
|
LlamaLendPayback: '0xB2B93495dA2Fee8F92513fBBfA804564110B63ee',
|
|
550
|
-
LlamaLendSelfLiquidate: '
|
|
551
|
+
LlamaLendSelfLiquidate: '0xC330F048B15CA5aadF34A9033B3a24c65200230A',
|
|
551
552
|
LlamaLendGetDebt: '0x81c01f08b8fc4487501c88404ed17ebc17764f9c',
|
|
552
553
|
LlamaLendBoost: '0xc52a3af27696f8cf999463f3455e23440a376f8d',
|
|
553
554
|
LlamaLendRepay: '0x320fdfa922ee33c1cc8a042ada855c9dfe9bed06',
|
|
@@ -557,16 +558,16 @@ export const actionAddresses = {
|
|
|
557
558
|
|
|
558
559
|
// fluid
|
|
559
560
|
FluidVaultT1Open: '0x1947Ce90ACCf0E243CcF85140fCceC2EfAeeA193',
|
|
560
|
-
FluidVaultT1Adjust: '
|
|
561
|
+
FluidVaultT1Adjust: '0x212bB7577B6b302450860E128Eb73Eb2F83514c7',
|
|
561
562
|
FluidVaultT1Borrow: '0x499da89aD564F5D6C828259ce55F53Fa288e7Be7',
|
|
562
|
-
FluidVaultT1Payback: '
|
|
563
|
+
FluidVaultT1Payback: '0x19FF948437B7f1221173effC029739568F5f844a',
|
|
563
564
|
FluidVaultT1Withdraw: '0xc13d93227d97197e5F1751d0a3e80c1080A5fa2B',
|
|
564
565
|
FluidVaultT1Supply: '0xBCF0Dc5bb2C4434AD07369207904F5900d391b0B',
|
|
565
566
|
FluidView: '0xf9e6d5568887ac8eC6fA33B7eefD2A176A958e71',
|
|
566
567
|
FluidDexOpen: '0xA456f13d358B8B93bE6778be3244111E267C0AaC',
|
|
567
568
|
FluidDexSupply: '0x3E49c4f914E01e5612719a7B4965e4FAfb324762',
|
|
568
569
|
FluidDexBorrow: '0x8626b70CDf64e557fDdcFbcb783833Dc314d95F4',
|
|
569
|
-
FluidDexPayback: '
|
|
570
|
+
FluidDexPayback: '0x72b9AAf4864631976D764574f4780B1562CCF0F4',
|
|
570
571
|
FluidDexWithdraw: '0x076D5434793798b153298bF70b014f5E6145aB2E',
|
|
571
572
|
|
|
572
573
|
// summer.fi
|
|
@@ -666,16 +667,16 @@ export const actionAddresses = {
|
|
|
666
667
|
|
|
667
668
|
// fluid
|
|
668
669
|
FluidVaultT1Open: '0xCd4d5896AEAf97e738d3E7215ac01c2CF97474bc',
|
|
669
|
-
FluidVaultT1Adjust: '
|
|
670
|
+
FluidVaultT1Adjust: '0x2f7839a733B93641aa6a6AF0b593202335c351D3',
|
|
670
671
|
FluidVaultT1Borrow: '0x8dCBF436cC0971FE29886E58CE0CAeb36d43E91E',
|
|
671
|
-
FluidVaultT1Payback: '
|
|
672
|
+
FluidVaultT1Payback: '0xD4cEe5755e4f713B69f5Fc73068505ec6B9ee2a2',
|
|
672
673
|
FluidVaultT1Withdraw: '0x26bE6a2EdE97aE826ed9DA8Fb79428037fe55cEB',
|
|
673
674
|
FluidVaultT1Supply: '0x028ACA45244d4897ff80ef65ed0b735Bb0D4B0A5',
|
|
674
675
|
FluidView: '0x6cd4D6af4F292817eA2A2311F099dF26cd015028',
|
|
675
676
|
FluidDexOpen: '0x5eA8Da9679145D51F5eAEC8Bf2f42f47003A8799',
|
|
676
677
|
FluidDexSupply: '0x2fCb7db80d3Be5C1B0049dF074b1AcFbcA93A867',
|
|
677
678
|
FluidDexBorrow: '0x9D40776a876fA67C6757DA386434844cB6616C5F',
|
|
678
|
-
FluidDexPayback: '
|
|
679
|
+
FluidDexPayback: '0xcaa8877aD3847B428135653AcA5fAd13a2811483',
|
|
679
680
|
FluidDexWithdraw: '0xEaBA867c49FE8e53F5716fFF8857F239bd7202e1',
|
|
680
681
|
|
|
681
682
|
TokenizedVaultAdapter: '0x88cf6cfa51b6f771570f6df450edf1c886212d3e',
|
|
@@ -684,6 +685,13 @@ export const actionAddresses = {
|
|
|
684
685
|
SFApproveTokens: '0x03EDC9A683f37BFB7516FF234223fFb6E38D5eb9',
|
|
685
686
|
SummerfiUnsub: '0x0000000000000000000000000000000000000000', // Only exists for Maker on Mainnet
|
|
686
687
|
SummerfiUnsubV2: '0x60587B8Fe62Fc149d285a611822263206b4138da',
|
|
688
|
+
|
|
689
|
+
MidnightPaybackDirect: '0xC1B049A038f9E9811dc1Ad1D335369844d4268D9',
|
|
690
|
+
MidnightBorrowFromOrders: '0x82F9dd7eA821463178A2c7bC4047057Bd338E5e5',
|
|
691
|
+
MidnightPaybackFromOrders: '0x4B0c242195B1C941A2e7a871Bfa242c40dbf032F',
|
|
692
|
+
MidnightSupplyCollateral: '0xC83C7Ca37203FC30636EDcd3Ef127194542504c5',
|
|
693
|
+
MidnightWithdrawCollateral: '0x4fA4DA5fDD813279409B4Bf0Bde5Fe9ca8006A9C',
|
|
694
|
+
MidnightView: '0x3aa272f329E8B562A3bA56Bb6979a44D23A28839',
|
|
687
695
|
},
|
|
688
696
|
[NETWORKS.linea.chainId]: {
|
|
689
697
|
// Basic
|
|
@@ -761,16 +769,16 @@ export const actionAddresses = {
|
|
|
761
769
|
|
|
762
770
|
// Fluid
|
|
763
771
|
FluidVaultT1Open: '0x491cc4AFbE0081C3464DeF1114ba27BE114b2401',
|
|
764
|
-
FluidVaultT1Adjust: '
|
|
772
|
+
FluidVaultT1Adjust: '0xC196dC97Eb0B58E3755a71143b41D3F24595643f',
|
|
765
773
|
FluidVaultT1Borrow: '0x95a8665Ba58aa13A58c60B0803572772cda153dB',
|
|
766
|
-
FluidVaultT1Payback: '
|
|
774
|
+
FluidVaultT1Payback: '0xdeF8B05Ce194D50C376233C9C5530027f6180442',
|
|
767
775
|
FluidVaultT1Withdraw: '0xcF91546046F16B3c38b890CC508E280BEffa66b9',
|
|
768
776
|
FluidVaultT1Supply: '0x54D1b51d2d68CD0Dc877296527780CA6aff68a39',
|
|
769
777
|
FluidView: '0x27C0BAe2338cE28097122393faF90375B9395dd1',
|
|
770
778
|
FluidDexOpen: '0xF32d5d8D81f2662A02955CE537537088DF29daf5',
|
|
771
779
|
FluidDexSupply: '0x903F7C93FFC4AAbaBB096a7A722F1f057816B399',
|
|
772
780
|
FluidDexBorrow: '0xa2A878a09639D1ab3AF544566c0CA4D0FeAEE65E',
|
|
773
|
-
FluidDexPayback: '
|
|
781
|
+
FluidDexPayback: '0x3094D0D64fa5318162150720c19669d1A163937B',
|
|
774
782
|
FluidDexWithdraw: '0x17B4ecd173b3Df2F5cB02c53Df8AA34e23Bcb92E',
|
|
775
783
|
// Pendle
|
|
776
784
|
PendleTokenRedeem: '0xB4c5f33bb5791D0174Df1879b809Bf57eE540B62',
|
|
@@ -0,0 +1,40 @@
|
|
|
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: EtherFiStakeFromLidoAction', () => {
|
|
7
|
+
let action;
|
|
8
|
+
const amount = 100;
|
|
9
|
+
const minAmountOut = 90;
|
|
10
|
+
const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
|
|
11
|
+
const to = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
|
|
12
|
+
|
|
13
|
+
it('constructor', () => {
|
|
14
|
+
action = new dfs.actions.etherfi.EtherFiStakeFromLidoAction(
|
|
15
|
+
amount,
|
|
16
|
+
minAmountOut,
|
|
17
|
+
from,
|
|
18
|
+
to,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
assert.equal(action.args[0], amount);
|
|
22
|
+
assert.equal(action.args[1], minAmountOut);
|
|
23
|
+
assert.equal(action.args[2], from);
|
|
24
|
+
assert.equal(action.args[3], to);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
28
|
+
it('encodeForRecipe', () => encodeForRecipe(action));
|
|
29
|
+
|
|
30
|
+
it('getEthValue', async () => {
|
|
31
|
+
assert.equal(await action.getEthValue(), '0');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('getAssetsToApprove', async () => {
|
|
35
|
+
const assetOwnerPairs = await action.getAssetsToApprove();
|
|
36
|
+
assert.lengthOf(assetOwnerPairs, 1);
|
|
37
|
+
assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WSTETH').address);
|
|
38
|
+
assert.equal(assetOwnerPairs[0].owner, from);
|
|
39
|
+
});
|
|
40
|
+
});
|