Skip to content

Conversation

@aliberkhsl
Copy link

@aliberkhsl aliberkhsl commented Nov 4, 2025

Changes:

  1. Fixed vault TVL calculations - Replaced direct totalSupply usage with oracle-based pricing for accurate valuations
  2. Refactored vault organization - Split vaults into categories (midasVaults, hyperbeatInfraVaults, morphoVaults) with dedicated oracle mappings
  3. Code cleanup - Removed unused imports and simplified TVL tracking to focus on vault assets

Methodology:

  • Midas Vaults: TVL = totalSupply * exchangeRate from token oracles (lastAnswer())
  • Infrastructure Vaults: TVL = totalSupply * exchangeRate using getRate() oracles
  • Morpho Vaults: TVL = totalAssets() from ERC4626 vaults
  • Maintains proper decimal scaling for 6-decimal tokens (USDC/USDT)

Technical Details:

  • Removed unwrapBeHype() function in favor of standard oracle pricing
  • Split TVL calculation into three specialized functions for better maintainability

@llamabutler
Copy link

The adapter at projects/hyperbeat exports TVL:

hyperliquid               440.51 M

total                    440.51 M 

@llamabutler
Copy link

The adapter at projects/hyperbeat exports TVL:

hyperliquid               355.02 M

total                    355.02 M 

@waynebruce0x
Copy link
Collaborator

Can we please avoid totalSupply and use balanceOf instead

@waynebruce0x waynebruce0x self-assigned this Nov 5, 2025
@aliberkhsl
Copy link
Author

Can we please avoid totalSupply and use balanceOf instead

balanceOf what?

const tvlMidasVaults = async (api) => {
const { midasVaults = {}, midasVaultTokenOracles = {} } = config
const vaultTokens = Object.keys(midasVaults)
const supplies = await api.multiCall({ calls: vaultTokens, abi: 'erc20:totalSupply' })
Copy link
Collaborator

Choose a reason for hiding this comment

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

here can we count the tokens deposited rather than the receipt tokens minted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants