2022-12-15

I am facing an undefined reading length error in my code below

This is the error I am getting when I try to deploy the code: Error: ERROR processing /home/anooj-patnaik/hh-fcc/hardhat-fund-me-fcc/deploy/00-deploy-mocks.js: TypeError: Cannot read properties of undefined (reading 'length')

const { network } = require("hardhat")

const {

    developmentChains,

    DECIMALS,

    INITIAL_ANSWER,

} = require("../helper-hardhat-config")

module.exports = async ({ getNamedAccounts, deployments }) => {

    const { deploy, log } = deployments

    const { deployer } = await getNamedAccounts()

    if (developmentChains.includes(network.name)) {

        log("Local Network Detected! Deploying Mocks...")

        await deploy("MockV3Aggregator", {

            contract: "MockV3Aggregator",

            from: deployer,

            log: true, 

            args: [DECIMALS, INITIAL_ANSWER],

        })

        log("Mocks deployed")

        log("---------------------------")

    }

}

module.exports.tags = ["all", "mocks"]

I have defined all the variables in a hardhat-helper-config.js and hardhat.config.js. The MockV3Aggregator is in a separate contract

Tried to deploy the code above and faced with an error



No comments:

Post a Comment