-
Notifications
You must be signed in to change notification settings - Fork 51
/
hardhat.config.ts
175 lines (167 loc) · 4.26 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import { task, subtask, HardhatUserConfig } from "hardhat/config";
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-ethers";
import "hardhat-gas-reporter";
import "@nomiclabs/hardhat-etherscan";
import "solidity-coverage";
import "hardhat-contract-sizer";
import "hardhat-abi-exporter";
import * as fs from "fs";
import "@typechain/hardhat";
import '@nomiclabs/hardhat-ethers'
import "./tasks/setup";
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
const defaultNetwork = "localhost";
function mnemonic() {
try {
return fs.readFileSync("./mnemonic.txt").toString().trim();
} catch (e) {
if (defaultNetwork !== "localhost") {
console.log(
"☢️ WARNING: No mnemonic file created for a deploy account. Try `yarn run generate` and then `yarn run account`."
);
}
}
return "";
}
function etherscan() {
try {
return fs.readFileSync("./etherscan.txt").toString().trim();
} catch (e) {
if (defaultNetwork !== "localhost") {
console.log("☢️ WARNING: No etherscan file");
}
}
return "";
}
const config: HardhatUserConfig = {
networks: {
localhost: {
url: "http://localhost:8545",
/*
notice no mnemonic here? it will just use account 0 of the hardhat node to deploy
(you can put in a mnemonic here to set the deployer locally)
*/
},
rinkeby: {
url: "https://rinkeby.infura.io/v3/460f40a260564ac4a4f4b3fffb032dad", //<---- YOUR INFURA ID! (or it won't work)
gas: 5000000,
gasPrice: 8000000000,
gasMultiplier: 2,
accounts: {
mnemonic: mnemonic(),
},
},
kovan: {
url: "https://kovan.infura.io/v3/460f40a260564ac4a4f4b3fffb032dad", //<---- YOUR INFURA ID! (or it won't work)
gas: 5000000,
gasPrice: 8000000000,
gasMultiplier: 2,
accounts: {
mnemonic: mnemonic(),
},
},
mainnet: {
url: "https://mainnet.infura.io/v3/460f40a260564ac4a4f4b3fffb032dad", //<---- YOUR INFURA ID! (or it won't work)
accounts: {
mnemonic: mnemonic(),
},
},
ropsten: {
url: "https://ropsten.infura.io/v3/460f40a260564ac4a4f4b3fffb032dad", //<---- YOUR INFURA ID! (or it won't work)
accounts: {
mnemonic: mnemonic(),
},
},
goerli: {
url: "https://goerli.infura.io/v3/460f40a260564ac4a4f4b3fffb032dad", //<---- YOUR INFURA ID! (or it won't work)
gas: 5000000,
gasPrice: 8000000000,
gasMultiplier: 2,
accounts: {
mnemonic: mnemonic(),
},
},
xdai: {
url: "https://rpc.gnosischain.com/",
gas: 5000000,
gasPrice: 8000000000,
accounts: {
mnemonic: mnemonic(),
},
},
matic: {
// url: 'https://rpc-mainnet.maticvigil.com/v1/036f1ba8516f0eee2204a574a960b68437ac8661',
url: "https://polygon-mainnet.infura.io/v3/cc7ca25d68f246f393d7630842360c47",
gasPrice: 1000000000,
accounts: {
mnemonic: mnemonic(),
},
},
mumbai: {
url: "https://rpc-mumbai.maticvigil.com/v1/036f1ba8516f0eee2204a574a960b68437ac8661",
gasPrice: 1000000000,
accounts: {
mnemonic: mnemonic(),
},
},
},
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
// apiKey: "61ED96HQAY6PASTEWRXN6AMYQEKM8SYTRY" // etherscan
apiKey: etherscan(),
},
solidity: {
compilers: [
{
version: "0.7.5",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: "0.8.13",
settings: {
optimizer: {
enabled: true,
runs: 100,
},
},
},
{
version: "0.5.3",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: "0.6.1",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
abiExporter: {
path: './abi',
clear: true,
flat: true,
except: ['@gnosis.pm', '@openzeppelin'],
},
typechain: {
outDir: "src/types",
target: "ethers-v5",
},
};
export default config;