-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
86 lines (81 loc) · 2.43 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
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import "@nomiclabs/hardhat-waffle";
import "@typechain/hardhat";
import "solidity-coverage";
import { resolve } from "path";
import { config as dotenvConfig } from "dotenv";
import { HardhatUserConfig, NetworkUserConfig } from "hardhat/types";
import { eEthereumNetwork, eNetwork, ePolygonNetwork } from "./helpers/types";
import { NETWORKS_RPC_URL, buildForkConfig, NETWORKS_CHAIN_ID, NETWORKS_DEFAULT_GAS } from "./helper-hardhat-config";
dotenvConfig({ path: resolve(__dirname, "./.env") });
const MNEMONIC_PATH = "m/44'/60'/0'/0";
const MNEMONIC = process.env.MNEMONIC || "";
const NETWORK = process.env.NETWORK || "hardhat";
const FORK = process.env.FORK || "";
const getCommonNetworkConfig = (networkName: eNetwork): NetworkUserConfig | undefined => ({
url: NETWORKS_RPC_URL[networkName],
gasPrice: "auto",
chainId: NETWORKS_CHAIN_ID[networkName] as number,
initialBaseFeePerGas: 1_00_000_000,
accounts: {
mnemonic: MNEMONIC,
path: MNEMONIC_PATH,
initialIndex: 0,
count: 20,
accountsBalance: "10000000000000000000000",
},
});
const config: HardhatUserConfig = {
networks: {
polygon: getCommonNetworkConfig(ePolygonNetwork.polygon),
mainnet: getCommonNetworkConfig(eEthereumNetwork.mainnet),
hardhat: {
gasPrice: NETWORKS_DEFAULT_GAS[NETWORK as eNetwork],
chainId: NETWORKS_CHAIN_ID[NETWORK as eNetwork] as number,
accounts: {
initialIndex: 0,
count: 20,
mnemonic: MNEMONIC,
path: MNEMONIC_PATH,
accountsBalance: "10000000000000000000000",
},
forking: buildForkConfig(FORK as eNetwork),
hardfork: "merge",
},
},
solidity: {
compilers: [
{
version: "0.8.11",
settings: {
metadata: {
// Not including the metadata hash
// https://github.com/paulrberg/solidity-template/issues/31
bytecodeHash: "none",
},
// Disable the optimizer when debugging
// https://hardhat.org/hardhat-network/#solidity-optimizer-support
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
paths: {
artifacts: "./artifacts",
cache: "./cache",
sources: "./contracts",
tests: "./test",
},
typechain: {
outDir: "typechain",
target: "ethers-v5",
},
mocha: {
timeout: 0,
},
};
export default config;