-
Notifications
You must be signed in to change notification settings - Fork 1
/
hardhat.config.ts
96 lines (90 loc) · 2.12 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 "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-foundry";
import "hardhat-contract-sizer";
import "hardhat-deploy";
import "hardhat-preprocessor";
import fs from "fs";
function getRemappings() {
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean) // remove empty lines
.map((line) => line.trim().split("="));
}
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: {
compilers: [
{
version: "0.8.19",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
namedAccounts: {
deployer: 0,
},
networks: {
hardhat: {},
localhost: {},
goerli: {
url:
process.env.GOERLI_URL ||
`https://goerli.infura.io/v3/${process.env.INFURA_KEY}`,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
arb: {
url:
process.env.ARB_URL ||
`https://arb.getblock.io/${process.env.GETBLOCK_KEY}/mainnet/`,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
mantle: {
url: process.env.MANTLE_TESTNET_URL || `https://rpc.mantle.xyz/`,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
},
etherscan: {
apiKey: {
mantle: 'mantle',
arb: process.env.ARBISCAN_API_KEY,
},
customChains: [
{
network: "mantle",
chainId: 5000,
urls: {
apiURL: "https://explorer.mantle.xyz/api",
browserURL: "https://explorer.mantle.xyz/"
}
}
]
},
preprocess: {
eachLine: (hre) => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
for (const [from, to] of getRemappings()) {
if (line.includes(from)) {
line = line.replace(from, to);
break;
}
}
}
return line;
},
}),
},
paths: {
sources: "./src",
cache: "./cache_hardhat",
},
};