-
Notifications
You must be signed in to change notification settings - Fork 12
/
hardhat.config.js
84 lines (76 loc) · 2.41 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
require("dotenv").config();
require("@nomicfoundation/hardhat-toolbox");
require("hardhat-gas-reporter");
const {
TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS,
TASK_TEST_GET_TEST_FILES,
} = require("hardhat/builtin-tasks/task-names");
const { subtask } = require("hardhat/config");
const path = require("path");
subtask(
TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS,
async (_, { config }, runSuper) => {
const paths = await runSuper();
return paths.filter((solidityFilePath) => {
const relativePath = path.relative(
config.paths.sources,
solidityFilePath
);
if (
relativePath.includes("node_modules") ||
relativePath.startsWith("lib") ||
relativePath.startsWith(".deps") ||
relativePath.startsWith("test/foundry")
) {
return false;
} else if (process.env.WHITELIST_PATH) {
const paths = process.env.WHITELIST_PATH.split(" ");
return (
paths.includes(relativePath) ||
paths.includes(solidityFilePath)
);
} else {
return true;
}
});
}
);
subtask(TASK_TEST_GET_TEST_FILES, async (_, { config }, runSuper) => {
const paths = await runSuper();
return paths.filter((testFilePath) => {
const relativePath = path.relative(config.paths.sources, testFilePath);
if (process.env.WHITELIST_CONTRACT) {
return relativePath.endsWith(
`/${process.env.WHITELIST_CONTRACT}.test.js`
);
} else {
return true;
}
});
});
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: {
version: "0.8.20",
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
paths: {
sources: "./",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts",
},
gasReporter: {
enabled: process.env.REPORT_GAS === "true" ? true : false,
//outputFile: "gas-report.txt",
noColors: true,
currency: "USD",
//coinmarketcap: process.env.COINMARKET_API_KEY,
//gasPrice: 50,
},
};