import "@nomiclabs/hardhat-waffle" ; import "hardhat-gas-reporter" ; import "solidity-coverage" ; import dotenv from "dotenv" ; import type { HttpNetworkUserConfig } from "hardhat/types" ; import yargs from "yargs" ; import { setupTasks } from "./src/tasks" ; import { setupTestConfigs } from "./test/test-management" ; const argv = yargs . option ( "network" , { type : "string" , default : "hardhat" , } ) . help ( false ) . version ( false ) . parseSync ( ) ; dotenv . config ( ) ; const { INFURA_KEY , MNEMONIC , PK , REPORT_GAS , MOCHA_CONF , NODE_URL } = process . env ; const DEFAULT_MNEMONIC = "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat" ; const sharedNetworkConfig = { } ; if ( PK ) { sharedNetworkConfig . accounts = [ PK ] ; } else { sharedNetworkConfig . accounts = { mnemonic : MNEMONIC || DEFAULT_MNEMONIC , } ; } if ( [ "rinkeby" , "mainnet" ] . includes ( argv . network ) && NODE_URL === undefined && INFURA_KEY === undefined ) { throw new Error ( `Could not find Infura key in env, unable to connect to network ${ argv . network }` ) ; } if ( NODE_URL !== undefined ) { sharedNetworkConfig . url = NODE_URL ; } const { mocha , initialBaseFeePerGas , optimizerDetails } = setupTestConfigs ( MOCHA_CONF ) ; setupTasks ( ) ; export default { mocha , paths : { artifacts : "build/artifacts" , cache : "build/cache" , deploy : "src/deploy" , sources : "src/contracts" , } , solidity : { compilers : [ { version : "0.8.10" , settings : { optimizer : { enabled : true , runs : 1000000 , details : optimizerDetails , } , } , } , ] , } , networks : { hardhat : { blockGasLimit : 12.5e6 , initialBaseFeePerGas , } , mainnet : { url : `https://mainnet.infura.io/v3/${ INFURA_KEY }` , ... sharedNetworkConfig , chainId : 1 , } , rinkeby : { url : `https://rinkeby.infura.io/v3/${ INFURA_KEY }` , ... sharedNetworkConfig , chainId : 4 , } , xdai : { url : "https://xdai.poanetwork.dev" , ... sharedNetworkConfig , chainId : 100 , } , } , namedAccounts : { deployer : 0 , } , gasReporter : { enabled : REPORT_GAS ? true : false , currency : "USD" , gasPrice : 21 , } , } ;