-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
139 lines (131 loc) · 4.01 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
import { spawnSync } from 'child_process';
import { writeFileSync } from 'fs';
import { HardhatUserConfig, task } from "hardhat/config";
import { NetworkUserConfig } from "hardhat/types";
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 "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.17",
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
],
},
networks: {
localhost: {},
hardhat: {
accounts: {
count: 20, // Adjust the number of accounts available when using the local Hardhat network
},
},
coverage: {
url: "http://127.0.0.1:8545", // Coverage launches its own 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,
},
};
export default config;