Introduction
…
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 money market contracts and their events
- Decodes them with the event metadata
- Streams transformed data into a unified postgres table
🛠️ Step 1: Create a Contract Filter
Then create the filter:
These are the contract addresses we’ll want to listen to:
0x794a61358D6845594F94dc1DB02A252b5b4814aD
0xF25212E676D1F7F89Cd72fFEe66158f541246445
0xaeB318360f27748Acb200CE616E389A6C9409a07
curl https://app.indexing.co/dw/filters/polygon_money_market_addresses \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: <your-api-key>' \
-d '{
"values": [
"0x794a61358D6845594F94dc1DB02A252b5b4814aD",
"0xF25212E676D1F7F89Cd72fFEe66158f541246445",
"0xaeB318360f27748Acb200CE616E389A6C9409a07"
]
}'
…explainer…
View the full code here
curl https://app.indexing.co/dw/transformations/polygon_money_market_events \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: <your-api-key>' \
-F code=@./polygon_money_market_events.js
💽 Step 4: Create the Database
…explainer…
create table events (
contract_address text,
transaction_hash text,
log_index: int,
method: text,
timestamp: timestamptz,
decoded: jsonb,
primary key (contract_address, transaction_hash, log_index)
);
create index on events (contract_address, method, timestamp);
🔗 Step 5: Create the Pipeline
curl https://app.indexing.co/dw/pipelines \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: <your-api-key>' \
-d '{
"name": "polygon_money_market_events",
"transformation": "polygon_money_market_events",
"filter": "polygon_money_market_addresses",
"filterKeys": [
"contract_address"
],
"networks": [
"polygon"
],
"enabled": true,
"delivery": {
"adapter": "POSTGRES",
"connectionUri": "postgres://...",
"tableMap": {
"events": ["contract_address", "transaction_hash", "log_index"],
}
}
}'
🥺 Step 5: Test the Stream
Once live, your database should receive events like:
You can test this manually and end-to-end using:
curl --location 'https://app.indexing.co/dw/pipelines/polygon_money_market_events/test/polygon/XXX' -H 'X-API-KEY: <your-api-key>'
🚀 Wrap-Up
You’ve now set up a real-time stream of Clanker token deployments using The Neighborhood. The data you’re receiving is identical to what Clanker themselves use in production.
Need help or want to go further?