erc_4626.vault_protocol.antarctic.historical_contextο
Documentation for eth_defi.erc_4626.vault_protocol.antarctic.historical_context Python module.
Read Antarctic settlements through Hypersync and persist replayable context.
Only subscriptions supply canonical prices. Redemptions retain their execution amounts for diagnostics. Source interfaces: https://arbiscan.io/address/0x98a6aEE58699e4f4E13D8d8d0800e4e9cbBcf8dD#code
Functions
|
Decode a Hypersync log with its verified manager interface. |
|
Prefill selected pools before any common price writer replacement. |
|
Fetch exact settlement observations, with cached source timestamps. |
Return Antarctic's shared historical context path. |
Classes
Persist exact settlement history and successful range cursors. |
|
Summarise a completed context refresh, including pending price repairs. |
|
One settlement with exact execution amounts and source provenance. |
- get_antarctic_historical_context_path()ο
Return Antarcticβs shared historical context path.
Other protocols retain their own tables in this file.
- Returns
Pipeline context DuckDB path.
- Return type
- class AntarcticSettlementο
Bases:
objectOne settlement with exact execution amounts and source provenance.
- pool_address: eth_typing.evm.HexAddressο
LP token identity, not the manager.
- account: eth_typing.evm.HexAddressο
Investor whose settlement was processed.
Raw LP shares; serialised as decimal text in DuckDB.
- property source_id: strο
Identify a log across replay and database imports.
Block hash is compared separately so a reorg can replace a location.
- Returns
Chain, LP token, transaction and log index identity.
- __init__(chain_id, pool_address, block_number, block_hash, block_timestamp, transaction_hash, log_index, kind, account, raw_usdt, raw_shares, raw_tvl, data)ο
- Parameters
chain_id (int) β
pool_address (eth_typing.evm.HexAddress) β
block_number (int) β
block_hash (str) β
block_timestamp (int) β
transaction_hash (str) β
log_index (int) β
kind (str) β
account (eth_typing.evm.HexAddress) β
raw_usdt (int) β
raw_shares (int) β
raw_tvl (int) β
data (str) β
- Return type
None
- class AntarcticPrefillResultο
Bases:
objectSummarise a completed context refresh, including pending price repairs.
- repair_from_blocks: collections.abc.Mapping[eth_typing.evm.HexAddress, int]ο
Earliest outstanding canonical rewrite per selected pool.
- __init__(observations_fetched, observations_inserted, repair_from_blocks)ο
- Parameters
observations_fetched (int) β
observations_inserted (int) β
repair_from_blocks (collections.abc.Mapping[eth_typing.evm.HexAddress, int]) β
- Return type
None
- decode_antarctic_settlement(log, deployment)ο
Decode a Hypersync log with its verified manager interface.
Reject source mismatches and non-positive subscription denominators. Request events are deliberately excluded by the query and are rejected here too.
- Parameters
log (object) β Hypersync log with source fields selected by the collector.
deployment (eth_defi.erc_4626.vault_protocol.antarctic.constants.AntarcticDeployment) β Reviewed manager and LP token routing.
- Returns
Exact settlement, awaiting cached block timestamp resolution.
- Return type
eth_defi.erc_4626.vault_protocol.antarctic.historical_context.AntarcticSettlement
- 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.
- __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]
- fetch_antarctic_settlements(*, hypersync_client, deployment, start_block, end_block, timestamp_cache_path=PosixPath('/home/runner/.tradingstrategy/block-timestamp'))ο
Fetch exact settlement observations, with cached source timestamps.
Uses only indexed Hypersync logs and exact block headers, never eth_getLogs or a dense timestamp backfill. Reorg block hashes come from the source logs.
- Parameters
hypersync_client (eth_defi.hypersync.session.ThrottledHypersyncClient) β Configured Arbitrum client.
deployment (eth_defi.erc_4626.vault_protocol.antarctic.constants.AntarcticDeployment) β Reviewed manager/token routing.
start_block (int) β Inclusive source boundary.
end_block (int) β Exclusive source boundary.
timestamp_cache_path (pathlib.Path) β Persistent per-chain timestamp cache root.
- Returns
Source observations in block/log order.
- Return type
collections.abc.Iterator[eth_defi.erc_4626.vault_protocol.antarctic.historical_context.AntarcticSettlement]
- fetch_and_store_antarctic_history(*, web3, hypersync_client, pool_start_blocks, end_block, context_path, timestamp_cache_path=PosixPath('/home/runner/.tradingstrategy/block-timestamp'), force_backfill=False)ο
Prefill selected pools before any common price writer replacement.
Successful quiet ranges advance independent per-pool cursors. A bounded replay replaces orphaned logs and records repairs until the writer succeeds.
- Parameters
web3 (web3.main.Web3) β Connection used for chain identity only.
hypersync_client (eth_defi.hypersync.session.ThrottledHypersyncClient) β Configured indexed event client.
pool_start_blocks (collections.abc.Mapping[eth_typing.evm.HexAddress, int]) β Selected LP tokens and inclusive source bounds.
end_block (int) β Exclusive reorg-safe scan boundary.
context_path (pathlib.Path) β Shared historical context database.
timestamp_cache_path (pathlib.Path) β Exact-block timestamp cache root.
force_backfill (bool) β Re-read the full requested range regardless of cursor, for an explicit operator migration or a deeper historical repair.
- Returns
Read/write counts and persistent pending repairs.
- Return type
eth_defi.erc_4626.vault_protocol.antarctic.historical_context.AntarcticPrefillResult