-
Notifications
You must be signed in to change notification settings - Fork 3
/
hardhat.config.ts
109 lines (100 loc) · 2.33 KB
/
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
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
105
106
107
108
109
import { HardhatUserConfig, HttpNetworkUserConfig } from "hardhat/types";
import { config as dotenvConfig } from "dotenv";
import { resolve } from "path";
dotenvConfig({ path: resolve(__dirname, "./.env") });
import "./tasks/accounts";
import "./tasks/clean";
import "./tasks/typechain";
import "@nomiclabs/hardhat-waffle";
// import "solidity-coverage";
import "@openzeppelin/hardhat-upgrades";
import "hardhat-contract-sizer";
import "hardhat-typechain";
// import "hardhat-gas-reporter";
import "@nomiclabs/hardhat-etherscan";
/**
* @dev You must have a `.env` file. Follow the example in `.env.example`.
* @param {string} network The name of the testnet
*/
function createHDAccountConfig(network: string): HttpNetworkUserConfig {
if (!process.env.MNEMONIC) {
console.log("Please set your MNEMONIC in a .env file");
process.exit(1);
}
if (!process.env.INFURA_API_KEY) {
console.log("Please set your INFURA_API_KEY");
process.exit(1);
}
return {
accounts: {
initialIndex: 0,
mnemonic: process.env.MNEMONIC,
path: "m/44'/60'/0'/0",
},
url: `https://${network}.infura.io/v3/${process.env.INFURA_API_KEY}`,
};
}
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
mocha: {
delay: true,
},
networks: {
hardhat: {
chainId: 31337,
},
local: {
url: "http://127.0.0.1:7545"
},
coverage: {
url: "http://127.0.0.1:8555",
},
goerli: {
...createHDAccountConfig("goerli"),
chainId: 5,
},
kovan: {
...createHDAccountConfig("kovan"),
chainId: 42,
},
rinkeby: {
...createHDAccountConfig("rinkeby"),
chainId: 4,
},
ropsten: {
...createHDAccountConfig("ropsten"),
chainId: 3,
},
mainnet: {
...createHDAccountConfig("mainnet"),
chainId: 1,
gasMultiplier: 1.2,
},
},
paths: {
artifacts: "./artifacts",
cache: "./cache",
// coverage: "./coverage",
// coverageJson: "./coverage.json",
root: "./",
sources: "./contracts",
tests: "./test",
},
solidity: {
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
version: "0.6.10",
},
typechain: {
outDir: "typechain",
target: "ethers-v5",
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
};
export default config;