Lesson 7 Error deploying on Rinkeby networkl #494
-
01-deploy-fund-me.js
When i try to run yarn deploy --network rinkeby, i get the following error TypeError: Cannot read properties of undefined (reading 'ethUsdPriceFeed') |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 12 replies
-
You might be missing the ".js" at the end of "../helper-hardhat-config". So this line:
should be:
|
Beta Was this translation helpful? Give feedback.
-
I ran into the same issue and logged the ethUsdPriceFeedAddress on my console. I got the following instead of the normal rinkeby address ethUsdPriceFeedAddress = 7.904547291129975e+47 For some reason, the rinkeby address is not been fetched correctly. Here is my 01-deploy-fund-me.js const {
networkConfig,
developmentChains,
} = require("../helper-hardhat-config.js")
const { network } = require("hardhat")
const { verify } = require("../utils/verify")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
console.log(`ChainId = ${chainId}`)
// If chainId is X use address A
// const ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
let ethUsdPriceFeedAddress
if (developmentChains.includes(network.name)) {
const ethUsdAggregator = await deployments.get("MockV3Aggregator")
ethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
// ethUsdPriceFeedAddress = "0x8a753747a1fa494ec906ce90e9f37563a8af630e"
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
//console.log(`ethUsdPriceFeedAddress = ${networkConfig[chainId]["ethUsdPriceFeed"]}`)
}
const args = [ethUsdPriceFeedAddress]
const fundMe = await deploy("FundMe", {
from: deployer,
args: args, // Price feed address
log: true,
waitConfirmations: network.config.blockConfirmations || 1, //
})
if (
!developmentChains.includes(network.name) &&
process.env.ETHERSCAN_API_KEY
) {
await verify(fundMe.address, args)
}
log("-------------------------------------------------")
}
module.exports.tags = ["all", "fundme"] Here is the error message An unexpected error occurred:
Error: ERROR processing /home/marcellus/web3/hardhat-fund-me/deploy/01-deploy-fund-me.js:
Error: invalid address (argument="address", value=7.904547291129975e+47, code=INVALID_ARGUMENT, version=address/5.6.1) (argument="priceFeedAddress", value=7.904547291129975e+47, code=INVALID_ARGUMENT, version=abi/5.6.4)
at Logger.makeError (/home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/logger/src.ts/index.ts:261:28)
at Logger.throwError (/home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/logger/src.ts/index.ts:273:20)
at Logger.throwArgumentError (/home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/logger/src.ts/index.ts:277:21)
at AddressCoder.Coder._throwError (/home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/abi/src.ts/coders/abstract-coder.ts:68:16)
at AddressCoder.encode (/home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/abi/src.ts/coders/address.ts:22:18)
at /home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/abi/src.ts/coders/array.ts:71:19
at Array.forEach (<anonymous>)
at pack (/home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/abi/src.ts/coders/array.ts:54:12)
at TupleCoder.encode (/home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/abi/src.ts/coders/tuple.ts:54:20)
at AbiCoder.encode (/home/marcellus/web3/hardhat-fund-me/node_modules/@ethersproject/abi/src.ts/abi-coder.ts:111:15)
at DeploymentsManager.executeDeployScripts (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1222:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at DeploymentsManager.runDeploy (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1052:5)
at SimpleTaskDefinition.action (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat-deploy/src/index.ts:438:5)
at Environment._runTaskDefinition (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
at Environment.run (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
at SimpleTaskDefinition.action (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat-deploy/src/index.ts:584:32)
at Environment._runTaskDefinition (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
at Environment.run (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
at SimpleTaskDefinition.action (/home/marcellus/web3/hardhat-fund-me/node_modules/hardhat-deploy/src/index.ts:669:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
Beta Was this translation helpful? Give feedback.
-
Hi! I have the same problem, what the terminal says is that it got troubles reading the properties of Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
All, I was having the exact same problem when trying to deploy to the rinkeby network. Here's what my helper-hardhat-config.js looks like:
Here's what the 01-deploy-fund-me.js file looked like:
And the error I was getting in the terminal:
The problem itself appears to be in the 01-deploy-fund-me.js file ... specifically in this line:
As soon as I changed this line to:
... it worked no problem. It deployed properly. Somehow the "configuration" of the helper-hardhat-config.js file ... how we define the different networks ... that configuration is not working when we specify the --network rinkeby in the terminal command. It's as if when we identify the --network rinkeby in the terminal ... it's not linking the chainId of 4 and rinkeby together. Hope this helps ... it's a bandaid-way of making it work. Would like to know how to make it work properly myself. @PatrickAlphaC .. any hints? |
Beta Was this translation helpful? Give feedback.
You might be missing the ".js" at the end of "../helper-hardhat-config".
So this line:
should be: