This repository has been archived by the owner on Jul 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
105 lines (98 loc) · 2.31 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
103
104
105
import * as dotenv from "dotenv";
import * as fs from "fs";
import { HardhatUserConfig } from "hardhat/config";
import "@nomiclabs/hardhat-etherscan";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "solidity-coverage";
import "@atixlabs/hardhat-time-n-mine";
import "@openzeppelin/hardhat-upgrades";
import "hardhat-preprocessor";
import "hardhat-storage-layout";
dotenv.config();
// Load tasks
const files = fs.readdirSync("./tasks");
for (const file of files) {
if (!file.endsWith(".js")) continue;
require(`./tasks/${file}`);
}
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
// "custom" network is what ANR calls itself, so we use that terminology
function getRemappings() {
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean)
.map((line) => line.trim().split("="));
}
const config: HardhatUserConfig = {
solidity: {
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
runs: 800,
},
},
},
defaultNetwork: "localhost",
networks: {
hardhat: {
accounts: {
mnemonic: process.env.MNEMONIC || "MISSING ENV MNEMONIC!",
accountsBalance: "1000000000000000000000000",
},
},
custom: {
url: `${process.env.ETH_RPC_URL}/ext/bc/C/rpc`,
gasPrice: 225000000000,
chainId: 43112,
accounts: {
mnemonic: process.env.MNEMONIC || "MISSING ENV MNEMONIC!",
},
},
fuji: {
url: "https://api.avax-test.network/ext/bc/C/rpc",
gasPrice: 225000000000,
chainId: 43113,
accounts: {
mnemonic: process.env.MNEMONIC || "MISSING ENV MNEMONIC!",
},
},
mainnet: {
url: "https://api.avax.network/ext/bc/C/rpc",
gasPrice: 225000000000,
chainId: 43114,
accounts: {
mnemonic: process.env.MNEMONIC || "MISSING ENV MNEMONIC!",
},
},
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
currency: "USD",
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
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: "./contracts",
cache: "./cache",
},
};
export default config;