Skip to content

Lesson 7 : Error: ERROR processing /root/hh-fcc/hardhat-fund-me-fcc/deploy/01-deploy-fund-me.js: TypeError: Cannot read properties of undefined (reading 'ethUsdPriceFeed') #5727

Discussion options

You must be logged in to vote

@MrPositive0709 Because the code is not able to read ethUsdPriceFeed because it is not defined for localhost in config file, you are missing this logic.

let ethUsdPriceFeedAddress
if (chainId == 31337) {
    const ethUsdAggregator = await deployments.get("MockV3Aggregator")
    ethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
    ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}

If the user deploying on local host then take the address from mocks otherwise from the networkConfig

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MrPositive0709
Comment options

Answer selected by MrPositive0709
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants