Verifying staking pool smart contracts
Now, it is time to verify the smart contracts we have built in this chapter. Staking pool smart contracts require us to generate new blocks in our development environment to verify the incremental rewards. Before verifying the staking pool smart contracts, we will introduce a method in Hardhat to simulate block mining for verifying our contracts.
Implementing the command to mine blocks with Hardhat
Hardhat has a powerful library to support mining blocks. They are very helpful for testing smart contracts as they simulate the real blockchain environment. For mining blocks on EVM-compatible blockchains with Hardhat, we can refer to Hardhat’s official documentation at https://hardhat.org/hardhat-network-helpers/docs/overview.
Now, let’s create a new JavaScript file at scripts/mine.js
for users to run for smart contract verification. To make the script accept an argument as the number of blocks to be mined and make the script...