Build EVM blockchain data indexers using Ponder (ponder.sh) - an open-source TypeScript framework for indexing smart contract events, transactions, and traces into custom database schemas with type-safe APIs. Use when the user mentions ponder, blockchain/EVM indexing, onchain data pipelines, subgraph replacement, or wants to index smart contract events into a queryable database.
98
99%
Does it follow best practices?
Impact
98%
1.25xAverage score across 5 eval scenarios
Passed
No known issues
A trading analytics platform wants to index all Uniswap V2 liquidity pool Swap events on Ethereum mainnet. The challenge is that Uniswap V2 creates new pair contracts dynamically through its factory contract at 0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f (deployed at block 10000835). Each pair contract emits Swap events when trades occur.
The factory emits a PairCreated event whenever a new pair is deployed:
event PairCreated(address indexed token0, address indexed token1, address pair, uint)Each pair contract emits:
event Swap(address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to)The team needs to track every swap across all Uniswap V2 pairs, recording which pool the swap occurred in, the amounts, and the trader address. They also want to query this data through an API that supports filtering by pool address.
Create a complete Ponder project with:
ponder.config.ts - Factory contract configuration for dynamic pair discoveryponder.schema.ts - Schema for swap records with appropriate keys and indexessrc/index.ts - Indexing handler for Swap events from factory-created pairssrc/api/index.ts - API setup for querying swap datatsconfig.json - TypeScript configurationpackage.json - Dependenciesabis/UniswapV2Factory.ts - Factory ABIabis/UniswapV2Pair.ts - Pair ABI.env.local - Environment variable template