agent0.chainsync.db.hyperdrive.convert_data

Utilities to convert hyperdrive related things to database schema objects.

Functions

convert_checkpoint_events(→ pandas.DataFrame)

Convert hyperdrive trade events to database schema objects.

convert_trade_events(→ pandas.DataFrame)

Convert hyperdrive trade events to database schema objects.

convert_pool_config(...)

Converts a pool_config_dict from a call in hyperdrive_interface to the postgres data type

convert_pool_info(...)

Converts a pool_info_dict from a call in hyperdrive interface to the postgres data type

Module Contents

agent0.chainsync.db.hyperdrive.convert_data.convert_checkpoint_events(events: list[dict[str, Any]]) pandas.DataFrame

Convert hyperdrive trade events to database schema objects.

Parameters:

events (list[dict[str, Any]]) – A list of event dictionary objects from get_logs to insert into postgres.

Returns:

A DataFrame that matches the db schema of checkpoint events.

Return type:

DataFrame

agent0.chainsync.db.hyperdrive.convert_data.convert_trade_events(events: list[dict[str, Any]], wallet_addr: str | None) pandas.DataFrame

Convert hyperdrive trade events to database schema objects.

Parameters:
  • events (list[dict[str, Any]]) – A list of event dictionary objects from get_logs to insert into postgres.

  • wallet_addr (str | None) – The wallet address that events are associated with for transfer events. If None, will assume we want all events to the database.

Returns:

A DataFrame that matches the db schema of trade events.

Return type:

DataFrame

agent0.chainsync.db.hyperdrive.convert_data.convert_pool_config(pool_config_dict: dict[str, Any]) agent0.chainsync.db.hyperdrive.schema.DBPoolConfig

Converts a pool_config_dict from a call in hyperdrive_interface to the postgres data type

Parameters:

pool_config_dict (dict[str, Any]) – A dicitonary containing the required pool_config keys.

Returns:

The db object for pool config

Return type:

PoolConfig

agent0.chainsync.db.hyperdrive.convert_data.convert_pool_info(pool_info_dict: dict[str, Any]) agent0.chainsync.db.hyperdrive.schema.DBPoolInfo

Converts a pool_info_dict from a call in hyperdrive interface to the postgres data type

Parameters:

pool_info_dict (dict[str, Any]) – The dictionary returned from hyperdrive_instance.get_hyperdrive_pool_info

Returns:

The db object for pool info

Return type:

PoolInfo