ERC4626HistoricalReader
Documentation for eth_defi.erc_4626.vault.ERC4626HistoricalReader Python class.
- class ERC4626HistoricalReader
Bases:
eth_defi.vault.base.VaultHistoricalReaderA reader that reads the historcal state of one specific vaults.
Generate a list of multicall instances that is needed to capture the vault state in a specific block height
All calls share the same state object which we use to track disabling reads for inactive vaults
Share price (returns), supply, NAV
For performance fees etc. there are no standards so you need to subclass this for each protocol
All calls for this reader share the same
Attributes summary
addressfirst_blockone_raw_shareMethods summary
__init__(vault, stateful)Polling endpoints defined in ERC-4626 spec.
Get the onchain calls that are needed to read the share price.
dictify_multicall_results(block_number, ...)Convert batch of multicalls made for this vault to more digestible dict.
process_core_erc_4626_result(call_by_name)Decode common ERC-4626 calls.
process_result(block_number, timestamp, ...)Process the result of mult
- __init__(vault, stateful)
- Parameters
vault (eth_defi.erc_4626.vault.ERC4626Vault) –
stateful (bool) –
- construct_multicalls()
Get the onchain calls that are needed to read the share price.
- construct_core_erc_4626_multicall()
Polling endpoints defined in ERC-4626 spec.
Does not include fee calls which do not have standard
- process_core_erc_4626_result(call_by_name)
Decode common ERC-4626 calls.
- Parameters
call_by_name (dict[str, eth_defi.event_reader.multicall_batcher.EncodedCallResult]) –
- Return type
- dictify_multicall_results(block_number, call_results, allow_failure=True)
Convert batch of multicalls made for this vault to more digestible dict.
Assert that all multicalls succeed
- Returns
Dictionary where each multicall is keyed by its
EncodedCall.extra_data["function"]- Parameters
block_number (int) –
call_results (list[eth_defi.event_reader.multicall_batcher.EncodedCallResult]) –
- Return type
dict[str, eth_defi.event_reader.multicall_batcher.EncodedCallResult]
- process_result(block_number, timestamp, call_results)
Process the result of mult
Calls are created in
construct_multicalls()This method combines result of this calls to a easy to manage historical record
VaultHistoricalRead
- Parameters
block_number (int) –
timestamp (datetime.datetime) –
call_results (list[eth_defi.event_reader.multicall_batcher.EncodedCallResult]) –
- Return type