Skip to main content

Getting Latest Pairs

Latest Trading Pairs for a DEX​

Let's see how we can get latest trading pairs created on DEXs. In this example we use Smart Contract Events to track PoolCreated event for Uniswap v3 factory contract. Because whenever a new pool gets created Uniswap v3 factory contract emits a PoolCreated event with the details of the pool.

{
EVM(dataset: combined, network: eth) {
Events(
orderBy: {descending: Block_Number}
limit: {count: 10}
where: {Log: {SmartContract: {is: "0x1f98431c8ad98523631ae4a59f267346ea31f984"}, Signature: {Name: {is: "PoolCreated"}}}}
) {
Log {
Signature {
Name
Parsed
Signature
}
SmartContract
}
Transaction {
Hash
}
Block {
Date
Number
}
Arguments {
Type {
Name
}
Value {
String
}
}
}
}
}

Open this query on our GraphQL IDE using this link.

Subscribe to the Latest Pairs for Uniswap V3​

You can use our GraphQL Subscription (Webhook) to subscribe to these events in case you don't want to call our APIs periodically.

subscription {
EVM(network: eth, trigger_on: head) {
Events(
orderBy: {descending: Block_Number}
limit: {count: 10}
where: {Log: {SmartContract: {is: "0x1f98431c8ad98523631ae4a59f267346ea31f984"}, Signature: {Name: {is: "PoolCreated"}}}}
) {
Log {
Signature {
Name
Parsed
Signature
}
SmartContract
}
Transaction {
Hash
}
Block {
Date
Number
}
Arguments {
Type {
Name
}
Value {
String
}
}
}
}
}

Open this query on our GraphQL IDE using this link