forked from keep-network/tbtc-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
269 lines (255 loc) · 7.84 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
import { HardhatUserConfig } from "hardhat/config"
import "./tasks"
import "@keep-network/hardhat-helpers"
import "@keep-network/hardhat-local-networks-config"
import "@nomiclabs/hardhat-waffle"
import "@nomiclabs/hardhat-etherscan"
import "hardhat-gas-reporter"
import "hardhat-contract-sizer"
import "hardhat-deploy"
import "@tenderly/hardhat-tenderly"
import "@typechain/hardhat"
import "hardhat-dependency-compiler"
import "solidity-docgen"
const ecdsaSolidityCompilerConfig = {
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
}
// Reduce the number of optimizer runs to 100 to keep the contract size sane.
// BridgeGovernance contract does not need to be super gas-efficient.
const bridgeGovernanceCompilerConfig = {
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
}
// Configuration for testing environment.
export const testConfig = {
// How many accounts we expect to define for non-staking related signers, e.g.
// deployer, thirdParty, governance.
// It is used as an offset for getting accounts for operators and stakes registration.
nonStakingAccountsCount: 10,
// How many roles do we need to define for staking, i.e. stakeOwner, stakingProvider,
// operator, beneficiary, authorizer.
stakingRolesCount: 5,
// Number of operators to register. Should be at least the same as group size.
operatorsCount: 110,
}
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
],
overrides: {
"@keep-network/ecdsa/contracts/WalletRegistry.sol":
ecdsaSolidityCompilerConfig,
"contracts/bridge/BridgeGovernance.sol": bridgeGovernanceCompilerConfig,
},
},
paths: {
artifacts: "./build",
},
networks: {
hardhat: {
forking: {
// forking is enabled only if FORKING_URL env is provided
enabled: !!process.env.FORKING_URL,
// URL should point to a node with archival data (Alchemy recommended)
url: process.env.FORKING_URL || "",
// latest block is taken if FORKING_BLOCK env is not provided
blockNumber:
process.env.FORKING_BLOCK && parseInt(process.env.FORKING_BLOCK, 10),
},
accounts: {
// Number of accounts that should be predefined on the testing environment.
count:
testConfig.nonStakingAccountsCount +
testConfig.stakingRolesCount * testConfig.operatorsCount,
},
tags: ["allowStubs"],
// we use higher gas price for tests to obtain more realistic results
// for gas refund tests than when the default hardhat ~1 gwei gas price is
// used
gasPrice: 200000000000, // 200 gwei
// Ignore contract size on deployment to hardhat network, to be able to
// deploy stub contracts in tests.
allowUnlimitedContractSize: process.env.TEST_USE_STUBS_TBTC === "true",
},
system_tests: {
url: "http://127.0.0.1:8545",
tags: ["allowStubs"],
},
development: {
url: "http://localhost:8545",
chainId: 1101,
tags: ["allowStubs"],
},
sepolia: {
url: process.env.CHAIN_API_URL || "",
chainId: 11155111,
accounts: process.env.ACCOUNTS_PRIVATE_KEYS
? process.env.ACCOUNTS_PRIVATE_KEYS.split(",")
: undefined,
tags: ["tenderly"],
},
mainnet: {
url: process.env.CHAIN_API_URL || "",
chainId: 1,
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
? [process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY]
: undefined,
tags: ["etherscan", "tenderly"],
},
},
tenderly: {
username: "thesis",
project: "",
},
// Define local networks configuration file path to load networks from file.
// localNetworksConfig: "./.hardhat/networks.ts",
external: {
contracts:
process.env.USE_EXTERNAL_DEPLOY === "true"
? [
{
artifacts: "node_modules/@keep-network/tbtc/artifacts",
},
{
artifacts:
"node_modules/@threshold-network/solidity-contracts/export/artifacts",
deploy:
"node_modules/@threshold-network/solidity-contracts/export/deploy",
},
{
artifacts:
"node_modules/@keep-network/random-beacon/export/artifacts",
deploy: "node_modules/@keep-network/random-beacon/export/deploy",
},
{
artifacts: "node_modules/@keep-network/ecdsa/export/artifacts",
deploy: "node_modules/@keep-network/ecdsa/export/deploy",
},
]
: undefined,
deployments: {
// For development environment we expect the local dependencies to be
// linked with `yarn link` command.
development: [
"node_modules/@threshold-network/solidity-contracts/deployments/development",
"node_modules/@keep-network/random-beacon/deployments/development",
"node_modules/@keep-network/ecdsa/deployments/development",
],
sepolia: [
"node_modules/@keep-network/tbtc/artifacts",
"node_modules/@keep-network/random-beacon/artifacts",
"node_modules/@keep-network/ecdsa/artifacts",
],
mainnet: ["./external/mainnet"],
},
},
namedAccounts: {
deployer: {
default: 1,
sepolia: 0,
mainnet: 0, // "0x123694886DBf5Ac94DDA07135349534536D14cAf"
},
governance: {
default: 2,
sepolia: 0,
mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", // Threshold Council
},
chaosnetOwner: {
default: 3,
sepolia: 0,
// Not used for mainnet deployment scripts of `@keepn-network/tbtc-v2`.
// Used by `@keep-network/random-beacon` and `@keep-network/ecdsa`
// when deploying `SortitionPool`s.
},
esdm: {
default: 4,
sepolia: 0,
mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", // Threshold Council
},
keepTechnicalWalletTeam: {
default: 5,
sepolia: 0,
mainnet: "0xB3726E69Da808A689F2607939a2D9E958724FC2A",
},
keepCommunityMultiSig: {
default: 6,
sepolia: 0,
mainnet: "0x19FcB32347ff4656E4E6746b4584192D185d640d",
},
treasury: {
default: 7,
sepolia: 0,
mainnet: "0x87F005317692D05BAA4193AB0c961c69e175f45f", // Token Holder DAO
},
spvMaintainer: {
default: 8,
sepolia: 0,
// We are not setting SPV maintainer for mainnet in deployment scripts.
},
v1Redeemer: {
default: 10,
sepolia: 0,
mainnet: "0x8Bac178fA95Cb56D11A94d4f1b2B1F5Fc48A30eA",
},
redemptionWatchtowerManager: {
default: 11,
sepolia: 0,
mainnet: "0x87F005317692D05BAA4193AB0c961c69e175f45f", // Token Holder DAO
},
},
dependencyCompiler: {
paths: [
"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol",
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol",
// WalletRegistry contract is deployed with @open-zeppelin/hardhat-upgrades
// plugin that doesn't work well with hardhat-deploy artifacts defined in
// external artifacts section, hence we have to compile the contracts from
// sources.
"@keep-network/ecdsa/contracts/WalletRegistry.sol",
],
keep: true,
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
contractSizer: {
alphaSort: true,
disambiguatePaths: false,
runOnCompile: true,
strict: true,
except: ["BridgeStub$"],
},
mocha: {
timeout: 60_000,
},
typechain: {
outDir: "typechain",
},
docgen: {
outputDir: "generated-docs",
templates: "docgen-templates",
pages: "files", // `single`, `items` or `files`
exclude: ["./test"],
},
}
export default config