v2 Queries

Last modified:

Overview

The v2 subgraph is best for analytics and historical views, not transaction execution. Use direct contract calls for real-time execution-sensitive reads.

Explorer: v2 deployment

Protocol Metrics

{
  centurionFactory(id: "0x0000000000000000000000000000000000000000") {
    pairCount
    totalVolumeUSD
    totalLiquidityUSD
    txCount
  }
}

Pair State

{
  pair(id: "0xa478c2975ab1ea89e8196811f51a7b7ade33eb11") {
    token0 { symbol }
    token1 { symbol }
    reserve0
    reserve1
    reserveUSD
    volumeUSD
  }
}

Recent Pair Swaps

{
  swaps(
    first: 20
    where: { pair: "0xa478c2975ab1ea89e8196811f51a7b7ade33eb11" }
    orderBy: timestamp
    orderDirection: desc
  ) {
    timestamp
    amount0In
    amount0Out
    amount1In
    amount1Out
    amountUSD
  }
}

Historical Snapshot

{
  centurionFactory(
    id: "0x0000000000000000000000000000000000000000"
    block: { number: 10291203 }
  ) {
    totalVolumeUSD
    totalLiquidityUSD
  }
}

Pagination Pattern

query Pairs($skip: Int!) {
  pairs(first: 1000, skip: $skip) {
    id
  }
}

Increase skip by 1000 until the response count is less than 1000.

See Also