-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
43 lines (38 loc) · 955 Bytes
/
hardhat.config.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
import type {HardhatUserConfig, NetworksUserConfig} from "hardhat/types";
import dotenv from "dotenv";
import "@nomicfoundation/hardhat-toolbox";
import "hardhat-gas-reporter";
let networks: NetworksUserConfig | undefined;
let etherscan: {apiKey?: string} | undefined;
const gasReporterEnabled = process.env.GAS_REPORTER;
const network = process.env.TARGET_NETWORK;
if (network) {
dotenv.config({path: `.env.${network}`});
networks = {
[network]: {
accounts: [process.env.ETH_PK!],
url: `https://${network}.infura.io/v3/${process.env.INFURA_KEY}`,
},
};
etherscan = {
apiKey: process.env.ETHERSCAN_KEY,
};
}
const config: HardhatUserConfig = {
solidity: {
version: "0.8.21",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
gasReporter: {
enabled: !!gasReporterEnabled,
},
defaultNetwork: "hardhat",
networks,
etherscan,
};
export default config;