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:


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 😁





Ethereum Enthusiast & Software Dev living in rural Japan

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Subtle Aspects of React Re-rendering (Part 1): Functions Calls and Lazy Evaluation

Initializing Variables!

Find the Largest Integer

Build an Isomorphic Application Using Deno and React Without WebPack

How to Persist Your MobX State

Can we implement Inheritance in Angular?

CodeStates Bootcamp : week3

Using React Native to build professional consumer apps

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 Dev living in rural Japan

More from Medium

Signing transactions with EIP-712

Laika Blockchain Lab (19 Jan 2022 Update)

Creating a Crowdsale for an ERC-20 Standard Token Using Truffle, and Deploying With Infura

⛽️ Gas Optimization with Hardhat-Gas-Reporter 👷