New Liquidity Pools on Polygon: Real-Time New Pairs API
What it is
A feed of every new liquidity pool and token pair on Polygon, read from the on-chain events that DEX factories emit when a liquidity pool is created. Use it for a new pairs list, a listing alert or the first step of a trading bot.
How to get it
Query the Events cube on EVM(network: matic). Run it as a query for the pools created so far, or change query to subscription for a live stream over WebSocket.
To use it outside the IDE you need an API token: how to generate a Bitquery API token.
How it is derived
A new liquidity pool shows up as one of these events:
| Event | Emitted by | Venue |
|---|---|---|
Initialize | Uniswap v4 PoolManager 0x67366782805870060151383f4bbff9dab53e5cd6 | Uniswap v4 liquidity pools |
PoolCreated | Uniswap v3 factory 0x1f98431c8ad98523631ae4a59f267346ea31f984 and other concentrated-liquidity factories | Uniswap v3 style liquidity pools |
PairCreated | QuickSwap v2 factory 0x5757371414417b8c6caad45baef941abc7d3ab32, Uniswap v2 factory 0x9e5a52f57b3038f1b8eee45f28b3c1967e22799c and other constant-product factories | Uniswap v2 style pairs |
Pool | QuickSwap v3 factory 0x411b0facc3489691f28ad58c47006af5e3ab3a28 | QuickSwap v3 liquidity pools |
LogHeader.Address on each row is the factory or PoolManager that created the liquidity pool, so it tells you the venue.
Fields
| Field | Meaning |
|---|---|
Log.Signature.Name | The event: Initialize, PoolCreated, PairCreated or Pool |
LogHeader.Address | The factory or PoolManager that emitted it |
Arguments | The two tokens and the new liquidity pool address or pool id |
Transaction.From | The wallet that created the liquidity pool |
Transaction.To | The contract it called, such as a launchpad or a router |
Block.Time | When the liquidity pool was created |
Examples
New liquidity pools created in the last day
Every liquidity pool created since yesterday 00:00 UTC, newest first.
{
EVM(network: matic) {
Events(
limit: {count: 50}
orderBy: {descending: Block_Time}
where: {
Block: {Date: {since_relative: {days_ago: 1}}}
any: [
{
LogHeader: {Address: {is: "0x67366782805870060151383f4bbff9dab53e5cd6"}}
Log: {Signature: {Name: {is: "Initialize"}}}
}
{Log: {Signature: {Name: {in: ["PoolCreated", "PairCreated"]}}}}
{
LogHeader: {Address: {is: "0x411b0facc3489691f28ad58c47006af5e3ab3a28"}}
Log: {Signature: {Name: {is: "Pool"}}}
}
]
}
) {
Block { Time Number }
Log { Signature { Name } }
LogHeader { Address }
Transaction { Hash From To }
Arguments {
Name
Value {
... on EVM_ABI_Address_Value_Arg { address }
... on EVM_ABI_BigInt_Value_Arg { bigInteger }
... on EVM_ABI_Bytes_Value_Arg { hex }
... on EVM_ABI_Boolean_Value_Arg { bool }
}
}
}
}
}
New liquidity pools live stream
The same filter as a subscription. Each new liquidity pool is pushed when its block is indexed.
subscription {
EVM(network: matic) {
Events(
where: {
any: [
{
LogHeader: {Address: {is: "0x67366782805870060151383f4bbff9dab53e5cd6"}}
Log: {Signature: {Name: {is: "Initialize"}}}
}
{Log: {Signature: {Name: {in: ["PoolCreated", "PairCreated"]}}}}
{
LogHeader: {Address: {is: "0x411b0facc3489691f28ad58c47006af5e3ab3a28"}}
Log: {Signature: {Name: {is: "Pool"}}}
}
]
}
) {
Block { Time Number }
Log { Signature { Name } }
LogHeader { Address }
Transaction { Hash From To }
Arguments {
Name
Value {
... on EVM_ABI_Address_Value_Arg { address }
... on EVM_ABI_BigInt_Value_Arg { bigInteger }
... on EVM_ABI_Bytes_Value_Arg { hex }
... on EVM_ABI_Boolean_Value_Arg { bool }
}
}
}
}
}
New QuickSwap and Uniswap liquidity pools in the last 7 days
Only the liquidity pools created by the QuickSwap and Uniswap factories. LogHeader.Address tells you which one.
{
EVM(network: matic, dataset: combined) {
Events(
limit: {count: 50}
orderBy: {descending: Block_Time}
where: {
Block: {Date: {since_relative: {days_ago: 7}}}
LogHeader: {Address: {in: ["0x5757371414417b8c6caad45baef941abc7d3ab32", "0x411b0facc3489691f28ad58c47006af5e3ab3a28", "0x9e5a52f57b3038f1b8eee45f28b3c1967e22799c", "0x1f98431c8ad98523631ae4a59f267346ea31f984"]}}
Log: {Signature: {Name: {in: ["PairCreated", "PoolCreated", "Pool"]}}}
}
) {
Block { Time Number }
Log { Signature { Name } }
LogHeader { Address }
Transaction { Hash From }
Arguments {
Name
Value {
... on EVM_ABI_Address_Value_Arg { address }
... on EVM_ABI_BigInt_Value_Arg { bigInteger }
... on EVM_ABI_Boolean_Value_Arg { bool }
}
}
}
}
}
Pitfalls
- The Uniswap v4
Initializefilter is pinned to the PoolManager address. Uniswap v3 style liquidity pools also emit their ownInitializewhen first priced, and those rows would repeat thePoolCreatedrows. - All Uniswap v4 liquidity pools live inside the PoolManager and share its address. Tell them apart by the
idargument ofInitialize. - A new liquidity pool is not a safe token. Check the trades and holders of the token before acting on a listing.
- For history older than the last few days, add
dataset: combinedtoEVMand keep aBlock.Datefilter on the query.
FAQ
Frequently Asked Questions
How can I track new QuickSwap and Uniswap liquidity pools on Polygon?
Filter Events on EVM with network matic to the QuickSwap and Uniswap factory addresses. QuickSwap v2 and Uniswap v2 emit PairCreated, Uniswap v3 emits PoolCreated, QuickSwap v3 emits Pool, and Uniswap v4 emits Initialize from the PoolManager. Each event returns the two tokens and the new liquidity pool.
Can I get new liquidity pools on Polygon as a live stream?
Yes. Change query to subscription and the same filter pushes each new liquidity pool over WebSocket when its block is indexed.
How do I get the trades of a new liquidity pool on Polygon?
Take the liquidity pool address from the event arguments and filter DEX trades by it. The Polygon DEX Trades API page has the queries.
Related
Ready to run this in production?
Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.