-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardhat.config.cts
More file actions
78 lines (69 loc) · 1.8 KB
/
hardhat.config.cts
File metadata and controls
78 lines (69 loc) · 1.8 KB
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
import "dotenv/config";
process.env.BCRYPTO_FORCE_FALLBACK ??= "1";
import { subtask } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import { join } from "path";
import { writeFile } from "fs/promises";
import { TASK_COMPILE_SOLIDITY } from "hardhat/builtin-tasks/task-names";
import "@nomicfoundation/hardhat-chai-matchers";
import "hardhat-switch-network";
if (process.env.SKIP_HARDHAT_TASKS !== "true") {
require("./tasks");
}
subtask(TASK_COMPILE_SOLIDITY).setAction(async (_, { config }, runSuper) => {
const superRes = await runSuper();
try {
await writeFile(
join(config.paths.artifacts, "package.json"),
'{ "type": "commonjs" }'
);
await writeFile(
join(config.paths.root, "typechain-types", "package.json"),
'{ "type": "commonjs" }'
);
} catch (error) {
console.error("Error writing package.json: ", error);
}
return superRes;
});
const PRIVATE_KEY = process.env.PRIVATE_KEY;
const ETHEREUM_SEPOLIA_RPC_URL = process.env.ETHEREUM_SEPOLIA_RPC_URL;
const ETHERSCAN_KEY = process.env.ETHERSCAN_API_KEY;
/** @type import('hardhat/config').HardhatUserConfig */
const config = {
solidity: {
version: "0.8.27",
settings: {
optimizer: {
enabled: true,
runs: 200
},
viaIR: true
}
},
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337
},
chainlinkLocalhost: {
url: "http://127.0.0.1:8545",
chainId: 1337
},
...(ETHEREUM_SEPOLIA_RPC_URL && {
sepolia: {
url: ETHEREUM_SEPOLIA_RPC_URL,
accounts: PRIVATE_KEY ? [PRIVATE_KEY] : undefined,
},
}),
},
etherscan: {
apiKey: ETHERSCAN_KEY,
},
typechain: {
outDir: "typechain-types",
target: "ethers-v6",
alwaysGenerateOverloads: true,
},
};
export = config;