A collection of Substreams packages for tracking real-time, block-aggregated trading data across decentralized exchanges (DEXes).
substreams/
├── proto/ # Common protocol buffer definitions
│ └── dex_common.proto # Universal ticker format for all DEXes
├── common/ # Shared utilities and functions
└── dexes/ # Individual DEX implementations
└── uniswap-v3-forks/ # Universal Uniswap V3 and forks implementation
All DEX packages output the same TickerOutput format defined in proto/dex_common.proto. This universal format ensures:
- Consistent data structure across ALL DEX types (V2, V3, Curve, etc.)
- Easy aggregation of volumes across multiple DEXes
- Unified downstream data pipelines
- Simple integration of new DEXes
The ticker format provides block-aggregated data including:
- Token volumes (raw units as integers)
- Swap counts
- sqrtPriceX96 (raw price data - clients must calculate actual price)
- Block number and timestamp
Note: All numerical values (volumes, prices) are provided as raw blockchain values. Clients must apply decimal adjustments and price calculations based on token decimals.
- ✅ Uniswap V3 and all forks - Universal implementation working on:
- Uniswap V3 (Ethereum, Polygon, Arbitrum, Optimism, Base, etc.)
- QuickSwap V3 (Polygon)
- PancakeSwap V3 (BSC, Ethereum, Arbitrum)
- SushiSwap V3
- Any other V3 fork
- 🔜 Uniswap V2 and forks (PancakeSwap V2, SushiSwap V2, etc.)
- 🔜 Curve Finance
- 🔜 Balancer
- 🔜 Other AMM protocols
- Real-time block data: Aggregated swap activity per block
- Chain-agnostic: Works on any EVM-compatible blockchain
- DEX-agnostic: Universal output format across all DEX types
- Stateless design: No complex state management required
- Raw volume data: Volumes in token units for accurate calculations
Each DEX package is self-contained with:
- Cargo.toml configuration
- Substreams manifest (substreams.yaml)
- Test scripts
- Documentation
All implementations must:
- Import the common proto definitions
- Output data in
TickerOutputformat - Aggregate all swap activity per pool per block
See individual DEX folders for specific implementation details and testing instructions.
# Build all packages
cargo build --release
# Build WASM for a specific DEX
cd dexes/uniswap-v3-forks
cargo build --target wasm32-unknown-unknown --releaseEach DEX implementation includes a test script:
cd dexes/uniswap-v3-forks
./test.shWhen adding a new DEX:
- Create a new folder under
dexes/ - Use the common proto format (
TickerOutput) - Follow the existing implementation patterns
- Include comprehensive documentation and tests