Output
dex.common.v1.DexOutputcoinranking_uniswap_v3
Package ref
coinranking-uniswap-v3@v0.2.0Run package
CLI
Run map_uniswap_ticker_output from the command line.
substreams run coinranking-uniswap-v3@v0.2.0 map_uniswap_ticker_output -e mainnetsubstreams auth or directly on thegraph.market (see docs).README
Uniswap V3 Block-Aggregated Swap Data Substream
Real-time block-aggregated swap data for Uniswap V3 pools on Ethereum mainnet.
Features
- Tracks pool creation events with token addresses and decimals
- Aggregates all swaps per pool per block
- Provides closing prices and swap counts
- Stateless design with no persistent stores
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 (token1/token0 ratio)
- Block number and timestamp
Usage
substreams run coinranking-uniswap-v3-v0.2.0.spkg map_uniswap_ticker_output \
--substreams-api-token="YOUR_TOKEN" \
--substreams-endpoint="mainnet.eth.streamingfast.io:443" \
-s 12345678 # Start from any block
Notes
- Prices are calculated from sqrtPriceX96 format to standard ratio
- All Ethereum addresses include the
0xprefix - No stores or state management - purely block-level aggregation
- Downstream systems handle rolling window calculations
Changelog
v0.2.0
- BREAKING: Removed 24-hour rolling volume calculations and all stores
- Simplified to stateless block-aggregated output only
- Removed
volume_24h_token0andvolume_24h_token1fields from output - Eliminated store size limitations and potential isolation issues
- Simplified codebase structure - all logic now in single
lib.rsfile
v0.1.2
- Fixed critical bug where negative volumes could occur during the first 24 hours of processing
- Added proper guard to prevent volume eviction before 24 hours of data has accumulated
- This ensures each period's volume is added exactly once and subtracted exactly once
Modules
Execution graph
Show 3 dependencies
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 ```
Output
uniswap.types.v1.EventsThis 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 ```
Output
uniswap.types.v1.PoolsThis module stores the Pools emitted by the `map_pools_created` module. Dynamic data sources pattern for Uniswap v3 pools.
Store value
proto:uniswap.types.v1.PoolUpdate policy
set