@@ -3,7 +3,6 @@ import { resolve } from 'path';
3
3
dotenvConfig ( { path : resolve ( __dirname , './.env' ) } ) ;
4
4
5
5
import { HardhatUserConfig } from 'hardhat/config' ;
6
- import { NetworkUserConfig } from 'hardhat/types' ;
7
6
import './tasks/accounts' ;
8
7
import './tasks/clean' ;
9
8
@@ -39,13 +38,6 @@ if (!process.env.MNEMONIC) {
39
38
mnemonic = process . env . MNEMONIC ;
40
39
}
41
40
42
- let infuraApiKey = '' ;
43
- if ( ! process . env . INFURA_ID ) {
44
- console . warn ( 'Please set your INFURA_ID in a .env file' ) ;
45
- } else {
46
- infuraApiKey = process . env . INFURA_ID ;
47
- }
48
-
49
41
let etherscanApiKey = '' ;
50
42
if ( ! process . env . ETHERSCAN_VERIFICATION_API_KEY ) {
51
43
console . warn ( 'Please set your ETHERSCAN_API_KEY in a .env file' ) ;
@@ -55,26 +47,12 @@ if (!process.env.ETHERSCAN_VERIFICATION_API_KEY) {
55
47
56
48
const shouldReportGas = process . env . REPORT_GAS === 'true' ;
57
49
58
- function createTestnetConfig ( network : keyof typeof chainIds ) : NetworkUserConfig {
59
- const url = `https://${ network } .infura.io/v3/${ infuraApiKey } ` ;
60
- return {
61
- accounts : {
62
- count : 10 ,
63
- initialIndex : 0 ,
64
- mnemonic,
65
- path : "m/44'/60'/0'/0" ,
66
- } ,
67
- chainId : chainIds [ network ] ,
68
- url,
69
- } ;
70
- }
71
-
72
50
const config : HardhatUserConfig = {
73
51
defaultNetwork : 'hardhat' ,
74
52
networks : {
75
53
hardhat : {
76
54
forking : {
77
- url : `https://sepolia.infura.io/v3/ ${ infuraApiKey } ` ,
55
+ url : String ( process . env . SEPOLIA_RPC_URL ) ,
78
56
} ,
79
57
chainId : chainIds . hardhat ,
80
58
accounts : {
@@ -97,7 +75,16 @@ const config: HardhatUserConfig = {
97
75
chainId : chainIds [ 'sepolia' ] ,
98
76
url : 'http://127.0.0.1:8545' ,
99
77
} ,
100
- sepolia : createTestnetConfig ( 'sepolia' ) ,
78
+ sepolia : {
79
+ accounts : {
80
+ count : 10 ,
81
+ initialIndex : 0 ,
82
+ mnemonic,
83
+ path : "m/44'/60'/0'/0" ,
84
+ } ,
85
+ chainId : chainIds [ 'sepolia' ] ,
86
+ url : String ( process . env . SEPOLIA_RPC_URL ) ,
87
+ } ,
101
88
mainnet : {
102
89
accounts : {
103
90
count : 10 ,
@@ -106,7 +93,7 @@ const config: HardhatUserConfig = {
106
93
path : "m/44'/60'/0'/0" ,
107
94
} ,
108
95
chainId : chainIds [ 'mainnet' ] ,
109
- url : `https://mainnet.infura.io/v3/ ${ infuraApiKey } ` ,
96
+ url : String ( process . env . MAINNET_RPC_URL ) ,
110
97
gasPrice : 60000000000 , // 60 gwei
111
98
} ,
112
99
polygon : {
0 commit comments