forked from otoco-io/SmartContract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.js
86 lines (77 loc) · 2.09 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
require("@nomicfoundation/hardhat-chai-matchers");
require('@openzeppelin/hardhat-upgrades');
require("@nomiclabs/hardhat-etherscan");
require("@nomiclabs/hardhat-ethers");
require('hardhat-contract-sizer');
require('solidity-coverage');
require('solidity-docgen');
require("hardhat-tracer");
require('dotenv').config();
require("./tasks/setup");
// require("hardhat-gas-reporter");
process.removeAllListeners('warning');
const chainIds = {
hardhat: 31337,
mainnet: 1,
goerli: 5,
polygon: 137,
mumbai: 80001,
};
function getChainConfig(chain){
const jsonRpcUrl = process.env[`RPC_${chain.toUpperCase()}_API`]
if (!jsonRpcUrl) throw new Error("API KEY not fount for "+chain);
return {
// Comment out for default hardhat account settings
accounts: {
count: 10,
mnemonic: process.env.MNEMONIC_PHRASE,
path: "m/44'/60'/0'/0",
},
chainId: chainIds[chain],
url: jsonRpcUrl
};
}
module.exports = {
defaultNetwork: "hardhat",
networks: {
localhost: { chainId: chainIds.hardhat },
hardhat: {
blockGasLimit: 30000000,
chainId: chainIds.hardhat,
accounts: process.env.MNEMONIC_PHRASE ? {
mnemonic: process.env.MNEMONIC_PHRASE,
path: "m/44'/60'/0'/0",
} : undefined,
forking: process.env.FORK_ENABLED === "true" ? {
url: getChainConfig(process.env.FORKED_NETWORK).url,
} : undefined,
},
mainnet: getChainConfig("mainnet"),
goerli: getChainConfig("goerli"),
polygon: getChainConfig("polygon"),
mumbai: getChainConfig("mumbai"),
},
etherscan: {
apiKey: {
mainnet: process.env.ETHERSCAN_API_KEY || "",
goerli: process.env.ETHERSCAN_API_KEY || "",
polygon: process.env.POLYGONSCAN_API_KEY || "",
polygonMumbai: process.env.POLYGONSCAN_API_KEY || "",
},
},
solidity: {
compilers: [
{ version: "0.8.0" },
{ version: "0.8.4" },
],
settings: {
metadata: {
bytecodeHash: "none",
},
optimizer: {
enabled: false,
// runs: 2_000,
},
},
},
};