error Error: No Contract deployed with name FundMe #2165
-
@alymurtazamemon i am having same error, can you help me out too const { networkConfig, developmentChains } = require("../helper-hardhat-config")
const { network, getNamedAccounts, deployments } = require("hardhat")
const { verify } = require("../utils/verify")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
let ethUsdPriceFeedAddress
if (chainId == 31337) {
const ethUsdAggregator = await deployments.get("MockV3Aggregator")
ethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}
const args = [ethUsdPriceFeedAddress]
const FundMe = await deploy("FundMe", {
from: deployer,
args: args,
log: true,
waitConfirmations: network.config.blockConfirmation || 1,
})
log(`FundMe deployed at ${FundMe.address}`)
if (!developmentChains.includes(network.name) && process.env.API_KEY) {
await verify(FundMe.address, args)
}
{
await verify(FundMe.address, [ethUsdPriceFeedAddress])
}
}
module.exports.tags = ("all", "FundMe") the above is 01-deploy-fund-me.js const { deployments, getNamedAccounts, ethers } = require("hardhat")
const { assert } = require("chai")
describe("fundMe", async function () {
let hello
let deployer
let MockV3Aggregator
beforeEach(async function () {
deployer = (await getNamedAccounts()).deployer
await deployments.fixture(["all"])
hello = await ethers.getContract("FundMe", deployer)
MockV3Aggregator = await ethers.getContract(
"MockV3Aggregator",
deployer
)
})
describe("constructor", async function () {
it("sets the aggregator addresses correctly", async function () {
const response = await hello.getPriceFeed()
assert.equal(response, MockV3Aggregator.address)
})
})
}) the error is below: yarn hardhat test
yarn run v1.22.15
warning package.json: No license field
$ /home/abdullah641/hardhatFundMe/node_modules/.bin/hardhat test
Compiled 3 Solidity files successfully
fundMe
constructor
1) "before each" hook for "sets the aggregator addresses correctly"
0 passing (1s)
1 failing
1) fundMe
"before each" hook for "sets the aggregator addresses correctly":
Error: No Contract deployed with name FundMe
at Object.getContract (node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:447:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)
at Context.<anonymous> (test/unit/fundMe.test.js:11:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Please share you fundme.sol file |
Beta Was this translation helpful? Give feedback.
-
@abdullahAttiq Push it to GitHub and leave link here. |
Beta Was this translation helpful? Give feedback.
-
Problem lies in the deploy script for fundme, it should be this instead: |
Beta Was this translation helpful? Give feedback.
@abdullahAttiq
Problem lies in the deploy script for fundme, it should be this instead:
module.exports.tags = ["all", "fundme"]
with the [] and also, in snakecase.