-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
147 lines (141 loc) · 3.42 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
* Copyright (C) 2022 Ultrachess team
* This file is part of Ultrachess - https://github.com/Ultrachess/contracts
*
* SPDX-License-Identifier: Apache-2.0
* See the file LICENSE for more information.
*/
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import "@typechain/hardhat";
import "hardhat-abi-exporter";
import "hardhat-deploy";
import "hardhat-gas-reporter";
import { HardhatUserConfig } from "hardhat/config";
import { HttpNetworkUserConfig } from "hardhat/types";
// read MNEMONIC from env variable
const mnemonic = process.env.MNEMONIC;
const infuraNetwork = (
network: string,
chainId?: number,
gas?: number
): HttpNetworkUserConfig => {
return {
url: `https://${network}.infura.io/v3/${process.env.PROJECT_ID}`,
chainId,
gas,
accounts: mnemonic ? { mnemonic } : undefined,
};
};
const config: HardhatUserConfig = {
networks: {
hardhat: {
accounts: mnemonic ? { mnemonic } : undefined,
allowUnlimitedContractSize: true,
saveDeployments: true,
},
localhost: {
url: "http://localhost:8545",
accounts: mnemonic ? { mnemonic } : undefined,
allowUnlimitedContractSize: true,
saveDeployments: true,
},
docker: {
url: "http://hardhat:8545",
accounts: mnemonic ? { mnemonic } : undefined,
},
mainnet: infuraNetwork("mainnet", 1, 6283185),
goerli: infuraNetwork("goerli", 5, 6283185),
polygon_mumbai: infuraNetwork("polygon-mumbai", 80001),
arbitrum_goerli: infuraNetwork("arbitrum-goerli", 421613),
optimism_goerli: infuraNetwork("optimism-goerli", 420),
},
solidity: {
compilers: [
{
version: "0.8.18",
settings: {
optimizer: {
enabled: true,
},
},
},
{
// Required by OpenZeppelin V3
// Required by Uniswap V3
version: "0.7.6",
settings: {
optimizer: {
enabled: true,
},
},
},
{
// Required by Aave V2
version: "0.6.12",
settings: {
evmVersion: "berlin",
optimizer: {
enabled: true,
runs: 1000000,
details: {
yul: true,
deduplicate: true,
cse: true,
constantOptimizer: true,
},
},
},
},
{
// Required by Cartesi token
// Required by OpenZeppelin V2
version: "0.5.17",
settings: {
optimizer: {
enabled: true,
},
},
},
],
},
paths: {
artifacts: "artifacts",
deploy: "deploy",
deployments: "deployments",
},
abiExporter: {
// Path to ABI export directory (relative to Hardhat root)
path: "./src/abi",
// Whether to automatically export ABIs during compilation
runOnCompile: true,
// Whether to delete old files in path
clear: true,
// Whether to use interface-style formatting of output for better readability
pretty: true,
},
typechain: {
outDir: "src/types",
target: "ethers-v5",
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
external: {
deployments: {
localhost: ["deployments/localhost"],
},
},
namedAccounts: {
deployer: {
default: 0,
},
beneficiary: {
default: 1,
},
},
gasReporter: {
enabled: process.env.REPORT_GAS ? true : false,
},
};
export default config;