FrankencoinHistoricalReader

Documentation for eth_defi.erc_4626.vault_protocol.frankencoin.vault.FrankencoinHistoricalReader Python class.

class FrankencoinHistoricalReader

Bases: eth_defi.erc_4626.vault.ERC4626HistoricalReader

Read Frankencoin savings TVL across the wrapper and savings module.

Frankencoin’s ERC-4626 totalAssets() only reports assets attributed to the svZCHF wrapper inside the savings module. Most savings deposits sit directly in the underlying savings module, outside the ERC-4626 wrapper.

For Trading Strategy vault TVL we treat the savings product as a whole and write ZCHF.balanceOf(savings_module) + ZCHF.balanceOf(svZCHF_wrapper) to total_assets. The share price and total supply still come from the ERC-4626 wrapper, so performance calculations keep using the wrapper’s own exchange rate.

Attributes summary

address

first_block

one_raw_share

Methods summary

__init__(vault, stateful)

construct_core_erc_4626_multicall()

Polling endpoints defined in ERC-4626 spec.

construct_multicalls()

Create calls for Frankencoin historical reads.

construct_savings_balance_multicalls()

Create ZCHF balance calls used to calculate savings product TVL.

dictify_multicall_results(block_number, ...)

Convert batch of multicalls made for this vault to more digestible dict.

get_warmup_calls()

Yield warmup calls for Frankencoin vaults.

process_core_erc_4626_result(call_by_name)

Decode common ERC-4626 calls.

process_result(block_number, timestamp, ...)

Process a Frankencoin historical read result.

process_savings_tvl_result(call_by_name)

Decode Frankencoin savings TVL calls.

should_skip_call(function_name)

Check if a specific function call should be skipped.

get_warmup_calls()

Yield warmup calls for Frankencoin vaults.

Includes the standard ERC-4626 calls plus the ZCHF balances that define the savings product TVL.

Returns

Tuples consumed by the vault warmup scanner.

Return type

collections.abc.Iterable[tuple[str, callable, object]]

construct_multicalls()

Create calls for Frankencoin historical reads.

Returns

Encoded calls for ERC-4626 state and Frankencoin savings TVL.

Return type

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

construct_savings_balance_multicalls()

Create ZCHF balance calls used to calculate savings product TVL.

Returns

Encoded ZCHF balanceOf calls for the savings module and wrapper.

Return type

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

process_savings_tvl_result(call_by_name)

Decode Frankencoin savings TVL calls.

Parameters

call_by_name (dict[str, eth_defi.event_reader.multicall_batcher.EncodedCallResult]) – Multicall results keyed by extra_data["function"].

Returns

(total_assets, errors) where total_assets is denominated in ZCHF.

Return type

tuple[decimal.Decimal | None, list[str]]

process_result(block_number, timestamp, call_results)

Process a Frankencoin historical read result.

Parameters
Returns

Historical row with Frankencoin savings product TVL for canonical wrappers, or regular ERC-4626 wrapper TVL for duplicate wrappers.

Return type

eth_defi.vault.base.VaultHistoricalRead

__init__(vault, stateful)
Parameters
construct_core_erc_4626_multicall()

Polling endpoints defined in ERC-4626 spec.

  • Does not include fee calls which do not have standard

Return type

Iterable[eth_defi.event_reader.multicall_batcher.EncodedCall]

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
Return type

dict[str, eth_defi.event_reader.multicall_batcher.EncodedCallResult]

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

tuple

should_skip_call(function_name)

Check if a specific function call should be skipped.

Uses the reader state’s call_status map if available.

Parameters

function_name (str) – The function name to check

Returns

True if the call should be skipped

Return type

bool