Understanding the architectures of staking and farming
Both staking and farming require users to deposit an amount of token to get a reward. A user should provide the staked token when depositing and get back an amount of the staked token (principal), plus an amount of the reward token (interest), when withdrawing the staked token. There are various types of designs on the market for staking and farming. In this section, we will demonstrate these architectures and discuss their characteristics.
Two types of architectures for staking
Generally speaking, a staking or farming smart contract holds amounts of staked tokens and/or reward tokens and provides the interfaces for users to deposit and withdraw those tokens. Similar to liquidity pools in DEX, the smart contracts for staking or farming are also called staking pools or farming pools. The reward tokens can be held in the same smart contract of staked tokens or a different smart contract. As a result, it populates two types...