enzyme.onyx_historical
Documentation for eth_defi.enzyme.onyx_historical Python module.
Historical price reader for Enzyme Onyx vaults.
Classes
Read Enzyme Onyx share price, supply, and value-asset TVL. |
- class EnzymeVaultHistoricalReader
Bases:
eth_defi.vault.base.VaultHistoricalReaderRead Enzyme Onyx share price, supply, and value-asset TVL.
The current Onyx
sharePricefield 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 asshare_price * total_supply. For the BaseUSD,BTCandEURvalue-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 leavesdeposits_openandredemption_openasNonerather 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
vault (EnzymeVault) –
stateful (bool) –
- construct_multicalls()
Construct calls for the stored share price and ERC-20 supply.
- 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
block_number (int) – Block whose
sharePriceandtotalSupplyresponses are being decoded.timestamp (datetime.datetime) – Naive UTC block timestamp.
call_results (list[eth_defi.event_reader.multicall_batcher.EncodedCallResult]) – Multicall responses for this vault’s price and supply calls.
- Returns
The decoded price, supply, calculated value-asset TVL, and any per-call failures.
- Return type
- 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
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
Falsefor the ordinary static-multicall path.
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.