Testing ERC20 Smart Contracts in Typescript & Hardhat

Testing with ethers.js & Waffle & Typescript & Hardhat

yuichiro aoki
Jul 18, 2021
Photo by Fotis Fotopoulos on Unsplash

Today, I will explain some testing examples of erc20 smart contracts using Typescript and Hardhat. If you are new to hardhat, this tutorial might help!

Testing ERC20 Token

This is a simple erc20 token smart contract using openzeppelin.

The example test for above contract is as follows:

Typechain

You can add typescript bindings for your smart contracts by using typechain. Just install dependencies listed below and import @typechain/hardhat at hardhat.config.ts, then when you compile contracts, it will automatically create typescript bindings in typechain folder in the root directory.

add typescript bindings

Or you can clone above repository and try it on your own.

Hope this helps. Thank you for reading ๐Ÿ˜

References

--

--