-
Notifications
You must be signed in to change notification settings - Fork 6
/
hardhat.network.ts
104 lines (94 loc) · 2.21 KB
/
hardhat.network.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { HardhatUserConfig } from 'hardhat/config';
const alchemyUrl = process.env.ALCHEMY_URL;
const infuraApiKey = process.env.INFURA_API_KEY;
const mnemonic = process.env.HDWALLET_MNEMONIC;
const avalanche = process.env.AVALANCHE_ENABLED;
const arbitrumGoerliRPCUrl = process.env.ARBITRUM_GOERLI_RPC_URL;
const optimismGoerliRPCUrl = process.env.OPTIMISM_GOERLI_RPC_URL;
const mumbaiRPCUrl = process.env.MUMBAI_RPC_URL;
const networks: HardhatUserConfig['networks'] = {
localhost: {
chainId: 1,
url: 'http://127.0.0.1:8545',
allowUnlimitedContractSize: true,
},
};
if (alchemyUrl && process.env.FORK_ENABLED && mnemonic) {
networks.hardhat = {
chainId: 1,
allowUnlimitedContractSize: true,
gas: 12000000,
blockGasLimit: 0x1fffffffffffff,
forking: {
url: alchemyUrl,
},
accounts: {
mnemonic,
},
};
} else {
networks.hardhat = {
allowUnlimitedContractSize: true,
gas: 12000000,
blockGasLimit: 0x1fffffffffffff,
};
}
if (!!avalanche) {
networks.fuji = {
chainId: 43113,
url: 'https://api.avax-test.network/ext/bc/C/rpc',
accounts: {
mnemonic,
},
};
}
if (infuraApiKey && mnemonic) {
networks.arbitrumGoerli = {
chainId: 421613,
url: arbitrumGoerliRPCUrl
? arbitrumGoerliRPCUrl
: `https://arbitrum-goerli.infura.io/v3/${infuraApiKey}`,
accounts: {
mnemonic,
},
};
networks.optimismGoerli = {
chainId: 420,
url: optimismGoerliRPCUrl
? optimismGoerliRPCUrl
: `https://optimism-goerli.infura.io/v3/${infuraApiKey}`,
accounts: {
mnemonic,
},
};
networks.mumbai = {
chainId: 80001,
url: mumbaiRPCUrl ? mumbaiRPCUrl : `https://polygon-mumbai.infura.io/v3/${infuraApiKey}`,
accounts: {
mnemonic,
},
};
networks.goerli = {
chainId: 5,
url: `https://goerli.infura.io/v3/${infuraApiKey}`,
accounts: {
mnemonic,
},
};
networks.sepolia = {
chainId: 11155111,
url: 'https://rpc.sepolia.org',
accounts: {
mnemonic,
},
};
networks.mainnet = {
url: alchemyUrl,
accounts: {
mnemonic,
},
};
} else {
console.warn('No infura or hdwallet available for testnets');
}
export default networks;