-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathhardhat.config.js
92 lines (87 loc) · 1.96 KB
/
hardhat.config.js
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
require("@nomiclabs/hardhat-waffle");
require("hardhat-gas-reporter");
require("@nomiclabs/hardhat-etherscan");
require("hardhat-preprocessor");
require('hardhat-deploy');
require('dotenv').config();
const fs = require("fs");
const { env } = require("process");
// for foundry remappings
function getRemappings() {
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean) // remove empty lines
.map((line) => line.trim().split("="));
}
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
module.exports = {
solidity: {
compilers: [
{
version: "0.8.13",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
namedAccounts: {
deployer: 0,
},
networks: {
hardhat: {
gas: 50000000000,
blockGasLimit: 100000000429720,
allowUnlimitedContractSize: true,
},
mainnet: {
url: process.env.NODE_URL_MAINNET,
accounts: [process.env.PK],
// gasPrice: 40000000000
},
rinkeby: {
url: process.env.NODE_URL,
accounts: [process.env.PK],
// gas: 2100000,
// gasPrice: 8000000000
},
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
// for foundry
preprocess: {
eachLine: (hre) => ({
transform: (line) => {
if (line.match(/^\s*import /i)) {
getRemappings().forEach(([find, replace]) => {
if (line.match('"' + find)) {
line = line.replace('"' + find, '"' + replace);
}
});
}
return line;
},
}),
},
paths: {
sources: "./src",
tests: "./hh-test",
cache: "./hh-cache",
artifacts: "./artifacts"
},
gasReporter: {
currency: 'USD',
gasPrice: 100,
showTimeSpent: true,
},
};