-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
183 lines (177 loc) · 5.23 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
176
177
178
179
180
181
182
183
import { spawnSync } from "child_process";
import { writeFileSync } from "fs";
import { HardhatUserConfig, task } from "hardhat/config";
import { NetworkUserConfig } from "hardhat/types";
import "@openzeppelin/hardhat-upgrades";
import "@nomiclabs/hardhat-etherscan";
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-solhint";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "hardhat-contract-sizer";
import "hardhat-deploy";
import "hardhat-docgen";
import "hardhat-spdx-license-identifier";
import "solidity-coverage";
import "@atixlabs/hardhat-time-n-mine"; //Use me to mine blocks in dev for time based contracts
import "./tasks"; //tasks - e.g npx hardhat audit
import { config as dotEnvConfig } from "dotenv";
dotEnvConfig();
/* interface Etherscan {
etherscan: { apiKey: string | undefined };
}
type HardhatUserEtherscanConfig = HardhatUserConfig & Etherscan; */
//NOTE: Debugger
/* const DEBUG = false;
function debug(text: String) {
if (DEBUG) {
console.log(text);
}
} */
//This well known public private key is a backup if private key env var not set
const defaultPrivateKey =
"0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3";
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.2",
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
{
version: "0.8.7",
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
{
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
],
},
networks: {
hardhat: {
accounts: {
count: 20, // Adjust the number of accounts available when using the local Hardhat network
},
initialBaseFeePerGas: 0,
chainId: 31337,
hardfork: "merge",
forking: {
url: process.env.ETH_MAINNET_URL || "",
// The Hardhat network will by default fork from the latest mainnet block
// To pin the block number, specify it below
// You will need access to a node with archival data for this to work!
// blockNumber: 14743877,
// If you want to do some forking, set `enabled` to true
enabled: false,
},
},
localhost: {
url: "http://127.0.0.1:8545",
},
coverage: {
url: "http://127.0.0.1:8555", // Coverage launches its own ganache-cli client
},
ropsten: {
url: process.env.ROPSTEN_RPC_URL || defaultPrivateKey,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
saveDeployments: true,
},
goerli: {
url: process.env.GOERLI_RPC_URL || defaultPrivateKey,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
saveDeployments: true,
},
kovan: {
url: process.env.KOVAN_RPC_URL || defaultPrivateKey,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
saveDeployments: true,
},
mainnet: {
url: process.env.MAINNET_RPC_URL || defaultPrivateKey,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
saveDeployments: true,
},
rinkeby: {
url: process.env.RINKEBY_RPC_URL || defaultPrivateKey,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
saveDeployments: true,
},
/* polygon_mumbai_testnet: {
url: "https://speedy-nodes-nyc.moralis.io//polygon/mumbai",
accounts:[privateKey],
}, */
// polygon_mainnet: {},
/* avalanche_testnet_fuji: {
url: 'https://api.avax-test.network/ext/bc/C/rpc',
gasPrice: 470000000000,
chainId: 43113,
accounts: []
},
avalanche_mainnet: {
url: 'https://api.avax.network/ext/bc/C/rpc',
gasPrice: 470000000000,
chainId: 43114,
accounts: []
} */
},
gasReporter: {
currency: "USD",
enabled: process.env.REPORT_GAS ? true : false,
excludeContracts: [],
src: "./contracts/*",
outputFile: "./reports/hardhat-gas-usage-report.md",
token: process.env.REPORT_GAS ? "ETH" : undefined,
},
etherscan: {
apiKey: {
arbitrumOne: process.env.ARBISCAN_API_KEY || "",
avalanche: process.env.SNOWTRACE_API_KEY || "",
bsc: process.env.BSCSCAN_API_KEY || "",
mainnet: process.env.ETHERSCAN_API_KEY || "",
goerli: process.env.ETHERSCAN_API_KEY || "",
optimisticEthereum: process.env.OPTIMISM_API_KEY || "",
polygon: process.env.POLYGONSCAN_API_KEY || "",
polygonMumbai: process.env.POLYGONSCAN_API_KEY || "",
rinkeby: process.env.ETHERSCAN_API_KEY || "",
},
},
contractSizer: {
alphaSort: true,
disambiguatePaths: false,
runOnCompile: true,
strict: true,
},
//@dev: Auto generate docs for contracts
docgen: {
clear: true,
runOnCompile: false,
},
// @dev: Automatically add SPDX license identifier to all contracts based on package.json
spdxLicenseIdentifier: {
overwrite: false,
runOnCompile: true,
},
};
export default config;