Skip to content

Added more configurations for hardhat and truffle config files

Config files for truffle and hardhat lacked important configurations such as the support for the Goerli testnet. Here are the new config files code.
Hardhat:

require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();
const GOERLI_RPC_URL = process.env.GOERLI_RPC_URL || "";
const PRIVATE_KEY = process.env.PRIVATE_KEY || "0x";
const FUJI_RPC_URL = process.env.FUJI_RPC_URL || "0x";

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.10",
  networks: {
    hardhat: {
      chainId: 1337, // We set 1337 to make interacting with MetaMask simpler
    },
    localhost: {
      chainId: 31337,
    },
    goerli: {
      url: GOERLI_RPC_URL,
      accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [],
      chainId: 5,
    },
    fuji: {
      url: FUJI_RPC_URL,
      chainId: 43113,
      accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [],
    },
  },
};

Truffle:

require("dotenv").config();
const HDWalletProvider = require("@truffle/hdwallet-provider");

//Account credentials from which our contract will be deployed
const MNEMONIC = process.env.MNEMONIC;

//API key of your Datahub account for Avalanche Fuji test network
const GOERLI_RPC = process.env.GEORLI_RPC;
const FUJI_RPC_URL = process.env.FUJI_RPC_URL || "0x";

module.exports = {
  contracts_build_directory: "../client/src/blockchainBuild/",
  networks: {
    fuji: {
      provider: function () {
        return new HDWalletProvider({
          MNEMONIC,
          providerOrUrl: FUJI_RPC_URL,
          chainId: "0xa869",
        });
      },
      network_id: "*",
      skipDryRun: true,
    },

    goerli: {
      provider: () => {
        return new HDWalletProvider(MNEMONIC, GOERLI_RPC);
      },
      network_id: "5", // eslint-disable-line camelcase
      gas: 4465030,
      gasPrice: 10000000000,
    },
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: 5777,
    },
  },
  plugins: ["solidity-coverage"],
  // Set default mocha options here, use special reporters etc.
  mocha: {
    // timeout: 100000
  },
  compilers: {
    solc: {
      version: "0.8.0",
    },
  },
};
Edited by Asem-Abdelhady

Merge request reports