Trades

The DEX trades table contains swaps made on decentralized exchanges, consolidated into a single table.

Project Coverage:

Currently, we support the following projects on Base.

ProjectsProtocol

aerodrome

aerodrome_v2

balancer

balancer_v2

kyberswap

kyberswap_elastic

rocketswap, sushiswap, pancakeswap, baseswap

uniswap_v2

baseswap, uniswap, sushiswap

uniswap_v3

Sample Query

Finding the swap volume of indexed projects on Base in the last 7 days.

select 
  date(block_timestamp) as date,
  project, 
  sum(usd_amount) as usd_volume 
from base.dex.trades
  where current_date - date(block_timestamp) < 7
  group by date, project
  order by date desc 

Table Columns

_str columns are numeric fields casted as varchar to retain precision when summing.

Column NameDescriptionExample

project

The project (decentralized exchange) of the liquidity pool that the swap occurred from.

baseswap

protocol

Version of the protocol.

uniswap_v2

liquidity_pool_address

Contract address of the liquidity pool holding the asset. For protocol without the concept of LP such as airswap, this will be null.

0x03dee98d0f3c2810ba39b406f672fa0a555426ea

sender_address

The address of the sender emitted on the swap event logs. This can be a router or pool address, which is different from the transaction initiator transaction_from_address that initiated the swap.

0x327df1e6de05895d2ab08513aadd9313fe505d86

to_address

Address of the recipient emitted on the swap event logs. For example, we use the to_address from the uniswap v2 swap event log and the recipient_address from the uniswap v3 swap event log.

0xb0e66ff71869815f2c2e14af9e039882cf0795ef

token_sold_address

Token address of the token sold.

0x5a22857facec930f46849063229ef7ef035b50a9

token_sold_name

Name of the token sold.

Real Smurf Cat

token_sold_symbol

Symbol of the token sold.

ΡˆΠ°ΠΉΠ»ΡƒΡˆΠ°ΠΉ

token_sold_amount_raw

Raw amount of tokens sold (unnormalized).

246602296359740.0

token_sold_amount_raw_str

Raw amount of tokens sold (unnormalized) in string.

246602296359740

token_sold_amount

Amount of tokens sold.

2466022.9635974

token_sold_amount_str

Amount of tokens sold in string.

2466022.9635974

usd_sold_amount

Amount of token sold in USD value.

nan

token_bought_address

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

0x4200000000000000000000000000000000000006

token_bought_name

Name of the token bought.

Wrapped Ethereum

token_bought_symbol

Symbol of the token bought.

WETH

token_bought_amount_raw

Raw amount of tokens bought (unnormalized).

498652743617853.0

token_bought_amount_raw_str

Raw amount of tokens bought (unnormalized) in string.

498652743617853

token_bought_amount

Amount of tokens bought.

0.000498652743617853

token_bought_amount_str

Amount of tokens bought in string.

0.000498652743617853

usd_bought_amount

Amount of token bought in USD value.

0.8167134096070644

usd_amount

USD value of the swap. This field preferentially selects the USD value of ETH and Stablecoin (USDT/USDC) tokens, as spam token prices may conflate the true swap value.

0.8167134096070644

transaction_from_address

Transaction sender address. I.e. the address of the transaction initiator. (from_address in the raw.transactions field for the transaction_hash of this swap).

0x94729346a21f5bb5c96d877c5d665382892f5f0c

transaction_to_address

Transaction receiver. (to_address in the raw.transactions field for the transaction_hash of this swap).

0xb0e66ff71869815f2c2e14af9e039882cf0795ef

transaction_hash

Transaction hash that this swap belongs to.

0x26279941168244cd15a70b47174d343c19e43d479ac7e3eb9517c3fe09d2a62e

log_index

The position of the swap event log in the transaction.

1278

block_timestamp

Block timestamp of the swap event.

2023-09-16 18:44:29+00:00

block_number

Block number of the swap event.

4050261

block_hash

Block hash of the swap event.

0x0b059eda41bd30bb2c818ac0c9b854a8806d9801f82128f6d5a9b962601fe5da

unique_id

Unique ID of the swap.

txn-0x26279941168244cd15a70b47174d343c19e43d479ac7e3eb9517c3fe09d2a62e_log_index-1278

Last updated