parallel-finance / liquid-staking-subql

MIT License
1 stars 0 forks source link

Liquid Staking Subql

Based on SubQuery project defines for collect the crowdloan data from Heiko or Parallel Substrate blockchain

Development

Start project in Docker

yarn
make launch

Query data

open your browser and head to http://localhost:3000.

Finally, you should see a GraphQL playground is showing in the explorer and the schemas that ready to query.

{
  query {
    ledgers(first: 5) {
      nodes {
        id
        assetId
        blockHeight
        total
      }
    }
    metadata(first: 5) {
      nodes {
        id
        stakingAssetId
        liquidAssetId
        blockHash
      }
    }
  }
}

Staking & Farming Positions

{
  query {
    stakingPositions(
      orderBy: BLOCK_HEIGHT_ASC
      first: 100
      filter: {
        id: { equalTo: "hJKzPoi3MQnSLvbShxeDmzbtHncrMXe5zwS3Wa36P6kXeNpcv" }
      }
    ) {
      nodes {
        id
        totalStaked
        totalEarned
        lending
        farming
        avgExchangeRate
        balance
        blockHeight
      }
    }
    farmingPositions(
      orderBy: BLOCK_HEIGHT_ASC
      first: 100
      filter: {
        id: { equalTo: "hJKzPoi3MQnSLvbShxeDmzbtHncrMXe5zwS3Wa36P6kXeNpcv" }
      }
    ) {
      nodes {
        id
        accrued
        claimed
        blockHeight
      }
    }
  }
}

Deployment

We used IPFS deployment from subQuery team provide.

Before do the deployment, make sure run yarn build successfully. And please check if the genesisHash in yaml file is correct for the blockchain you want to collect.

Generate IPFS CID

Need to prepare your SUBQL_ACCESS_TOKEN before call actions.

Get IPFS CID from github action

The check the response in deployment action Publish to IPFS step, for example, there should be as following:

Building and packing code... done
Uploading SupQuery project to IPFS
SubQuery Project uploaded to IPFS: <CID>

Use CID for next step.

Deploy slot with IPFS CID

Go To subQuery project page, click Deploy button for staging slot and enter the CID you previously get. After staging finished deployment and everything looks good. Click Promote to production deploy the changes to production slot.