meditativeape / subgraphs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 PR (pull request) to this repo after you are done. Make sure you submit your PR as a draft if it's a work-in-progress.

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
  • For metrics calculation (e.g. revenue, fees, TVL), please refer to the README.md in the protocol's subgraph folder for methodology. There is also a broader explanation of how different fields are defined in the schema in docs/Schema.md. 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.

Protocol Status Versions † Deployments
DEX AMM
Apeswap πŸ›  1.0.1 / 1.0.0 / 1.0.0 Apeswap BSC Apeswap Polygon
Balancer v2 πŸ”¨
Bancor v2 πŸ”¨
Bancor v3
Curve πŸ”¨
DODO v2 πŸ”¨
Saddle Finance πŸ”¨
Sushiswap πŸ”¨
Uniswap v2 πŸ›  1.0.1 / 1.0.1 / 1.0.0 Uniswap V2
Uniswap v3 πŸ›  1.0.1 / 1.0.0 / 1.0.0 Uniswap V3 Uniswap V3 Polygon Uniswap V3 Optimism Uniswap V3 Arbtitrum
Lending Protocols
Aave v2 πŸ”¨
Benqi πŸ”¨
Compound πŸ›  1.0.1 / 1.0.0 / 1.0.0 Compund Ethereum
CREAM πŸ”¨
Geist πŸ”¨
Hundred Finance πŸ”¨
TrueFi
Maple Finance πŸ”¨
CDPs
Abracadabra πŸ›  1.1.0 / 0.0.6 / 1.0.0 Abracadabra Money
Alchemix
Inverse Finance
Liquity πŸ›  1.1.0 / 1.0.0 / 1.0.0 Liquity Ethereum
MakerDAO πŸ”¨
QiDAO
Yield Aggregators
Autofarm
Badger DAO πŸ”¨
Beefy Finance πŸ”¨
Belt Finance πŸ›  1.1.0 / 1.0.0 / 1.0.0 Belt BSC
Convex Finance πŸ”¨
Harvest Finance πŸ”¨
Liquid Driver πŸ”¨
Pancakebunny πŸ”¨
Reaper Farm πŸ”¨
Stake DAO πŸ›  1.0.0 / 1.0.0 / 1.0.0 Stake DAO
Tokemak πŸ›  1.0.0 / 1.0.0 / 1.0.0 Tokemac
Vesper Finance πŸ”¨
Yield Yak πŸ”¨
Yearn v2 πŸ”¨

† Versions are schema version, subgraph version, methodology version respectively

About

License:MIT License


Languages

Language:TypeScript 99.5%Language:HTML 0.3%Language:CSS 0.2%Language:Dockerfile 0.1%