Summary
This chapter introduced and implemented staking pool smart contracts. The smart contracts we have implemented can be used for both staking normal tokens (non-LP tokens) and farming (LP tokens). We also did a deep dive into the mathematical formulas for reward calculation and learned about the concepts of accumulated reward per share and reward debt for reward calculation. We used these formulas in our smart contract and implemented the functions of the smart contract. Finally, we learned how to use Hardhat to simulate block mining and went through the verification process in the Hardhat console.
In the next chapter, you will learn how to build the staking pages and farming pages for a DeFi application with JavaScript and React. Because the pages of these two features are similar to each other and they access the smart contracts similarly, we will deep dive into building the pages for token staking by going through all the UI components. After, we will copy these components...