FluidVaultHistoricalReader
Documentation for eth_defi.erc_4626.vault_protocol.fluid.vault.FluidVaultHistoricalReader Python class.
- class FluidVaultHistoricalReader
Bases:
eth_defi.erc_4626.vault.ERC4626HistoricalReaderRead Fluid vault core data + utilisation.
Attributes summary
addressfirst_blockone_raw_shareReturn this reader's sparse share-price comparison threshold.
Return whether this reader supplies protocol-sourced observations.
Return whether cash flows must be ignored by the sparse filter.
write_all_samplesRetain every successful static Multicall sample, including unchanged NAVs.
Methods summary
__init__(vault, stateful)Polling endpoints defined in ERC-4626 spec.
Get the onchain calls that are needed to read the share price.
Add idle assets call for utilisation calculation.
dictify_multicall_results(block_number, ...)Convert batch of multicalls made for this vault to more digestible dict.
Yield protocol-sourced historical rows outside the static call grid.
Yield warmup calls for Fluid vaults.
process_core_erc_4626_result(call_by_name)Decode common ERC-4626 calls.
process_result(block_number, timestamp, ...)Process the result of mult
process_utilisation_result(call_by_name, ...)Decode Fluid utilisation data.
should_skip_call(function_name)Check if a specific function call should be skipped.
- get_warmup_calls()
Yield warmup calls for Fluid vaults.
Includes base ERC-4626 calls plus idle_assets for utilisation.
- construct_multicalls()
Get the onchain calls that are needed to read the share price.
- construct_utilisation_calls()
Add idle assets call for utilisation calculation.
Fluid uses idle assets pattern: asset().balanceOf(vault)
- process_utilisation_result(call_by_name, total_assets)
Decode Fluid utilisation data.
Utilisation = (totalAssets - idle) / totalAssets
- Parameters
call_by_name (dict[str, eth_defi.event_reader.multicall_batcher.EncodedCallResult]) –
total_assets (Optional[decimal.Decimal]) –
- Return type
tuple[decimal.Decimal | None, float | None]
- process_result(block_number, timestamp, call_results)
Process the result of mult
Calls are created in
construct_multicalls()This method combines result of this calls to a easy to manage historical record
VaultHistoricalRead
- Parameters
block_number (int) –
timestamp (datetime.datetime) –
call_results (list[eth_defi.event_reader.multicall_batcher.EncodedCallResult]) –
- Return type
- __init__(vault, stateful)
- Parameters
vault (eth_defi.erc_4626.vault.ERC4626Vault) –
stateful (bool) –
- construct_core_erc_4626_multicall()
Polling endpoints defined in ERC-4626 spec.
Does not include fee calls which do not have standard
- dictify_multicall_results(block_number, call_results, allow_failure=True)
Convert batch of multicalls made for this vault to more digestible dict.
Assert that all multicalls succeed
- Returns
Dictionary where each multicall is keyed by its
EncodedCall.extra_data["function"]- Parameters
block_number (int) –
call_results (list[eth_defi.event_reader.multicall_batcher.EncodedCallResult]) –
- Return type
dict[str, eth_defi.event_reader.multicall_batcher.EncodedCallResult]
- fetch_contextual_historical_reads(start_block, end_block, step)
Yield protocol-sourced historical rows outside the static call grid.
Contextual readers override this method and read an already-prefilled local cache. Network collection belongs before the common price scan.
- Parameters
- Returns
Ordinary
VaultHistoricalReadrows for the common writer.- Raises
NotImplementedError – If a reader opts into contextual history without implementing it.
- Return type
- process_core_erc_4626_result(call_by_name)
Decode common ERC-4626 calls.
- Parameters
call_by_name (dict[str, eth_defi.event_reader.multicall_batcher.EncodedCallResult]) –
- Return type
- property share_price_change_threshold: float
Return this reader’s sparse share-price comparison threshold.
Event-only readers may require every exact price change; ordinary readers retain the existing ten-basis-point suppression threshold.
- Returns
Non-negative relative suppression threshold.
- should_skip_call(function_name)
Check if a specific function call should be skipped.
Uses the reader state’s call_status map if available.
- property uses_contextual_history: bool
Return whether this reader supplies protocol-sourced observations.
Most EVM vaults expose static calldata that the common multicaller can execute on a regular block grid. Protocols such as GMX instead expose sparse value events that are prefetched into a protocol-owned cache.
- Returns
Falsefor the ordinary static-multicall path.
- property uses_share_price_equivalence: bool
Return whether cash flows must be ignored by the sparse filter.
Vault-like products without a standard share-price method can still expose a supply-normalised price equivalent. Their TVL and supply changes must not create false performance observations.
- Returns
Truewhen the vault carries theshare_price_equivalencefeature.