Skip to content

Graph Protocol subgraph to index OHM token holders across different chains

Notifications You must be signed in to change notification settings

unbanksy/token-holders-subgraph

 
 

Repository files navigation

Token Holders Subgraph

Setup

  1. Install neccessary packages:
npm install -g @graphprotocol/graph-cli
yarn global add @graphprotocol/graph-cli
yarn global add @graphprotocol/graph-ts
  1. Create a subgraph in Subgraph Studio, get the deploy key.
  2. Authenticate: graph auth --studio DEPLOY_KEY
  3. Deploy: graph deploy --studio olympus-tokenholders-subgraph

Intended Uses

  • Tracking the number of holders of a particular token
  • Tracking the balances of particular token and holder combinations

Architecture

Considerations

  • Calculating daily balances within a subgraph is currently prohibitively slow, so this is outsourced to the Google Cloud Function deployed by the token-holder-balances repo.

Design Principles

  • The subgraph should need minimal maintenance
  • The subgraph entities should enable users to calculate the metrics they need (i.e. don't try too hard to anticipate the metrics needed)

Indexing

Indexing takes place in the following circumstances:

  • Transfer function call
    • When the transfer function is called on any of the tokens, a TokenHolderTransaction record is created for each of the sender and receiver.

About

Graph Protocol subgraph to index OHM token holders across different chains

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%