1- import { HardhatUserConfig } from 'hardhat/config'
2- import { networkConfig } from './utils/config-loader'
1+ import { HardhatUserConfig } from 'hardhat/config' ;
2+ import { networkConfig } from './utils/config-loader' ;
3+ import * as dotenv from 'dotenv' ;
34
4- import '@nomiclabs/hardhat-truffle5'
5- import '@nomiclabs/hardhat-ethers'
6- import '@nomiclabs/hardhat-web3'
7- import '@nomiclabs/hardhat-etherscan'
8- import '@nomicfoundation/hardhat-chai-matchers'
5+ import '@nomiclabs/hardhat-truffle5' ;
6+ import '@nomiclabs/hardhat-ethers' ;
7+ import '@nomiclabs/hardhat-web3' ;
8+ import '@nomiclabs/hardhat-etherscan' ;
9+ import '@nomicfoundation/hardhat-chai-matchers' ;
910
10- import 'hardhat-gas-reporter'
11- import 'solidity-coverage'
12- import { HardhatConfig } from 'hardhat/types'
11+ import 'hardhat-gas-reporter' ;
12+ import 'solidity-coverage' ;
1313
14- require ( 'dotenv' ) . config ( )
15-
16- const ganacheNetwork = {
17- url : 'http://127.0.0.1:8545' ,
18- blockGasLimit : 6000000000
19- }
14+ dotenv . config ( ) ;
15+ loadAndValidateEnvironment ( ) ;
2016
2117const config : HardhatUserConfig = {
2218 solidity : {
@@ -33,66 +29,36 @@ const config: HardhatUserConfig = {
3329 } ,
3430 paths : {
3531 root : 'src' ,
36- tests : '../ tests'
32+ tests : 'tests'
3733 } ,
3834 networks : {
3935 // Define here to easily specify private keys
40- devnet : validateEnvironment ( )
41- ? {
42- url : 'https://rpc.dev.immutable.com' ,
43- accounts : [ process . env . DEPLOYER_PRIV_KEY ! , process . env . WALLET_IMPL_CHANGER_PRIV_KEY ! ]
44- }
45- : {
46- url : 'SET ENVIRONMENT VARIABLES' ,
47- accounts : [ ]
48- } ,
49- testnet : validateEnvironment ( )
50- ? {
51- url : 'https://rpc.testnet.immutable.com' ,
52- accounts : [ process . env . DEPLOYER_PRIV_KEY ! , process . env . WALLET_IMPL_CHANGER_PRIV_KEY ! ]
53- }
54- : {
55- url : 'SET ENVIRONMENT VARIABLES' ,
56- accounts : [ ]
57- } ,
58- sepolia : networkConfig ( 'sepolia' ) ,
59- mainnet : networkConfig ( 'mainnet' ) ,
60- ropsten : networkConfig ( 'ropsten' ) ,
61- rinkeby : networkConfig ( 'rinkeby' ) ,
62- kovan : networkConfig ( 'kovan' ) ,
63- goerli : networkConfig ( 'goerli' ) ,
64- matic : networkConfig ( 'matic' ) ,
65- mumbai : networkConfig ( 'mumbai' ) ,
66- arbitrum : networkConfig ( 'arbitrum' ) ,
67- arbitrumTestnet : networkConfig ( 'arbitrum-testnet' ) ,
68- optimism : networkConfig ( 'optimism' ) ,
69- metis : networkConfig ( 'metis' ) ,
70- nova : networkConfig ( 'nova' ) ,
71- avalanche : networkConfig ( 'avalanche' ) ,
72- avalancheTestnet : networkConfig ( 'avalanche-testnet' ) ,
73- ganache : ganacheNetwork ,
74- coverage : {
75- url : 'http://localhost:8555'
76- }
77- } ,
78- etherscan : {
79- // Your API key for Etherscan
80- // Obtain one at https://etherscan.io/
81- apiKey : networkConfig ( 'mainnet' ) . etherscan
36+ localhost : {
37+ url : 'http://127.0.0.1:8545' ,
38+ accounts : [ process . env . DEPLOYER_PRIV_KEY ! , process . env . WALLET_IMPL_CHANGER_PRIV_KEY ! ]
39+ } ,
40+ devnet : {
41+ url : 'https://rpc.dev.immutable.com' ,
42+ accounts : [ process . env . DEPLOYER_PRIV_KEY ! , process . env . WALLET_IMPL_CHANGER_PRIV_KEY ! ]
43+ } ,
44+ testnet : {
45+ url : 'https://rpc.testnet.immutable.com' ,
46+ accounts : [ process . env . DEPLOYER_PRIV_KEY ! , process . env . WALLET_IMPL_CHANGER_PRIV_KEY ! ]
47+ } ,
48+ mainnet : {
49+ url : 'https://rpc.immutable.com' ,
50+ accounts : [ process . env . DEPLOYER_PRIV_KEY ! , process . env . WALLET_IMPL_CHANGER_PRIV_KEY ! ]
51+ } ,
8252 } ,
8353 mocha : {
8454 timeout : process . env . COVERAGE ? 15 * 60 * 1000 : 30 * 1000
8555 } ,
86- gasReporter : {
87- enabled : ! ! process . env . REPORT_GAS === true ,
88- currency : 'USD' ,
89- gasPrice : 21 ,
90- showTimeSpent : true
91- }
92- }
56+ } ;
9357
94- export default config
58+ export default config ;
9559
96- function validateEnvironment ( ) : boolean {
97- return ! ! process . env . DEPLOYER_PRIV_KEY && ! ! process . env . WALLET_IMPL_CHANGER_PRIV_KEY
60+ function loadAndValidateEnvironment ( ) : boolean {
61+ return ! ! process . env . DEPLOYER_PRIV_KEY &&
62+ ! ! process . env . WALLET_IMPL_CHANGER_PRIV_KEY &&
63+ ! ! process . env . DEPLOYER_CONTRACT_ADDRESS ;
9864}
0 commit comments