-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardhat.config.ts
More file actions
92 lines (91 loc) · 2.41 KB
/
Copy pathhardhat.config.ts
File metadata and controls
92 lines (91 loc) · 2.41 KB
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
import { HardhatUserConfig } from "hardhat/config";
import "dotenv/config";
import "@nomicfoundation/hardhat-toolbox";
import "hardhat-preprocessor";
import * as fs from "fs";
function getRemappings() {
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean)
.map((line: string) => line.trim().split("="));
}
const config: HardhatUserConfig = {
solidity: {
version: "0.8.24",
settings: {
optimizer: {
enabled: true,
runs: 200, // Balanced for execution gas and deployment size
},
evmVersion: "cancun",
viaIR: true,
},
},
networks: {
hardhat: {
initialBaseFeePerGas: 0,
forking: {
url: process.env.BASE_MAINNET_RPC_URL || "https://mainnet.base.org",
blockNumber: 25000000, // Optional: pin a block
},
},
baseSepolia: {
url: process.env.BASE_SEPOLIA_RPC_URL || "https://sepolia.base.org",
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
},
base: {
url: process.env.BASE_MAINNET_RPC_URL || "https://mainnet.base.org",
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
},
sepolia: {
url: process.env.SEPOLIA_RPC_URL || "https://rpc.sepolia.org",
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
},
mainnet: {
url: process.env.MAINNET_RPC_URL || "https://eth.llamarpc.com",
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
},
},
paths: {
artifacts: "./artifacts",
sources: "./contracts",
tests: "./test",
cache: "./cache",
},
preprocess: {
eachLine: () => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
for (const [find, replace] of getRemappings()) {
if (line.includes(find)) {
line = line.replace(find, replace);
}
}
}
return line;
},
}),
},
etherscan: {
apiKey: {
base: process.env.BASESCAN_API_KEY || "",
mainnet: process.env.ETHERSCAN_API_KEY || "",
sepolia: process.env.ETHERSCAN_API_KEY || "",
},
customChains: [
{
network: "base",
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org",
},
},
],
},
gasReporter: {
enabled: false,
},
};
export default config;