Showcase Uniswap v4 on Base · powered by Substreams

Pools & swaps, accessible in minutes

Decode PoolManager + PositionManager events with Substreams, land them in ClickHouse, and serve apps with Hasura GraphQL — no business state in WASM.

One Substreams pipeline

Fixed PoolManager + PositionManager only — no dynamic pool contracts, no stores for Tier A+B.

1

Substreams extract

Address-gated decode of Initialize, Swap, ModifyLiquidity, and Position NFT Transfer logs. Output: typed protobuf events.

2

Substreams sink

substreams sink clickhouse inserts events. SQL views project api_pools, api_swaps, positions, tokens.

3

Serve with Hasura

Hasura tracks public api_* views over ClickHouse and exposes GraphQL — with Console for exploring pools and swaps live.

Substreams at the center

Same sg2ss rules as other packages: events in WASM, HOL in the database, GraphQL as a read-only serving layer.

No pool template store

V4 pools are not separate contracts — all pool logs come from one PoolManager. Identity is bytes32 pool id, not a cloned address.

Address-gated PositionManager

ERC-721 Transfer is generic — only PositionManager is decoded so tables stay clean.

You control the database

ClickHouse is yours: indexes, partitions, and query plans. Hasura only tracks views you choose. Optional hosted sink from StreamingFast if you do not want to run the sink yourself.

Query pools with GraphQL

After the sink has data and views are tracked, open pools are one GraphQL request away.

GraphQL
query OpenPools {
  uniswap_v4_api_pools(limit: 5) {
    pool_id
    token0
    token1
    fee
    tick
    liquidity
    swap_count
  }
}
curl
curl -s http://localhost:8080/v1/graphql \
-H 'content-type: application/json' \
-H 'x-hasura-admin-secret: SecureMe!' \
-d '{"query":"{ uniswap_v4_api_pools(limit: 5) { pool_id token0 token1 fee tick liquidity swap_count } }"}'

Run the Substreams package

Install the Substreams CLI. Package source: uniswap-v4-substreams@v0.1.0. Local stack: Docker Compose for ClickHouse + Hasura.

Prefer not to run the sink yourself?

StreamingFast can host Substreams for you against your ClickHouse or Postgres.

Hosted sinks docs → · StreamingFast Portal →

Terminal
# clone chain-modules, then enter the package
git clone https://github.com/streamingfast/substreams-chain-modules.git
cd substreams-chain-modules/dex/uniswap-v4-substreams

docker compose up -d

# install CLI: https://docs.substreams.dev/how-to-guides/installing-the-cli
substreams sink clickhouse ./substreams.yaml \
  --dsn "clickhouse://default:SecureMe!@127.0.0.1:9000/uniswap_v4" \
  -s 25350988 --network base \
  --cursor-file-path ./cursor.txt \
  --sink-info-folder ./ch-sink-info

# after tables exist
./scripts/apply_views.sh
./scripts/hasura_connect_clickhouse.sh

Local endpoints

GraphQL · http://localhost:8080/v1/graphql
Console · http://localhost:8080/console · secret SecureMe!
ClickHouse · http://127.0.0.1:8123 · DB uniswap_v4