forked from scroll-tech/scroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
151 lines (143 loc) · 3.92 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
import * as dotenv from "dotenv";
import { HardhatUserConfig, subtask } from "hardhat/config";
import * as toml from "toml";
import "@nomicfoundation/hardhat-verify";
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-chai-matchers";
import "@typechain/hardhat";
import "@primitivefi/hardhat-dodoc";
import "hardhat-gas-reporter";
import "solidity-coverage";
import { readFileSync } from "fs";
import { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } from "hardhat/builtin-tasks/task-names";
dotenv.config();
const L1_DEPLOYER_PRIVATE_KEY = process.env.L1_DEPLOYER_PRIVATE_KEY || "1".repeat(64);
const L2_DEPLOYER_PRIVATE_KEY = process.env.L2_DEPLOYER_PRIVATE_KEY || "1".repeat(64);
const SOLC_DEFAULT = "0.8.24";
// try use forge config
let foundry: any;
try {
foundry = toml.parse(readFileSync("./foundry.toml").toString());
foundry.default.solc = foundry.default["solc-version"] ? foundry.default["solc-version"] : SOLC_DEFAULT;
} catch (error) {
foundry = {
default: {
solc: SOLC_DEFAULT,
},
};
}
// prune forge style tests from hardhat paths
subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(async (_, __, runSuper) => {
const paths = await runSuper();
return paths.filter((p: string) => !p.endsWith(".t.sol")).filter((p: string) => !p.includes("test/mocks"));
});
const config: HardhatUserConfig = {
solidity: {
version: foundry.default?.solc_version || SOLC_DEFAULT,
settings: {
optimizer: {
enabled: foundry.default?.optimizer || true,
runs: foundry.default?.optimizer_runs || 200,
},
evmVersion: "cancun",
},
},
networks: {
ethereum: {
url: "https://1rpc.io/eth",
accounts: [L1_DEPLOYER_PRIVATE_KEY],
},
sepolia: {
url: "https://1rpc.io/sepolia",
accounts: [L1_DEPLOYER_PRIVATE_KEY],
},
scroll: {
url: "https://rpc.scroll.io",
accounts: [L2_DEPLOYER_PRIVATE_KEY],
},
scroll_sepolia: {
url: "https://sepolia-rpc.scroll.io",
accounts: [L2_DEPLOYER_PRIVATE_KEY],
},
},
paths: {
cache: "./cache-hardhat",
sources: "./src",
tests: "./integration-test",
},
typechain: {
outDir: "./typechain",
target: "ethers-v6",
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
excludeContracts: ["src/test"],
currency: "USD",
},
etherscan: {
apiKey: {
ethereum: process.env.ETHERSCAN_API_KEY || "",
sepolia: process.env.ETHERSCAN_API_KEY || "",
scroll: process.env.SCROLLSCAN_API_KEY || "",
scroll_sepolia: process.env.SCROLLSCAN_API_KEY || "",
},
customChains: [
{
network: "scroll",
chainId: 534352,
urls: {
apiURL: "https://api.scrollscan.com/api",
browserURL: "https://www.scrollscan.com/",
},
},
{
network: "scroll_sepolia",
chainId: 534351,
urls: {
apiURL: "https://api-sepolia.scrollscan.com/api",
browserURL: "https://sepolia.scrollscan.com/",
},
},
],
},
mocha: {
timeout: 10000000,
},
dodoc: {
runOnCompile: true,
keepFileStructure: false,
include: [
"ScrollChain",
"L1ScrollMessenger",
"L2ScrollMessenger",
"L1GatewayRouter",
"L2GatewayRouter",
"L1StandardERC20Gateway",
"L2StandardERC20Gateway",
"L1ERC721Gateway",
"L2ERC721Gateway",
"L1ERC1155Gateway",
"L2ERC1155Gateway",
"L1WETHGateway",
"L2WETHGateway",
"ScrollStandardERC20Factory",
],
outputDir: "docs/apis",
exclude: [
"IERC677Receiver",
"IL1ScrollMessenger",
"IL2ScrollMessenger",
"IL1GatewayRouter",
"IL2GatewayRouter",
"IL1ERC721Gateway",
"IL2ERC721Gateway",
"IL1ERC1155Gateway",
"IL2ERC1155Gateway",
"IScrollStandardERC20Factory",
"IScrollChain",
"ScrollChainCommitmentVerifier",
"WETH9",
],
},
};
export default config;