0
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9; 
import "opezeppilines/openzeppelin-contracts-master/contracts/token/ERC20/ERC20.sol";

contract currency is ERC20 {
    constructor(string memory name,string memory symbol) ERC20(name,symbol)
    {
        _mint(msg.sender,10*10**18);
        
    }
}

my currency.sol

async function main()
{
    const {deployer} = await ethers.getSigners();
    const Token = await ethers.getContractFactory("currency");
    const token = await Token.deploy();
}

main().then(() => process.exit(0))
.catch(
err => {console.error(err);
process.exit(1);
});

My deploy.js

PS E:\vs code files> npx hardhat run --network Goerli scripts/deploy.js
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
Error: missing argument:  in Contract constructor (count=0, expectedCount=2, code=MISSING_ARGUMENT, version=contracts/5.6.2)
    at Logger.makeError (E:\vs code files\node_modules\@ethersproject\logger\src.ts\index.ts:261:28)
    at Logger.throwError (E:\vs code files\node_modules\@ethersproject\logger\src.ts\index.ts:273:20)
    at Logger.checkArgumentCount (E:\vs code files\node_modules\@ethersproject\logger\src.ts\index.ts:332:18)
    at ContractFactory.<anonymous> (E:\vs code files\node_modules\@ethersproject\contracts\src.ts\index.ts:1237:16)
    at step (E:\vs code files\node_modules\@ethersproject\contracts\lib\index.js:48:23)
    at Object.next (E:\vs code files\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 (E:\vs code files\node_modules\@ethersproject\contracts\lib\index.js:19:12)
    at ContractFactory.deploy (E:\vs code files\node_modules\@ethersproject\contracts\lib\index.js:1138:16) {
  reason: 'missing argument:  in Contract constructor',
  code: 'MISSING_ARGUMENT',
  count: 0,
  expectedCount: 2
}

ERROR MESSAGE

1
  • do i need to share my hardhat.config,js Commented Jul 19, 2022 at 6:13

2 Answers 2

2

Your constructor needs 2 values as input, which you didn't provide in your script. The name and the symbol. Change your code line to somthing like this:

const token = await Token.deploy("tokenName", "tokenSymbol");
1

There's also a typo in the first contract code you shared. You wrote opezeppilines, but it should be openzeppelin

Corrected here:

//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9; 
import "openzeppelin/openzeppelin-contracts-master/contracts/token/ERC20/ERC20.sol";

contract currency is ERC20 {
    constructor(string memory name,string memory symbol) ERC20(name,symbol)
    {
        _mint(msg.sender,10*10**18);
        
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.