Skip to content

Commit c193df2

Browse files
authored
add new base pools (#15564)
1 parent cefe34b commit c193df2

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

projects/zyfai/base.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ const MORPHO_POOL_ADDRESSES = {
1010
const SPARK_POOL_ADDRESSES = {
1111
'USDC': '0x3128a0F7f0ea68E7B7c9B00AFa7E41045828e858'
1212
};
13+
const COMPOUND_TOKEN_ADDRESS = '0xb125E6687d4313864e53df431d5425969c15Eb2F';
14+
15+
const MOONWELL_POOL_ADDRESSES = {
16+
'Moonwell Flagship USDC': '0xc1256Ae5FF1cf2719D4937adb3bbCCab2E00A2Ca',
17+
'USDC': '0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22'
18+
};
19+
20+
async function compoundTvl(api, owners) {
21+
const balanceCalls = owners.map(owner => ({ target: COMPOUND_TOKEN_ADDRESS, params: [owner] }));
22+
const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCalls });
23+
const total = balances.reduce((sum, bal) => sum + Number(bal) / 1e6, 0);
24+
api.add(COMPOUND_TOKEN_ADDRESS, total);
25+
}
26+
27+
async function moonwellTvl(api, owners) {
28+
const moonwellPools = Object.values(MOONWELL_POOL_ADDRESSES);
29+
const balanceCalls = moonwellPools.flatMap(pool => owners.map(owner => ({ target: pool, params: [owner] })));
30+
const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCalls });
31+
balances.forEach((balance, i) => {
32+
api.add(balanceCalls[i].target, balance);
33+
});
34+
}
1335

1436
async function aaveTvl(api, owners) {
1537
const balanceCalls = owners.map(owner => ({ target: AAVE_TOKEN_ADDRESS, params: [owner] }));
@@ -49,5 +71,7 @@ module.exports = {
4971
aaveTvl,
5072
fluidTvl,
5173
morphoTvl,
52-
sparkTvl
74+
sparkTvl,
75+
compoundTvl,
76+
moonwellTvl
5377
};

projects/zyfai/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { siloTvl, aaveTvl, eulerTvl, pendleTvl, beetsTvl, penpieTvl, yieldfiTvl } = require('./helpers');
2-
const { aaveTvl: aaveTvlBase, fluidTvl, morphoTvl, sparkTvl } = require('./base');
2+
const { aaveTvl: aaveTvlBase, fluidTvl, morphoTvl, sparkTvl, compoundTvl, moonwellTvl } = require('./base');
33
const { get } = require('../helper/http');
44

55
async function sonicTvl(api) {
@@ -23,7 +23,9 @@ async function baseTvl(api) {
2323
aaveTvlBase(api, owners),
2424
fluidTvl(api, owners),
2525
morphoTvl(api, owners),
26-
sparkTvl(api, owners)
26+
sparkTvl(api, owners),
27+
compoundTvl(api, owners),
28+
moonwellTvl(api, owners)
2729
]);
2830
}
2931

0 commit comments

Comments
 (0)