This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathhardhat.config.js
109 lines (92 loc) · 2.45 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
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
const fs = require("fs");
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");
require("hardhat-contract-sizer");
require('hardhat-gas-reporter');
require("solidity-coverage");
// Load tasks
const files = fs.readdirSync('./tasks');
for (let file of files) {
if (!file.endsWith('.js')) continue;
require(`./tasks/${file}`);
}
// Config
module.exports = {
networks: {
hardhat: {
hardfork: 'arrowGlacier',
chainId: 1,
},
localhost: {
chainId: 1,
url: "http://127.0.0.1:8545",
timeout: 5 * 60 * 1000,
},
},
solidity: {
compilers: [
{
version: "0.8.10",
settings: {
optimizer: {
enabled: true,
runs: 1000000,
},
outputSelection: {
"contracts/Storage.sol": {
"*": [
"storageLayout",
],
},
},
},
},
],
},
gasReporter: {
enabled: !!process.env.REPORT_GAS,
},
contractSizer: {
//runOnCompile: true,
},
mocha: {
timeout: 100000
}
};
if (process.env.NODE_ENV) {
let path = `.env.${process.env.NODE_ENV}`;
if (!fs.existsSync(path)) throw(`unable to open env file: ${path}`);
require("dotenv").config({ path, });
} else if (fs.existsSync('./.env')) {
require("dotenv").config();
}
for (let k in process.env) {
if (k.startsWith("RPC_URL_")) {
let networkName = k.slice(8).toLowerCase();
module.exports.networks = {
...module.exports.networks,
[networkName]: {
url: `${process.env[k]}`,
accounts: [`0x${process.env.PRIVATE_KEY}`],
}
}
}
if (k === "ETHERSCAN_API_KEY") {
module.exports.etherscan = {
apiKey: {
// ethereum smart contract verification key
mainnet: process.env[k],
goerli: process.env[k]
}
}
}
if (k === "POLYGONSCAN_API_KEY") {
module.exports.etherscan = {
apiKey: {
// polygon smart contract verification key
polygon: process.env[k],
polygonMumbai: process.env[k]
}
}
}
}