-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
103 lines (97 loc) · 2.67 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
import { HardhatUserConfig, NetworkUserConfig } from "hardhat/types";
import "@typechain/hardhat";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import "@nomiclabs/hardhat-waffle";
require("dotenv").config();
import "hardhat-abi-exporter";
import "hardhat-contract-sizer";
import "hardhat-gas-reporter";
import "hardhat-spdx-license-identifier";
import { envConfig } from "./config/envs";
import { chainIds } from "./config/networks";
function createEthereumNetworkConfig(network: keyof typeof chainIds): NetworkUserConfig {
const url: string = `https://eth-${network}.alchemyapi.io/v2/${envConfig.crypto.ALCHEMY_KEY}`;
let networkConfig: NetworkUserConfig = {
chainId: chainIds[network],
url,
};
const pk: string = envConfig.crypto.PRIVATE_KEY;
if (pk != "") {
networkConfig.accounts = [pk];
}
return networkConfig;
}
const hardhatConfig: HardhatUserConfig = {
defaultNetwork: "localhost",
networks: {
hardhat: {
chainId: chainIds.hardhat,
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/${envConfig.crypto.ALCHEMY_KEY}`,
blockNumber:
15269796,
},
},
localhost: {
// used for local deployment
url: "http://localhost:8545",
},
mainnet: createEthereumNetworkConfig("mainnet"),
goerli: createEthereumNetworkConfig("goerli"),
kovan: createEthereumNetworkConfig("kovan"),
rinkeby: createEthereumNetworkConfig("rinkeby"),
ropsten: createEthereumNetworkConfig("ropsten"),
},
solidity: {
compilers: [
{
version: '0.5.12',
},
{
version: '0.8.0',
},
{
version: '0.8.4',
},
{
version: '0.8.9',
},
{
version: '^0.8.12',
},
],
settings: {
outputSelection: {
"*": {
"*": ["storageLayout"]
}
}
},
},
etherscan: {
apiKey: envConfig.crypto.ETHERSCAN_KEY,
},
gasReporter: {
enabled: true,
showMethodSig: true,
showTimeSpent: true,
},
abiExporter: {
path: "./abis",
runOnCompile: true,
clear: true,
flat: true,
spacing: 2,
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
},
typechain: {
outDir: "typechain",
target: "ethers-v5",
},
};
export default hardhatConfig;