-
I 've been stuck with this error while runing scripts/fund.js Error: No Contract deployed with name FundMe
at Object.getContract (../hh-fcc/hardhat-fund-me/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:447:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at main (../hh-fcc/hardhat-fund-me/scripts/fund.js:18:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. @alymurtazamemon const { ethers, getNamedAccounts } = require("hardhat")
async function main() {
const { deployer } = await getNamedAccounts()
const fundMe = await ethers.getContract("FundMe", deployer)
console.log(`Got contract FundMe at ${fundMe.address}`)
console.log("Funding contract...")
const transactionResponse = await fundMe.fund({
value: ethers.utils.parseEther("0.1"),
})
await transactionResponse.wait()
console.log("Funded!")
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
}) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I see no syntax error in the script. Please refer to #2917 and try the proposed solution. |
Beta Was this translation helpful? Give feedback.
-
Make sure to specify |
Beta Was this translation helpful? Give feedback.
-
@edoblinz Make sure the hardhat node is running and in another terminal, as @Rishi860 said you need to append |
Beta Was this translation helpful? Give feedback.
Make sure to specify
--network localhost
in the end while running the script.