This is the error i am getting while testing my contract with hardhat pls help me to get this
PS E:\vs code files> npx hardhat test
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
× Help us improve Hardhat with anonymous crash reports & basic usage data? (Y/n) · y
1) Deployment should assign the total supply of the token
0 passing (4s)
1 failing
1) Token Contract
Deployment should assign the total supply of the token:
Error: missing argument: passed to contract (count=1, expectedCount=2, code=MISSING_ARGUMENT, version=contracts/5.6.2)
at Logger.makeError (node_modules\@ethersproject\logger\src.ts\index.ts:261:28)
at Logger.throwError (node_modules\@ethersproject\logger\src.ts\index.ts:273:20)
at Logger.checkArgumentCount (node_modules\@ethersproject\logger\src.ts\index.ts:332:18)
at E:\vs code files\node_modules\@ethersproject\contracts\src.ts\index.ts:187:12
at step (node_modules\@ethersproject\contracts\lib\index.js:48:23)
at Object.next (node_modules\@ethersproject\contracts\lib\index.js:29:53)
at E:\vs code files\node_modules\@ethersproject\contracts\lib\index.js:23:71
at new Promise (<anonymous>)
at __awaiter (node_modules\@ethersproject\contracts\lib\index.js:19:12)
at populateTransaction (node_modules\@ethersproject\contracts\lib\index.js:152:12)
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
contract Token{
string public name = "HARDHAT TESTING";
string public symbol = "HHH";
uint256 public totalsupply = 10000;
mapping(address=>uint256) balances;
address owner;
constructor()
{
balances[msg.sender] = totalsupply;
owner = msg.sender;
}
function balanceof(address _to,uint256 amount) external {
require(balances[msg.sender] > amount,"not enought tokens");
balances[msg.sender] -=amount;
balances[_to] +=amount;
}
function showbalance(address account) external view returns(uint256)
{
return balances[account];
}
}
this is my contract
const {expect} = require("chai");
describe("Token Contract",function()
{
it("Deployment should assign the total supply of the token",async function()
{
const [owners] = await ethers.getSigners(); // represent an ethereum account
console.log("Signers Object",owners);
const Token = await ethers.getContractFactory("Token"); // instance created
const deploy_token = await Token.deploy(); // deploy the contract statement
const ownerbalance = await deploy_token.balanceof(owners.address); //calling balanceof function of the contract
console.log(owners.address);
expect(await ownerbalance.showbalance(owners).to.equal(ownerbalance));
});
});
My token.js file
Thanks in advance