Curve gauges
(gauge is equivalent to Sushi farm) where each gauge is a smart contract deployed by main factory contract? Actually no, in case of MasterChef the farm and user info is stored in data structures within the single main contract:userInfo
mapping. Value of the mapping is another mapping with user's address as a key and UserInfo
struct as a value. Let's see what info these structs are made of.PoolInfo
contains address of the LP token and set of variables which determine how Sushi rewards are distributed.UserInfo
tracks how many SLP tokens user has staked into the farm and how many Sushi reward tokens he is entitled to. In our subgraph we will define entity schema which will store the same info as in the contract, so that at any point of time we will know state of the farms and user positions. poolInfo
we find the following: add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate)
- addition of a new farmset(uint256 _pid, uint256 _allocPoint, bool _withUpdate)
- update farm's allocation pointmigrate(uint256 _pid)
- replace the LP token of a farmupdatePool(uint256 _pid)
- update reward variables of a farmdeposit(uint256 _pid, uint256 _amount)
- user deposits his SLP tokens into a farmwithdraw(uint256 _pid, uint256 _amount)
- user withdraws his SLP tokens from a farmemergencyWithdraw(uint256 _pid)
- user withdraws his SLP tokens without getting rewards