|
2 | 2 | const ADDRESSES = require("../helper/coreAssets.json");
|
3 | 3 |
|
4 | 4 | const contractAbis = {
|
5 |
| - readOraclePrice: { |
6 |
| - inputs: [], |
7 |
| - name: "read", |
8 |
| - outputs: [ |
9 |
| - { internalType: "int224", name: "value", type: "int224" }, |
10 |
| - { internalType: "uint32", name: "timestamp", type: "uint32" }, |
11 |
| - ], |
12 |
| - stateMutability: "view", |
13 |
| - type: "function", |
14 |
| - }, // |
| 5 | + readOraclePrice: "function read() view returns (int224 value, uint32 timestamp)", |
15 | 6 | balanceOf: "function balanceOf(address) external view returns (uint256)",
|
16 | 7 | getPrice: "function answer() external view returns (uint256)",
|
17 | 8 | getTotalSupply: "function totalSupply() external view returns (uint256)",
|
18 | 9 | getTotalAssets: "function totalAssets() external view returns (uint256)",
|
19 | 10 | getVectorSharePrice: "function getVectorSharePrice() external view returns (uint256)",
|
20 | 11 | getMswEthPrice: "function exchangeRateToNative() external view returns (uint256)",
|
21 | 12 | getMswBalance: "function getAllEigeinPieCycleDepositAmounts() external view returns (uint256)",
|
| 13 | + getUnderlyingPrice: "function getUnderlyingPrice(address cToken) view returns (uint256)", |
22 | 14 | };
|
23 | 15 |
|
24 | 16 | module.exports = {
|
25 | 17 | misrepresentedTokens: true,
|
26 | 18 |
|
| 19 | + mode: { |
| 20 | + tvl: async (api) => { |
| 21 | + const lendingMode = { |
| 22 | + eth: "0x89C133c5e8eD4Cd7CD87A1A00c1e70c13A29b90B", |
| 23 | + }; |
| 24 | + await api.sumTokens({ |
| 25 | + tokensAndOwners: [[ADDRESSES.mode.WETH, lendingMode.eth]], |
| 26 | + }); |
| 27 | + |
| 28 | + const ezETH = { |
| 29 | + vault: "0x497eB27Ca1ed7566653edf811b03d6418a03FC9d", |
| 30 | + reStakingToken: "0x2416092f143378750bb29b79eD961ab195CcEea5", |
| 31 | + oracle: "0x2BAF3A2B667A5027a83101d218A9e8B73577F117", //Renzo |
| 32 | + oracleToken: "0x59e710215d45f584f44c0fee83da6d43d762d857", |
| 33 | + }; |
| 34 | + |
| 35 | + const balOfezETH = await api.call({ |
| 36 | + abi: contractAbis.balanceOf, |
| 37 | + target: ezETH.reStakingToken, |
| 38 | + params: [ezETH.vault], |
| 39 | + }); |
| 40 | + |
| 41 | + const priceOfezETH = await api.call({ |
| 42 | + target: ezETH.oracle, |
| 43 | + abi: contractAbis.getUnderlyingPrice, |
| 44 | + params: [ezETH.oracleToken], |
| 45 | + }); |
| 46 | + |
| 47 | + const ezETHBalInETH = (balOfezETH * priceOfezETH) / 1e18; |
| 48 | + |
| 49 | + api.add(ADDRESSES.mode.WETH, ezETHBalInETH); |
| 50 | + }, |
| 51 | + }, |
| 52 | + |
27 | 53 | ethereum: {
|
28 | 54 | tvl: async (api) => {
|
29 | 55 | const lendingMain = {
|
@@ -181,23 +207,42 @@ module.exports = {
|
181 | 207 | }
|
182 | 208 |
|
183 | 209 | const mswETH = {
|
184 |
| - valut: "0x7c505E03460aEF7FE88e218CC5fcEeCCcA4C4394", |
| 210 | + vault: "0x7c505E03460aEF7FE88e218CC5fcEeCCcA4C4394", |
| 211 | + reStakingToken: "0x32bd822d615A3658A68b6fDD30c2fcb2C996D678", |
| 212 | + }; |
| 213 | + |
| 214 | + const mswETH1x = { |
| 215 | + vault: "0x1100195fbdA2f22AA6f394E6C65f168779Fe572c", |
185 | 216 | reStakingToken: "0x32bd822d615A3658A68b6fDD30c2fcb2C996D678",
|
186 | 217 | };
|
187 | 218 |
|
188 | 219 | const mswETHPrice = await api.call({
|
189 | 220 | abi: contractAbis.getMswEthPrice,
|
190 | 221 | target: mswETH.reStakingToken,
|
191 | 222 | });
|
| 223 | + // mswETH1x |
| 224 | + |
| 225 | + for (const msw of [mswETH, mswETH1x]) { |
| 226 | + if (msw.vault == "0x1100195fbdA2f22AA6f394E6C65f168779Fe572c") { |
| 227 | + const bal = await api.call({ |
| 228 | + abi: contractAbis.balanceOf, |
| 229 | + target: msw.reStakingToken, |
| 230 | + params: [msw.vault], |
| 231 | + }); |
| 232 | + const balInETH = (bal * mswETHPrice) / 1e18; |
| 233 | + api.add(ADDRESSES.ethereum.WETH, balInETH); |
| 234 | + continue; |
| 235 | + } |
192 | 236 |
|
193 |
| - const mswETHBal = await api.call({ |
194 |
| - abi: contractAbis.getMswBalance, |
195 |
| - target: mswETH.valut, |
196 |
| - }); |
| 237 | + const mswETHBal = await api.call({ |
| 238 | + abi: contractAbis.getMswBalance, |
| 239 | + target: msw.vault, |
| 240 | + }); |
197 | 241 |
|
198 |
| - const mswETHBalInETH = (mswETHBal * mswETHPrice) / 1e18; |
| 242 | + const mswETHBalInETH = (mswETHBal * mswETHPrice) / 1e18; |
199 | 243 |
|
200 |
| - api.add(ADDRESSES.ethereum.WETH, mswETHBalInETH); |
| 244 | + api.add(ADDRESSES.ethereum.WETH, mswETHBalInETH); |
| 245 | + } |
201 | 246 | },
|
202 | 247 | },
|
203 | 248 |
|
|
0 commit comments