forked from AbdelStark/token-vesting-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
130 lines (115 loc) · 3.1 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
import "@nomicfoundation/hardhat-toolbox";
import "@nomiclabs/hardhat-solhint";
import "hardhat-abi-exporter";
import "hardhat-docgen";
import "hardhat-tracer";
import { HardhatUserConfig } from "hardhat/config";
import { NetworksUserConfig, SolidityUserConfig } from "hardhat/types/config";
import { AbiExporterUserConfig } from "hardhat-abi-exporter";
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const config: HardhatUserConfig = {
solidity: {
version: "0.8.18",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
} as SolidityUserConfig,
networks: {
mainnet: mainnetNetworkConfig(),
goerli: goerliNetworkConfig(),
bscMainnet: bscMainnetNetworkConfig(),
bscTestnet: bscTestnetNetworkConfig(),
} as NetworksUserConfig,
abiExporter: {
path: "./abi",
clear: true,
flat: false,
spacing: 2,
pretty: true,
runOnCompile: true,
} as AbiExporterUserConfig,
docgen: {
path: "./docs",
clear: true,
runOnCompile: true,
},
gasReporter: {
currency: "USD",
},
etherscan: {
apiKey: getEtherscanApiKey(),
},
};
export default config;
function mainnetNetworkConfig() {
let url = "https://mainnet.infura.io/v3/";
let accountPrivateKey =
"0x0000000000000000000000000000000000000000000000000000000000000000";
if (process.env.MAINNET_ENDPOINT) {
url = `${process.env.MAINNET_ENDPOINT}`;
}
if (process.env.MAINNET_PRIVATE_KEY) {
accountPrivateKey = `${process.env.MAINNET_PRIVATE_KEY}`;
}
return {
url: url,
accounts: [accountPrivateKey],
};
}
function goerliNetworkConfig() {
let url = "https://goerli.infura.io/v3/";
let accountPrivateKey =
"0x0000000000000000000000000000000000000000000000000000000000000000";
if (process.env.GOERLI_ENDPOINT) {
url = `${process.env.GOERLI_ENDPOINT}`;
}
if (process.env.GOERLI_PRIVATE_KEY) {
accountPrivateKey = `${process.env.GOERLI_PRIVATE_KEY}`;
}
return {
url: url,
accounts: [accountPrivateKey],
};
}
function bscMainnetNetworkConfig() {
let url = "https://data-seed-prebsc-1-s1.binance.org:8545/";
let accountPrivateKey =
"0x0000000000000000000000000000000000000000000000000000000000000000";
if (process.env.BSC_MAINNET_ENDPOINT) {
url = `${process.env.BSC_MAINNET_ENDPOINT}`;
}
if (process.env.BSC_MAINNET_PRIVATE_KEY) {
accountPrivateKey = `${process.env.BSC_MAINNET_PRIVATE_KEY}`;
}
return {
url: url,
accounts: [accountPrivateKey],
};
}
function bscTestnetNetworkConfig() {
let url = "https://data-seed-prebsc-1-s1.binance.org:8545/";
let accountPrivateKey =
"0x0000000000000000000000000000000000000000000000000000000000000000";
if (process.env.BSC_TESTNET_ENDPOINT) {
url = `${process.env.BSC_TESTNET_ENDPOINT}`;
}
if (process.env.BSC_TESTNET_PRIVATE_KEY) {
accountPrivateKey = `${process.env.BSC_TESTNET_PRIVATE_KEY}`;
}
return {
url: url,
accounts: [accountPrivateKey],
};
}
function getEtherscanApiKey() {
let apiKey = "";
if (process.env.ETHERSCAN_API_KEY) {
apiKey = `${process.env.ETHERSCAN_API_KEY}`;
}
return apiKey;
}