Getting onchain rewards info using Fuul contracts subgraphs

This article shows how to get users rewards - either claimed or unclaimed.

Every payout reward has an onchain record on the project's FuulProject contract. This information can be retrieved from any indexer, but using our aggregated subgraphs makes it much easier.

Getting onchain rewards info

To get the total, claimed and unclaimed rewards for a specific user and Fuul projects, use the following query.

userBalances(
  where: { 
    owner_contains_nocase: "0x12345", 
    project_: {
      deployedAddress:"0x12345"
    }}
) {
  availableToClaim
  claimed
  currency
  project {
    id
    deployedAddress
  }
}

You can also filter out by currency like this:

userBalances(
  where: { 
    owner_contains_nocase: "0x12345", 
    currency_contains: "0x0000000000000000000000000000000000000000",
    project_: {
      deployedAddress:"0x12345"
    }}
) {
  availableToClaim
  claimed
  currency
  project {
    id
    deployedAddress
  }
}

To query the subgraph, follow this guide from TheGraph, or make a request directly to the endpoint using a library like axios or requests.

Subgraphs

There is one subgraph per network supported by Fuul. These are the endpoints:

Last updated