I'm trying to run a script with Hardhat to deploy a contract which has constructor arguments. When I run npx hardhat run scriptsdeploy.js --network rinkeby
I get the error:
Error: missing argument: in Contract constructor (count=0, expectedCount=7, code=MISSING_ARGUMENT, version=contracts/5.5.0)
I've tried to use the --constructor-args parameter but get another error:
Error HH305: Unrecognized param --constructor-args
All the references I've found to constructor-args suggests that it's only available as part of hardhat verify, not hardhat run but if that's the case how can I pass arguments when deploying?
Updated to include deploy script
// deploy.js
async function main() {
const [deployer] = await ethers.getSigners();
console.log('%c n Deploying contracts with the account:', 'color:', deployer.address );
console.log('%c n Account balance:', 'color:', (await deployer.getBalance()).toString() );
const Token = await ethers.getContractFactory("Test01");
const token = await Token.deploy();
console.log('%c n Token address:', 'color:', token.address );
}
main()
.then( () => process.exit(0) )
.catch( (error) => {
console.error(error);
process.exit(1);
});
```