Understanding The Protocol
To understand the protocol we need to answer following questions about the protocol
SushiSwap is an exchange protocol as it allows users to exchange an asset for another at market price. SushiSwap also provides yield farms but for the purpose of subgraph we will consider this as a separate protocol and will develop a separate subgraph for SushiSwap farms. We need to keep them separate because of difference in the core interactions a user can do with these markets. We will discuss these interactions below.
A user can do following interactions with SushiSwap exchange -
- 1.Deposit a pair of ERC20 tokens in a pool
- 2.Withdraw full or part of deposited tokens from the pool
- 3.Swapping an ERC20 token for another
Above actions can be mapped to finance terms as shown below -
- 1.Deposit tokens in a pool - Making investment in to a market
- 2.Withdraw tokens from the pool - Redeeming investment from the market
- 3.Swapping tokens - Updating market reserves by other actions
Now that we understand the core interaction and their mapping with finance terms we need to understand how this interaction data is managed in the smart contracts. Let's do that in our next article Understanding Smart Contracts.