Skip to content

Commit 1ecb3b7

Browse files
authored
addition token holding by the protocol (DefiLlama#14276)
1 parent b0dd7b4 commit 1ecb3b7

File tree

1 file changed

+46
-22
lines changed

1 file changed

+46
-22
lines changed

projects/reservoir-protocol/index.js

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,53 @@
11
const ADDRESSES = require('../helper/coreAssets.json')
22

33
const config = {
4-
ethereum: [
5-
// https://docs.reservoir.xyz/products/proof-of-reserves
6-
'0x0c7e4342534e6e8783311dCF17828a2aa0951CC7',
7-
'0x9BB2c38F57883E5285b7c296c66B9eEA4769eF80',
8-
'0x99A95a9E38e927486fC878f41Ff8b118Eb632b10',
9-
'0xE45321525c85fcc418C88E606B96daD8cBcc047f',
10-
'0x841DB2cA7E8A8C2fb06128e8c58AA162de0CfCbC',
11-
// '0x31Eae643b679A84b37E3d0B4Bd4f5dA90fB04a61', - exluded RUSD because it is project's own token
12-
]
4+
ethereum: [
5+
// https://docs.reservoir.xyz/products/proof-of-reserves
6+
'0x0c7e4342534e6e8783311dCF17828a2aa0951CC7',
7+
'0x9BB2c38F57883E5285b7c296c66B9eEA4769eF80',
8+
'0x99A95a9E38e927486fC878f41Ff8b118Eb632b10',
9+
'0xE45321525c85fcc418C88E606B96daD8cBcc047f',
10+
'0x841DB2cA7E8A8C2fb06128e8c58AA162de0CfCbC',
11+
'0x99E8903bdEFB9e44cd6A24B7f6F97dDd071549bc'
12+
// '0x31Eae643b679A84b37E3d0B4Bd4f5dA90fB04a61', - exluded RUSD because it is project's own token
13+
]
1314
}
1415

1516
Object.keys(config).forEach(chain => {
16-
const funds = config[chain]
17-
module.exports[chain] = {
18-
tvl: async (api) => {
19-
const tokens = await api.multiCall({ abi: 'address:underlying', calls: funds })
20-
const bals = await api.multiCall({ abi: 'uint256:totalValue', calls: funds })
21-
const decimals = await api.multiCall({ abi: 'uint8:decimals', calls: tokens })
22-
bals.forEach((v, i) => bals[i] = v * 10 ** (decimals[i] - 18))
23-
api.add(tokens, bals)
24-
return api.sumTokens({
25-
owner: '0x4809010926aec940b550D34a46A52739f996D75D', token: ADDRESSES.ethereum.USDC
26-
})
17+
if (chain === 'berachain') {
18+
const lpToken = '0xbbB228B0D7D83F86e23a5eF3B1007D0100581613';
19+
const honeyToken = '0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce';
20+
const byusdToken = '0x688e72142674041f8f6af4c808a4045ca1d6ac82';
21+
22+
const owner = '0x0db79c0770E1C647b8Bb76D94C22420fAA7Ac181';
23+
24+
module.exports[chain] = {
25+
tvl: async (api) => {
26+
const lpBalance = await api.call({ abi: 'address:balanceOf', target: lpToken, params: owner })
27+
const honeyBalance = await api.call({ abi: 'address:balanceOf', target: honeyToken, params: owner })
28+
const byusdBalance = await api.call({ abi: 'address:balanceOf', target: byusdToken, params: owner })
29+
30+
api.add(lpToken, lpBalance);
31+
api.add(honeyToken, honeyBalance)
32+
api.add(byusdToken, byusdBalance)
33+
34+
return api.getBalances()
35+
}
36+
}
37+
}
38+
else if (chain === 'ethereum') {
39+
const funds = config[chain]
40+
module.exports[chain] = {
41+
tvl: async (api) => {
42+
const tokens = await api.multiCall({ abi: 'address:underlying', calls: funds })
43+
const bals = await api.multiCall({ abi: 'uint256:totalValue', calls: funds })
44+
const decimals = await api.multiCall({ abi: 'uint8:decimals', calls: tokens })
45+
bals.forEach((v, i) => bals[i] = v * 10 ** (decimals[i] - 18))
46+
api.add(tokens, bals)
47+
return api.sumTokens({
48+
owner: '0x4809010926aec940b550D34a46A52739f996D75D', token: ADDRESSES.ethereum.USDC
49+
})
50+
}
51+
}
2752
}
28-
}
29-
})
53+
})

0 commit comments

Comments
 (0)