enzyme.onyx_historical

Documentation for eth_defi.enzyme.onyx_historical Python module.

Historical price reader for Enzyme Onyx vaults.

Classes

EnzymeVaultHistoricalReader

Read Enzyme Onyx share price, supply, and value-asset TVL.

class EnzymeVaultHistoricalReader

Bases: eth_defi.vault.base.VaultHistoricalReader

Read Enzyme Onyx share price, supply, and value-asset TVL.

The current Onyx sharePrice field and Shares ERC-20 token use 18-decimal fixed-point values. The reader reports the stored share value in the vault’s declared value asset and calculates total value as share_price * total_supply. For the Base USD, BTC and EUR value-asset labels, the adapter deliberately exports these values in USDC, cbBTC and EURC terms respectively so generic lifetime metrics retain an ERC-20 denomination. This is not proof that the mapped token was the active deposit token. Historical deposit and redemption availability is unsupported: Shares delegates these actions to mutable, potentially account-restricted handlers and cannot enumerate those handlers. The reader therefore leaves deposits_open and redemption_open as None rather than deriving them from price or supply observations.

Create a historical reader, optionally with adaptive reader state.

__init__(vault, stateful)

Create a historical reader, optionally with adaptive reader state.

Parameters
construct_multicalls()

Construct calls for the stored share price and ERC-20 supply.

Return type

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

process_result(block_number, timestamp, call_results)

Convert Onyx price and supply calls to a historical vault row.

Update the shared reader state after every usable response. This keeps incremental scans anchored at their previous end block even when an Onyx vault’s reported NAV remains unchanged for a long period.

Parameters
Returns

The decoded price, supply, calculated value-asset TVL, and any per-call failures.

Return type

eth_defi.vault.base.VaultHistoricalRead

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]

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.