MidasVaultHistoricalReader
Documentation for eth_defi.midas.historical.MidasVaultHistoricalReader Python class.
- class MidasVaultHistoricalReader
Bases:
eth_defi.vault.base.VaultHistoricalReaderRead historical supply and NAV/share for Midas products.
Midas does not expose ERC-4626
convertToAssets()ortotalAssets(). The canonical on-chain share price is the MidasIDataFeedvalue exposed throughgetDataInBase18(). Historical total assets are therefore calculated astotalSupply() * getDataInBase18().Create a Midas historical reader.
- Parameters
vault – Midas vault adapter.
stateful – Whether to attach adaptive reader state used by the shared historical multicaller.
Attributes summary
addressfirst_blockMethods summary
__init__(vault, stateful)Create a Midas historical reader.
Construct Midas historical multicalls.
process_result(block_number, timestamp, ...)Convert Midas multicall results to a vault price row.
- __init__(vault, stateful)
Create a Midas historical reader.
- Parameters
vault (MidasVault) – Midas vault adapter.
stateful (bool) – Whether to attach adaptive reader state used by the shared historical multicaller.
- construct_multicalls()
Construct Midas historical multicalls.
- Returns
Multicall batch reading ERC-20
totalSupply()and MidasgetDataInBase18()NAV/share.- Return type
collections.abc.Iterable[eth_defi.event_reader.multicall_batcher.EncodedCall]
- process_result(block_number, timestamp, call_results)
Convert Midas multicall results to a vault price row.
- Parameters
block_number (int) – Historical block number.
timestamp (datetime.datetime) – Naive UTC block timestamp.
call_results (list[eth_defi.event_reader.multicall_batcher.EncodedCallResult]) – Multicall results for calls from
construct_multicalls().
- Returns
VaultHistoricalReadwith Midas NAV/share and supply.- Return type