This is my constructor

constructor (uint256 _initialSupply) {
        ownerOfContract = msg.sender;
        balanceOf[msg.sender] = _initialSupply;
        totalSupply = _initialSupply;

But when I deploy the contract, it gives me the following error:

{ reason: 'missing argument: in Contract constructor',
code: 'MISSING_ARGUMENT', count: 0, expectedCount: 1 }

Upon googling I came to know that constructor and deploy function should have same number of arguments when deploying through hardhat. But what should I pass in deploy()?

1 Answer 1


When you call Contract.deploy(), you just need to pass the constructor parameters in the order they are declared in your contract, like this:

Contract.deploy(initialSupply), or Contract.deploy("100000000");

If your constructor looked like this: constructor (uint256 _initialSupply, string tokenName)

Then you would deploy it in hardhat like:

Contract.deploy("100000000", "TokenA")

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.