Skip to main content
2 of 3
added 821 characters in body
OmerS
  • 13
  • 5

error deploying with hardhat- config issue

I'm having error in my config file: Error HH8: There's one or more errors in your config file:

  * Invalid value undefined for HardhatConfig.networks.rinkeby.url - Expected a value of type string.
  * Invalid value {} for HardhatConfig.networks.rinkeby - Expected a value of type HttpNetworkHDAccountsConfig.
  * Invalid value undefined for HardhatConfig.networks.ropsten.url - Expected a value of type string.
  * Invalid value {} for HardhatConfig.networks.ropsten - Expected a value of type HttpNetworkHDAccountsConfig.
  * Invalid value {} for HardhatConfig.networks.ganache - Expected a value of type HttpNetworkHDAccountsConfig.
  * Invalid value undefined for HardhatConfig.networks.mainnet.url - Expected a value of type string.
  * Invalid value {} for HardhatConfig.networks.mainnet - Expected a value of type HttpNetworkHDAccountsConfig.
  * Invalid value {} for HardhatConfig.networks.polygon - Expected a value of type HttpNetworkHDAccountsConfig.
  
To learn more about Hardhat's configuration, please go to https://hardhat.org/config/

my config file:

require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");


require('dotenv').config()

// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
  const accounts = await hre.ethers.getSigners();

  for (const account of accounts) {
    console.log(account.address);
  }
});
const MAINNET_RPC_URL = process.env.MAINNET_RPC_URL || process.env.ALCHEMY_MAINNET_RPC_URL
const RINKEBY_RPC_URL = process.env.RINKEBY_RPC_URL
const ROPSTEN_RPC_URL = process.env.ROPSTEN_RPC_URL
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY
const MNEMONIC = process.env.MNEMONIC
module.exports = {
  solidity: "0.8.4",
  networks: {
   

    rinkeby: {
      url: RINKEBY_RPC_URL,
      // accounts: [PRIVATE_KEY],
      accounts: {
        mnemonic: MNEMONIC,
      },
      saveDeployments: true,
    },
    ropsten: {
      url: ROPSTEN_RPC_URL,
      // accounts: [PRIVATE_KEY],
      accounts: {
        mnemonic: MNEMONIC,
      },
      saveDeployments: true,
    },
    ganache: {
      url: 'http://localhost:8545',
      accounts: {
        mnemonic: MNEMONIC,
      }
    },
    mainnet: {
      url: MAINNET_RPC_URL,
      // accounts: [PRIVATE_KEY],
      accounts: {
        mnemonic: MNEMONIC,
      },
      saveDeployments: true,
    },
    polygon: {
      url: "https://rpc-mainnet.maticvigil.com/",
      // accounts: [PRIVATE_KEY],
      accounts: {
        mnemonic: MNEMONIC,
      },
      saveDeployments: true,

    }
  },
  etherscan: {
    // Your API key for Etherscan
    // Obtain one at https://etherscan.io/
    apiKey: ETHERSCAN_API_KEY
  },
  mocha: {
    timeout: 100000
  }
};

I actually deployed a couple of times smart contracts to different networks as mentioned above. Any ideas?

OmerS
  • 13
  • 5