Package Logo
coinranking_uniswap_v3
coinranking_uniswap_v3@v0.1.1
Total Downloads
5
Published
2 weeks ago
Network
mainnet mainnet
Publisher
User Avatar wouthoekstra

Readme

Uniswap V3 24-Hour Rolling Volume Substream

Real-time 24-hour rolling volume tracking for Uniswap V3 pools on Ethereum mainnet.

Features

  • Tracks pool creation events with token decimals
  • Captures all swap transactions with closing prices
  • Calculates 24-hour rolling volumes using efficient 5-minute aggregation
  • Provides both per-block and 24-hour volume metrics

Output Format

The substream produces DexOutput messages containing:

  • pools_created: New pool deployments with token addresses and decimals
  • tickers: Per-pool metrics including:
    • Block-level volumes for both tokens
    • Swap count
    • Closing price (raw sqrtPriceX96 format)
    • 24-hour rolling volumes

Usage

substreams run coinranking-uniswap-v3-v0.1.0.spkg map_uniswap_ticker_output \
  --substreams-api-token="YOUR_TOKEN" \
  --substreams-endpoint="mainnet.eth.streamingfast.io:443" \
  -s -7500  # Start ~25 hours ago for complete 24h data

Notes

  • Prices are in raw format - apply decimal adjustment using token decimals from pool creation events
  • All Ethereum addresses include the 0x prefix
  • Volume tracking uses a circular buffer for efficient memory usage

Documentation

Modules

Maps icon
Maps

map
map_uniswap_ticker_output

0280a03249d75a00145c0851f61aea2b30756653
map map_uniswap_ticker_output (
blocksf.ethereum.type.v2.Block
store_rolling_deltasGET<add,bigdecimal>
)  -> dex.common.v1.DexOutput
substreams gui coinranking-uniswap-v3@v0.1.1 map_uniswap_ticker_output

map
uniswap:uni_v0_2_9:map_pools_created

3a5e4d92aeccd801140b7a330e3a1c0407bae58d
map uniswap:uni_v0_2_9:map_pools_created (
)  -> uniswap.types.v1.Pools

This module will loop over block transactions and detect pools created events. Once the pool created events have been detected, Pools structs will be emitted out of the module.

Try with

substreams gui substreams.yaml map_pools_created -t +1000
substreams gui coinranking-uniswap-v3@v0.1.1 uniswap:uni_v0_2_9:map_pools_created

map
uniswap:uni_v0_2_9:map_extract_data_types

9daec64c4ffe5d1cb38272f14d656b87928d2e28

Chunky module which emits multiple types of Events. Looping over every transaction to filter out Events. For some events, we have to loop over StorageChanges to be able to fetch certain changes such as liquidity increases and decreases. For more information on what the Event contains, check proto/uniswap/v1/uniswap.proto.

Try with

substreams gui substreams.yaml map_extract_data_types -t +1000
substreams gui coinranking-uniswap-v3@v0.1.1 uniswap:uni_v0_2_9:map_extract_data_types
Stores icon
Stores

store
store_period_volumes

b2dcb755b9edcdbc363d6fe7dadefbdcc2ef4e94
substreams gui coinranking-uniswap-v3@v0.1.1 store_period_volumes

store
store_rolling_deltas

dfab6545769a34231c9c58d3937932b9cd8cc867
substreams gui coinranking-uniswap-v3@v0.1.1 store_rolling_deltas

store
uniswap:uni_v0_2_9:store_pools_created

3ec75d75eea4b8dfd8b515e09dca992a14f059ed
store <set,uniswap.types.v1.Pool> uniswap:uni_v0_2_9:store_pools_created (
)

This module stores the Pools emitted by the map_pools_created module. Dynamic data sources pattern for Uniswap v3 pools.

substreams gui coinranking-uniswap-v3@v0.1.1 uniswap:uni_v0_2_9:store_pools_created
Protobuf

Protobuf Docs Explorer

dex.common.v1
uniswap.types.v1