dojo.dataloaders package

Dataloaders load protocol events data for dojo environments.

class dojo.dataloaders.AaveV3Loader(rpc_url: str, chain: Chain, env_name: str, date_range: tuple[datetime, datetime])

Bases: BaseLoader

Class for loading events data from PostgreSQL database.

class dojo.dataloaders.BaseLoader(rpc_url: str, chain: Chain, env_name: str, date_range: tuple[datetime, datetime], **kwargs: Any)

Bases: ABC

Abstract base class for dataloaders.

This class automatically checks that the events data loaded is in the correct format. It also converts addresses to checksum format and dates to UTC timezone.

You can implement your own dataloader by inheriting from this class and overriding the _load_data method. This method should return a list of dictionaries in the formats specified under dojo/dataloaders/formats.py.

class dojo.dataloaders.UniswapV3Loader(rpc_url: str, chain: Chain, env_name: str, date_range: Tuple[datetime, datetime], pools: list[str])

Bases: BaseLoader

Class for loading events data from PostgreSQL database.

Submodules

Load protocol events data from PostgreSQL database.

class dojo.dataloaders.aavev3_loader.AaveV3Loader(rpc_url: str, chain: Chain, env_name: str, date_range: tuple[datetime, datetime])

Bases: BaseLoader

Class for loading events data from PostgreSQL database.

The base dataloader class.

class dojo.dataloaders.base_loader.BaseLoader(rpc_url: str, chain: Chain, env_name: str, date_range: tuple[datetime, datetime], **kwargs: Any)

Bases: ABC

Abstract base class for dataloaders.

This class automatically checks that the events data loaded is in the correct format. It also converts addresses to checksum format and dates to UTC timezone.

You can implement your own dataloader by inheriting from this class and overriding the _load_data method. This method should return a list of dictionaries in the formats specified under dojo/dataloaders/formats.py.

dojo.dataloaders.base_loader.address_to_name(chain: Chain, protocol: str, address: str) str

Convert contract address to name.

Raises:

KeyError – If the address is not found

Event format specifications.

This module specifies the format of events data that is compatible with dojo environments. The data passed to the dataloader should have these formats.

class dojo.dataloaders.formats.Event(date: datetime, block: int, log_index: int, action: str, gas: int, gas_price: int)

Bases: object

Base class for events.

Parameters:
  • date – date of event (datetime)

  • block – block number of event (int)

  • log_index – log index of event (int)

  • action – action type of event (str)

  • gas – gas used for the event (int)

  • gas_price – gas price used for the event (int)

action: str
block: int
date: datetime
gas: int
gas_price: int
log_index: int
class dojo.dataloaders.formats.GMXEvent(date: datetime, block: int, log_index: int, action: str, gas: int, gas_price: int, contract: str, transaction_hash: str, event_data: str, inner_event_name: str, topic1: str | None = None, topic2: str | None = None)

Bases: Event

GMX events.

Relevant values extracted from the deeply nested event data for convenience.

contract: str
event_data: str
inner_event_name: str
topic1: str | None = None
topic2: str | None = None
transaction_hash: str
class dojo.dataloaders.formats.UniswapV3Burn(date: datetime, block: int, log_index: int, action: str, gas: int, gas_price: int, pool: str, quantities: list, tick_range: list, liquidity: int, owner: str)

Bases: UniswapV3Event

Event class for UniswapV3 burns.

Parameters:
  • date – date of event (datetime)

  • block – block number of event (int)

  • log_index – log index of event (int)

  • action – action type of event (str)

  • pool – pool address (str)

  • quantities – token quantities of the burn (list)

  • tick_range – tick range of the burn (list)

  • liquidity – liquidity of the burn (int)

  • owner – owner address of the burn (str)

  • gas – gas used for the event (int)

  • gas_price – gas price used for the event (int)

action: str
block: int
date: datetime
gas: int
gas_price: int
liquidity: int
log_index: int
owner: str
pool: str
quantities: list
tick_range: list
class dojo.dataloaders.formats.UniswapV3Collect(date: datetime, block: int, log_index: int, action: str, gas: int, gas_price: int, pool: str, quantities: list, tick_range: list)

Bases: UniswapV3Event

Event class for UniswapV3 collects.

Parameters:
  • date – date of event (datetime)

  • block – block number of event (int)

  • log_index – log index of event (int)

  • action – action type of event (str)

  • pool – pool address (str)

  • quantities – token quantities of the collect (list)

  • tick_range – tick range of the collect (list)

  • gas – gas used for the event (int)

  • gas_price – gas price used for the event (int)

action: str
block: int
date: datetime
gas: int
gas_price: int
log_index: int
pool: str
quantities: list
tick_range: list
class dojo.dataloaders.formats.UniswapV3Event(date: datetime, block: int, log_index: int, action: str, gas: int, gas_price: int, pool: str)

Bases: Event

Base class for uniswap v3 events.

Parameters:
  • date – date of event (datetime)

  • block – block number of event (int)

  • log_index – log index of event (int)

  • action – action type of event (str)

  • pool – pool address (str)

  • gas – gas used for the event (int)

  • gas_price – gas price used for the event (int)

action: str
block: int
date: datetime
gas: int
gas_price: int
log_index: int
pool: str
class dojo.dataloaders.formats.UniswapV3Initialize(date: datetime, block: int, log_index: int, action: str, gas: int, gas_price: int, pool: str, sqrt_priceX96: int, tick: int)

Bases: UniswapV3Event

Event class for UniswapV3 pool initializations.

Parameters:
  • date – date of event (datetime)

  • block – block number of event (int)

  • log_index – log index of event (int)

  • action – action type of event (str)

  • pool – pool address (str)

  • sqrt_priceX96 – initial sqrt_priceX96 set in the pool by event (int)

  • tick – initial tick set in the pool by event (int)

  • gas – gas used for the event (int)

  • gas_price – gas price used for the event (int)

action: str
block: int
date: datetime
gas: int
gas_price: int
log_index: int
pool: str
sqrt_priceX96: int
tick: int
class dojo.dataloaders.formats.UniswapV3Mint(date: datetime, block: int, log_index: int, action: str, gas: int, gas_price: int, pool: str, quantities: list, tick_range: list, liquidity: int, owner: str)

Bases: UniswapV3Event

Event class for UniswapV3 mints.

Parameters:
  • date – date of event (datetime)

  • block – block number of event (int)

  • log_index – log index of event (int)

  • action – action type of event (str)

  • pool – pool address (str)

  • quantities – token quantities of the mint (list)

  • tick_range – tick range of the mint (list)

  • liquidity – liquidity of the mint (int)

  • owner – owner address of the mint (str)

  • gas – gas used for the event (int)

  • gas_price – gas price used for the event (int)

action: str
block: int
date: datetime
gas: int
gas_price: int
liquidity: int
log_index: int
owner: str
pool: str
quantities: list
tick_range: list
class dojo.dataloaders.formats.UniswapV3Swap(date: datetime, block: int, log_index: int, action: str, gas: int, gas_price: int, pool: str, quantities: list)

Bases: UniswapV3Event

Event class for UniswapV3 swaps.

Parameters:
  • date – date of event (datetime)

  • block – block number of event (int)

  • log_index – log index of event (int)

  • action – action type of event (str)

  • pool – pool address (str)

  • quantities – token quantities of the swap (list)

  • gas – gas used for the event (int)

  • gas_price – gas price used for the event (int)

action: str
block: int
date: datetime
gas: int
gas_price: int
log_index: int
pool: str
quantities: list

Load protocol events data from PostgreSQL database.

class dojo.dataloaders.uniswapV3_loader.UniswapV3Loader(rpc_url: str, chain: Chain, env_name: str, date_range: Tuple[datetime, datetime], pools: list[str])

Bases: BaseLoader

Class for loading events data from PostgreSQL database.