forked from privacy-scaling-explorations/maci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
134 lines (127 loc) · 3.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
/* eslint-disable import/no-extraneous-dependencies */
import "@nomicfoundation/hardhat-toolbox";
import dotenv from "dotenv";
import "hardhat-artifactor";
import "hardhat-contract-sizer";
import "solidity-docgen";
import type { HardhatUserConfig } from "hardhat/config";
// Don't forget to import new tasks here
import "./tasks/deploy";
import {
EChainId,
ESupportedChains,
NETWORKS_DEFAULT_GAS,
getEtherscanApiKeys,
getNetworkRpcUrls,
} from "./tasks/helpers/constants";
import "./tasks/runner/deployFull";
import "./tasks/runner/deployPoll";
import "./tasks/runner/merge";
import "./tasks/runner/prove";
import "./tasks/runner/verifyFull";
dotenv.config();
const DEFAULT_BLOCK_GAS_LIMIT = 30_000_000;
const DEFAULT_GAS_MUL = 2;
const TEST_MNEMONIC = "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat";
const NETWORKS_RPC_URL = getNetworkRpcUrls();
const ETHERSCAN_API_KEYS = getEtherscanApiKeys();
const getCommonNetworkConfig = (networkName: ESupportedChains, chainId: number, mnemonic?: string) => ({
url: NETWORKS_RPC_URL[networkName],
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
gasMultiplier: DEFAULT_GAS_MUL,
gasPrice: process.env.GAS_PRICE ? Number(process.env.GAS_PRICE) : NETWORKS_DEFAULT_GAS[networkName],
saveDeployments: true,
chainId,
accounts: {
mnemonic: mnemonic || process.env.MNEMONIC || TEST_MNEMONIC,
path: "m/44'/60'/0'/0",
initialIndex: 0,
count: 20,
},
});
const config: HardhatUserConfig = {
solidity: {
version: "0.8.10",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
defaultNetwork: "localhost",
networks: {
sepolia: getCommonNetworkConfig(ESupportedChains.Sepolia, EChainId.Sepolia),
optimism_sepolia: getCommonNetworkConfig(ESupportedChains.OptimismSepolia, EChainId.OptimismSepolia),
coverage: getCommonNetworkConfig(ESupportedChains.Coverage, EChainId.Coverage, TEST_MNEMONIC),
localhost: {
url: "http://localhost:8545",
loggingEnabled: false,
},
hardhat: {
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
gasMultiplier: DEFAULT_GAS_MUL,
gasPrice: NETWORKS_DEFAULT_GAS[ESupportedChains.Hardhat],
chainId: EChainId.Hardhat,
accounts: {
mnemonic: TEST_MNEMONIC,
path: "m/44'/60'/0'/0",
initialIndex: 0,
count: 20,
},
gas: DEFAULT_BLOCK_GAS_LIMIT,
loggingEnabled: process.env.HARDHAT_LOGGING === "true",
allowUnlimitedContractSize: true,
throwOnTransactionFailures: true,
throwOnCallFailures: true,
mining: {
auto: true,
interval: 100,
},
forking: process.env.FORKING_URL
? {
url: process.env.FORKING_URL,
blockNumber: process.env.FORKING_BLOCK_NUM ? parseInt(process.env.FORKING_BLOCK_NUM, 10) : 0,
}
: undefined,
},
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
},
etherscan: {
apiKey: {
[ESupportedChains.Sepolia]: ETHERSCAN_API_KEYS[ESupportedChains.Sepolia]!,
[ESupportedChains.OptimismSepolia]: ETHERSCAN_API_KEYS[ESupportedChains.OptimismSepolia]!,
},
customChains: [
{
network: ESupportedChains.OptimismSepolia,
chainId: EChainId.OptimismSepolia,
urls: {
apiURL: "https://api-sepolia-optimism.etherscan.io/api",
browserURL: "https://sepolia-optimism.etherscan.io",
},
},
],
},
sourcify: {
enabled: true,
},
paths: {
tests: "./tests",
artifacts: "./artifacts",
},
docgen: {
outputDir: "./docs",
pages: "files",
exclude: ["./trees/zeros"],
},
gasReporter: {
currency: "USD",
enabled: true,
},
};
export default config;