-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhardhat.config.ts
More file actions
105 lines (99 loc) · 2.58 KB
/
hardhat.config.ts
File metadata and controls
105 lines (99 loc) · 2.58 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
93
94
95
96
97
98
99
100
101
102
103
104
105
import "@nomicfoundation/hardhat-ethers";
import type { HardhatUserConfig } from "hardhat/config";
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
import dotenv from "dotenv";
import * as fs from "fs";
// One .env covers local + testnet + mainnet; `--network` selects which
// BSC_*_PRIVATE_KEY / BSC_*_RPC_URL gets read. override:true because dotenv
// v17 auto-injects .env earlier with override:false.
if (!fs.existsSync(".env")) {
console.error(
"\x1b[31mFATAL: .env not found. Copy .env.example → .env and fill in the blanks.\x1b[0m",
);
process.exit(1);
}
dotenv.config({ path: ".env", override: true });
const config: HardhatUserConfig = {
plugins: [hardhatToolboxViemPlugin],
verify: {
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY || "",
},
},
chainDescriptors: {
97: {
name: "BSC Testnet",
blockExplorers: {
etherscan: {
url: "https://testnet.bscscan.com",
apiUrl: "https://api.etherscan.io/v2/api",
},
},
},
56: {
name: "BSC Mainnet",
blockExplorers: {
etherscan: {
url: "https://bscscan.com",
apiUrl: "https://api.etherscan.io/v2/api",
},
},
},
},
solidity: {
profiles: {
default: {
version: "0.8.28",
settings: {
evmVersion: "cancun",
optimizer: {
enabled: true,
runs: 200,
},
viaIR: true,
},
},
production: {
version: "0.8.28",
settings: {
evmVersion: "cancun",
optimizer: {
enabled: true,
runs: 200,
},
viaIR: true,
},
},
},
},
networks: {
hardhatMainnet: {
type: "edr-simulated",
chainType: "l1",
},
bscTestnetFork: {
type: "edr-simulated",
chainType: "l1",
forking: {
url: process.env.BSC_TESTNET_RPC_URL || "https://data-seed-prebsc-2-s3.binance.org:8545",
},
},
localhost: {
type: "http",
url: "http://127.0.0.1:8545",
},
bscTestnet: {
type: "http",
chainType: "l1",
url: process.env.BSC_TESTNET_RPC_URL || "https://data-seed-prebsc-2-s3.binance.org:8545",
accounts: process.env.BSC_TESTNET_PRIVATE_KEY ? [process.env.BSC_TESTNET_PRIVATE_KEY] : [],
},
bsc: {
type: "http",
chainType: "l1",
url: process.env.BSC_RPC_URL || "https://bsc-dataseed.binance.org",
accounts: process.env.BSC_PRIVATE_KEY ? [process.env.BSC_PRIVATE_KEY] : [],
},
},
};
export default config;