-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
100 lines (92 loc) · 2.95 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
import "@nomicfoundation/hardhat-toolbox";
import "hardhat-deploy";
import type { HardhatUserConfig } from "hardhat/config";
import { vars } from "hardhat/config";
import type { NetworkUserConfig } from "hardhat/types";
import "./tasks/warpDeploy";
// Run 'npx hardhat vars setup' to see the list of variables that need to be set
const pk: string = vars.get("PK");
const alchemyApiKey: string = vars.get("ALCHEMY_API_KEY");
const chainIds = {
"opt-sepolia": 11155420,
"base-sepolia": 84532,
"arb-sepolia": 421614,
"eth-sepolia": 11155111,
hardhat: 31337,
};
function getChainConfig(chain: keyof typeof chainIds): NetworkUserConfig {
let jsonRpcUrl: string = `https://${chain}.g.alchemy.com/v2/${alchemyApiKey}`;
return {
accounts: [pk],
chainId: chainIds[chain],
url: jsonRpcUrl,
};
}
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
namedAccounts: {
deployer: 0,
},
etherscan: {
apiKey: {
arbitrumOne: vars.get("ARBISCAN_API_KEY", ""),
optimisticEthereum: vars.get("OPTIMISM_API_KEY", ""),
"optimism-sepolia": vars.get("OPTIMISM_API_KEY", ""),
base: vars.get("BASESCAN_API_KEY", ""),
"base-sepolia": vars.get("BASESCAN_API_KEY", ""),
sepolia: vars.get("ETHERSCAN_API_KEY", ""),
},
customChains: [
{
network: "optimism-sepolia",
chainId: 11155420,
urls: {
apiURL: "https://api-sepolia-optimistic.etherscan.io/api",
browserURL: "https://sepolia-optimism.etherscan.io/",
},
},
{
network: "base-sepolia",
chainId: 84532,
urls: {
apiURL: "https://api-sepolia.basescan.org/api",
browserURL: "https://sepolia.basescan.org/",
},
},
],
},
networks: {
hardhat: {},
"optimism-sepolia": getChainConfig("opt-sepolia"),
"base-sepolia": getChainConfig("base-sepolia"),
"arbitrum-sepolia": getChainConfig("arb-sepolia"),
sepolia: getChainConfig("eth-sepolia"),
},
paths: {
artifacts: "./artifacts",
cache: "./cache",
sources: "./contracts",
tests: "./test",
},
solidity: {
version: "0.8.27",
settings: {
metadata: {
// Not including the metadata hash
// https://github.com/paulrberg/hardhat-template/issues/31
bytecodeHash: "none",
},
// Disable the optimizer when debugging
// https://hardhat.org/hardhat-network/#solidity-optimizer-support
optimizer: {
enabled: true,
runs: 800,
},
},
},
typechain: {
outDir: "types",
target: "ethers-v6",
},
};
export default config;