Skip to content

Commit 1243088

Browse files
authored
Add new berancia vaults (#14877)
1 parent 483c957 commit 1243088

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

projects/berancia/index.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,28 @@ const BERA_KODIAK_VAULTS = [
2828
kodiakIsland: "0x5347e5133b22A680Ee94b7e62803E848F8d8C92e",
2929
token0: "0x7e768f47dfDD5DAe874Aac233f1Bc5817137E453",
3030
token1: "0x982940eBfC5caa2F5b5a82AAc2Dfa99F18BB7dA4"
31+
},
32+
{
33+
address: "0x585ad5BcD7cC28dAdb3BDd79782D14513171f760",
34+
kodiakIsland: "0x9f6cf7aCb2F16f7d906EeeCB0a6020a5Cf91A41d",
35+
token0: "0x6969696969696969696969696969696969696969",
36+
token1: "0xf3530788DEB3d21E8fA2c3CBBF93317FB38a0D3C"
37+
},
38+
]
39+
40+
const BULLA_VAULTS = [
41+
{
42+
address: "0xE5A5Cbc42aE849a3780Ec847184Fd9a7ae3F56A5",
43+
asset: "0xcfFBFD665BEdB19B47837461A5aBf4388C560D35",
44+
token0: "0x6969696969696969696969696969696969696969",
45+
token1: "0xac03CABA51e17c86c921E1f6CBFBdC91F8BB2E6b"
46+
},
47+
// AquaBera vault uses same TVL calculation as bulla vaults
48+
{
49+
address: "0x978A2FfFB70F40Cf9d64755c80a49f177Ff95e18",
50+
asset: "0x04fD6a7B02E2e48caedaD7135420604de5f834f8",
51+
token0: "0x6969696969696969696969696969696969696969",
52+
token1: "0xb2F776e9c1C926C4b2e54182Fac058dA9Af0B6A5"
3153
}
3254
]
3355

@@ -44,6 +66,18 @@ const BURR_BEAR_VAULTS = [
4466
asset: "0xD10E65A5F8cA6f835F2B1832e37cF150fb955f23",
4567
poolId: "0xd10e65a5f8ca6f835f2b1832e37cf150fb955f23000000000000000000000004",
4668
vault: "0xBE09E71BDc7b8a50A05F7291920590505e3C7744"
69+
},
70+
{
71+
address: "0x42dc43875401b2BA1db58be240A06E2e834BA07D",
72+
asset: "0xCbeF1B65399065c2DE2C495971e90466ff38f2d0",
73+
poolId: "0xcbef1b65399065c2de2c495971e90466ff38f2d000000000000000000000001e",
74+
vault: "0xBE09E71BDc7b8a50A05F7291920590505e3C7744"
75+
},
76+
{
77+
address: "0x3960DFdbDb82b67D31CD490aA4d0D7B3DF2087Ea",
78+
asset: "0x2A9EA10b60Ab02e9B8960a08b4996e6Bf5eA5EAb",
79+
poolId: "0x2a9ea10b60ab02e9b8960a08b4996e6bf5ea5eab000000000000000000000162",
80+
vault: "0x4Be03f781C497A489E3cB0287833452cA9B9E80B"
4781
}
4882
]
4983

@@ -71,6 +105,41 @@ async function beraTvl(api) {
71105
api.add(vault.token1, token1Balance)
72106
}
73107

108+
for (const vault of BULLA_VAULTS) {
109+
const vaultBalance = await api.call({
110+
abi: "function totalAssets() view returns (uint256 totalAssets)",
111+
target: vault.address,
112+
})
113+
const totalSupply = await api.call({
114+
abi: "erc20:totalSupply",
115+
target: vault.asset
116+
})
117+
const {total0, total1} = await api.call({
118+
abi: "function getTotalAmounts() view returns (uint256 total0, uint256 total1)",
119+
target: vault.asset
120+
})
121+
const token0AmountRaw = await api.call({
122+
abi: "erc20:balanceOf",
123+
target: vault.token0,
124+
params: [vault.asset]
125+
})
126+
const token1AmountRaw = await api.call({
127+
abi: "erc20:balanceOf",
128+
target: vault.token1,
129+
params: [vault.asset]
130+
})
131+
132+
// Calculate vault assets based on island assets and vault balance
133+
const poolToken0Total = +total0+(+token0AmountRaw)
134+
const poolToken1Total = +total1+(+token1AmountRaw)
135+
const beranciaVaultShares = ((+vaultBalance) / (+totalSupply))
136+
const token0Balance = poolToken0Total * beranciaVaultShares
137+
const token1Balance = poolToken1Total * beranciaVaultShares
138+
139+
api.add(vault.token0, token0Balance)
140+
api.add(vault.token1, token1Balance)
141+
}
142+
74143
for (const vault of BERA_BORROW_VAULTS) {
75144
const vaultBalance = await api.call({
76145
abi: "function totalAssets() view returns (uint256 totalAssets)",

0 commit comments

Comments
 (0)