coreyjj1679 / subgraph-token-holder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERC20 Holder Subgraph

Fetch all transfer/approval logs, user balances and token holder for your ERC20 using TheGraph. It may take weeks to sync the subgraph, better deploy it once you deployed your scam token.

demo: https://thegraph.com/hosted-service/subgraph/ruggedev/uni-token

Setup

  1. Fork this repo

  2. Install dependencies

$ yarn
$ chmod u+x scripts/*
  1. Update .env
$ cp .env.template .env

Remember to create the subgraph first.

  1. Update config.json

  2. Generate subgraph.yaml file and deploy.

$ yarn prepare:yaml
$ yarn deploy

Time travel queries

To get snapshot on a specific block height:

{
  infos(block: {number: <BLOCK_NUMBER>}) {
    id
    lastUpdateBlock
    lastUpdateTimestamp
    transferCount
    tokenHolder
  }
}

About


Languages

Language:TypeScript 86.2%Language:Shell 13.8%