LogoLogo
  • Introduction
  • Network
    • SXP
    • Staking
    • Governance
    • API
  • Swap
    • Smart Contract
      • Implement a Swap
      • Providing Liquidity
      • Building an Oracle
      • Flash Swaps
      • Pair Addresses
      • Supporting meta transactions
    • Subgraph API
      • Exchange
        • Entities
        • Queries
      • MasterChef
        • Entities
        • Queries
    • Reference
      • Smart Contracts
  • Swipechain
    • Introduction
    • Swipe Nodes
      • Churn
      • Bitfrost
      • Transactions
      • Continuous Liquidity Pools
      • Incentivizes
      • Governance
    • Run SwipeChain
      • Build on Source Code
      • Build with Script
    • Developers
      • How to contribute
      • Connecting to SwipeNode
  • Staking
  • Staking Details
    • Swipe Network
    • SXP Bonding
    • Unbond SXP
  • Metamask
    • Add Swipe Token
    • Deposit SXP
    • Connect MetaMask
    • Stake SXP
  • Trust Wallet
    • Add Swipe Token
    • Deposit SXP
    • Connect Trust Wallet
    • Stake SXP
  • Ledger
    • Connect Ledger
    • Add Swipe Token
    • Deposit SXP
    • Connect to Swipe
    • Stake SXP
  • View your Rewards
  • Claim Your Rewards
  • Governance
    • Vote
    • Proposals
  • FAQ
    • Frequently Asked Questions
Powered by GitBook
On this page

Was this helpful?

  1. Swap
  2. Subgraph API
  3. MasterChef

Queries

PreviousEntitiesNextReference

Last updated 4 years ago

Was this helpful?

The subgraph can be queried to retrieve important information about MasterChef, pools, pool histories, users, and more. This page will provide examples for common queries.

To try these queries and run your own visit the .

MasterChef

All time Swipe rewards, total rewards in USD, all time pool count.

{
  masterChef(id: "0x267748fe0db99863e1d5448ef5b9442230c24789") {
    id
    bonusMultiplier
    bonusEndBlock
    swipe
    swipePerBlock
    totalAllocPoint
    poolCount
  }
}

Pool

Current Pool balance, all time swipe harvested, harvested Swipe in USD

{
  pool(id: 2) {
    id
    pair
    balance
    entryUSD
    exitUSD
    swipeHarvested
    swipeHarvestedUSD
    block
    slpBalance
    slpAge
    slpAgeRemoved
    slpDeposited
    slpWithdrawn
    userCount
  }
}

Pool History

Snapshot of a pool state at every block generation time

{
  poolHistory(id: "118682") {
    id
    entryUSD
    exitUSD
    swipeHarvested
    swipeHarvestedUSD
    block
    slpBalance
    slpAge
    slpAgeRemoved
    slpDeposited
    slpWithdrawn
    userCount
    block
  }
}

History

Snapshot of the whole MasterChef pools at every event generation time

{
  history(id: "0x267748fe0db99863e1d5448ef5b9442230c2478918682") {
    id
    block
    slpBalance
    slpAge
    slpAgeRemoved
    slpDeposited
    slpWithdrawn
    block
  }
}

User

User reward status in each pools

{
  users(where: { address: "0x1d85ddeb7f73c33802d4e2545ee65a579781e0b6" }) {
    id
		address
    amount
    rewardDebt
    entryUSD
    exitUSD
    swipeHarvested
    swipeHarvestedUSD
  }
}
MasterChef subgraph sandbox