This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.js
66 lines (59 loc) · 1.63 KB
/
hardhat.config.js
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
/**
* @type import('hardhat/config').HardhatUserConfig
*/
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");
require('hardhat-contract-sizer');
require("hardhat-gas-reporter");
const { OC_ENV, ROPSTEN_API_URL, RINKEBY_API_URL, MAINNET_API_URL, PRIVATE_KEY, ETHERSCAN_API_KEY, GAS_PRICE, ETH_PRICE } = process.env;
let networkConfig = {hardhat: {}}; // Local Hardhat test blockchain is always available
if (PRIVATE_KEY) {
// All other network operations require a wallet PK to sign.
if (RINKEBY_API_URL) {
networkConfig.rinkeby = {
url: RINKEBY_API_URL,
accounts: [`0x${PRIVATE_KEY}`]
};
}
if (ROPSTEN_API_URL) {
networkConfig.ropsten = {
url: ROPSTEN_API_URL,
accounts: [`0x${PRIVATE_KEY}`]
};
}
if (MAINNET_API_URL) {
networkConfig.mainnet = {
url: MAINNET_API_URL,
accounts: [`0x${PRIVATE_KEY}`]
};
}
}
let config = {
solidity: {
version: "0.8.4",
settings: {
optimizer: {
enabled: OC_ENV === 'production',
runs: 200
}
}
},
defaultNetwork: "hardhat", // DO NOT CHANGE. defaultNetwork is used for unit tests.
networks: networkConfig,
contractSizer: {
alphaSort: true,
disambiguatePaths: false,
runOnCompile: true,
strict: true,
},
gasReporter: {
currency: 'USD',
gasPrice: GAS_PRICE || 150,
ethPrice: ETH_PRICE || 4650
}
};
if (ETHERSCAN_API_KEY) {
// We only use Etherscan for contract verification, so don't need a wallet key.
config.etherscan = {apiKey: ETHERSCAN_API_KEY};
}
module.exports = config;