Hardhat#2: Testing using Ethers.js — Potential problems and solutions on your first day

By akohad Mar21,2023

[ad_1]

In this article I will go through my first experience testing with Hardhat, how to connect and interact with the deployed contract in your tests.

A Signer in Ethers.js is an object that represents an Ethereum account. It’s used to send transactions to contracts and other accounts.

function mint(address _to, uint _amount) external {
require(msg.sender == owner);
_mint(_to, _amount);
}
let TokenFactory = await ethers.getContractFactory(
'Token',
deployer
);
await this.token.mint(deployerAddress, DEPLOYER_MINT)
this.token.connect(user2).transfer(user3.address, FIRST_TRANSFER)
await this.token.connect(user2).transfer(user3.address, FIRST_TRANSFER) 

[ad_2]

Source link

By akohad

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *