Skip to content

Instantly share code, notes, and snippets.

@derrekcoleman
Created February 19, 2024 17:10
Show Gist options
  • Save derrekcoleman/5ff4806dce3824fed544aa778cd2cc46 to your computer and use it in GitHub Desktop.
Save derrekcoleman/5ff4806dce3824fed544aa778cd2cc46 to your computer and use it in GitHub Desktop.
hardhat.config.ts - 40+ networks, default API keys
import * as dotenv from "dotenv";
dotenv.config();
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-chai-matchers";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "solidity-coverage";
import "@nomicfoundation/hardhat-verify";
import "hardhat-deploy";
import "hardhat-deploy-ethers";
// If not set, it uses our default API key for Grove.
// You can get your own at https://dashboard.alchemyapi.io
const groveApiKey = process.env.GROVE_API_KEY || "9e1bdf09";
// If not set, it uses our default API key for Alchemy.
// You can get your own at https://portal.grove.city
const alchemyApiKey = process.env.ALCHEMY_API_KEY || "oKxs-03sij-U_N0iOlrSsZFr29-IqbuF";
// If not set, it uses the hardhat account 0 private key.
const deployerPrivateKey =
process.env.DEPLOYER_PRIVATE_KEY ?? "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
// If not set, it uses our default API key for Etherscan.
const etherscanApiKey = process.env.ETHERSCAN_API_KEY || "DNXJA8RX2Q3VZ4URQIWP7Z68CJXQZSC6AW";
const config: HardhatUserConfig = {
solidity: {
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
// https://docs.soliditylang.org/en/latest/using-the-compiler.html#optimizer-options
runs: 200,
},
},
},
defaultNetwork: "localhost",
namedAccounts: {
deployer: {
// By default, it will take the first Hardhat account as the deployer
default: 0,
},
},
networks: {
// View the networks that are pre-configured.
// If the network you are looking for is not here you can add new network settings
hardhat: {
forking: {
url: `https://eth-mainnet.rpc.grove.city/v1/${groveApiKey}`,
enabled: process.env.MAINNET_FORKING_ENABLED === "true",
},
},
arbitrum: {
url: `https://arbitrum-one.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
arbitrumSepolia: {
url: `https://arb-sepolia.g.alchemy.com/v2/${alchemyApiKey}`,
accounts: [deployerPrivateKey],
},
avax: {
url: `https://avax-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
base: {
url: `https://base-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
baseGoerli: {
url: "https://goerli.base.org",
accounts: [deployerPrivateKey],
},
baseSepolia: {
url: `https://base-testnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
binanceSmartChain: {
url: `https://bsc-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
boba: {
url: `https://boba-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
celo: {
url: `https://celo-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
chiado: {
url: "https://rpc.chiadochain.net",
accounts: [deployerPrivateKey],
},
evmos: {
url: `https://evmos-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
fantom: {
url: `https://fantom-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
fuse: {
url: `https://fuse-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
goerli: {
url: `https://eth-goerli.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
gnosis: {
url: `https://gnosischain-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
harmonyShard0: {
url: `https://harmony-0.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
iotex: {
url: `https://iotex-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
kava: {
url: `https://kava-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
klaytn: {
url: `https://klaytn-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
// Ethereum Mainnet
mainnet: {
url: `https://eth-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
metis: {
url: `https://metis-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
moonbeam: {
url: `https://moonbeam-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
moonriver: {
url: `https://moonriver-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
near: {
url: `https://near-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
oasys: {
url: `https://oasys-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
okc: {
url: `https://okc-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
optimism: {
url: `https://optimism-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
optimismSepolia: {
url: `https://opt-sepolia.g.alchemy.com/v2/${alchemyApiKey}`,
accounts: [deployerPrivateKey],
},
osmosis: {
url: `https://osmosis-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
pgn: {
url: "https://rpc.publicgoods.network",
accounts: [deployerPrivateKey],
},
pgnTestnet: {
url: "https://sepolia.publicgoods.network",
accounts: [deployerPrivateKey],
},
polygon: {
url: `https://poly-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
polygonMumbai: {
url: `https://polygon-mumbai.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
pokt: {
url: `https://mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
polygonZkEvm: {
url: `https://polygon-zkevm-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
polygonZkEvmTestnet: {
url: `https://polygonzkevm-testnet.g.alchemy.com/v2/${alchemyApiKey}`,
accounts: [deployerPrivateKey],
},
radix: {
url: `https://radix-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
scroll: {
url: `https://scroll-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
scrollSepolia: {
url: "https://sepolia-rpc.scroll.io",
accounts: [deployerPrivateKey],
},
scrollTestnet: {
url: `https://scroll-testnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
sepolia: {
url: `https://sepolia.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
solana: {
url: `https://solana-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
sui: {
url: `https://sui-mainnet.rpc.grove.city/v1/${groveApiKey}`,
accounts: [deployerPrivateKey],
},
},
// configuration for hardhat-verify plugin
etherscan: {
apiKey: `${etherscanApiKey}`,
},
// configuration for etherscan-verify from hardhat-deploy plugin
verify: {
etherscan: {
apiKey: `${etherscanApiKey}`,
},
},
sourcify: {
enabled: false,
},
};
export default config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment