When trying to deploy my smart contract, I get this error message:
TypeError: no matching function (argument="key", value="deployed",
code=INVALID_ARGUMENT, version=6.5.1)at main
(C:\Users…\simple-storage\backend\scripts\deploy.js:16:26)
at processTicksAndRejections (node:internal/process/task_queues:95:5) { code: > 'INVALID_ARGUMENT',
argument: 'key', value: 'deployed' }
I'm using hardhat for deploying with this deploy.js code:
const { ethers } = require("hardhat");
async function main() {
const simpleStorageContract = await ethers.getContractFactory(
"SimpleStorage"
);
const deployedContract = await simpleStorageContract.deploy("Hello World!");
await deployedContract.deployed(); // error is here
console.log("SimpleStorage Contract Address:", deployedContract.address);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Anyone have any idea what might be causing this?
Best Answer
This is due to the changes in hardhat-tools 3.0.0. Make the following changes deploy => deployContract, deployed => waitForDeployment
So your main function would look like -