From ccef246c27c2bb5333b9dcf15152dddb308b641b Mon Sep 17 00:00:00 2001 From: Dhaiwat Pandya Date: Wed, 24 Aug 2022 00:37:45 +0530 Subject: [PATCH] Add Ankr RPCs as fallback --- hardhat.config.js | 185 ++++++++++++++++++++++++---------------------- 1 file changed, 95 insertions(+), 90 deletions(-) diff --git a/hardhat.config.js b/hardhat.config.js index a382ba5e8..e7c91b3a5 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -13,14 +13,19 @@ require("dotenv").config() */ const MAINNET_RPC_URL = - process.env.MAINNET_RPC_URL || - process.env.ALCHEMY_MAINNET_RPC_URL || - "https://eth-mainnet.alchemyapi.io/v2/your-api-key" + process.env.MAINNET_RPC_URL || + process.env.ALCHEMY_MAINNET_RPC_URL || + "https://eth-mainnet.alchemyapi.io/v2/your-api-key" || + "https://rpc.ankr.com/eth" const RINKEBY_RPC_URL = - process.env.RINKEBY_RPC_URL || "https://eth-rinkeby.alchemyapi.io/v2/your-api-key" + process.env.RINKEBY_RPC_URL || + "https://eth-rinkeby.alchemyapi.io/v2/your-api-key" || + "https://rpc.ankr.com/eth_rinkeby" const KOVAN_RPC_URL = process.env.KOVAN_RPC_URL || "https://eth-kovan.alchemyapi.io/v2/your-api-key" const POLYGON_MAINNET_RPC_URL = - process.env.POLYGON_MAINNET_RPC_URL || "https://polygon-mainnet.alchemyapi.io/v2/your-api-key" + process.env.POLYGON_MAINNET_RPC_URL || + "https://polygon-mainnet.alchemyapi.io/v2/your-api-key" || + "https://rpc.ankr.com/polygon" const PRIVATE_KEY = process.env.PRIVATE_KEY // optional const MNEMONIC = process.env.MNEMONIC || "Your mnemonic" @@ -32,96 +37,96 @@ const POLYGONSCAN_API_KEY = process.env.POLYGONSCAN_API_KEY || "Your polygonscan const REPORT_GAS = process.env.REPORT_GAS || false module.exports = { - defaultNetwork: "hardhat", - networks: { - hardhat: { - // If you want to do some forking set `enabled` to true - forking: { - url: MAINNET_RPC_URL, - blockNumber: FORKING_BLOCK_NUMBER, - enabled: false, - }, - chainId: 31337, + defaultNetwork: "hardhat", + networks: { + hardhat: { + // If you want to do some forking set `enabled` to true + forking: { + url: MAINNET_RPC_URL, + blockNumber: FORKING_BLOCK_NUMBER, + enabled: false, + }, + chainId: 31337, + }, + localhost: { + chainId: 31337, + }, + kovan: { + url: KOVAN_RPC_URL, + accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [], + //accounts: { + // mnemonic: MNEMONIC, + // }, + saveDeployments: true, + chainId: 42, + }, + rinkeby: { + url: RINKEBY_RPC_URL, + accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [], + // accounts: { + // mnemonic: MNEMONIC, + // }, + saveDeployments: true, + chainId: 4, + }, + mainnet: { + url: MAINNET_RPC_URL, + accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [], + // accounts: { + // mnemonic: MNEMONIC, + // }, + saveDeployments: true, + chainId: 1, + }, + polygon: { + url: POLYGON_MAINNET_RPC_URL, + accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [], + saveDeployments: true, + chainId: 137, + }, }, - localhost: { - chainId: 31337, + etherscan: { + // yarn hardhat verify --network + apiKey: { + rinkeby: ETHERSCAN_API_KEY, + kovan: ETHERSCAN_API_KEY, + polygon: POLYGONSCAN_API_KEY, + }, }, - kovan: { - url: KOVAN_RPC_URL, - accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [], - //accounts: { - // mnemonic: MNEMONIC, - // }, - saveDeployments: true, - chainId: 42, + gasReporter: { + enabled: REPORT_GAS, + currency: "USD", + outputFile: "gas-report.txt", + noColors: true, + // coinmarketcap: process.env.COINMARKETCAP_API_KEY, }, - rinkeby: { - url: RINKEBY_RPC_URL, - accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [], - // accounts: { - // mnemonic: MNEMONIC, - // }, - saveDeployments: true, - chainId: 4, + contractSizer: { + runOnCompile: false, + only: ["APIConsumer", "KeepersCounter", "PriceConsumerV3", "RandomNumberConsumerV2"], }, - mainnet: { - url: MAINNET_RPC_URL, - accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [], - // accounts: { - // mnemonic: MNEMONIC, - // }, - saveDeployments: true, - chainId: 1, + namedAccounts: { + deployer: { + default: 0, // here this will by default take the first account as deployer + 1: 0, // similarly on mainnet it will take the first account as deployer. Note though that depending on how hardhat network are configured, the account 0 on one network can be different than on another + }, + feeCollector: { + default: 1, + }, }, - polygon: { - url: POLYGON_MAINNET_RPC_URL, - accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [], - saveDeployments: true, - chainId: 137, + solidity: { + compilers: [ + { + version: "0.8.7", + }, + { + version: "0.6.6", + }, + { + version: "0.4.24", + }, + ], }, - }, - etherscan: { - // yarn hardhat verify --network - apiKey: { - rinkeby: ETHERSCAN_API_KEY, - kovan: ETHERSCAN_API_KEY, - polygon: POLYGONSCAN_API_KEY, + mocha: { + timeout: 200000, // 200 seconds max for running tests }, - }, - gasReporter: { - enabled: REPORT_GAS, - currency: "USD", - outputFile: "gas-report.txt", - noColors: true, - // coinmarketcap: process.env.COINMARKETCAP_API_KEY, - }, - contractSizer: { - runOnCompile: false, - only: ["APIConsumer", "KeepersCounter", "PriceConsumerV3", "RandomNumberConsumerV2"], - }, - namedAccounts: { - deployer: { - default: 0, // here this will by default take the first account as deployer - 1: 0, // similarly on mainnet it will take the first account as deployer. Note though that depending on how hardhat network are configured, the account 0 on one network can be different than on another - }, - feeCollector: { - default: 1, - }, - }, - solidity: { - compilers: [ - { - version: "0.8.7", - }, - { - version: "0.6.6", - }, - { - version: "0.4.24", - }, - ], - }, - mocha: { - timeout: 200000, // 200 seconds max for running tests - }, }