@defisaver/sdk 1.2.10 → 1.2.12-dev-ezeth-weeth

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.
Files changed (31) hide show
  1. package/esm/src/actions/etherfi/EtherFiStakeAction.d.ts +20 -0
  2. package/esm/src/actions/etherfi/EtherFiStakeAction.js +41 -0
  3. package/esm/src/actions/etherfi/EtherFiUnwrapAction.d.ts +19 -0
  4. package/esm/src/actions/etherfi/EtherFiUnwrapAction.js +39 -0
  5. package/esm/src/actions/etherfi/EtherFiWrapAction.d.ts +19 -0
  6. package/esm/src/actions/etherfi/EtherFiWrapAction.js +39 -0
  7. package/esm/src/actions/etherfi/index.d.ts +3 -0
  8. package/esm/src/actions/etherfi/index.js +3 -0
  9. package/esm/src/actions/index.d.ts +3 -1
  10. package/esm/src/actions/index.js +3 -1
  11. package/esm/src/actions/renzo/RenzoStakeAction.d.ts +19 -0
  12. package/esm/src/actions/renzo/RenzoStakeAction.js +39 -0
  13. package/esm/src/actions/renzo/index.d.ts +1 -0
  14. package/esm/src/actions/renzo/index.js +1 -0
  15. package/esm/src/addresses.d.ts +18 -2
  16. package/esm/src/addresses.js +9 -2
  17. package/esm/src/index.d.ts +72 -8
  18. package/package.json +1 -1
  19. package/src/actions/etherfi/EtherFiStakeAction.ts +38 -0
  20. package/src/actions/etherfi/EtherFiUnwrapAction.ts +31 -0
  21. package/src/actions/etherfi/EtherFiWrapAction.ts +36 -0
  22. package/src/actions/etherfi/index.ts +3 -0
  23. package/src/actions/index.ts +4 -0
  24. package/src/actions/renzo/RenzoStakeAction.ts +33 -0
  25. package/src/actions/renzo/index.ts +1 -0
  26. package/src/addresses.ts +11 -2
  27. package/test/actions/etherFi/EtherFiStakeAction.js +66 -0
  28. package/test/actions/etherFi/EtherFiUnwrapAction.js +35 -0
  29. package/test/actions/etherFi/EtherFiWrapAction.js +35 -0
  30. package/test/actions/renzo/RenzoStakeAction.js +60 -0
  31. package/umd/index.js +290 -60
@@ -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,3 @@
1
+ export * from './EtherFiStakeAction';
2
+ export * from './EtherFiWrapAction';
3
+ export * from './EtherFiUnwrapAction';
@@ -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
@@ -89,7 +89,7 @@ export const actionAddresses = {
89
89
  LSVBorrow: '0x7dFB434527Fdb39854156cDBa9bF4799E36E7e82',
90
90
  LSVSupply: '0x984c00DC098c98bed1CDfe2Ed786Fe1443da6671',
91
91
  LSVPayback: '0x10749CE97583dBcEb54a083386CC8438C4e0FE65',
92
- LSVSell: '0x0c1bb9A39d4A0EF4215Ade19Ce4F954E8419Dfd7',
92
+ LSVSell: '0x10B748Dc504C2515Bb6A9e23CB2F686090b6c584',
93
93
 
94
94
  // morpho aave v2
95
95
  MorphoAaveV2Borrow: '0xa85C3E41Bf9F75a381927e1Aa9b00f77C4631109',
@@ -136,7 +136,7 @@ export const actionAddresses = {
136
136
  FLMaker: '0x0f8C3368cADF78167F5355D746Ed7b2A826A6e3b',
137
137
  FLBalancer: '0x93d333930c7f7260a1E6061B0a8C0CbdEC95F367',
138
138
  FLSpark: '0xe9Fe5a0f5e4B370Ae60d837da58744666D5C06F7',
139
- FLAction: '0xC2b92B6c69e5c3b6b29385C1a17FEe906e0CA910',
139
+ FLAction: '0x5f1dC84Ba060Ea3f7429c6A7bBEdd9243CF1209b',
140
140
  FLUniV3: '0x9CAdAC8Be718572F82B672b950c53F0b58483A35',
141
141
  FLGho: '0xbb67b81dD080a406227A38965d0393f396ddECBc',
142
142
  FLMorphoBlue: '0x6206C96EAc5EAC546861438A9f953B6BEa50EBAB',
@@ -295,6 +295,13 @@ export const actionAddresses = {
295
295
  EulerV2View: '0x8932E46Ecf96b5Fe033F5e27Ab6dC755Cb668967',
296
296
 
297
297
  MerklClaim: '0xE88036F3F0D7e216D63726356cA2bC334e305fe5',
298
+
299
+ RenzoStake: '0x1E68038608F181432F666bbD2FB5C5a2E1Bf8fd4',
300
+
301
+ // etherFi
302
+ EtherFiStake: '0x8D9cDA62DC7Bf75f687c6C8729ABB51ac82E20d5',
303
+ EtherFiWrap: '0x2b10B000292745099Deb15304A247c0816bd8b73',
304
+ EtherFiUnwrap: '0xDd5F7bf1009Edc3EE55AfcD70D417968bf4647C6',
298
305
  },
299
306
  [NETWORKS.optimism.chainId]: {
300
307
  DFSSell: '0x9f234af5c10c136863a20865ba00b26951ab8269',
@@ -440,6 +447,8 @@ export const actionAddresses = {
440
447
  PermitToken: '0x57c8ae94a5A11dA33e0518054102488b604628D0',
441
448
  HandleAuth: '0x18a90e6db79199ace00140631ef931e0bd97837c',
442
449
  ToggleSub: '0x5F16C0a08d52b67fc73706c494F7535Dd3382b58',
450
+ CreateSub: '0xeE739937085A716477BCB5b01b0f74e1BE046645',
451
+ UpdateSub: '0x1601c6ABCDE6e6d8Ad96628AFe20d47908127Aea',
443
452
 
444
453
  // Flashloan
445
454
  FLAaveV3: '0x79Eb9cEe432Cd3e7b09A9eFdB21A733A6d7b4c3A',
@@ -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
+ })