@defisaver/sdk 1.2.12 → 1.2.13-dev1
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/actions/curveusd/CurveUsdLevCreateTransientAction.d.ts +9 -0
- package/esm/src/actions/curveusd/CurveUsdLevCreateTransientAction.js +33 -0
- package/esm/src/actions/curveusd/CurveUsdRepayTransientAction.d.ts +9 -0
- package/esm/src/actions/curveusd/CurveUsdRepayTransientAction.js +25 -0
- package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollTransientAction.d.ts +9 -0
- package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollTransientAction.js +35 -0
- package/esm/src/actions/curveusd/index.d.ts +3 -0
- package/esm/src/actions/curveusd/index.js +3 -0
- package/esm/src/actions/etherfi/EtherFiStakeAction.d.ts +20 -0
- package/esm/src/actions/etherfi/EtherFiStakeAction.js +41 -0
- package/esm/src/actions/etherfi/EtherFiUnwrapAction.d.ts +19 -0
- package/esm/src/actions/etherfi/EtherFiUnwrapAction.js +39 -0
- package/esm/src/actions/etherfi/EtherFiWrapAction.d.ts +19 -0
- package/esm/src/actions/etherfi/EtherFiWrapAction.js +39 -0
- package/esm/src/actions/etherfi/index.d.ts +3 -0
- package/esm/src/actions/etherfi/index.js +3 -0
- package/esm/src/actions/flashloan/CurveUsdFlashLoanAction.d.ts +17 -0
- package/esm/src/actions/flashloan/CurveUsdFlashLoanAction.js +18 -0
- package/esm/src/actions/flashloan/index.d.ts +1 -0
- package/esm/src/actions/flashloan/index.js +1 -0
- package/esm/src/actions/index.d.ts +3 -1
- package/esm/src/actions/index.js +3 -1
- package/esm/src/actions/renzo/RenzoStakeAction.d.ts +19 -0
- package/esm/src/actions/renzo/RenzoStakeAction.js +39 -0
- package/esm/src/actions/renzo/index.d.ts +1 -0
- package/esm/src/actions/renzo/index.js +1 -0
- package/esm/src/addresses.d.ts +36 -0
- package/esm/src/addresses.js +13 -3
- package/esm/src/index.d.ts +144 -0
- package/package.json +1 -1
- package/src/actions/curveusd/CurveUsdLevCreateTransientAction.ts +52 -0
- package/src/actions/curveusd/CurveUsdRepayTransientAction.ts +36 -0
- package/src/actions/curveusd/CurveUsdSelfLiquidateWithCollTransientAction.ts +55 -0
- package/src/actions/curveusd/index.ts +4 -1
- package/src/actions/etherfi/EtherFiStakeAction.ts +38 -0
- package/src/actions/etherfi/EtherFiUnwrapAction.ts +31 -0
- package/src/actions/etherfi/EtherFiWrapAction.ts +36 -0
- package/src/actions/etherfi/index.ts +3 -0
- package/src/actions/flashloan/CurveUsdFlashLoanAction.ts +27 -0
- package/src/actions/flashloan/index.ts +1 -0
- package/src/actions/index.ts +4 -0
- package/src/actions/renzo/RenzoStakeAction.ts +33 -0
- package/src/actions/renzo/index.ts +1 -0
- package/src/addresses.ts +15 -3
- package/test/actions/etherFi/EtherFiStakeAction.js +66 -0
- package/test/actions/etherFi/EtherFiUnwrapAction.js +35 -0
- package/test/actions/etherFi/EtherFiWrapAction.js +35 -0
- package/test/actions/renzo/RenzoStakeAction.js +60 -0
- package/umd/index.js +848 -494
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import {
|
|
5
|
+
EthAddress,
|
|
6
|
+
uint256,
|
|
7
|
+
uint32,
|
|
8
|
+
} from '../../types';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @category CurveUsd
|
|
13
|
+
*/
|
|
14
|
+
export class CurveUsdSelfLiquidateWithCollTransientAction extends Action {
|
|
15
|
+
constructor(
|
|
16
|
+
controllerAddress: EthAddress,
|
|
17
|
+
percentage: uint256,
|
|
18
|
+
minCrvUsdExpected: uint256,
|
|
19
|
+
to: EthAddress,
|
|
20
|
+
exchangeOrder: Array<any>,
|
|
21
|
+
sellAllCollateral: boolean,
|
|
22
|
+
gasUsed: uint32,
|
|
23
|
+
) {
|
|
24
|
+
requireAddress(to);
|
|
25
|
+
super(
|
|
26
|
+
'CurveUsdSelfLiquidateWithCollTransient',
|
|
27
|
+
getAddr('CurveUsdSelfLiquidateWithCollTransient'),
|
|
28
|
+
[
|
|
29
|
+
'address',
|
|
30
|
+
'uint256',
|
|
31
|
+
'uint256',
|
|
32
|
+
'address',
|
|
33
|
+
['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
|
|
34
|
+
'bool',
|
|
35
|
+
'uint32',
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
controllerAddress,
|
|
39
|
+
percentage,
|
|
40
|
+
minCrvUsdExpected,
|
|
41
|
+
to,
|
|
42
|
+
exchangeOrder,
|
|
43
|
+
sellAllCollateral,
|
|
44
|
+
gasUsed,
|
|
45
|
+
],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
this.mappableArgs = [
|
|
49
|
+
this.args[0],
|
|
50
|
+
this.args[1],
|
|
51
|
+
this.args[2],
|
|
52
|
+
this.args[3],
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -8,4 +8,7 @@ export * from './CurveUsdSelfLiquidateAction';
|
|
|
8
8
|
export * from './CurveUsdLevCreateAction';
|
|
9
9
|
export * from './CurveUsdSelfLiquidateWithCollAction';
|
|
10
10
|
export * from './CurveUsdAdjustAction';
|
|
11
|
-
export * from './CurveUsdGetDebtAction';
|
|
11
|
+
export * from './CurveUsdGetDebtAction';
|
|
12
|
+
export * from './CurveUsdLevCreateTransientAction';
|
|
13
|
+
export * from './CurveUsdRepayTransientAction';
|
|
14
|
+
export * from './CurveUsdSelfLiquidateWithCollTransientAction';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
import { requireAddress } from '../../utils/general';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* EtherFiStakeAction - Receives WETH, transforms it to ETH then sends it to EtherFi staking contract receiving eETH in return or weETH if wrapping is enabled
|
|
9
|
+
*
|
|
10
|
+
* @category EtherFi
|
|
11
|
+
*/
|
|
12
|
+
export class EtherFiStakeAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param amount - amount of WETH to pull
|
|
15
|
+
* @param from - address from which to pull WETH from
|
|
16
|
+
* @param to - address where received eETH will be sent to
|
|
17
|
+
* @param shouldWrap - true if received eETH should be wrapped to weETH
|
|
18
|
+
*/
|
|
19
|
+
constructor(amount:uint256, from:EthAddress, to:EthAddress, shouldWrap:boolean) {
|
|
20
|
+
requireAddress(to);
|
|
21
|
+
super(
|
|
22
|
+
'EtherFiStake',
|
|
23
|
+
getAddr('EtherFiStake'),
|
|
24
|
+
['uint256', 'address', 'address', 'bool'],
|
|
25
|
+
[amount, from, to, shouldWrap],
|
|
26
|
+
);
|
|
27
|
+
this.mappableArgs = [
|
|
28
|
+
this.args[0],
|
|
29
|
+
this.args[1],
|
|
30
|
+
this.args[2],
|
|
31
|
+
this.args[3],
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async getAssetsToApprove() {
|
|
36
|
+
return [{ asset: getAssetInfo('WETH').address, owner: this.args[1] }];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
import { requireAddress } from '../../utils/general';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* EtherFiUnwrapAction - Unwrap weETH and receive eETH
|
|
9
|
+
*
|
|
10
|
+
* @category EtherFi
|
|
11
|
+
*/
|
|
12
|
+
export class EtherFiUnwrapAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param amount - amount of weETH to pull
|
|
15
|
+
* @param from - address from which to pull weETH from
|
|
16
|
+
* @param to - address where received eETH will be sent to
|
|
17
|
+
*/
|
|
18
|
+
constructor(amount:uint256, from:EthAddress, to:EthAddress) {
|
|
19
|
+
requireAddress(to);
|
|
20
|
+
super('EtherFiUnwrap', getAddr('EtherFiUnwrap'), ['uint256', 'address', 'address'], [amount, from, to]);
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0],
|
|
23
|
+
this.args[1],
|
|
24
|
+
this.args[2],
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async getAssetsToApprove() {
|
|
29
|
+
return [{ asset: getAssetInfo('weETH').address, owner: this.args[1] }];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
import { requireAddress } from '../../utils/general';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* EtherFiWrapAction - Wraps eETH into Wrapped eETH (weETH)
|
|
9
|
+
*
|
|
10
|
+
* @category EtherFi
|
|
11
|
+
*/
|
|
12
|
+
export class EtherFiWrapAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param amount - amount of eETH to pull
|
|
15
|
+
* @param from - address from which to pull eETH from
|
|
16
|
+
* @param to - address where received weETH will be sent to
|
|
17
|
+
*/
|
|
18
|
+
constructor(amount:uint256, from:EthAddress, to:EthAddress) {
|
|
19
|
+
requireAddress(to);
|
|
20
|
+
super(
|
|
21
|
+
'EtherFiWrap',
|
|
22
|
+
getAddr('EtherFiWrap'),
|
|
23
|
+
['uint256', 'address', 'address'],
|
|
24
|
+
[amount, from, to],
|
|
25
|
+
);
|
|
26
|
+
this.mappableArgs = [
|
|
27
|
+
this.args[0],
|
|
28
|
+
this.args[1],
|
|
29
|
+
this.args[2],
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async getAssetsToApprove() {
|
|
34
|
+
return [{ asset: getAssetInfo('eETH').address, owner: this.args[1] }];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256, bytes } from '../../types';
|
|
4
|
+
import { FlashLoanId } from './FlashLoanId';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Gets a crvUSD flashloan from CurveUsd Flash Minter
|
|
8
|
+
*
|
|
9
|
+
* @category Flashloans
|
|
10
|
+
*/
|
|
11
|
+
export class CurveUsdFlashLoanAction extends Action implements FlashLoanId {
|
|
12
|
+
public flashLoanId = 9;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param amount
|
|
16
|
+
* @param flParamGetterAddr
|
|
17
|
+
* @param flParamGetterData
|
|
18
|
+
*/
|
|
19
|
+
constructor(amount: uint256, flParamGetterAddr: EthAddress = getAddr('Empty'), flParamGetterData: bytes = []) {
|
|
20
|
+
super(
|
|
21
|
+
'FLAction',
|
|
22
|
+
getAddr('FLAction'),
|
|
23
|
+
['address[]', 'uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes'],
|
|
24
|
+
[[], [amount], [], getAddr('Empty'), flParamGetterAddr, flParamGetterData, []],
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/actions/index.ts
CHANGED
|
@@ -32,6 +32,8 @@ import * as merkl from './merkl';
|
|
|
32
32
|
import * as eulerV2 from './eulerV2';
|
|
33
33
|
import * as sky from './sky';
|
|
34
34
|
import * as stkgho from './stkgho';
|
|
35
|
+
import * as renzo from './renzo';
|
|
36
|
+
import * as etherfi from './etherfi';
|
|
35
37
|
|
|
36
38
|
export {
|
|
37
39
|
aave,
|
|
@@ -68,4 +70,6 @@ export {
|
|
|
68
70
|
eulerV2,
|
|
69
71
|
sky,
|
|
70
72
|
stkgho,
|
|
73
|
+
renzo,
|
|
74
|
+
etherfi,
|
|
71
75
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
import { requireAddress } from '../../utils/general';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* RenzoStakeAction - Supplies ETH (action receives WETH) to Renzo for ETH2 Staking. Receives ezETH in return
|
|
9
|
+
*
|
|
10
|
+
* @category Renzo
|
|
11
|
+
*/
|
|
12
|
+
export class RenzoStakeAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param amount - amount of WETH to pull
|
|
15
|
+
* @param from - address from which to pull WETH from
|
|
16
|
+
* @param to - address where received ezETH will be sent to
|
|
17
|
+
*/
|
|
18
|
+
constructor(amount:uint256, from:EthAddress, to:EthAddress) {
|
|
19
|
+
requireAddress(to);
|
|
20
|
+
super(
|
|
21
|
+
'RenzoStake', getAddr('RenzoStake'), ['uint256', 'address', 'address'], [amount, from, to],
|
|
22
|
+
);
|
|
23
|
+
this.mappableArgs = [
|
|
24
|
+
this.args[0],
|
|
25
|
+
this.args[1],
|
|
26
|
+
this.args[2],
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async getAssetsToApprove() {
|
|
31
|
+
return [{ asset: getAssetInfo('WETH').address, owner: this.args[1] }];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RenzoStakeAction';
|
package/src/addresses.ts
CHANGED
|
@@ -25,6 +25,7 @@ export const actionAddresses = {
|
|
|
25
25
|
PermitToken: '0x2654056046ed5E3f673FbcBC99A1BDB77F5c460B',
|
|
26
26
|
StarknetClaim: '0x40069889098cd54d6c1021578000f37b197479cf',
|
|
27
27
|
HandleAuth: '0xfc2e2b37c73d5d43cf5fcbd80a4049b620d60eba',
|
|
28
|
+
SendTokens: '0x7d05c0ABeF6d91300a237026507c4a2631ddAdEa',
|
|
28
29
|
|
|
29
30
|
// exchange
|
|
30
31
|
DFSSell: '0x901d383c37b30cefad9b6e2bbb0539a40e02c5f4',
|
|
@@ -85,11 +86,11 @@ export const actionAddresses = {
|
|
|
85
86
|
GhoUnstake: '0x3fD02e65B4fb12381946D03815Ff3FF8Ebe2fC63',
|
|
86
87
|
|
|
87
88
|
// LSV action
|
|
88
|
-
LSVWithdraw: '
|
|
89
|
+
LSVWithdraw: '0xB0197CF09cc4c9891B0c2fCbE4AD7323154cA8a5',
|
|
89
90
|
LSVBorrow: '0x7dFB434527Fdb39854156cDBa9bF4799E36E7e82',
|
|
90
|
-
LSVSupply: '
|
|
91
|
+
LSVSupply: '0x17a3e39a1aA6d9BA1Ffd80Ae0E388cA064a8D28F',
|
|
91
92
|
LSVPayback: '0x10749CE97583dBcEb54a083386CC8438C4e0FE65',
|
|
92
|
-
LSVSell: '
|
|
93
|
+
LSVSell: '0xE4D93b8d55D7456e85afc0fcF91AC085aF26bbBA',
|
|
93
94
|
|
|
94
95
|
// morpho aave v2
|
|
95
96
|
MorphoAaveV2Borrow: '0xa85C3E41Bf9F75a381927e1Aa9b00f77C4631109',
|
|
@@ -257,11 +258,15 @@ export const actionAddresses = {
|
|
|
257
258
|
CurveUsdLevCreate: '0xcbd9aFc2b7532b9eeB3A7EC4ea8Bb4320795d9Ad',
|
|
258
259
|
CurveUsdRepay: '0x6F91E8671d17ecEE3D3fb17DcCA87E86B8D83807',
|
|
259
260
|
CurveUsdSwapper: '0xFA8c594b903651F97b27aCADEa83b720cfD7F80b',
|
|
261
|
+
CurveUsdSwapperTransient: '0xcF0298592b8FCB3823d31Bb257b65afFCAcCb8b6',
|
|
260
262
|
CurveUsdSelfLiquidate: '0xd90d8a4955DfE9D4f45F7f60595313B0925ee1da',
|
|
261
263
|
CurveUsdSelfLiquidateWithColl: '0x7cE305FC2A18c6820a533AD418dC0A549aFeDcAF',
|
|
262
264
|
CurveUsdGetDebt: '0x3Bb41d3f300dA758780fe7696bb4fB93cD7172fB',
|
|
263
265
|
CurveUsdCollRatioTrigger: '0xFCc610809b735BB13E583c5E46595457083D2b0c',
|
|
264
266
|
CurveUsdCollRatioCheck: '0x8c65f37ca216de1625886431249be13ead051388',
|
|
267
|
+
CurveUsdSelfLiquidateWithCollTransient: '0x9c41eA5D82AF27Fd436Cd4Cf525808313B35f0D1',
|
|
268
|
+
CurveUsdLevCreateTransient: '0x798eA3B6E1C6210c6594aD5A1dBDA5b6b3347920',
|
|
269
|
+
CurveUsdRepayTransient: '0xa923a9111377F2f8614E8A1287DbC081e23a29b8',
|
|
265
270
|
|
|
266
271
|
MorphoBlueSupply: '0x1D0F6027Eeb118dEc06055735eE840E3Fe3E6f9a',
|
|
267
272
|
MorphoBlueSupplyCollateral: '0x1cdAC5D4b207e8DBd308504BbedD5D1BD19D26ac',
|
|
@@ -295,6 +300,13 @@ export const actionAddresses = {
|
|
|
295
300
|
EulerV2View: '0x8932E46Ecf96b5Fe033F5e27Ab6dC755Cb668967',
|
|
296
301
|
|
|
297
302
|
MerklClaim: '0xE88036F3F0D7e216D63726356cA2bC334e305fe5',
|
|
303
|
+
|
|
304
|
+
RenzoStake: '0x17DCF7132E30a0dC3d515C605E7c3D750c61E73c',
|
|
305
|
+
|
|
306
|
+
// etherFi
|
|
307
|
+
EtherFiStake: '0xcadB650B6a60C89f7847Cba555A7eeCC220EA2e8',
|
|
308
|
+
EtherFiWrap: '0x086464be5c73f66cfbe6b64ec23aa5a86749ef58',
|
|
309
|
+
EtherFiUnwrap: '0x6Eb09948DDf9332d628d156950b9B1C0c091e8D8',
|
|
298
310
|
},
|
|
299
311
|
[NETWORKS.optimism.chainId]: {
|
|
300
312
|
DFSSell: '0x9f234af5c10c136863a20865ba00b26951ab8269',
|
|
@@ -0,0 +1,66 @@
|
|
|
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: EtherFiStakeAction', () => {
|
|
7
|
+
let action;
|
|
8
|
+
const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
|
|
9
|
+
const to = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
|
|
10
|
+
context('Stake 100 WETH tokens without wrapping', () => {
|
|
11
|
+
it('constructor', () => {
|
|
12
|
+
const amount = 100;
|
|
13
|
+
const shouldWrap = false;
|
|
14
|
+
action = new dfs.actions.etherfi.EtherFiStakeAction(
|
|
15
|
+
amount,
|
|
16
|
+
from,
|
|
17
|
+
to,
|
|
18
|
+
shouldWrap,
|
|
19
|
+
);
|
|
20
|
+
assert.equal(action.args[0], amount);
|
|
21
|
+
assert.equal(action.args[1], from);
|
|
22
|
+
assert.equal(action.args[2], to);
|
|
23
|
+
assert.equal(action.args[3], shouldWrap);
|
|
24
|
+
})
|
|
25
|
+
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
26
|
+
it('encodeForRecipe', () => encodeForRecipe(action));
|
|
27
|
+
it('getEthValue', async () => {
|
|
28
|
+
const ethValue = await action.getEthValue();
|
|
29
|
+
assert.equal(ethValue, '0');
|
|
30
|
+
})
|
|
31
|
+
it('getAssetsToApprove', async () => {
|
|
32
|
+
const assetOwnerPairs = await action.getAssetsToApprove();
|
|
33
|
+
assert.lengthOf(assetOwnerPairs, 1);
|
|
34
|
+
assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WETH').address);
|
|
35
|
+
assert.equal(assetOwnerPairs[0].owner, from);
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
context('Stake maxUint256 WETH with wrapping', () => {
|
|
39
|
+
it('constructor', () => {
|
|
40
|
+
const amount = '115792089237316195423570985008687907853269984665640564039457584007913129639935';
|
|
41
|
+
const shouldWrap = true;
|
|
42
|
+
action = new dfs.actions.etherfi.EtherFiStakeAction(
|
|
43
|
+
amount,
|
|
44
|
+
from,
|
|
45
|
+
to,
|
|
46
|
+
shouldWrap,
|
|
47
|
+
);
|
|
48
|
+
assert.equal(action.args[0], amount);
|
|
49
|
+
assert.equal(action.args[1], from);
|
|
50
|
+
assert.equal(action.args[2], to);
|
|
51
|
+
assert.equal(action.args[3], shouldWrap);
|
|
52
|
+
})
|
|
53
|
+
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
54
|
+
it('encodeForRecipe', () => encodeForRecipe(action));
|
|
55
|
+
it('getEthValue', async () => {
|
|
56
|
+
const ethValue = await action.getEthValue();
|
|
57
|
+
assert.equal(ethValue, '0');
|
|
58
|
+
})
|
|
59
|
+
it('getAssetsToApprove', async () => {
|
|
60
|
+
const assetOwnerPairs = await action.getAssetsToApprove();
|
|
61
|
+
assert.lengthOf(assetOwnerPairs, 1);
|
|
62
|
+
assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WETH').address);
|
|
63
|
+
assert.equal(assetOwnerPairs[0].owner, from);
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
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: EtherFiUnwrap', () => {
|
|
7
|
+
let action;
|
|
8
|
+
const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
|
|
9
|
+
const to = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
|
|
10
|
+
context('Unwrap 100 weETH tokens', () => {
|
|
11
|
+
it('constructor', () => {
|
|
12
|
+
const amount = 100;
|
|
13
|
+
action = new dfs.actions.etherfi.EtherFiUnwrapAction(
|
|
14
|
+
amount,
|
|
15
|
+
from,
|
|
16
|
+
to,
|
|
17
|
+
);
|
|
18
|
+
assert.equal(action.args[0], amount);
|
|
19
|
+
assert.equal(action.args[1], from);
|
|
20
|
+
assert.equal(action.args[2], to);
|
|
21
|
+
})
|
|
22
|
+
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
23
|
+
it('encodeForRecipe', () => encodeForRecipe(action));
|
|
24
|
+
it('getEthValue', async () => {
|
|
25
|
+
const ethValue = await action.getEthValue();
|
|
26
|
+
assert.equal(ethValue, '0');
|
|
27
|
+
})
|
|
28
|
+
it('getAssetsToApprove', async () => {
|
|
29
|
+
const assetOwnerPairs = await action.getAssetsToApprove();
|
|
30
|
+
assert.lengthOf(assetOwnerPairs, 1);
|
|
31
|
+
assert.equal(assetOwnerPairs[0].asset, getAssetInfo('weETH').address);
|
|
32
|
+
assert.equal(assetOwnerPairs[0].owner, from);
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
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: EtherFiWrap', () => {
|
|
7
|
+
let action;
|
|
8
|
+
const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
|
|
9
|
+
const to = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
|
|
10
|
+
context('Wrap 100 eETH tokens', () => {
|
|
11
|
+
it('constructor', () => {
|
|
12
|
+
const amount = 100;
|
|
13
|
+
action = new dfs.actions.etherfi.EtherFiWrapAction(
|
|
14
|
+
amount,
|
|
15
|
+
from,
|
|
16
|
+
to,
|
|
17
|
+
);
|
|
18
|
+
assert.equal(action.args[0], amount);
|
|
19
|
+
assert.equal(action.args[1], from);
|
|
20
|
+
assert.equal(action.args[2], to);
|
|
21
|
+
})
|
|
22
|
+
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
23
|
+
it('encodeForRecipe', () => encodeForRecipe(action));
|
|
24
|
+
it('getEthValue', async () => {
|
|
25
|
+
const ethValue = await action.getEthValue();
|
|
26
|
+
assert.equal(ethValue, '0');
|
|
27
|
+
})
|
|
28
|
+
it('getAssetsToApprove', async () => {
|
|
29
|
+
const assetOwnerPairs = await action.getAssetsToApprove();
|
|
30
|
+
assert.lengthOf(assetOwnerPairs, 1);
|
|
31
|
+
assert.equal(assetOwnerPairs[0].asset, getAssetInfo('eETH').address);
|
|
32
|
+
assert.equal(assetOwnerPairs[0].owner, from);
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
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: RenzoStakeAction', () => {
|
|
7
|
+
let action;
|
|
8
|
+
const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
|
|
9
|
+
const to = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
|
|
10
|
+
context('Stake 100 WETH tokens without wrapping', () => {
|
|
11
|
+
it('constructor', () => {
|
|
12
|
+
const amount = 100;
|
|
13
|
+
action = new dfs.actions.renzo.RenzoStakeAction(
|
|
14
|
+
amount,
|
|
15
|
+
from,
|
|
16
|
+
to,
|
|
17
|
+
);
|
|
18
|
+
assert.equal(action.args[0], amount);
|
|
19
|
+
assert.equal(action.args[1], from);
|
|
20
|
+
assert.equal(action.args[2], to);
|
|
21
|
+
})
|
|
22
|
+
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
23
|
+
it('encodeForRecipe', () => encodeForRecipe(action));
|
|
24
|
+
it('getEthValue', async () => {
|
|
25
|
+
const ethValue = await action.getEthValue();
|
|
26
|
+
assert.equal(ethValue, '0');
|
|
27
|
+
})
|
|
28
|
+
it('getAssetsToApprove', async () => {
|
|
29
|
+
const assetOwnerPairs = await action.getAssetsToApprove();
|
|
30
|
+
assert.lengthOf(assetOwnerPairs, 1);
|
|
31
|
+
assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WETH').address);
|
|
32
|
+
assert.equal(assetOwnerPairs[0].owner, from);
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
context('Stake maxUint256 WETH with wrapping', () => {
|
|
36
|
+
it('constructor', () => {
|
|
37
|
+
const amount = '115792089237316195423570985008687907853269984665640564039457584007913129639935';
|
|
38
|
+
action = new dfs.actions.renzo.RenzoStakeAction(
|
|
39
|
+
amount,
|
|
40
|
+
from,
|
|
41
|
+
to,
|
|
42
|
+
);
|
|
43
|
+
assert.equal(action.args[0], amount);
|
|
44
|
+
assert.equal(action.args[1], from);
|
|
45
|
+
assert.equal(action.args[2], to);
|
|
46
|
+
})
|
|
47
|
+
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
48
|
+
it('encodeForRecipe', () => encodeForRecipe(action));
|
|
49
|
+
it('getEthValue', async () => {
|
|
50
|
+
const ethValue = await action.getEthValue();
|
|
51
|
+
assert.equal(ethValue, '0');
|
|
52
|
+
})
|
|
53
|
+
it('getAssetsToApprove', async () => {
|
|
54
|
+
const assetOwnerPairs = await action.getAssetsToApprove();
|
|
55
|
+
assert.lengthOf(assetOwnerPairs, 1);
|
|
56
|
+
assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WETH').address);
|
|
57
|
+
assert.equal(assetOwnerPairs[0].owner, from);
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
})
|