import 'dotenv/config' ; import '@nomiclabs/hardhat-waffle' ; import '@nomiclabs/hardhat-ethers' ; import '@nomiclabs/hardhat-etherscan' ; import '@typechain/hardhat' ; import '@typechain/hardhat/dist/type-extensions' ; import { removeConsoleLog } from 'hardhat-preprocessor' ; import 'hardhat-gas-reporter' ; import 'hardhat-deploy' ; import 'solidity-coverage' ; import { HardhatUserConfig , MultiSolcUserConfig , NetworksUserConfig } from 'hardhat/types' ; import { getNodeUrl , accounts } from './utils/network' ; import 'tsconfig-paths/register' ; const networks = process . env . TEST ? { } : { hardhat : { forking : { enabled : process . env . FORK ? true : false , url : getNodeUrl ( 'mainnet' ) , } , } , localhost : { url : getNodeUrl ( 'localhost' ) , accounts : accounts ( 'localhost' ) , } , kovan : { url : getNodeUrl ( 'kovan' ) , accounts : accounts ( 'kovan' ) , } , rinkeby : { url : getNodeUrl ( 'rinkeby' ) , accounts : accounts ( 'rinkeby' ) , } , ropsten : { url : getNodeUrl ( 'ropsten' ) , accounts : accounts ( 'ropsten' ) , } , mainnet : { url : getNodeUrl ( 'mainnet' ) , accounts : accounts ( 'mainnet' ) , } , } ; const config = { defaultNetwork : 'hardhat' , namedAccounts : { deployer : { default : 0 , } , } , mocha : { timeout : process . env . MOCHA_TIMEOUT || 300000 , } , networks , solidity : { compilers : [ { version : '0.8.11' , settings : { optimizer : { enabled : true , runs : 200 , } , } , } , ] , } , gasReporter : { currency : process . env . COINMARKETCAP_DEFAULT_CURRENCY || 'USD' , coinmarketcap : process . env . COINMARKETCAP_API_KEY , enabled : process . env . REPORT_GAS ? true : false , showMethodSig : true , onlyCalledMethods : false , } , preprocess : { eachLine : removeConsoleLog ( ( hre ) => hre . network . name !== 'hardhat' ) , } , etherscan : { apiKey : process . env . ETHERSCAN_API_KEY , } , typechain : { outDir : 'typechained' , target : 'ethers-v5' , } , } ; if ( process . env . TEST ) { ( config . solidity as MultiSolcUserConfig ) . compilers = ( config . solidity as MultiSolcUserConfig ) . compilers . map ( ( compiler ) => { return { ... compiler , outputSelection : { '*' : { '*' : [ 'storageLayout' ] , } , } , } ; } ) ; } export default config ;