Skip to content

SteerProtocol/vault-holders-subgraph

Repository files navigation

To deploy this subgraph

  1. Create a new subgraph in The Graph Hosted service

You will then have a username/subgraphname that you will use later.

  1. Clone the repo:
git clone git@github.com:dabit3/erc20-subgraph-starter.git
  1. Install dependencies
npm install

# or

yarn
  1. Update the deploy script in package.json to match the name of your subgraph:
"deploy": "graph deploy --node https://api.thegraph.com/deploy/your-username/your-subgraphname"

# update
your-username/your-subgraphname
  1. Authenticate
graph auth
  1. Deploy
yarn deploy

Example Queries

Get All Balances for an Account

{
  accounts {
    ERC20balances {
      id 
      value
      contract {
        name
      }
    }
  }
}

Get All Holders of a Specific Vault

{
  erc20Contract(id: "0x1234...") {  # Replace with vault address
    symbol
    name
    balances(where: { valueExact_gt: "0" }) {
      account {
        id
      }
      value
      valueExact
    }
  }
}

Query Variables

For queries that require variables, you can pass them like this:

query getVaultHolders($vaultAddress: String!) {
  erc20Contract(id: $vaultAddress) {
    symbol
    name
    balances(where: { valueExact_gt: "0" }) {
      account {
        id
      }
      value
      valueExact
    }
  }
}

Variables:

{
  "vaultAddress": "0x1234..." // Replace with actual vault address
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published