Catalog · DEX trades

Uniswap trade data

BlockJuice loads Uniswap swaps on Ethereum into a Postgres you run. Each row is one Swap log from a v2, v3 or v4 pool: the token the swapper received, the token they paid, and how much of each.

Coverage

Each source reads only the tokens you list, so the table covers the pools that trade them, not every pool. Amounts are in each token’s base units, with no decimals or prices applied. The zero address in token_bought or token_sold is native ETH. Uniswap on Ethereum is the only DEX the table covers today.

Ethereum

Tables
01
Columns
17

Tables

One Uniswap swap: the token the swapper received and the token they paid, in each token's base units, with no decimals or prices applied. One row per Swap log. Covers Uniswap v2, v3 and v4 on Ethereum, for the pools that trade the tokens you list.

The dex pipeline builds it from the stream sources evm-uniswap-v2, evm-uniswap-v3 and evm-uniswap-v4.

analytics.dex_trades

GrainOne row per Swap log.

id
text
The Swap log's place on its chain, <block>:<logIndex>.
chain
text
ethereum.
protocol
text
uniswap.
version
text
v2, v3 or v4.
pool
text
The pool's address, or its id in v4.
block_number
bigint
The block the swap was in.
block_timestamp
timestamptz
When that block was produced.
tx_hash
text
The transaction the log was in.
log_index
integer
The log's position in the block.
tx_from
text
Who signed the transaction.
sender
text
The pool's own sender field, often a router.
recipient
text
The pool's own recipient field. Null in v4.
hooks
text
The v4 pool's hooks contract. Null in v2 and v3.
token_bought
text
The token the swapper received. The zero address is native ETH.
amount_bought
numeric
How much of it, in base units.
token_sold
text
The token the swapper paid.
amount_sold
numeric
How much of it, in base units.

Query it

select block_timestamp, pool, hooks, token_bought, amount_bought, token_sold, amount_sold
from analytics.dex_trades
where version = 'v4'
order by block_timestamp desc
limit 20

Each row is one Uniswap v4 swap. In v4, pool is the pool’s id and hooks names its hooks contract.

select tx_from, version, pool, amount_sold, token_bought, amount_bought
from analytics.dex_trades
where token_sold = '0x0000000000000000000000000000000000000000'
order by amount_sold desc
limit 20

Each row is one swap paid for in native ETH, largest first. amount_sold is in wei.

Load it

The dex pipeline builds the table on this page.

uv run --project orchestration bj run dex
  1. List the wallets, tokens, feeds and contracts you follow in each source’s addresses.json.
  2. Build the tables with bj run <pipeline>, or turn on the pipeline’s schedule in Dagster to rebuild them each day at 06:00 UTC.
  3. Query the analytics schema in your Postgres with SQL, or ask in plain language with /bj <question>.