@defisaver/positions-sdk 0.0.16 → 0.0.17

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 (83) hide show
  1. package/cjs/compoundV3/index.d.ts +1 -1
  2. package/cjs/compoundV3/index.js +3 -2
  3. package/cjs/config/contracts.d.ts +72 -184
  4. package/cjs/config/contracts.js +0 -16
  5. package/cjs/helpers/compoundHelpers/index.js +2 -2
  6. package/cjs/markets/curveUsd/index.d.ts +0 -2
  7. package/cjs/markets/curveUsd/index.js +1 -14
  8. package/cjs/types/compound.d.ts +1 -0
  9. package/cjs/types/contracts/generated/index.d.ts +0 -2
  10. package/cjs/types/curveUsd.d.ts +1 -2
  11. package/cjs/types/curveUsd.js +0 -1
  12. package/esm/compoundV3/index.d.ts +1 -1
  13. package/esm/compoundV3/index.js +3 -2
  14. package/esm/config/contracts.d.ts +72 -184
  15. package/esm/config/contracts.js +0 -16
  16. package/esm/helpers/compoundHelpers/index.js +2 -2
  17. package/esm/markets/curveUsd/index.d.ts +0 -2
  18. package/esm/markets/curveUsd/index.js +0 -12
  19. package/esm/types/compound.d.ts +1 -0
  20. package/esm/types/contracts/generated/index.d.ts +0 -2
  21. package/esm/types/curveUsd.d.ts +1 -2
  22. package/esm/types/curveUsd.js +0 -1
  23. package/package.json +40 -40
  24. package/src/aaveV2/index.ts +220 -220
  25. package/src/aaveV3/index.ts +556 -556
  26. package/src/assets/index.ts +60 -60
  27. package/src/chickenBonds/index.ts +123 -123
  28. package/src/compoundV2/index.ts +206 -206
  29. package/src/compoundV3/index.ts +273 -269
  30. package/src/config/contracts.js +651 -651
  31. package/src/constants/index.ts +3 -3
  32. package/src/contracts.ts +100 -100
  33. package/src/curveUsd/index.ts +228 -228
  34. package/src/exchange/index.ts +17 -17
  35. package/src/helpers/aaveHelpers/index.ts +134 -134
  36. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  37. package/src/helpers/compoundHelpers/index.ts +181 -181
  38. package/src/helpers/curveUsdHelpers/index.ts +32 -32
  39. package/src/helpers/index.ts +5 -5
  40. package/src/helpers/makerHelpers/index.ts +94 -94
  41. package/src/helpers/sparkHelpers/index.ts +106 -106
  42. package/src/index.ts +40 -40
  43. package/src/liquity/index.ts +103 -103
  44. package/src/maker/index.ts +101 -101
  45. package/src/markets/aave/index.ts +80 -80
  46. package/src/markets/aave/marketAssets.ts +32 -32
  47. package/src/markets/compound/index.ts +85 -85
  48. package/src/markets/compound/marketsAssets.ts +35 -35
  49. package/src/markets/curveUsd/index.ts +69 -69
  50. package/src/markets/index.ts +3 -3
  51. package/src/markets/spark/index.ts +29 -29
  52. package/src/markets/spark/marketAssets.ts +9 -9
  53. package/src/moneymarket/moneymarketCommonService.ts +75 -75
  54. package/src/morpho/markets.ts +39 -39
  55. package/src/morphoAaveV2/index.ts +254 -254
  56. package/src/morphoAaveV3/index.ts +617 -617
  57. package/src/multicall/index.ts +22 -22
  58. package/src/services/dsrService.ts +15 -15
  59. package/src/services/priceService.ts +21 -21
  60. package/src/services/utils.ts +34 -34
  61. package/src/spark/index.ts +413 -413
  62. package/src/staking/staking.ts +167 -167
  63. package/src/types/aave.ts +256 -256
  64. package/src/types/chickenBonds.ts +45 -45
  65. package/src/types/common.ts +83 -83
  66. package/src/types/compound.ts +122 -121
  67. package/src/types/contracts/generated/index.ts +0 -2
  68. package/src/types/curveUsd.ts +112 -112
  69. package/src/types/index.ts +6 -6
  70. package/src/types/liquity.ts +29 -29
  71. package/src/types/maker.ts +50 -50
  72. package/src/types/spark.ts +106 -106
  73. package/cjs/types/contracts/generated/CrvUSDsfrxETHAmm.d.ts +0 -139
  74. package/cjs/types/contracts/generated/CrvUSDsfrxETHAmm.js +0 -5
  75. package/cjs/types/contracts/generated/CrvUSDsfrxETHController.d.ts +0 -205
  76. package/cjs/types/contracts/generated/CrvUSDsfrxETHController.js +0 -5
  77. package/esm/types/contracts/generated/CrvUSDsfrxETHAmm.d.ts +0 -139
  78. package/esm/types/contracts/generated/CrvUSDsfrxETHAmm.js +0 -4
  79. package/esm/types/contracts/generated/CrvUSDsfrxETHController.d.ts +0 -205
  80. package/esm/types/contracts/generated/CrvUSDsfrxETHController.js +0 -4
  81. package/src/types/contracts/generated/CrvUSDsfrxETHAmm.ts +0 -286
  82. package/src/types/contracts/generated/CrvUSDsfrxETHController.ts +0 -403
  83. package/yarn-error.log +0 -64
@@ -1,168 +1,168 @@
1
- import Dec from 'decimal.js';
2
- import Web3 from 'web3';
3
- import {
4
- CbEthContract, LidoContract, PotContract, REthContract, wstETHContract,
5
- } from '../contracts';
6
- import { MMAssetsData, MMUsedAssets, NetworkNumber } from '../types/common';
7
- import { ContractEventLog } from '../types/contracts/generated/types';
8
- import { BLOCKS_IN_A_YEAR, SECONDS_PER_YEAR, AVG_BLOCK_TIME } from '../constants';
9
- import { multicall } from '../multicall';
10
-
11
- export const getStETHApr = async (web3: Web3, fromBlock = 17900000, blockNumber: 'latest' | number = 'latest') => {
12
- try {
13
- const tokenRebasedEvents: ContractEventLog<{ [key: string]: any }>[] = await LidoContract(web3, NetworkNumber.Eth).getPastEvents('TokenRebased', { fromBlock, toBlock: blockNumber });
14
- tokenRebasedEvents.sort((a, b) => b.blockNumber - a.blockNumber); // sort from highest to lowest block number
15
- const movingAverage = 7;
16
- const aprs = tokenRebasedEvents.slice(0, movingAverage).map(({ returnValues: event }) => {
17
- const preShareRate = new Dec(event.preTotalEther.toString()).div(event.preTotalShares.toString());
18
- const postShareRate = new Dec(event.postTotalEther.toString()).div(event.postTotalShares.toString());
19
- return new Dec(SECONDS_PER_YEAR).mul(new Dec(postShareRate).sub(preShareRate).div(preShareRate))
20
- .div(event.timeElapsed.toString()).mul(100)
21
- .toNumber();
22
- });
23
- return aprs.reduce((a, b) => a + b, 0) / aprs.length;
24
- } catch (e) {
25
- console.warn('Failed to fetch stETH APY from events, falling back to Lido API');
26
- const res = await fetch('https://eth-api.lido.fi/v1/protocol/steth/apr/sma');
27
- const data = await res.json();
28
- return data.data.smaApr;
29
- }
30
- };
31
-
32
-
33
- export const getCbETHApr = async (web3: Web3, blockNumber: 'latest' | number = 'latest') => {
34
- let currentBlock = blockNumber;
35
- if (blockNumber === 'latest') currentBlock = await web3.eth.getBlockNumber();
36
- const blockDiff = 6 * 24 * 60 * 60 / AVG_BLOCK_TIME;
37
- const pastBlock = (currentBlock as number) - blockDiff;
38
- const contract = CbEthContract(web3, NetworkNumber.Eth);
39
- const [pastRate, currentRate] = await Promise.all([
40
- contract.methods.exchangeRate().call({}, pastBlock),
41
- contract.methods.exchangeRate().call({}, currentBlock),
42
- ]);
43
- const apr = new Dec(currentRate.toString()).sub(pastRate.toString()).div(currentRate.toString())
44
- .mul(BLOCKS_IN_A_YEAR / blockDiff)
45
- .mul(100)
46
- .toString();
47
- return apr;
48
- };
49
-
50
-
51
- export const getREthApr = async (web3: Web3, blockNumber: 'latest' | number = 'latest') => {
52
- let currentBlock = blockNumber;
53
- if (blockNumber === 'latest') currentBlock = await web3.eth.getBlockNumber();
54
- const blockDiff = 8 * 24 * 60 * 60 / AVG_BLOCK_TIME;
55
- const pastBlock = (currentBlock as number) - blockDiff;
56
- const contract = REthContract(web3, NetworkNumber.Eth);
57
- const [pastRate, currentRate] = await Promise.all([
58
- contract.methods.getExchangeRate().call({}, pastBlock),
59
- contract.methods.getExchangeRate().call({}, currentBlock),
60
- ]);
61
- const apr = new Dec(currentRate.toString()).sub(pastRate.toString()).div(currentRate.toString())
62
- .mul(BLOCKS_IN_A_YEAR / blockDiff)
63
- .mul(100)
64
- .toString();
65
-
66
- return apr;
67
- };
68
-
69
- export const getDsrApy = async (web3: Web3, blockNumber: 'latest' | number = 'latest') => {
70
- const potContract = PotContract(web3, NetworkNumber.Eth);
71
- return new Dec(await potContract.methods.dsr().call())
72
- .div(new Dec(1e27))
73
- .pow(SECONDS_PER_YEAR)
74
- .sub(1)
75
- .mul(100)
76
- .toString();
77
- };
78
-
79
- export const getStakingApy = (asset: string, web3: Web3, blockNumber: 'latest' | number = 'latest', fromBlock: number | undefined = undefined) => {
80
- if (asset === 'stETH' || asset === 'wstETH') return getStETHApr(web3, fromBlock, blockNumber);
81
- if (asset === 'cbETH') return getCbETHApr(web3, blockNumber);
82
- if (asset === 'rETH') return getREthApr(web3, blockNumber);
83
- if (asset === 'sDAI') return getDsrApy(web3);
84
- };
85
-
86
- export const calculateInterestEarned = (principal: string, interest: string, type: string, apy = false) => {
87
- let interval = 1;
88
-
89
- if (+interest === 0) return 0;
90
-
91
- if (type === 'month') interval = 1 / 12;
92
- if (type === 'week') interval = 1 / 52.1429;
93
-
94
- if (apy) {
95
- // interest rate already compounded
96
- return (+principal * (1 + (+interest / 100 * interval))) - +principal;
97
- }
98
-
99
- return (+principal * (((1 + (+interest / 100) / BLOCKS_IN_A_YEAR)) ** (BLOCKS_IN_A_YEAR * interval))) - +principal; // eslint-disable-line
100
- };
101
-
102
- export const calculateNetApy = (usedAssets: MMUsedAssets, assetsData: MMAssetsData, isMorpho = false) => {
103
- const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
104
- const acc = { ..._acc };
105
- const assetData = assetsData[usedAsset.symbol];
106
-
107
- if (usedAsset.isSupplied) {
108
- const amount = usedAsset.suppliedUsd;
109
- acc.suppliedUsd = new Dec(acc.suppliedUsd).add(amount).toString();
110
- const rate = isMorpho
111
- ? usedAsset.supplyRate === '0' ? assetData.supplyRateP2P : usedAsset.supplyRate
112
- : assetData.supplyRate;
113
- const supplyInterest = calculateInterestEarned(amount, rate as string, 'year', true);
114
- acc.supplyInterest = new Dec(acc.supplyInterest).add(supplyInterest.toString()).toString();
115
- if (assetData.incentiveSupplyApy) {
116
- // take COMP/AAVE yield into account
117
- const incentiveInterest = calculateInterestEarned(amount, assetData.incentiveSupplyApy, 'year', true);
118
- acc.incentiveUsd = new Dec(acc.incentiveUsd).add(incentiveInterest).toString();
119
- }
120
- }
121
-
122
- if (usedAsset.isBorrowed) {
123
- const amount = usedAsset.borrowedUsd;
124
- acc.borrowedUsd = new Dec(acc.borrowedUsd).add(amount).toString();
125
- const rate = isMorpho
126
- ? usedAsset.borrowRate === '0' ? assetData.borrowRateP2P : usedAsset.borrowRate
127
- : usedAsset.symbol === 'GHO'
128
- ? usedAsset.discountedBorrowRate
129
- : (usedAsset?.interestMode === '1' ? usedAsset.stableBorrowRate : assetData.borrowRate);
130
- const borrowInterest = calculateInterestEarned(amount, rate as string, 'year', true);
131
- acc.borrowInterest = new Dec(acc.borrowInterest).sub(borrowInterest.toString()).toString();
132
- if (assetData.incentiveBorrowApy) {
133
- // take COMP/AAVE yield into account
134
- const incentiveInterest = calculateInterestEarned(amount, assetData.incentiveBorrowApy, 'year', true);
135
- acc.incentiveUsd = new Dec(acc.incentiveUsd).add(incentiveInterest).toString();
136
- }
137
- }
138
-
139
- return acc;
140
- }, {
141
- borrowInterest: '0', supplyInterest: '0', incentiveUsd: '0', borrowedUsd: '0', suppliedUsd: '0',
142
- });
143
-
144
- const {
145
- borrowedUsd, suppliedUsd, borrowInterest, supplyInterest, incentiveUsd,
146
- } = sumValues;
147
-
148
- const totalInterestUsd = new Dec(borrowInterest).add(supplyInterest).add(incentiveUsd).toString();
149
- const balance = new Dec(suppliedUsd).sub(borrowedUsd);
150
- const netApy = new Dec(totalInterestUsd).div(balance).times(100).toString();
151
-
152
- return { netApy, totalInterestUsd, incentiveUsd };
153
- };
154
-
155
- export const getWstETHByStETH = async (stETHAmount: string | number, web3: Web3) => wstETHContract(web3, NetworkNumber.Eth).methods.getWstETHByStETH(stETHAmount).call();
156
-
157
- export const getStETHByWstETH = async (wstETHAmount: string | number, web3: Web3) => wstETHContract(web3, NetworkNumber.Eth).methods.getStETHByWstETH(wstETHAmount).call();
158
-
159
- export const getStETHByWstETHMultiple = async (wstEthAmounts: string[] | number[], web3: Web3) => {
160
- const contract = wstETHContract(web3, NetworkNumber.Eth);
161
- const calls = wstEthAmounts.map((amount) => ({
162
- target: contract.options.address,
163
- abiItem: contract.options.jsonInterface.find((i) => i.name === 'getStETHByWstETH'),
164
- params: [amount],
165
- }));
166
- const stEthAmounts = await multicall(calls, web3);
167
- return stEthAmounts.map((arr) => arr[0]);
1
+ import Dec from 'decimal.js';
2
+ import Web3 from 'web3';
3
+ import {
4
+ CbEthContract, LidoContract, PotContract, REthContract, wstETHContract,
5
+ } from '../contracts';
6
+ import { MMAssetsData, MMUsedAssets, NetworkNumber } from '../types/common';
7
+ import { ContractEventLog } from '../types/contracts/generated/types';
8
+ import { BLOCKS_IN_A_YEAR, SECONDS_PER_YEAR, AVG_BLOCK_TIME } from '../constants';
9
+ import { multicall } from '../multicall';
10
+
11
+ export const getStETHApr = async (web3: Web3, fromBlock = 17900000, blockNumber: 'latest' | number = 'latest') => {
12
+ try {
13
+ const tokenRebasedEvents: ContractEventLog<{ [key: string]: any }>[] = await LidoContract(web3, NetworkNumber.Eth).getPastEvents('TokenRebased', { fromBlock, toBlock: blockNumber });
14
+ tokenRebasedEvents.sort((a, b) => b.blockNumber - a.blockNumber); // sort from highest to lowest block number
15
+ const movingAverage = 7;
16
+ const aprs = tokenRebasedEvents.slice(0, movingAverage).map(({ returnValues: event }) => {
17
+ const preShareRate = new Dec(event.preTotalEther.toString()).div(event.preTotalShares.toString());
18
+ const postShareRate = new Dec(event.postTotalEther.toString()).div(event.postTotalShares.toString());
19
+ return new Dec(SECONDS_PER_YEAR).mul(new Dec(postShareRate).sub(preShareRate).div(preShareRate))
20
+ .div(event.timeElapsed.toString()).mul(100)
21
+ .toNumber();
22
+ });
23
+ return aprs.reduce((a, b) => a + b, 0) / aprs.length;
24
+ } catch (e) {
25
+ console.warn('Failed to fetch stETH APY from events, falling back to Lido API');
26
+ const res = await fetch('https://eth-api.lido.fi/v1/protocol/steth/apr/sma');
27
+ const data = await res.json();
28
+ return data.data.smaApr;
29
+ }
30
+ };
31
+
32
+
33
+ export const getCbETHApr = async (web3: Web3, blockNumber: 'latest' | number = 'latest') => {
34
+ let currentBlock = blockNumber;
35
+ if (blockNumber === 'latest') currentBlock = await web3.eth.getBlockNumber();
36
+ const blockDiff = 6 * 24 * 60 * 60 / AVG_BLOCK_TIME;
37
+ const pastBlock = (currentBlock as number) - blockDiff;
38
+ const contract = CbEthContract(web3, NetworkNumber.Eth);
39
+ const [pastRate, currentRate] = await Promise.all([
40
+ contract.methods.exchangeRate().call({}, pastBlock),
41
+ contract.methods.exchangeRate().call({}, currentBlock),
42
+ ]);
43
+ const apr = new Dec(currentRate.toString()).sub(pastRate.toString()).div(currentRate.toString())
44
+ .mul(BLOCKS_IN_A_YEAR / blockDiff)
45
+ .mul(100)
46
+ .toString();
47
+ return apr;
48
+ };
49
+
50
+
51
+ export const getREthApr = async (web3: Web3, blockNumber: 'latest' | number = 'latest') => {
52
+ let currentBlock = blockNumber;
53
+ if (blockNumber === 'latest') currentBlock = await web3.eth.getBlockNumber();
54
+ const blockDiff = 8 * 24 * 60 * 60 / AVG_BLOCK_TIME;
55
+ const pastBlock = (currentBlock as number) - blockDiff;
56
+ const contract = REthContract(web3, NetworkNumber.Eth);
57
+ const [pastRate, currentRate] = await Promise.all([
58
+ contract.methods.getExchangeRate().call({}, pastBlock),
59
+ contract.methods.getExchangeRate().call({}, currentBlock),
60
+ ]);
61
+ const apr = new Dec(currentRate.toString()).sub(pastRate.toString()).div(currentRate.toString())
62
+ .mul(BLOCKS_IN_A_YEAR / blockDiff)
63
+ .mul(100)
64
+ .toString();
65
+
66
+ return apr;
67
+ };
68
+
69
+ export const getDsrApy = async (web3: Web3, blockNumber: 'latest' | number = 'latest') => {
70
+ const potContract = PotContract(web3, NetworkNumber.Eth);
71
+ return new Dec(await potContract.methods.dsr().call())
72
+ .div(new Dec(1e27))
73
+ .pow(SECONDS_PER_YEAR)
74
+ .sub(1)
75
+ .mul(100)
76
+ .toString();
77
+ };
78
+
79
+ export const getStakingApy = (asset: string, web3: Web3, blockNumber: 'latest' | number = 'latest', fromBlock: number | undefined = undefined) => {
80
+ if (asset === 'stETH' || asset === 'wstETH') return getStETHApr(web3, fromBlock, blockNumber);
81
+ if (asset === 'cbETH') return getCbETHApr(web3, blockNumber);
82
+ if (asset === 'rETH') return getREthApr(web3, blockNumber);
83
+ if (asset === 'sDAI') return getDsrApy(web3);
84
+ };
85
+
86
+ export const calculateInterestEarned = (principal: string, interest: string, type: string, apy = false) => {
87
+ let interval = 1;
88
+
89
+ if (+interest === 0) return 0;
90
+
91
+ if (type === 'month') interval = 1 / 12;
92
+ if (type === 'week') interval = 1 / 52.1429;
93
+
94
+ if (apy) {
95
+ // interest rate already compounded
96
+ return (+principal * (1 + (+interest / 100 * interval))) - +principal;
97
+ }
98
+
99
+ return (+principal * (((1 + (+interest / 100) / BLOCKS_IN_A_YEAR)) ** (BLOCKS_IN_A_YEAR * interval))) - +principal; // eslint-disable-line
100
+ };
101
+
102
+ export const calculateNetApy = (usedAssets: MMUsedAssets, assetsData: MMAssetsData, isMorpho = false) => {
103
+ const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
104
+ const acc = { ..._acc };
105
+ const assetData = assetsData[usedAsset.symbol];
106
+
107
+ if (usedAsset.isSupplied) {
108
+ const amount = usedAsset.suppliedUsd;
109
+ acc.suppliedUsd = new Dec(acc.suppliedUsd).add(amount).toString();
110
+ const rate = isMorpho
111
+ ? usedAsset.supplyRate === '0' ? assetData.supplyRateP2P : usedAsset.supplyRate
112
+ : assetData.supplyRate;
113
+ const supplyInterest = calculateInterestEarned(amount, rate as string, 'year', true);
114
+ acc.supplyInterest = new Dec(acc.supplyInterest).add(supplyInterest.toString()).toString();
115
+ if (assetData.incentiveSupplyApy) {
116
+ // take COMP/AAVE yield into account
117
+ const incentiveInterest = calculateInterestEarned(amount, assetData.incentiveSupplyApy, 'year', true);
118
+ acc.incentiveUsd = new Dec(acc.incentiveUsd).add(incentiveInterest).toString();
119
+ }
120
+ }
121
+
122
+ if (usedAsset.isBorrowed) {
123
+ const amount = usedAsset.borrowedUsd;
124
+ acc.borrowedUsd = new Dec(acc.borrowedUsd).add(amount).toString();
125
+ const rate = isMorpho
126
+ ? usedAsset.borrowRate === '0' ? assetData.borrowRateP2P : usedAsset.borrowRate
127
+ : usedAsset.symbol === 'GHO'
128
+ ? usedAsset.discountedBorrowRate
129
+ : (usedAsset?.interestMode === '1' ? usedAsset.stableBorrowRate : assetData.borrowRate);
130
+ const borrowInterest = calculateInterestEarned(amount, rate as string, 'year', true);
131
+ acc.borrowInterest = new Dec(acc.borrowInterest).sub(borrowInterest.toString()).toString();
132
+ if (assetData.incentiveBorrowApy) {
133
+ // take COMP/AAVE yield into account
134
+ const incentiveInterest = calculateInterestEarned(amount, assetData.incentiveBorrowApy, 'year', true);
135
+ acc.incentiveUsd = new Dec(acc.incentiveUsd).add(incentiveInterest).toString();
136
+ }
137
+ }
138
+
139
+ return acc;
140
+ }, {
141
+ borrowInterest: '0', supplyInterest: '0', incentiveUsd: '0', borrowedUsd: '0', suppliedUsd: '0',
142
+ });
143
+
144
+ const {
145
+ borrowedUsd, suppliedUsd, borrowInterest, supplyInterest, incentiveUsd,
146
+ } = sumValues;
147
+
148
+ const totalInterestUsd = new Dec(borrowInterest).add(supplyInterest).add(incentiveUsd).toString();
149
+ const balance = new Dec(suppliedUsd).sub(borrowedUsd);
150
+ const netApy = new Dec(totalInterestUsd).div(balance).times(100).toString();
151
+
152
+ return { netApy, totalInterestUsd, incentiveUsd };
153
+ };
154
+
155
+ export const getWstETHByStETH = async (stETHAmount: string | number, web3: Web3) => wstETHContract(web3, NetworkNumber.Eth).methods.getWstETHByStETH(stETHAmount).call();
156
+
157
+ export const getStETHByWstETH = async (wstETHAmount: string | number, web3: Web3) => wstETHContract(web3, NetworkNumber.Eth).methods.getStETHByWstETH(wstETHAmount).call();
158
+
159
+ export const getStETHByWstETHMultiple = async (wstEthAmounts: string[] | number[], web3: Web3) => {
160
+ const contract = wstETHContract(web3, NetworkNumber.Eth);
161
+ const calls = wstEthAmounts.map((amount) => ({
162
+ target: contract.options.address,
163
+ abiItem: contract.options.jsonInterface.find((i) => i.name === 'getStETHByWstETH'),
164
+ params: [amount],
165
+ }));
166
+ const stEthAmounts = await multicall(calls, web3);
167
+ return stEthAmounts.map((arr) => arr[0]);
168
168
  };