Skip to content

Commit 89826a5

Browse files
authored
Remove infura dependence in contracts-core (#662)
1 parent 4e3efd4 commit 89826a5

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

contracts-core/hardhat.config.ts

+12-25
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { resolve } from 'path';
33
dotenvConfig({ path: resolve(__dirname, './.env') });
44

55
import { HardhatUserConfig } from 'hardhat/config';
6-
import { NetworkUserConfig } from 'hardhat/types';
76
import './tasks/accounts';
87
import './tasks/clean';
98

@@ -39,13 +38,6 @@ if (!process.env.MNEMONIC) {
3938
mnemonic = process.env.MNEMONIC;
4039
}
4140

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-
4941
let etherscanApiKey = '';
5042
if (!process.env.ETHERSCAN_VERIFICATION_API_KEY) {
5143
console.warn('Please set your ETHERSCAN_API_KEY in a .env file');
@@ -55,26 +47,12 @@ if (!process.env.ETHERSCAN_VERIFICATION_API_KEY) {
5547

5648
const shouldReportGas = process.env.REPORT_GAS === 'true';
5749

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-
7250
const config: HardhatUserConfig = {
7351
defaultNetwork: 'hardhat',
7452
networks: {
7553
hardhat: {
7654
forking: {
77-
url: `https://sepolia.infura.io/v3/${infuraApiKey}`,
55+
url: String(process.env.SEPOLIA_RPC_URL),
7856
},
7957
chainId: chainIds.hardhat,
8058
accounts: {
@@ -97,7 +75,16 @@ const config: HardhatUserConfig = {
9775
chainId: chainIds['sepolia'],
9876
url: 'http://127.0.0.1:8545',
9977
},
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+
},
10188
mainnet: {
10289
accounts: {
10390
count: 10,
@@ -106,7 +93,7 @@ const config: HardhatUserConfig = {
10693
path: "m/44'/60'/0'/0",
10794
},
10895
chainId: chainIds['mainnet'],
109-
url: `https://mainnet.infura.io/v3/${infuraApiKey}`,
96+
url: String(process.env.MAINNET_RPC_URL),
11097
gasPrice: 60000000000, // 60 gwei
11198
},
11299
polygon: {

0 commit comments

Comments
 (0)