Testing ERC20 Smart Contracts in Typescript & Hardhat

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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
yuichiro aoki

yuichiro aoki

Ethereum Enthusiast & Software Developer