DEX Trades

Query DEX swaps volume across multiple blockchain in a single query.

Thecrosschain.dex.trades table aggregates DEX trades indexed by Allium across multiple blockchains (EVM and non-EVM) into a single table.

The crosschain.dex.trades_evm table aggregates DEX trades on EVM-compatible blockchain. This model includes EVM-specific fee details (e.g. priority fees) that are not found on non-EVM chains.

Coverage

This table currently does not contain aggregator swaps to avoid double-counting volume. The dex trades table only contains swap events/instructions from DEXs with liquidity pools/vaults.

For example, suppose a DEX swap was executed by an aggregator (e.g. openocean, 0x) and routed to liquidity pools on Uniswap and Balancer.

In that case, only the volume on Uniswap and Balancer is included in this table.

Sample Query

Query DEX Volume and Users Across Blockchains indexed by Allium in the last 90 days.

select
    date(block_timestamp) as date,
    chain,
    sum(usd_amount) as usd_volume,
    count(distinct transaction_from_address) as traders
from crosschain.dex.trades
where block_timestamp >= current_timestamp - interval '90 days'
group by all

Table Columns

For blockchains (e.g. Solana) that are not EVM-compatible, the additional fields only relevant to these chains (e.g. Signer for Solana) are added and appended at the end of this table.

Column NameDescription

chain

Blockchain where the dex trade was executed.

project

Name of the project e.g. uniswap, balancer, curve, sushiswap, pancakeswap, fraxswap.

protocol

Version of the protocol used e.g. uniswap_v2, uniswap_v3, balancer_v1, balancer_v2, curve_v1, curve_v2

liquidity_pool_address

Contract address of the liquidity pool holding the asset.

sender_address

Address of the sender of the swap event log, which can be the Router.

to_address

Address of the recipient of the swap event.

token_bought_address

Token address of the token bought, i.e. the asset acquired from the trade.

token_bought_name

Name of the token bought.

token_bought_symbol

Symbol of the token bought.

token_sold_address

Address of the token sold.

token_sold_name

Name of the token sold.

token_sold_symbol

Symbol of the token sold.

token_bought_amount_raw

Amount of token bought (not divided by the number of decimals).

token_bought_amount

token_bought_amount_raw divided by the number of decimals of the token.

token_sold_amount_raw

Amount of token sold (not divided by the number of decimals).

token_sold_amount

token_sold_amount_raw divided by the number of decimals of the token.

usd_amount

USD value of the swap.

transaction_from_address

The address of the sending party of this transaction (Signer on Solana).

transaction_to_address

The address of the receiving party of this transaction, which could be a contract address. (Null for Solana)

transaction_hash

Transaction hash of this trade. (txn_id For Solana)

transaction_index

Transaction index of this trade in the block.

log_index

Log index of this trade. (Null for Solana)

block_timestamp

Block timestamp of this trade.

block_number

Block number of this trade. (block_slot for Solana)

block_hash

Block hash of this trade.

unique_id

Unique ID of each trade.

aggregator

(Solana) Aggregator used for the trade. (Only applicable for Solana trades currently).

block_height

(Solana) Block height of the trade.

instruction_index

(Solana) Instruction index of the trade.

signer

(Solana) Signer of the trade.

program_id

(Solana) program_id of the trade.

Last updated