Closed celalaksu closed 2 years ago
Try updating your network.name
!developmentChains.includes(network.naem) &&
to
!developmentChains.includes(network.name) &&
Thank you @FerraroSoftware . I fixed it but the same error persists.
When i use address directly ethUsdPriceFeedAddress = "0x8A753747A1Fa494EC906cE90E9f37563A8AF630e"
instead of ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
It gives this error
Error: ERROR processing /home/eemcs/freecodecamp/hardhat-fund-me-cc/deploy/01-deploy-fund-me.js:
TypeError: Cannot read properties of undefined (reading 'length')
at getFrom (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/helpers.ts:1713:14)
at _deploy (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/helpers.ts:533:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at _deployOne (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/helpers.ts:1004:16)
at Object.module.exports.default [as func] (/home/eemcs/freecodecamp/hardhat-fund-me-cc/deploy/01-deploy-fund-me.js:22:20)
at DeploymentsManager.executeDeployScripts (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1219:22)
at DeploymentsManager.runDeploy (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1052:5)
at SimpleTaskDefinition.action (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/index.ts:438:5)
at Environment._runTaskDefinition (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
at Environment.run (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
at DeploymentsManager.executeDeployScripts (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1222:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at DeploymentsManager.runDeploy (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1052:5)
at SimpleTaskDefinition.action (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/index.ts:438:5)
at Environment._runTaskDefinition (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
at Environment.run (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
at SimpleTaskDefinition.action (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat-deploy/src/index.ts:584:32)
at Environment._runTaskDefinition (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
at Environment.run (/home/eemcs/freecodecamp/hardhat-fund-me-cc/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
at SimpleTaskDefinition.action (/home/eemcs/freecodecamp/hardhat-fund-me-cc/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.
@celalaksu In 01-deploy-fund-me.js file, Can you console chainId and tell me what output you are getting?
Thank you @rodriguesnavil. There was an syntax mistake about chainId. I fixed it . But i have same error
TypeError: Cannot read properties of undefined (reading 'length')
Chain Id is 4. I tried orj repo and i get same error. Is there any installation I forget?
I added RINKEBY_RPC_URL, PRIVATE_KEY from metamask rinkeby testnet ( and added to .env file without "0x" ), ETHERSCAN_API_KEY, COINMARKETCAP_API_KEY to .env file.
require("dotenv").config()
require("@nomiclabs/hardhat-etherscan")
require("@nomiclabs/hardhat-waffle")
require("hardhat-gas-reporter")
require("solidity-coverage")
require("hardhat-deploy")
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const RINKEBY_RPC_URL = process.env.RINKEBY_RPC_URL
const PRIVATE_KEY = process.env.PRIVATE_KEY
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY
const COINMARKEKETCAP_API_KEY = process.env.COINMARKEKETCAP_API_KEY
module.exports = {
//solidity: "0.8.8",
solidity: {
compilers: [{ version: "0.8.8" }, { version: "0.6.6" }],
},
defaultNetwork: "hardhat",
networks: {
rinkeby: {
url: RINKEBY_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 4,
blockConfirmations: 6,
},
},
gasReporter: {
enabled: true,
outputFile: "gas-report.txt",
noColors: true,
currency: "USD",
coinmarketcap: COINMARKEKETCAP_API_KEY,
token: "MATIC",
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
namedAccounts: {
deployer: {
default: 0,
1: 0,
4: 1,
},
},
}
Update the namedaccounts section:
namedAccounts: {
deployer: {
default: 0,
},
},
Thank you @PatrickAlphaC. It worked
I faced the same issue and this solution worked for me too. But I am a little confused, why did this happen in the first place? Why adding chainId: index
key-value pair in the deployer
was creating this error? Would someone please explain this?
yarn hardhat deploy --network rinkeby
deploy error01-deploy-fund-me.js
helper-hardhat-config.js