Subgraph

The GYSR subgraph

GYSR has built and launched a subgraph which indexes a variety of information about our platform. This includes data about tokens (price, name, type, etc.), users (positions, activity, etc.), Pools (configuration, APR, TVL, etc.) and more.

You can find the subgraph source code here.

You can experiment with queries and view entities on the subgraph's playground page:

Entities

Pool

An entity created for each Pool launched on the GYSR protocol

Token

An entity created for each token used as a staking or reward token in a GYSR Pool

PoolStakingToken

An entity created for each staking token association with a specific Pool

PoolRewardToken

An entity created for each reward token association with a specific Pool

User

An entity created for each wallet address that has interacted with a Pool

Position

An entity created for each position a user has in a Pool. This can be comprised of one or several stakes, as a user can have multiple stakes in one Pool.

Stake

An entity created for each stake a user has in a Pool

Platform

An entity created for aggregate stats on the GYSR protocol like TVL

Transaction

An entity created for each transaction on a Pool, including Stake, Unstake, and Claim

Funding

An entity created for each funding on a Pool

PoolDayData

An entity created as a "snapshot" of a Pool's stats on a given day

ConfigurationParameter

An entity created for each parameter set in the global Configuration contract

Fee

An entity to track each token collected as a protocol fee

Examples

Get top 10 Pools with highest TVL

{
  pools(first: 10, orderBy: tvl, orderDirection: desc) {
    id
    tvl
    apr
    stakingTokens {
      token {
        symbol
        alias
      }
    }
    rewardTokens {
      funded
      apr
      token {
        symbol
        alias
      }
    }
  }
}

Get fundings for a specific Pool

Note: replace the id with the Pool you want to query

{
  pool(id: "0x6c1ffdecc6520571d2c41087726611938a9ae99f") {
    fundings {
      originalAmount
      start
      end
    }
  }
}

Get transactions for a specific Pool

Note: replace pool id with the Pool you want to query

{
  transactions( where: { pool: "0x6c1ffdecc6520571d2c41087726611938a9ae99f"}) {
    type
    timestamp
    amount
    earnings
    gysrSpent
  }
}

Get daily snapshots for a Pool over a time range

This example gets snapshots from the week of 11/9/20 - 11/15/20 UTC

{
  poolDayDatas(where: { poolAddress: "0x6c1ffdecc6520571d2c41087726611938a9ae99f", date_gte: 1604966400, date_lte: 1605484800}) {
    date
    totalStaked
    totalGysrSpent
    totalUsers
    tvl
    volume
  }
}

Get a user's positions

Note: replace the id with the wallet address you want to query

{
  user(id: "") {
    earned
    positions {
      pool {
        id
      }
      shares
    }
  }
}

Get global stats for GYSR protocol (on the respective chain)

{
  platform(id: "0x0000000000000000000000000000000000000000") {
    tvl
    users
    operations
    gysrSpent
    pools
    volume
    rewardsVolume
  }
}

Get current protocol configuration parameters

{
  configurationParameters {
    name
    key
    type
    address
    number
  }
}

Last updated