Open Abhishek2061 opened 1 year ago
As per the latest Hardhat Documentation:
const SimpleStorageFactory = await ethers.deployContract("SimpleStorage");
console.log("Deploying Contract...");
await SimpleStorageFactory.waitForDeployment();
console.log(
Deployed contract to:${await SimpleStorageFactory.getAddress()}
);
Or Downgrade your Hardhat version to run the code you have mentioned: npm install --save-dev --save-exact hardhat@2.14.0
use await SimpleStorage.waitForDeployment();
why its returning [AsyncFunction: getAddress]
instead of the contract address?????
solved I forgot to add () after getAddress
async function main() {
const SimpleStorageFactory = await ethers.deployContract("SimpleStorage");
console.log("deploying wait");
const SimpleStorage = await SimpleStorageFactory.waitForDeployment();
console.log(await SimpleStorage.getAddress());```
console.log(SimpleStorage.target);
.target better than getAddress()
Lesson
Lesson 6
Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")
No response
Operating System
None
Describe the bug
async function main() { const SimpleStorageFactory = await ethers.getContractFactory( "SimpleStorage" )
console.log("Deploying Contract...") const simpleStorage = await SimpleStorageFactory.deploy() // await simpleStorage.deployed() // console.log(
Deployed contract to:${simpleStorage.address}
) }*So the commented part is having a problem in deployment.
TypeError: no matching function (argument="key", value="address", code=INVALID_ARGUMENT, version=6.6.0) at makeError (/home/niv_2061/fcc-hardhat/hardhat-fcc-first/node_modules/ethers/src.ts/utils/errors.ts:670:21) at assert (/home/niv_2061/fcc-hardhat/hardhat-fcc-first/node_modules/ethers/src.ts/utils/errors.ts:694:25) at assertArgument (/home/niv_2061/fcc-hardhat/hardhat-fcc-first/node_modules/ethers/src.ts/utils/errors.ts:706:5) at Interface.getFunctionName (/home/niv_2061/fcc-hardhat/hardhat-fcc-first/node_modules/ethers/src.ts/abi/interface.ts:542:23) at buildWrappedMethod (/home/niv_2061/fcc-hardhat/hardhat-fcc-first/node_modules/ethers/src.ts/contract/contract.ts:334:34) at BaseContract.getFunction (/home/niv_2061/fcc-hardhat/hardhat-fcc-first/node_modules/ethers/src.ts/contract/contract.ts:849:22) at Object.get (/home/niv_2061/fcc-hardhat/hardhat-fcc-first/node_modules/ethers/src.ts/contract/contract.ts:747:39) at main (/home/niv_2061/fcc-hardhat/hardhat-fcc-first/scripts/deploy.js:11:55) at processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 'INVALID_ARGUMENT', argument: 'key', value: 'address' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.*