Subgraph

View data related to markets, tokens and bond purchases

We have subgraphs available for all supported chains, mainnet and testnet. Our Ethereum Mainnet runs on Graph Protocol's decentralized network, all others are on their hosted service.

Documentation is available for all entities and their fields, to access it, follow one of the links at the bottom of this page, then in GraphiQL:

Click the Query link in the Document Explorer
Click the link for the entity you are interested in
A description of the entity and each field will be available

Mainnet Subgraphs

Testnet Subgraphs

Example Queries

List markets, including all data loaded by dApp on initial load:

{
    markets(where: { hasClosed: false }) {
      id
      name
      network
      auctioneer
      teller
      marketId
      owner
      callbackAddress
      capacity
      capacityInQuote
      chainId
      minPrice
      scale
      start
      conclusion
      payoutToken {
        id
        address
        symbol
        decimals
        name
      }
      quoteToken {
        id
        address
        symbol
        decimals
        name
        lpPair {
          token0 {
            id
            address
            symbol
            decimals
            name
            typeName
          }
          token1 {
            id
            address
            symbol
            decimals
            name
            typeName
          }
        }
        balancerWeightedPool {
          id
          vaultAddress
          poolId
          constituentTokens {
            id
            address
            symbol
            decimals
            name
            typeName
          }
        }
      }
      vesting
      vestingType
      isInstantSwap
      hasClosed
      totalBondedAmount
      totalPayoutAmount
      creationBlockTimestamp
    }
  }

List all tokens:

{
    tokens {
      id
      network
      chainId
      address
      decimals
      symbol
      name
      lpPair {
        token0 {
          id
        }
        token1 {
          id
        }
      }
      balancerWeightedPool {
        constituentTokens {
          id
        }
      }
    }
  }

Show vesting token balances for a given user:

{
    ownerBalances(where: { owner_contains_nocase: OWNER_ADDRESS, balance_gt: 0 }) {
      id
      tokenId
      owner
      balance
      network
      chainId
      bondToken {
        id
        symbol
        decimals
        expiry
        network
        chainId
        type
        teller
        underlying {
          id
          symbol
          decimals
        }
      }
    }
  }

TBV per owner/token combination:

{
    ownerTokenTbvs(first: 1000) {
      owner
      token
      tbv
      network
      chainId
    }
  }

Bond purchases per market:

{
    bondPurchases(
      first: 1000
      where: { marketId: MARKET_ID }
      orderBy: timestamp
    ) {
      id
      recipient
      payout
      amount
      timestamp
      purchasePrice
      postPurchasePrice
      quoteToken {
        id
        name
        symbol
        address
      }
      payoutToken {
        id
        name
        symbol
        address
      }
    }
  }

Last updated