Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update StakeStone Berachain Vault #13005

Merged
merged 4 commits into from
Jan 8, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions projects/stakestone-berastone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ const vaultABI = {
"assetsBorrowed": "function assetsBorrowed() external view returns (uint256)"
}

const Vault = '0x8f88aE3798E8fF3D0e0DE7465A0863C9bbB577f0';
const ETHVault = '0x8f88aE3798E8fF3D0e0DE7465A0863C9bbB577f0';
const BTCVault = '0xf401Cc9f467c7046796D9A8b44b0c1348b4DEec7';

const Tvl = async (api) => {
const usedTVL = await api.call({ abi: vaultABI.assetsBorrowed, target: Vault })
const tvl = async (api) => {
// to include assets moved to boyco vault
const usedTVL = await api.call({ abi: vaultABI.assetsBorrowed, target: ETHVault })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the vault has WETH & STONE, which asset will be moved to boyco vault?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both. When weth and stone are moved to boyco, assetsBorrowed will increase, and stone is calculated according to the exchange rate

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, counting it as stone to be safe. We are excluding STONE & SBTC value here from parent tvl (as backing of these are already counted as tvl under other sublistings)

api.add(ADDRESSES.ethereum.WETH, usedTVL);

const underlyings = await api.call({ abi: vaultABI.getUnderlyings, target: Vault })
return api.sumTokens({ owner: Vault, tokens: underlyings })
const vaults = [ETHVault, BTCVault];
const tokens = await api.multiCall({ abi: vaultABI.getUnderlyings, calls: vaults})
return api.sumTokens({ ownerTokens: tokens.map((t, i) => [t, vaults[i]]) })
}

module.exports = {
doublecounted: true,
ethereum: {
tvl: Tvl,
tvl,
}
}
}
Loading