-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhardhat.config.ts
97 lines (88 loc) · 2.43 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
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-toolbox";
import dotenv from "dotenv";
import 'hardhat-deploy'
import { HttpNetworkUserConfig } from "hardhat/types";
dotenv.config();
const { CUSTOM_NODE_URL, LOCALHOST_NODE_URL } = process.env;
// const DEFAULT_MNEMONIC = "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat";
// Function to get all keys matching the pattern PK{number}
const getPrivateKeys = () => {
return Object.keys(process.env)
.filter(key => /^PK\d+$/.test(key))
.map(key => process.env[key] as string);
};
const privateKeys = getPrivateKeys();
const sharedNetworkConfig: HttpNetworkUserConfig = {};
if (privateKeys.length >= 2) {
sharedNetworkConfig.accounts = privateKeys;
} else {
throw new Error("At least 2 private keys must be provided in .env");
}
const customNetwork = CUSTOM_NODE_URL
? {
custom: {
...sharedNetworkConfig,
url: CUSTOM_NODE_URL,
},
}
: {};
const compilerSettings = {
version: "0.8.27",
settings: {
optimizer: {
enabled: true,
runs: 10_000_000,
},
viaIR: false,
evmVersion: "paris",
}
};
const config: HardhatUserConfig = {
paths: {
artifacts: 'build/artifacts',
cache: 'build/cache',
deploy: 'src/deploy',
sources: 'contracts',
},
networks: {
localhost: {
...sharedNetworkConfig,
url: LOCALHOST_NODE_URL || "http://localhost:8545",
allowUnlimitedContractSize: true
},
hardhat: {
allowUnlimitedContractSize: true
},
sepolia: {
...sharedNetworkConfig,
url: "https://rpc.ankr.com/eth_sepolia",
},
pectra:{
...sharedNetworkConfig,
url: "https://rpc.pectra-devnet-4.ethpandaops.io",
gasPrice: 50_000_000_000,
gas: 1_000_000_000,
timeout: 100000000,
},
ithaca:{
...sharedNetworkConfig,
url: "https://odyssey.ithaca.xyz",
timeout: 100000000,
},
...customNetwork,
},
solidity: {
compilers: [compilerSettings],
},
namedAccounts: {
deployer: 0,
relayer: 1,
delegator: 2
},
mocha: {
timeout: 100000000
},
};
export default config;