This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 506
/
hardhat.config.cjs
94 lines (87 loc) · 2.37 KB
/
hardhat.config.cjs
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
require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-web3");
const task = require("hardhat/config").task;
require("dotenv").config();
const importToml = require("import-toml");
const foundryConfig = importToml.sync("foundry.toml");
const baseConfig = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
forking: {
url: `https://mainnet.infura.io/v3/${process.env.INFURA_TOKEN}`,
blockNumber: 18364580,
},
// set this here because it is the limit of the bor testchain
// and we can only set this once for all hardhat tests
blockGasLimit: 20000000,
allowUnlimitedContractSize: true,
accounts: {
mnemonic:
"clock radar mass judge dismiss just intact mind resemble fringe diary casino",
},
},
},
solidity: {
version: foundryConfig.profile.default.solc_version,
settings: {
optimizer: {
enabled: true,
runs: foundryConfig.profile.default.optimizer_runs,
},
},
},
paths: {
sources: "./contracts",
cache: "./cache_hardhat",
tests: "./test",
},
};
const networks = () => {
if (process.env.ENV === "dev") {
return {
...baseConfig.networks,
sepolia: {
url: "https://sepolia.infura.io/v3/" + process.env.INFURA_TOKEN,
accounts: {
mnemonic: process.env.MNEMONIC_DEV,
},
},
};
} else if (process.env.ENV === "prod") {
return {
...baseConfig.networks,
mainnet: {
url: "https://mainnet.infura.io/v3/" + process.env.INFURA_TOKEN,
accounts: [process.env.PK_MAINNET],
},
};
} else if (process.env.LOCAL_NETWORK) {
console.log("using local hardhat network");
return {
hardhat: {
blockGasLimit: 20000000,
allowUnlimitedContractSize: true,
accounts: {
mnemonic:
"clock radar mass judge dismiss just intact mind resemble fringe diary casino",
},
},
};
}
return baseConfig.networks;
};
const config = {
...baseConfig,
networks: networks(),
etherscan: !process.env.ETHERSCAN_TOKEN
? {}
: { apiKey: process.env.ETHERSCAN_TOKEN },
};
task("accounts", "Prints the list of accounts", async (_, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(await account.address);
}
});
module.exports = config;