MellowVaultHistoricalReader

Documentation for eth_defi.mellow.historical.MellowVaultHistoricalReader Python class.

class MellowVaultHistoricalReader

Bases: eth_defi.vault.base.VaultHistoricalReader

Read the currently supported Mellow historical state.

The reader samples tokenised ShareManager.totalSupply() and the latest Mellow oracle report for the denomination asset. Mellow reports raw shares per raw asset as priceD18; the reader converts it to the shared asset-per-share historical price convention and derives denomination-token TVL as share_price * total_supply.

Create a Mellow historical reader.

Parameters
  • vault – Mellow vault adapter.

  • stateful – Whether to attach adaptive reader state used by the shared historical multicaller.

Attributes summary

address

first_block

share_price_change_threshold

Return this reader's sparse share-price comparison threshold.

uses_contextual_history

Return whether this reader supplies protocol-sourced observations.

uses_share_price_equivalence

Return whether cash flows must be ignored by the sparse filter.

write_all_samples

Retain every successful static Multicall sample, including unchanged NAVs.

Methods summary

__init__(vault, stateful)

Create a Mellow historical reader.

construct_multicalls()

Construct Mellow historical multicalls.

fetch_contextual_historical_reads(...)

Yield protocol-sourced historical rows outside the static call grid.

process_result(block_number, timestamp, ...)

Convert Mellow multicall results to a vault price row.

__init__(vault, stateful)

Create a Mellow historical reader.

Parameters
  • vault (MellowVault) – Mellow vault adapter.

  • stateful (bool) – Whether to attach adaptive reader state used by the shared historical multicaller.

construct_multicalls()

Construct Mellow historical multicalls.

Returns

Multicall batch reading ShareManager.totalSupply(), Oracle.getReport(denomination_token) and FeeManager rates.

Return type

collections.abc.Iterable[eth_defi.event_reader.multicall_batcher.EncodedCall]

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
  • start_block (int) – Inclusive archive block boundary.

  • end_block (int) – Exclusive archive block boundary.

  • step (int) – Approximate block spacing used to downsample source observations.

Returns

Ordinary VaultHistoricalRead rows for the common writer.

Raises

NotImplementedError – If a reader opts into contextual history without implementing it.

Return type

Iterable[eth_defi.vault.base.VaultHistoricalRead]

process_result(block_number, timestamp, call_results)

Convert Mellow multicall results to a vault price row.

Parameters
Returns

VaultHistoricalRead with Mellow share price and supply.

Return type

eth_defi.vault.base.VaultHistoricalRead

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.

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

False for 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

True when the vault carries the share_price_equivalence feature.