forked from across-protocol/contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
222 lines (213 loc) · 6.71 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
import * as dotenv from "dotenv";
import { HardhatUserConfig } from "hardhat/config";
import { getNodeUrl, getMnemonic } from "@uma/common";
import "@nomicfoundation/hardhat-verify"; // Must be above hardhat-upgrades
import "@nomiclabs/hardhat-waffle";
import "@typechain/hardhat";
import "@matterlabs/hardhat-zksync-solc";
import "@matterlabs/hardhat-zksync-verify";
import "@matterlabs/hardhat-zksync-upgradable";
import "hardhat-gas-reporter";
import "solidity-coverage";
import "hardhat-deploy";
import "@openzeppelin/hardhat-upgrades";
// Custom tasks to add to HRE.
// eslint-disable-next-line node/no-missing-require
require("./tasks/enableL1TokenAcrossEcosystem");
dotenv.config();
// To compile with zksolc, `hardhat` must be the default network and its `zksync` property must be true.
// So we allow the caller to set this environment variable to toggle compiling zk contracts or not.
// TODO: Figure out way to only compile specific contracts intended to be deployed on ZkSync (e.g. ZkSync_SpokePool) if
// the following config is true.
const compileZk = process.env.COMPILE_ZK === "true";
const solcVersion = "0.8.18";
const mnemonic = getMnemonic();
// Compilation settings are overridden for large contracts to allow them to compile without going over the bytecode
// limit.
const LARGE_CONTRACT_COMPILER_SETTINGS = {
version: solcVersion,
settings: { optimizer: { enabled: true, runs: 200 }, viaIR: true },
};
const config: HardhatUserConfig = {
solidity: {
compilers: [{ version: solcVersion, settings: { optimizer: { enabled: true, runs: 1000000 }, viaIR: true } }],
overrides: {
"contracts/HubPool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
"contracts/Boba_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
"contracts/Optimism_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
"contracts/Base_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
"contracts/test/MockSpokePoolV2.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
"contracts/test/MockOptimism_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
},
},
zksolc: {
version: "latest",
settings: {
optimizer: {
enabled: true,
},
},
},
networks: {
hardhat: { accounts: { accountsBalance: "1000000000000000000000000" }, zksync: compileZk },
mainnet: {
url: getNodeUrl("mainnet", true, 1),
accounts: { mnemonic },
saveDeployments: true,
chainId: 1,
},
"zksync-goerli": {
chainId: 280,
url: "https://testnet.era.zksync.dev",
saveDeployments: true,
accounts: { mnemonic },
ethNetwork: "goerli",
companionNetworks: { l1: "goerli" },
zksync: true,
verifyURL: "https://zksync2-testnet-explorer.zksync.dev/contract_verification",
},
zksync: {
chainId: 324,
url: "https://mainnet.era.zksync.io",
saveDeployments: true,
accounts: { mnemonic },
ethNetwork: "mainnet",
companionNetworks: { l1: "mainnet" },
zksync: true,
verifyURL: "https://zksync2-mainnet-explorer.zksync.io/contract_verification",
},
kovan: {
url: getNodeUrl("kovan", true, 42),
accounts: { mnemonic },
saveDeployments: true,
chainId: 42,
},
"optimism-kovan": {
url: getNodeUrl("optimism-kovan", true, 69),
accounts: { mnemonic },
saveDeployments: true,
chainId: 69,
companionNetworks: { l1: "kovan" },
},
optimism: {
url: getNodeUrl("optimism", true, 10),
accounts: { mnemonic },
saveDeployments: true,
chainId: 10,
companionNetworks: { l1: "mainnet" },
},
arbitrum: {
chainId: 42161,
url: getNodeUrl("arbitrum", true, 42161),
saveDeployments: true,
accounts: { mnemonic },
companionNetworks: { l1: "mainnet" },
},
"arbitrum-rinkeby": {
chainId: 421611,
url: getNodeUrl("arbitrum-rinkeby", true, 421611),
saveDeployments: true,
accounts: { mnemonic },
companionNetworks: { l1: "rinkeby" },
},
"arbitrum-goerli": {
chainId: 421613,
url: "https://goerli-rollup.arbitrum.io/rpc",
saveDeployments: true,
accounts: { mnemonic },
companionNetworks: { l1: "goerli" },
},
rinkeby: {
chainId: 4,
url: getNodeUrl("rinkeby", true, 4),
saveDeployments: true,
accounts: { mnemonic },
},
goerli: {
chainId: 5,
url: getNodeUrl("goerli", true, 5),
saveDeployments: true,
accounts: { mnemonic },
},
sepolia: {
url: "https://rpc2.sepolia.org",
accounts: { mnemonic },
saveDeployments: true,
chainId: 11155111,
},
polygon: {
chainId: 137,
url: getNodeUrl("polygon-matic", true, 137),
saveDeployments: true,
accounts: { mnemonic },
companionNetworks: { l1: "mainnet" },
},
boba: {
chainId: 288,
url: getNodeUrl("boba", true, 288),
accounts: { mnemonic },
companionNetworks: { l1: "mainnet" },
},
"polygon-mumbai": {
chainId: 80001,
url: getNodeUrl("polygon-mumbai", true, 80001),
saveDeployments: true,
accounts: { mnemonic },
companionNetworks: { l1: "goerli" },
},
base: {
chainId: 8453,
url: "https://mainnet.base.org",
saveDeployments: true,
accounts: { mnemonic },
companionNetworks: { l1: "mainnet" },
},
"base-goerli": {
chainId: 84531,
url: "https://goerli.base.org",
saveDeployments: true,
accounts: { mnemonic },
companionNetworks: { l1: "goerli" },
},
},
gasReporter: { enabled: process.env.REPORT_GAS !== undefined, currency: "USD" },
etherscan: {
apiKey: {
mainnet: process.env.ETHERSCAN_API_KEY!,
kovan: process.env.ETHERSCAN_API_KEY!,
rinkeby: process.env.ETHERSCAN_API_KEY!,
goerli: process.env.ETHERSCAN_API_KEY!,
sepolia: process.env.ETHERSCAN_API_KEY!,
optimisticEthereum: process.env.OPTIMISM_ETHERSCAN_API_KEY!,
arbitrumOne: process.env.ARBITRUM_ETHERSCAN_API_KEY!,
polygon: process.env.POLYGON_ETHERSCAN_API_KEY!,
polygonMumbai: process.env.POLYGON_ETHERSCAN_API_KEY!,
base: process.env.ETHERSCAN_API_KEY!,
"base-goerli": process.env.ETHERSCAN_API_KEY!,
},
customChains: [
{
network: "base",
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org",
},
},
{
network: "base-goerli",
chainId: 84531,
urls: {
apiURL: "https://api-goerli.basescan.org/api",
browserURL: "https://goerli.basescan.org",
},
},
],
},
namedAccounts: { deployer: 0 },
typechain: {
outDir: "./typechain",
target: "ethers-v5",
},
};
export default config;