AntarcticHistoricalContextStore
Documentation for eth_defi.erc_4626.vault_protocol.antarctic.historical_context.AntarcticHistoricalContextStore Python class.
- class AntarcticHistoricalContextStore
Bases:
contextlib.AbstractContextManagerPersist exact settlement history and successful range cursors.
File-backed bulk tables intentionally have no ART primary/unique indexes. A complete overlap replacement removes orphaned logs, including removed-only reorgs. Pending price repairs survive a subsequent writer failure.
Open the shared store without altering foreign protocol tables.
- Parameters
path – Shared context DuckDB path.
- Returns
None.
Methods summary
__init__(path)Open the shared store without altering foreign protocol tables.
acknowledge_repair(address, end_block)Clear a pending repair after a successful complete price rewrite.
fetch_cursor(address)Read successful range coverage and outstanding price repair.
iter_settlements(address, start_block, ...)Yield exact source records or one canonical subscription per block.
replace_range(address, start_block, ...)Commit a complete source range and cursor transactionally.
- __init__(path)
Open the shared store without altering foreign protocol tables.
- Parameters
path (pathlib.Path) – Shared context DuckDB path.
- Returns
None.
- Return type
None
- fetch_cursor(address)
Read successful range coverage and outstanding price repair.
Empty successful ranges have cursors too, avoiding repeated full scans.
- Parameters
address (eth_typing.evm.HexAddress) – Reviewed LP token address.
- Returns
Exclusive completed block and earliest pending price repair.
- Return type
- replace_range(address, start_block, end_block, observations)
Commit a complete source range and cursor transactionally.
Hash joins compare exact staged records before replacing the target interval. All validation completes before changing persistent tables.
- Parameters
address (eth_typing.evm.HexAddress) – LP identity to replace, never a chain-wide scope.
start_block (int) – Inclusive complete source boundary.
end_block (int) – Exclusive complete source boundary.
observations (collections.abc.Iterator[eth_defi.erc_4626.vault_protocol.antarctic.historical_context.AntarcticSettlement]) – Decoded, timestamp-resolved settlements.
- Returns
Fetched and inserted/replaced counts.
- Return type
- acknowledge_repair(address, end_block)
Clear a pending repair after a successful complete price rewrite.
The caller must have written the pool through its completed source end.
- Parameters
address (eth_typing.evm.HexAddress) – LP token whose price rewrite succeeded.
end_block (int) – Exclusive successful price writer boundary.
- Returns
None.
- Return type
None
- iter_settlements(address, start_block, end_block, *, canonical_only=False)
Yield exact source records or one canonical subscription per block.
Raw context retains every event; common price storage collapses a block to the last canonical log, deterministically.
- Parameters
address (eth_typing.evm.HexAddress) – LP token identity.
start_block (int) – Inclusive range boundary.
end_block (int) – Exclusive range boundary.
canonical_only (bool) – Select last AddLiquidity per block when true.
- Returns
Ordered immutable source records.
- Return type
collections.abc.Iterator[eth_defi.erc_4626.vault_protocol.antarctic.historical_context.AntarcticSettlement]