This guide shows you how to stream real-time DEX activity from Polygon into your own database. You’ll tap into the most active decentralized exchanges on the network: Uniswap, Quickswap, Balancer V2, Sushi, and Curve. The template captures a range of onchain events including swaps, liquidity changes, and more. By the end, you’ll have a working pipeline that decodes relevant contract event logs and stores structured trade data for analysis or downstream use.
The contract_address and pool_address represents the swap pool for dex_events and swaps, respectively. The above provides a single, primary key index for each table, but you may find you want other indexes added based on scale and query patterns.
You’ve now set up a real-time stream of Polygon DEX events using The Neighborhood. The data you’re receiving is contains events from the most used Polygon DEXs. In case you want to add new DEXs we encourage you to reach out to us or adjust the template.Need help or want to go further?