-
Notifications
You must be signed in to change notification settings - Fork 3
/
hardhat.config.ts
68 lines (63 loc) · 1.87 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
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
require("dotenv").config();
import "hardhat-abi-exporter";
import "hardhat-contract-sizer";
import "hardhat-spdx-license-identifier";
import { envConfig } from "./config/envs";
import { chainIds } from "./config/networks";
function createEthereumNetworkConfig(network: keyof typeof chainIds): NetworkUserConfig {
const url: string = `https://eth-${network}.g.alchemy.com/v2/${envConfig.crypto.ETH_MAINNET_ALCHEMY_API_KEY}`;
let networkConfig: NetworkUserConfig = {
chainId: chainIds[network],
url,
};
const pk: string = envConfig.crypto.ETH_MAINNET_PRIVATE_KEY;
if (pk != "") {
networkConfig.accounts = [pk];
}
return networkConfig;
}
const hardhatConfig: HardhatUserConfig = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
allowUnlimitedContractSize: true,
// used in unit tests.
chainId: chainIds.hardhat,
forking: {
url: `https://eth-mainnet.g.alchemy.com/v2/${envConfig.crypto.ETH_MAINNET_ALCHEMY_API_KEY}`,
blockNumber:
15269796,
},
},
localhost: {
allowUnlimitedContractSize: true,
chainId: chainIds.hardhat,
},
mainnet: createEthereumNetworkConfig("mainnet"),
sepolia: createEthereumNetworkConfig("sepolia"),
},
solidity: {
version: "0.8.24",
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
gasReporter: {
enabled: true,
showMethodSig: true,
showTimeSpent: true,
},
abiExporter: {
path: "./abis",
runOnCompile: true,
clear: true,
flat: true,
spacing: 2,
},
};
export default hardhatConfig;