Bridges API
This subgraph dynamically tracks any pair created by the Bridges factory together with tokens swapped on other protocols through the aggregator functionality. It also contains stats for historical data and USD prices.
  • aggregated data across pairs and tokens
  • data on individual pairs and tokens
  • data on transactions
  • data on liquidity providers
  • historical data on Bridges, pairs or tokens, aggregated by day

Queries

Below are a few ways to show how to query the Bridges-subgraph for data. The queries show most of the information that is queryable, but there are many other filtering options that can be used, just check out the querying api. These queries can be used locally or in The Graph Explorer playground.

Key Entity Overviews

bridgesFactory

Contains data about Bridges. This entity tracks liquidity (in BNB and USD, see below), all time volume, transaction count, number of pairs and more.
bridgesFactory(id: "0xab4103C29eb9ec4d92F883Dc1d04554C370709ad") {
​
totalPairs
totalTransactions
totalVolumeUSD
totalLiquidityUSD
}

Token

Contains data on a specific token. This token specific data is aggregated across all pairs, and is updated whenever there is a transaction involving that token.
token(id: "") {
id
name
symbol
derivedBNB
derivedUSD
tradeVolume
tradeVolumeUSD
totalTransactions
totalLiquidity
}

Pair

Contains data on a specific pair.
pair(id:"") {
name
token0 {
id
}
token1 {
id
}
reserve0
reserve1
totalSupply
reserveBNB
reserveUSD
trackedReserveBNB
token0Price
token1Price
volumeToken0
volumeToken1
reserveUSD
totalTransactions
​
}

Transaction

Every transaction on Bridges is stored. Each transaction contains an array of mints, burns, and swaps that occured within it.
Transaction(id:"") {
id
block
timestamp
mints
burns
swaps
}

Mint, Burn, Swap

These contain specifc information about a transaction. Things like which pair triggered the transaction, amounts, sender, recipient, and more. Each is linked to a parent Transaction entity.
Example:
Swap(id:""){
transaction
timestamp
pair
sender
from
amount0In
amount1In
amount0Out
amount1Out
to
logIndex
amountUSD
}

Daily data

Contains Bridges daily data (24 hours previous id)
bridgesDayData(id:"") {
id
block
timestamp
mints
burns
swaps
}
id = current timestamp/86400 rounded.
E.g.
06082022 19:36:48 = 1659814608
bridgesDayData(id:"19210") gives the volume in the 24 hourse previous to 06082022 19:36:48

Queries

The api can be queried using different graphQL libraries, refer to the subgraph documentation here: https://thegraph.com/docs/en/querying/querying-from-an-application/​
Copy link
On this page
Queries
Key Entity Overviews
bridgesFactory
Token
Pair
Transaction
Mint, Burn, Swap
Daily data
Queries