Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 1.31 KB

README.md

File metadata and controls

26 lines (19 loc) · 1.31 KB

dai-subgraph

A subgraph for the DAI token.

Documentation: https://thegraph.com/docs/en/cookbook/quick-start/

First Step

  1. Add a Transfer entity with these fields:
  • from: String (address)
  • to: String (address)
  • amount: BigInt (transfer amount)
  1. Add a daily entity that summarizes totaly daily transfer count, transfer amount, and unique users (from or to).

  2. Find a price oracle contract and convert the transfer amount to US dollar.

Second Step

  1. Find pairs on UniSwap v2 with one of the tokens is DAI
  1. For each DAI pair, track pool (pair address, token0, token1, reserve0, reserve1) and swap (to, from, tokenA, tokenB, amountIn, amountOut) with a pool and swap entity
  2. add to daily entity, total DAI liquidity (reserve) across all pools, total swap count, total swap amount (USD)
  3. add to daily entity, % of DAI supply that is providing liquidity at UniSwap v2, % of DAI transfer counts that is swaps, % DAI transfer amount that is swaps

Third Step

Develop a subgraph for Uniswap v2 using Messari's DEX schema: https://github.com/messari/subgraphs/blob/master/schema-dex-amm.graphql