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

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

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

[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

LEAVE A REPLY

Please enter your comment!
Please enter your name here