-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
126 lines (118 loc) · 3.16 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
import "hardhat-deploy";
import "@nomiclabs/hardhat-etherscan";
import "@nomiclabs/hardhat-ethers";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import { HardhatUserConfig } from "hardhat/types";
import { RpcUrl, Explorer, NetworkConfigMap } from "./models/models";
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const RPC_URL: RpcUrl = {
mainnet: process.env.MAINNET_RPC_URL || "",
rinkeby: process.env.RINKEBY_RPC_URL || "",
kovan: process.env.KOVAN_RPC_URL || "",
polygon: process.env.POLYGON_RPC_URL || "",
};
const PRIVATE_KEY = {
main: process.env.PRIVATE_KEY_MAIN,
test: process.env.PRIVATE_KEY_TEST,
};
const BLOCKCHAIN_EXPLORER: Explorer = {
etherscan: process.env.ETHERSCAN_API_TOKEN || "",
polygonscan: process.env.POLYGONSCAN_API_TOKEN || "",
};
const REPORT_GAS: boolean = Boolean(process.env.REPORT_GAS) || false;
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337,
},
localhost: {
chainId: 31337,
},
kovan: {
url: RPC_URL.kovan,
accounts: PRIVATE_KEY.test !== undefined ? [PRIVATE_KEY.test] : [],
saveDeployments: true,
chainId: 42,
},
rinkeby: {
url: RPC_URL.rinkeby,
accounts: PRIVATE_KEY.test !== undefined ? [PRIVATE_KEY.test] : [],
saveDeployments: true,
chainId: 4,
},
mainnet: {
url: RPC_URL.mainnet,
accounts: PRIVATE_KEY.main !== undefined ? [PRIVATE_KEY.main] : [],
saveDeployments: true,
chainId: 1,
},
polygon: {
url: RPC_URL.polygon,
accounts: PRIVATE_KEY.main !== undefined ? [PRIVATE_KEY.main] : [],
saveDeployments: true,
chainId: 137,
},
},
etherscan: {
// yarn hardhat verify --network <NETWORK> <CONTRACT_ADDRESS> <CONSTRUCTOR_PARAMETERS>
// or just use a custom script
apiKey: {
mainnet: BLOCKCHAIN_EXPLORER.etherscan,
rinkeby: BLOCKCHAIN_EXPLORER.etherscan,
kovan: BLOCKCHAIN_EXPLORER.etherscan,
polygon: BLOCKCHAIN_EXPLORER.polygonscan,
},
},
gasReporter: {
enabled: REPORT_GAS,
currency: "USD",
outputFile: "gas-report.txt",
noColors: true,
},
solidity: "0.8.8",
namedAccounts: {
deployer: {
default: 0,
},
beneficiary: {
default: 1 || "0x",
},
},
paths: {
sources: "./contracts",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts",
},
};
export const networkConfig: NetworkConfigMap = {
hardhat: {
chainId: 31337,
verify: false,
},
localhost: {
chainId: 31337,
verify: false,
},
mainnet: {
chainId: 1,
verify: false,
},
rinkeby: {
chainId: 4,
verify: false,
},
kovan: {
chainId: 42,
verify: false,
},
polygon: {
chainId: 137,
verify: false,
},
};
export default config;