PatrickAlphaC / hardhat-fund-me-fcc

82 stars 184 forks source link

FundMe project isn't deploying and getting "No deployment found for: MockV3Aggregator" error #17

Closed uzair011 closed 2 years ago

uzair011 commented 2 years ago

When I run this command yarn hardhat deploy --tags fundme I'm getting this MockV3Aggregator error.

Error: ERROR processing /Users/mohameduzair/blockChain/JSweb3_2/fundMe_hardhat/deploy/01-deploy-fundMe.js: Error: No deployment found for: MockV3Aggregator at Object.get (/Users/mohameduzair/blockChain/JSweb3_2/fundMe_hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:162:17)

01-deploy-fundMe.js deploy script

const { network, deployments, getNamedAccounts } = require("hardhat")
const { networkConfig, developmentChains } = require("../helper-hardhat-config")

module.exports = async ({ getNamedAccounts, deployments }) => {
    const { deploy, log } = deployments
    const { deployer } = await getNamedAccounts()
    const chainId = network.config.chainId

    // when we going for localhost or hardhat network we want to use mock
    // ?selecting the correct pricefeed address
    let ethUsdPriceFeedAddress
    if (developmentChains.includes(network.name)) {
        // if (chainId === 31337) {
        const ethUsdAggregator = await deployments.get("MockV3Aggregator")
        ethUsdPriceFeedAddress = ethUsdAggregator.address
    } else {
        ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
    }

    const fundMe = await deploy("FundMe", {
        from: deployer,
        args: [ethUsdPriceFeedAddress],
        log: true,
    })
    log(`FundMe deployed at ${fundMe.address}`)
    log(`-------------------------!!!--------------------------`)
}
module.exports.tags = ["all", "fundme"] 

MockV3Aggregator.sol contract

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
// pragma solidity >=0.6.6 <0.8.7;
import "@chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol";

Thank you

uzair011 commented 2 years ago

After spending 5 hours, I fixed the bug. It was an extra {curly brace} in my code and a deployment error.

PatrickAlphaC commented 2 years ago

Welcome to coding 😆

kevinabraham23 commented 2 years ago

After spending 5 hours, I fixed the bug. It was an extra {curly brace} in my code and a deployment error.

could specify where was it u had the typo and the deployment error currently facing the same issue thanks>>

jawadgit commented 2 years ago

Hi @uzair011

I am still stuck in this issue.

I am running following command

yarn hardhat deploy

still getting same above error.

please clearly specify where i can change the network

thanks in advance

waiting for your reply