MidasVaultHistoricalReader

Documentation for eth_defi.midas.historical.MidasVaultHistoricalReader Python class.

class MidasVaultHistoricalReader

Bases: eth_defi.vault.base.VaultHistoricalReader

Read historical supply and NAV/share for Midas products.

Midas does not expose ERC-4626 convertToAssets() or totalAssets(). The canonical on-chain share price is the Midas IDataFeed value exposed through getDataInBase18(). Historical total assets are therefore calculated as totalSupply() * 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

address

first_block

Methods summary

__init__(vault, stateful)

Create a Midas historical reader.

construct_multicalls()

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 Midas getDataInBase18() 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
Returns

VaultHistoricalRead with Midas NAV/share and supply.

Return type

eth_defi.vault.base.VaultHistoricalRead