Closed Pif50 closed 1 year ago
Hi everyone. I'm stuck at 10:58:56, when Patrick is trying to deploy.
When I deploy I have an error TypeError: Cannot read properties of undefined (reading 'includes').
01-deploy-fun-me.js
const { network } = require("hardhat") const { networkConfig, developmentChains } = require("../helper-hardhat-config") const { verify } = require("../utils/verify") module.exports = async ({ getNamedAccounts, deployments }) => { const { deploy, log } = deployments const { deployer } = await getNamedAccounts() //getNamedAccounts is a way for get a named account const chainId = network.config.chainId let ethUsdPriceFeedAddress if (chainId == 31337) { const ethUsdAggregator = await deployments.get("MockV3Aggregator") ethUsdPriceFeedAddress = ethUsdAggregator.address } else { ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"] } log("----------------------------------------------------") log("Deploying FundMe and waiting for confirmations...") const args = [ethUsdPriceFeedAddress] const fundMe = await deploy("FundMe", { from: deployer, args: args, //put price feed address log: true, waitConfirmations: network.config.blockConfirmations || 1, }) log(`FundMe deployed at ${fundMe.address}`) if ( !developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY ) { await verify(fundMe.address, args) } log("-------------------------------------------------------------------------------------------------------------------") } module.exports.tags = ["all", "fundme"]
hardhat.config.js
require("@nomicfoundation/hardhat-toolbox"); require("dotenv").config() require("@nomiclabs/hardhat-etherscan"); require("hardhat-gas-reporter") require("solidity-coverage") require("hardhat-deploy") /** @type import('hardhat/config').HardhatUserConfig */ const GOERLI_RPC_URL = process.env.GOERLI_RPC_URL const PRIVATE_KEY = process.env.PRIVATE_KEY const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY module.exports = { //solidity: "0.8.8", solidity: { compilers: [ { version: "0.8.8" }, { version: "0.6.6" } ], }, defaultNetwork: "hardhat", networks: { goerli: { url: GOERLI_RPC_URL, accounts: [PRIVATE_KEY], chainId: 5, blockConfirmation: 6, }, localhost: { url: "http://127.0.0.1:8545/", chainId: 31337, } }, etherscan: { apiKey: ETHERSCAN_API_KEY, }, gasReporter: { enabled: true, currency: "USD", outputFile: "gas-report.txt", noColors: true, coinmarketcap: COINMARKETCAP_API_KEY, }, namedAccounts: { deployer: { default: 0, }, }, };
helper-hardhat-config.js
const networkConfig = { 31337: { name: "localhost", }, 5: { name: "goerli", ethUsdPriceFeed: "0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e", }, } const developmentChain = ["hardhat", "localhost"] const DECIMALS = 8 const INITIAL_ANSWER = 200000000000 module.exports = { networkConfig, developmentChain, DECIMALS, INITIAL_ANSWER }
I wrote developmentChains, in helper-hardhat-cofig.js, without 's' final
Hi everyone. I'm stuck at 10:58:56, when Patrick is trying to deploy.
When I deploy I have an error TypeError: Cannot read properties of undefined (reading 'includes').
01-deploy-fun-me.js
hardhat.config.js
helper-hardhat-config.js