-
Notifications
You must be signed in to change notification settings - Fork 69
/
hardhat.config.js
112 lines (103 loc) · 2.91 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
110
111
112
require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-solpp");
require("./script/deploy_zklink");
require("./script/upgrade_zklink");
require("./script/deploy_lz_bridge");
require("./script/deploy_faucet");
require("./script/deploy_account_mock");
require("./script/interact");
require("./script/deploy_l1_gateway");
require("./script/deploy_l2_gateway");
require("./script/deloy_multicall");
require("./script/upgrade_l2_gateway");
require("./script/upgrade_l1_gateway");
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const hardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.18",
settings: {
viaIR: true,
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: "0.7.6",
settings: {
optimizer: {
enabled: true,
runs: 800,
},
},
},
],
},
networks: {
hardhat: {
allowUnlimitedContractSize: true,
},
},
solpp: {
defs: {
BLOCK_PERIOD: "1 seconds",
UPGRADE_NOTICE_PERIOD: 0,
PRIORITY_EXPIRATION: 0,
CHAIN_ID: 1,
MAX_CHAIN_ID: 4,
ALL_CHAINS: 15,
MASTER_CHAIN_ID: 1,
},
},
gasReporter: {
enabled: !!process.env.REPORT_GAS,
},
mocha: {
timeout: 600000,
},
};
// custom hardhat user config for different net
if (process.env.NET !== undefined) {
const netName = process.env.NET;
hardhatUserConfig.defaultNetwork = netName;
const netConfig = require(`./etc/${netName}.json`);
hardhatUserConfig.networks[netName] = netConfig.network;
if (netConfig.macro !== undefined) {
hardhatUserConfig.solpp.defs = netConfig.macro;
}
// config contract verify key if exist
if (netConfig.etherscan !== undefined) {
hardhatUserConfig.etherscan = netConfig.etherscan;
}
// import these packages if network is zksync
if (netConfig.network.zksync !== undefined && netConfig.network.zksync) {
require("@matterlabs/hardhat-zksync-solc");
require("@matterlabs/hardhat-zksync-verify");
hardhatUserConfig.zksolc = {
version: "1.3.8",
compilerSource: "binary",
settings: {},
};
} else {
require("@openzeppelin/hardhat-upgrades");
}
} else if (process.env.MASTER_UNITTEST !== undefined) {
hardhatUserConfig.solpp.defs.CHAIN_ID = 1;
hardhatUserConfig.solpp.defs.MAX_CHAIN_ID = 4;
hardhatUserConfig.solpp.defs.ALL_CHAINS = 11; // [1,3,4]
hardhatUserConfig.solpp.defs.MASTER_CHAIN_ID = 1;
} else if (process.env.SLAVER_UNITTEST !== undefined) {
hardhatUserConfig.solpp.defs.CHAIN_ID = 2;
hardhatUserConfig.solpp.defs.MAX_CHAIN_ID = 4;
hardhatUserConfig.solpp.defs.ALL_CHAINS = 11; // [1,3,4]
hardhatUserConfig.solpp.defs.MASTER_CHAIN_ID = 1;
}
hardhatUserConfig.isMasterChain =
hardhatUserConfig.solpp.defs.CHAIN_ID ===
hardhatUserConfig.solpp.defs.MASTER_CHAIN_ID;
module.exports = hardhatUserConfig;