Lesson 7 : Error: No deployment found for: MockV3Aggregator #1264
-
i deployed mock and it's running, but when i deploy fundme, I'm getting this error.
01-deploy-fund-me.js const { networkConfig, developmentChains } = require("../helper-hardhat-config")
const { getNamedAccounts, deployments, network } = require("hardhat")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
let ethUsdPriceFeedAddress
if (developmentChains.includes(network.name)) {
const ethUsdAggregator = await deployments.get("MockV3Aggregator")
ethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}
log("----------------------------------------------------")
log("Deploying FundMe and waiting for confirmations...")
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
const fundMe = await deploy("FundMe", {
from: deployer,
args: [ethUsdPriceFeedAddress],
log: true,
// we need to wait if on a live network so we can verify properly
})
}
module.exports.tags = ["all", "fundme"] i tried if (chainId == 31337) instead of if (developmentChains.includes(network.name)) but still, shows same error |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
@zulfi984 Push it to GitHub and leave link here |
Beta Was this translation helpful? Give feedback.
-
The reason for the error in running yarn hardhat deploy -- tags fundme here is that the mock 00-deploy-mocks.js was not executed, resulting in the absence of a MockV3Eggregator in this deployment process. Therefore, we can use yarn hardhat deploy to deploy Alternatively, use yarn hardhat deploy -- tags all |
Beta Was this translation helpful? Give feedback.
@zulfi984 Push it to GitHub and leave link here