fetch_and_store_vault_settlements_for_chain

Documentation for eth_defi.erc_4626.settlement_scan.fetch_and_store_vault_settlements_for_chain function.

fetch_and_store_vault_settlements_for_chain(*, vault_db, chain_id, rpc_url, end_block, settlement_db_path=None, supported_features=frozenset({<ERC4626Feature.accountable_like: 'accountable_like'>, <ERC4626Feature.d2_like: 'd2_like'>, <ERC4626Feature.lagoon_like: 'lagoon_like'>, <ERC4626Feature.ember_like: 'ember_like'>}), forced_start_block=None, forced_end_block=None, use_hypersync=None, chunk_size=50000, fail_gracefully=True)

Fetch and store settlement events for one already-scanned chain.

This helper is used by the production scanner loop. It avoids re-reading the vault pickle and raw price parquet by consuming the already-loaded vault metadata and the end block reported by the just-completed chain scan.

Parameters
  • vault_db (eth_defi.vault.vaultdb.VaultDatabase) – Vault metadata database.

  • chain_id (int) – Chain id to scan.

  • rpc_url (str) – JSON-RPC configuration string for the chain.

  • end_block (int) – Latest block reached by the successful chain scan.

  • settlement_db_path (Optional[pathlib.Path]) – Settlement DuckDB path. None uses the default pipeline path.

  • supported_features (Union[set[eth_defi.erc_4626.core.ERC4626Feature], frozenset[eth_defi.erc_4626.core.ERC4626Feature]]) – Protocol feature flags whose event readers are available.

  • forced_start_block (Optional[int]) – Optional inclusive backfill start block.

  • forced_end_block (Optional[int]) – Optional inclusive backfill end block.

  • use_hypersync (Optional[bool]) – Passed to protocol readers. None lets each reader auto-detect.

  • chunk_size (int) – JSON-RPC eth_getLogs chunk size for fallback reads.

  • fail_gracefully (bool) – If True, a failed chain settlement batch is logged and counted without aborting the caller.

Returns

Scan summary.

Return type

eth_defi.erc_4626.settlement_scan.VaultSettlementScanResult