-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
102 lines (94 loc) · 2.2 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
101
102
import "@nomicfoundation/hardhat-toolbox"
import { HardhatUserConfig } from "hardhat/config"
import fs from "fs"
import "hardhat-preprocessor"
import "hardhat-deploy"
import "@typechain/hardhat"
import "@nomiclabs/hardhat-ethers"
import "@nomiclabs/hardhat-waffle"
import "dotenv/config"
import "hardhat-gas-reporter"
function getRemappings() {
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean) // remove empty lines
.map((line) => line.trim().split("="))
}
const config: HardhatUserConfig = {
solidity: "0.8.17",
preprocess: {
eachLine: (hre) => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
getRemappings().forEach(([find, replace]) => {
if (line.match(find)) {
line = line.replace(find, replace)
}
})
}
return line
},
}),
},
paths: {
sources: "./src",
cache: "./cache_hardhat",
},
defaultNetwork: "hardhat",
networks: {
localhost: {
chainId: 31337,
// blockConfirmations: 1,
},
hardhat: {
chainId: 31337,
// blockConfirmations: 1,
},
rinkeby: {
chainId: 4,
// blockConfirmations: 6,
url: process.env.RINKEBY_RPC_URL,
accounts: [process.env.PRIVATE_KEY!],
},
goerli: {
chainId: 5,
// blockConfirmations: 6,
url: process.env.GOERLI_RPC_URL,
accounts: [process.env.PRIVATE_KEY!],
},
polygonMumbai: {
chainId: 80001,
url: process.env.MUMBAI_RPC_URL,
accounts: [process.env.PRIVATE_KEY!],
},
},
mocha: {
timeout: 300000, // 300 seconds max
},
etherscan: {
apiKey: {
goerli: process.env.ETHERSCAN_API_KEY!,
rinkeby: process.env.ETHERSCAN_API_KEY!,
polygonMumbai: process.env.POLYGONSCAN_API_KEY!,
},
},
gasReporter: {
// enabled: process.env.REPORT_GAS !== undefined,
enabled: true,
currency: "INR",
// outputFile: "gas-report.txt",
// noColors: true,
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
token: "Matic",
},
namedAccounts: {
deployer: {
default: 0,
},
player: {
default: 1,
},
},
}
export default config