Skip to content

Commit b49fcf1

Browse files
0xMBrog1nt0ki
andauthored
added dex tvl to projects/cybro (DefiLlama#12842)
Co-authored-by: g1nt0ki <[email protected]>
1 parent a20e090 commit b49fcf1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

projects/cybro/index.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,31 @@ const vaults = [
2222
'0x24e72c2c7be9b07942f6f8d3cdce995df699514d',
2323
]
2424

25+
const dexes = [
26+
'0xe9041d3483a760c7d5f8762ad407ac526fbe144f',
27+
'0xbfb18eda8961ee33e38678caf2bceb2d23aedfea',
28+
'0xe472ccb182a51c589034957cd6291d0b64eaaab2',
29+
'0x370498c028564de4491b8aa2df437fb772a39ec5',
30+
'0xc95317e48451a97602e3ae09c237d1dd8ee83cd0',
31+
'0x66e1bea0a5a934b96e2d7d54eddd6580c485521b',
32+
]
33+
2534
async function tvl(api) {
26-
return api.erc4626Sum2({ calls: vaults })
35+
const token0s = await api.multiCall({ abi: 'address:token0', calls: dexes})
36+
const token1s = await api.multiCall({ abi: 'address:token1', calls: dexes})
37+
const positionData = await api.multiCall({ abi: 'function getPositionAmounts() view returns (uint256 amount0, uint256 amount1)', calls: dexes})
38+
const ownerTokens = []
39+
dexes.forEach((dex, idx) => {
40+
const token0 = token0s[idx]
41+
const token1 = token1s[idx]
42+
const { amount0, amount1 } = positionData[idx]
43+
api.add(token0, amount0)
44+
api.add(token1, amount1)
45+
ownerTokens.push([[token0, token1], dex])
46+
})
47+
48+
await api.sumTokens({ ownerTokens })
49+
return api.erc4626Sum2({ calls: vaults });
2750
}
2851

2952
module.exports = {

0 commit comments

Comments
 (0)