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:
userInfomapping. Value of the mapping is another mapping with user's address as a key and
UserInfostruct as a value. Let's see what info these structs are made of.
PoolInfocontains address of the LP token and set of variables which determine how Sushi rewards are distributed.
UserInfotracks 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.
poolInfowe find the following:
add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate)- addition of a new farm
set(uint256 _pid, uint256 _allocPoint, bool _withUpdate)- update farm's allocation point
migrate(uint256 _pid)- replace the LP token of a farm
updatePool(uint256 _pid)- update reward variables of a farm
deposit(uint256 _pid, uint256 _amount)- user deposits his SLP tokens into a farm
withdraw(uint256 _pid, uint256 _amount)- user withdraws his SLP tokens from a farm
emergencyWithdraw(uint256 _pid)- user withdraws his SLP tokens without getting rewards