DIVA subgraphs

Data emitted as the result of DIVA smart contract interactions is indexed using TheGraph.

The DIVA subgraph can be accessed here:

Pool data

The following query can be used to pull the data for a given pool Id (here pool Id = 5):

{
  pools(where: {id: 5}) {
    id
    referenceAsset
    floor
    inflection
    cap
    supplyInitial
    supplyShort
    supplyLong
    expiryTime
    collateralToken {
      id
      name
      symbol
      decimals
    }
    collateralBalanceShortInitial
    collateralBalanceLongInitial
    collateralBalance
    shortToken {
      id
      name
      symbol
      decimals
    }
    longToken {
      id
      name
      symbol
      decimals
    }
    finalReferenceValue
    statusFinalReferenceValue
    redemptionAmountLongToken
    redemptionAmountShortToken
    statusTimestamp
    dataProvider
    redemptionFee
    settlementFee
    createdBy
    createdAt
    
  }
}

Sample output from the above query:

Data providers

Data providers that want to listen to pools where they are selected as the data provider can use the following reduced version of the pool query (here using address 0x9adefeb576dcf52f5220709c1b267d89d5208d78 as the data provider, all in small letters):

Sample output of the above query:

Fees

Query to pull the fee claims for a given address (has to be lower case!):

Sample output from the above query:

Challenge

Query to retrieve the submitted challenges for a given poolId (here poolId = 5):

Sample output of above query:

User positions

Query to retrieve a shortlist of position tokens that a user may own. The shortlist is constructed based on user interactions with the DIVA Protocol functions as well as 0x protocol. Note that position tokens received via different avenues (e.g., Uniswap or simple transfer) will not appear in the list.

Sample output of above query

Last updated