From ae22bd7be95ca61ba34f9ad0cdb7b712c62b0d37 Mon Sep 17 00:00:00 2001 From: cedoor Date: Fri, 18 Feb 2022 15:45:13 +0100 Subject: [PATCH] chore: add kovan & arbitrum networks Former-commit-id: 7d88065862fa289ef41de62e04b82c30038cb186 --- .env.example | 2 ++ hardhat.config.ts | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 9b91f04b..993641a6 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,4 @@ +INFURA_API_KEY= +BACKEND_PRIVATE_KEY= COINMARKETCAP_API_KEY= REPORT_GAS=false diff --git a/hardhat.config.ts b/hardhat.config.ts index a1e86da3..26946c48 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -4,6 +4,7 @@ import "@typechain/hardhat" import { config as dotenvConfig } from "dotenv" import "hardhat-gas-reporter" import { HardhatUserConfig } from "hardhat/config" +import { NetworksUserConfig } from "hardhat/types" import { resolve } from "path" import "solidity-coverage" import { config } from "./package.json" @@ -13,6 +14,26 @@ import "./tasks/deploy-verifier" dotenvConfig({ path: resolve(__dirname, "./.env") }) +function getNetworks(): NetworksUserConfig | undefined { + if (process.env.INFURA_API_KEY && process.env.BACKEND_PRIVATE_KEY) { + const infuraApiKey = process.env.INFURA_API_KEY + const accounts = [`0x${process.env.BACKEND_PRIVATE_KEY}`] + + return { + kovan: { + url: `https://kovan.infura.io/v3/${infuraApiKey}`, + chainId: 42, + accounts + }, + arbitrum: { + url: "https://arb1.arbitrum.io/rpc", + chainId: 42161, + accounts + } + } + } +} + const hardhatConfig: HardhatUserConfig = { solidity: config.solidity, paths: { @@ -26,10 +47,7 @@ const hardhatConfig: HardhatUserConfig = { chainId: 1337, allowUnlimitedContractSize: true }, - localhost: { - url: "http://localhost:8545", - allowUnlimitedContractSize: true - } + ...getNetworks() }, gasReporter: { currency: "USD",