Skip to content

Commit 57ba1b8

Browse files
0xKMGg1nt0ki
andauthored
add new pools on mode (DefiLlama#9705)
* add new pools on mode * code refactor * fix: msw1x pool calculation --------- Co-authored-by: g1nt0ki <[email protected]>
1 parent a2ae6f1 commit 57ba1b8

File tree

1 file changed

+62
-17
lines changed

1 file changed

+62
-17
lines changed

projects/airpuff/index.js

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,54 @@
22
const ADDRESSES = require("../helper/coreAssets.json");
33

44
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)",
156
balanceOf: "function balanceOf(address) external view returns (uint256)",
167
getPrice: "function answer() external view returns (uint256)",
178
getTotalSupply: "function totalSupply() external view returns (uint256)",
189
getTotalAssets: "function totalAssets() external view returns (uint256)",
1910
getVectorSharePrice: "function getVectorSharePrice() external view returns (uint256)",
2011
getMswEthPrice: "function exchangeRateToNative() external view returns (uint256)",
2112
getMswBalance: "function getAllEigeinPieCycleDepositAmounts() external view returns (uint256)",
13+
getUnderlyingPrice: "function getUnderlyingPrice(address cToken) view returns (uint256)",
2214
};
2315

2416
module.exports = {
2517
misrepresentedTokens: true,
2618

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+
2753
ethereum: {
2854
tvl: async (api) => {
2955
const lendingMain = {
@@ -181,23 +207,42 @@ module.exports = {
181207
}
182208

183209
const mswETH = {
184-
valut: "0x7c505E03460aEF7FE88e218CC5fcEeCCcA4C4394",
210+
vault: "0x7c505E03460aEF7FE88e218CC5fcEeCCcA4C4394",
211+
reStakingToken: "0x32bd822d615A3658A68b6fDD30c2fcb2C996D678",
212+
};
213+
214+
const mswETH1x = {
215+
vault: "0x1100195fbdA2f22AA6f394E6C65f168779Fe572c",
185216
reStakingToken: "0x32bd822d615A3658A68b6fDD30c2fcb2C996D678",
186217
};
187218

188219
const mswETHPrice = await api.call({
189220
abi: contractAbis.getMswEthPrice,
190221
target: mswETH.reStakingToken,
191222
});
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+
}
192236

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+
});
197241

198-
const mswETHBalInETH = (mswETHBal * mswETHPrice) / 1e18;
242+
const mswETHBalInETH = (mswETHBal * mswETHPrice) / 1e18;
199243

200-
api.add(ADDRESSES.ethereum.WETH, mswETHBalInETH);
244+
api.add(ADDRESSES.ethereum.WETH, mswETHBalInETH);
245+
}
201246
},
202247
},
203248

0 commit comments

Comments
 (0)