Developers Docs

Sushi Farms (MasterChef) Subgraph


You've learned how to create a subgraph from SushiSwap exchange. Your subgraph is tracking the state of the market for every existing Sushiswap pair, e.g. amount of both tokens in WETH-DAI pool. Additionally, position of every user, or more precisely liquidity provider, is tracked as well. When user provides his tokens into the pool, he gets back Sushi LP (SLP) tokens. You can find out how many SLP tokens user held over time, how much trading fees he earned and what was the ROI on that investment at any point of time.
But one thing is missing. SushiSwap offers liquidity providers to stake their SLP token into a Sushi farm and get rewards in return. Rewards are the newly minted Sushi tokens, and potentially extra reward tokens used to further incentivize users to boost available liquidity - e.g. staking SLP tokens into DAI-wstETH farm will get you LDO rewards in addition to Sushi. All of this is implemented in SushiSwap's MasterChef smart contract. Let's build a subgraph to index it and get all the farming info we're interested in!