agent0.chainsync.exec.acquire_data

Script to format on-chain hyperdrive pool, config, and transaction data post-processing.

Functions

acquire_data([start_block, lookback_block_limit, ...])

Execute the data acquisition pipeline.

Module Contents

agent0.chainsync.exec.acquire_data.acquire_data(start_block: int = 0, lookback_block_limit: int | None = 3000, interfaces: list[agent0.ethpy.hyperdrive.HyperdriveReadInterface] | None = None, rpc_uri: str | None = None, hyperdrive_addresses: list[eth_typing.ChecksumAddress] | dict[str, eth_typing.ChecksumAddress] | None = None, db_session: sqlalchemy.orm.Session | None = None, postgres_config: agent0.chainsync.PostgresConfig | None = None, backfill=True, backfill_sample_period: int | None = None, backfill_progress_bar: bool = False)

Execute the data acquisition pipeline.

Parameters:
  • start_block (int) – The starting block to filter the query on

  • lookback_block_limit (int, optional) – The maximum number of blocks to look back when filling in missing data. If None, will ignore lookback block limit. Defaults to 3000.

  • interfaces (list[HyperdriveReadInterface] | None, optional) – A collection of Hyperdrive interface objects, each connected to a pool. If not set, will initialize one based on rpc_uri and hyperdrive_address.

  • rpc_uri (str, optional) – The URI for the web3 provider to initialize the interface with. Not used if an interface is provided.

  • hyperdrive_addresses (list[ChecksumAddress] | dict[str, ChecksumAddress] | None, optional) – A collection of Hyperdrive address, each pointing to an initialized pool. Can also be the output of get_hyperdrive_addresses_from_registry, which is a dictionary keyed by a logical name and a value of a hyperdrive address. If it’s a dictionary, will add this mapping to the database. Not used if a list of interfaces is provided.

  • db_session (Session | None) – Session object for connecting to db. If None, will initialize a new session based on postgres_config.

  • postgres_config (PostgresConfig | None = None,) – PostgresConfig for connecting to db. If none, will set from .env.

  • backfill (bool, optional) – If true, will fill in missing pool info data for every backfill_sample_period blocks. Defaults to True.

  • backfill_sample_period (int | None, optional) – The sample frequency when backfilling. If None, will backfill every block.

  • backfill_progress_bar (bool, optional) – If true, will show a progress bar when backfilling. Defaults to False.