Skip to content
forked from messari/subgraphs

Standardized subgraphs for DeFi data

License

Notifications You must be signed in to change notification settings

cd-dr/subgraphs

 
 

Repository files navigation

Subgraphs

Contribution Guidelines

  • Decide which protocol you want to build a subgraph for
  • Fork this repository
  • Add a folder under subgraphs with the name of the protocol you want to work on
  • Copy over the corresponding schema from the root folder. For example, if you are working on a yield aggregator, you should copy over schema-yield.graphql to your folder and rename it to schema.graphql. Note schema-common.graphql is used for schema design and reference, and should never be used for implementation
  • Build the subgraph within that folder. Feel free to use the reference subgraph as a reference.
  • Submit a pull request to this repo after you are done

Recommended Development Workflow

  • Start with understanding the protocol. An easy start could be interacting with the protocol UI on testnets, check transaction details on Etherscan and pay attention to key events that are emitted
  • Go over the smart contracts. Identify the ones that we need to pull data from
    • Usually each protocol has a factory contract that's responsible for tracking other contracts (e.g. Uniswap's Factory contract, Aave's Lending Pool Registry, Yearn's Registry)
    • Also a pool/vault contract that's responsible for pool level bookkeeping and transactions (e.g. Uniswap's Pair contract, Yearn's Vault contract, Aave's Lending Pool contract)
  • Go over the schema and think about what data are needed from smart contract events/calls to map to the fields in each entity
    • It's easiest to start with more granular entities and build up to aggregated data
    • For example, usually it's easier to start writing mappings for transactions and usage metrics
  • Go over the documents in the docs folder. That should answer lots of questions you may have
  • Implement the mappings, deploy and test your data using either Hosted Service or The Graph Studio
  • Refer to the methodology for metrics calculation (e.g. revenue, fees, TVL). Feel free to reach out to me if anything isn't clear
  • Verify your subgraph against other sources and include specific links to these sources in the README. Below are some common sources:

Resources

Introductory

Intermediate

Advanced

Development Status

🔨 = In progress.
🛠 = Feature complete. Additional testing required.
✅ = Production-ready.

Feature Status Version
DEX AMM
Uniswap v2 🛠
Uniswap v3 🔨
Sushiswap 🔨
Curve 🔨
Balancer v2
Bancor v2 🔨
Bancor v3
DODO v2
Lending Protocols
Aave v2 🔨
Compound 🔨
Geist 🔨
Benqi 🔨
Yield Aggregators
Yearn v2 🔨
Convex Finance 🔨
Badger DAO 🔨
Stake DAO 🛠 1.0.0
Beefy Finance
Tokemak 🛠 1.0.0
Harvest Finance 🔨
Yield Yak

About

Standardized subgraphs for DeFi data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 98.8%
  • Other 1.2%