-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
96 lines (89 loc) · 2.4 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
import dotenv from "dotenv";
dotenv.config();
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@openzeppelin/hardhat-upgrades";
import "@semaphore-protocol/hardhat";
import "solidity-coverage";
import "./tasks";
const { PRIVATE_KEY, ALCHEMY_API_KEY, NETWORK } = process.env;
const hasCustomNetwork = NETWORK && NETWORK !== "hardhat";
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || "";
if (hasCustomNetwork) {
if (!PRIVATE_KEY) {
throw new Error("PRIVATE_KEY not set");
}
if (!ALCHEMY_API_KEY) {
throw new Error("ALCHEMY_API_KEY not set");
}
}
const API_TEMPLATE = "https://{{network}}.g.alchemy.com/v2/{{key}}";
const config: HardhatUserConfig = {
solidity: {
version: "0.8.4",
settings: {
viaIR: false,
optimizer: {
enabled: true,
runs: 200,
},
},
},
defaultNetwork: NETWORK,
networks: {
hardhat: {},
linea_testnet: {
url: `https://linea-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts: [process.env.PRIVATE_KEY!],
gas: 7100000,
gasPrice: 80100010000,
},
opt_goerli: {
url: `https://opt-goerli.g.alchemy.com/v2/GZ-aIq52UCdrNOdonkLAX7jS2qfpRx9X`,
accounts: [process.env.PRIVATE_KEY!],
gasPrice: 80100010,
},
// ...(hasCustomNetwork
// ? {
// [NETWORK]: {
// url: API_TEMPLATE.replace("{{network}}", NETWORK).replace(
// "{{key}}",
// ALCHEMY_API_KEY!
// ),
// // uncomment to make tx go faster
// // gasPrice: 450000000000,
// accounts: [PRIVATE_KEY],
// },
// }
// : {}),
},
typechain: {
outDir: "src/types",
target: "ethers-v5",
},
etherscan: {
apiKey: {
linea_testnet: process.env.LINEASCAN_API_KEY || "",
optimisticGoerli: process.env.ETHERSCAN_API_KEY!,
},
customChains: [
{
network: "linea_testnet",
chainId: 59140,
urls: {
apiURL: "https://explorer.goerli.linea.build/api",
browserURL: "https://explorer.goerli.linea.build",
},
},
{
network: "opt_goerli",
chainId: 59140,
urls: {
apiURL: "https://api-goerli-optimistic.etherscan.io/",
browserURL: "https://goerli-optimism.etherscan.io/",
},
},
],
},
};
export default config;