-
Notifications
You must be signed in to change notification settings - Fork 2
/
hardhat.config.ts
116 lines (103 loc) · 2.96 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@openzeppelin/hardhat-upgrades";
import fs from "fs";
import { NetworkUserConfig } from "hardhat/types";
// Ensure that we have all the environment variables we need.
// const mnemonic: string = process.env.MNEMONIC ? process.env.MNEMONIC : utils.entropyToMnemonic(utils.randomBytes(32));
let mnemonic = 'inspire school random normal account steel strike shove close album produce cube bounce memory before';
if (fs.existsSync(".mnemonic")) {
mnemonic = fs.readFileSync(".mnemonic").toString().trim();
}
const chainIds = {
hardhat: 31337,
DMDv4: 777012
};
function getChainConfig(chain: keyof typeof chainIds): NetworkUserConfig {
let jsonRpcUrl: string = "";
switch (chain) {
case "DMDv4":
jsonRpcUrl = "http://rpc.uniq.diamonds:8540";
break;
}
return {
accounts: {
count: 10,
mnemonic,
path: "m/44'/60'/0'/0",
},
chainId: chainIds[chain],
gas: 21_000_000_000,
gasPrice: 1_000_000_000,
allowUnlimitedContractSize: true,
blockGasLimit: 100000000429720,
url: jsonRpcUrl,
};
}
const config: {} = {
defaultNetwork: "hardhat",
etherscan: {
apiKey: {
DMDv4: "http://explorer.uniq.diamonds/api",
},
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
},
gasReporter: {
currency: "USD",
enabled: process.env.REPORT_GAS ? true : false,
excludeContracts: [],
src: "./contracts",
},
networks: {
hardhat: {
accounts: {
count: 100,
mnemonic,
accountsBalance: "1000000000000000000000000000"
},
chainId: chainIds.hardhat,
allowUnlimitedContractSize: true,
hardfork: "istanbul",
minGasPrice: 0
},
DMDv4: getChainConfig("DMDv4"),
},
paths: {
artifacts: "./artifacts",
cache: "./cache",
sources: "./contracts",
tests: "./test",
},
solidity: {
version: "0.8.18",
settings: {
// metadata: {
// // Not including the metadata hash
// // https://github.com/paulrberg/hardhat-template/issues/31
// bytecodeHash: "none",
// },
// Disable the optimizer when debugging
// https://hardhat.org/hardhat-network/#solidity-optimizer-support
optimizer: {
enabled: true,
runs: 200,
details: {
yul: true,
},
},
evmVersion: "istanbul"
},
},
typechain: {
outDir: "typechain-types/",
target: "ethers-v5",
},
mocha: {
timeout: 100000000
},
};
export default config;