Polygon DEX Events
Introduction
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.
Prerequisites
You’ll need:
- A Neighborhood API key. To get access, email hello@indexing.co
- curl or Postman
- An active postgres database
⚙️ What You’ll Build
A pipeline that:
- Listens to the majority of Polygon DEX contracts and their events
- Decodes them with the event metadata
- Streams transformed data into a unified postgres table
🔄 Step 1: Add the Transformation Logic
We’ll want to decode and return all events + unified swaps for known DEXs.
View the full code here
✍️ Step 2: Create the Transformation
💽 Step 3: Create the Database
…explainer…
🔗 Step 4: Create the Pipeline
🥺 Step 5: Test the Stream
Once live, your database should receive events like:
You can test this manually and end-to-end using:
🚀 Wrap-Up
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?
- Reach out at indexing.co/get-in-touch
- Or email us at hello@indexing.co