Skip to content

Commit a935364

Browse files
authored
Credit Coop Listing (#16778)
1 parent a25e1f9 commit a935364

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

projects/credit-coop/index.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// projects/credit-coop/index.js
2+
const config = {
3+
ethereum: {
4+
vaults: [
5+
'0x6dACaF632017E2DFc929484606B0feb93088B623'
6+
],
7+
},
8+
base: {
9+
vaults: [
10+
'0x0cf11AC4ea33b6d7274CD7d6e7cEA9f3F65FCf9D',
11+
'0x214699b0ad2e26ffef0247fd0c244bb7fedc85ce',
12+
],
13+
},
14+
}
15+
16+
const abi = {
17+
totalAssets: 'uint256:totalAssets',
18+
asset: 'address:asset',
19+
}
20+
21+
async function tvlEth(api) {
22+
const vaults = config.ethereum.vaults
23+
const tokens = await api.multiCall({ abi: abi.asset, calls: vaults })
24+
const balances = await api.multiCall({
25+
abi: abi.totalAssets,
26+
calls: vaults,
27+
permitFailure: true
28+
})
29+
30+
// multicall sensitive vault
31+
const vault = '0x6C99a74a62Aaf2e6Aa3fF08Ce7661D5C86E01DbC';
32+
const vaultTotal = await api.call({
33+
target: vault,
34+
abi: abi.totalAssets,
35+
});
36+
const vaultAsset = await api.call({
37+
target: vault,
38+
abi: abi.asset,
39+
});
40+
41+
tokens.push(vaultAsset);
42+
balances.push(vaultTotal);
43+
44+
api.add(tokens, balances)
45+
}
46+
47+
async function tvlBase(api) {
48+
const vaults = config.base.vaults
49+
const tokens = await api.multiCall({ abi: abi.asset, calls: vaults })
50+
const balances = await api.multiCall({ abi: abi.totalAssets, calls: vaults })
51+
52+
api.add(tokens, balances)
53+
}
54+
55+
module.exports = {
56+
methodology: 'Sum of ERC-4626 totalAssets() for Credit Coop vaults, valued in their underlying assets.',
57+
ethereum: { tvl: tvlEth },
58+
base: { tvl: tvlBase },
59+
}

0 commit comments

Comments
 (0)