fetch_vault_balances
Documentation for eth_defi.enzyme.events.fetch_vault_balances function.
- fetch_vault_balances(vault, block_identifier='latest')[source]
Get the live balances of the vault tokens at a specific block.
Does EVM state based reading instead of event based reading.
Gets the total balances of positions held by vault
Does not get shares of individual investors
Warning
Enzyme returns positions with zero balance so you need to filter these out.
Example:
balance_map = {b.token.address: b for b in fetch_vault_balances(vault) if b.balance > 0} assert len(balance_map) == 2 assert balance_map[usdc.address].balance == 1300 assert balance_map[weth.address].balance == pytest.approx(Decimal("0.124500872629987902"))
- Parameters
vault (eth_defi.enzyme.vault.Vault) – Enzyme vault we are interested in
block_identifier – Specific block to query
- Returns
The balances at the current or specific block
- Return type