Skip to main content
grasp.study
Log in
Try it for free
Back to course
👋
Welcome to a Grasp lesson
Create a free account
to keep studying and create your own study path.
Blockchain cryptocurrency investment course
·
Module 5
Automated Testing with Hardhat
1
Setting Up Your Hardhat Testing Environment
Set up a testing environment using Hardhat, ethers.js, and Chai.
2
Testing ERC-20 Core Functions
Write unit tests for core ERC-20 functions like 'transfer' and 'balanceOf'.
3
Testing Token Allowances
Test the 'approve' and 'transferFrom' mechanism with multiple simulated accounts.
4
Writing Revert Tests for Smart Contracts
Write tests to verify that contracts correctly revert on invalid inputs or conditions.
5
Leveraging Test Fixtures for Efficient Testing
Implement test fixtures to reduce code duplication and improve test performance.
6
Testing Access-Controlled Functions
Test functions that are restricted by access control modifiers (e.g., Ownable).
7
Gas Optimization: Analyzing Smart Contract Efficiency
Measure and analyze the gas consumption of your smart contract functions.
Previous module
Building an ERC-20 Token
Next module
Smart Contract Security Principles