PatrickAlphaC / hardhat-fund-me-fcc

82 stars 184 forks source link

Error: cannot find artifact "fundme" #32

Closed asmar10 closed 2 years ago

asmar10 commented 2 years ago

Hi im facing this error when i run the yarn hardhat deploy command:

$ C:\Users\ROSHAN\hardhat-fundme\node_modules\.bin\hardhat deploy
Nothing to compile
Local network detected! Deploying mocks...
deploying "MockV3Aggregator" (tx: 0x2f60bd4cba5dffe33cd22380f4891cfadb7f13aad763bb084e8a1c3336b892f9)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 569635 gas
Mocks deployed!
-----------------------------------------------------------
An unexpected error occurred:

Error: ERROR processing C:\Users\ROSHAN\hardhat-fundme\deploy\01-deploy-fundme.js:
Error: cannot find artifact "fundme"
    at getArtifact (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\DeploymentsManager.ts:207:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at listOnTimeout (node:internal/timers:526:9)
    at processTimers (node:internal/timers:500:7)
    at getArtifactFromOptions (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\helpers.ts:498:20)
    at getLinkedArtifact (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\helpers.ts:514:38)
    at _deploy (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\helpers.ts:535:54)
    at _deployOne (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\helpers.ts:1004:16)
    at Object.deployFunc [as func] (C:\Users\ROSHAN\hardhat-fundme\deploy\01-deploy-fundme.js:23:5)
    at DeploymentsManager.executeDeployScripts (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\DeploymentsManager.ts:1222:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at listOnTimeout (node:internal/timers:526:9)
    at processTimers (node:internal/timers:500:7)
    at DeploymentsManager.runDeploy (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\DeploymentsManager.ts:1052:5)        
    at SimpleTaskDefinition.action (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\index.ts:438:5)
    at Environment._runTaskDefinition (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat\src\internal\core\runtime-environment.ts:219:14)
    at Environment.run (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat\src\internal\core\runtime-environment.ts:131:14)
    at SimpleTaskDefinition.action (C:\Users\ROSHAN\hardhat-fundme\node_modules\hardhat-deploy\src\index.ts:584:32)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

this is my code:

const { network } = require("hardhat");
const { networkConfig, devChains } = require("../hardhat-helper-config.js");
const { verify } = require("../utils/verify.js");

async function deployFunc(hre) {

    hre.deployments;
    hre.getNamedAccounts;

    const { deploy, log, get } = deployments;
    const { deployer } = await getNamedAccounts();
    const chainId = network.config.chainId;
    let ethUsdPriceFeedAddress;

    if (devChains.includes(network.name)) {
        const ethUsdAggregator = await get("MockV3Aggregator");
        ethUsdPriceFeedAddress = ethUsdAggregator.address;
    } else {
        ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"];
    }

    const fundMe = await deploy("fundme", {
        contract: "fundme",
        from: deployer,
        args: [ethUsdPriceFeedAddress],
        log: true,
        waitConfirmations: network.config.blockConfirmations,
    })

    if (!devChains.includes(network.name)) {
        verify(fundMe.address, [ethUsdPriceFeedAddress]);
    }

}

module.exports.default = deployFunc;
module.exports.tags = ["all", "fundme"]