-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
120 lines (111 loc) · 3.53 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
import * as dotenv from "dotenv";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import "@nomiclabs/hardhat-waffle";
import "@openzeppelin/hardhat-upgrades";
import "@typechain/hardhat";
import "hardhat-abi-exporter";
import "hardhat-gas-reporter";
import "hardhat-log-remover";
import {HardhatUserConfig, task, types} from "hardhat/config";
import "solidity-coverage";
import "hardhat-test-utils";
dotenv.config({
path: `.env.${process.env.NODE_ENV ? process.env.NODE_ENV : "development"}`,
});
task("flat", "Flattens and prints contracts and their dependencies (Resolves licenses)")
.addOptionalVariadicPositionalParam("files", "The files to flatten", undefined, types.inputFile)
.setAction(async ({files}, hre) => {
let flattened = await hre.run("flatten:get-flattened-sources", {files});
// Remove every line started with "// SPDX-License-Identifier:"
flattened = flattened.replace(/SPDX-License-Identifier:/gm, "License-Identifier:");
flattened = `// SPDX-License-Identifier: MIXED\n\n${flattened}`;
// Remove every line started with "pragma experimental ABIEncoderV2;" except the first one
flattened = flattened.replace(
/pragma experimental ABIEncoderV2;\n/gm,
(
(i) => (m: any) =>
!i++ ? m : ""
)(0)
);
console.log(flattened);
});
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
const config: HardhatUserConfig = {
solidity: {
version: "0.8.9",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
networks: {
okc: {
url: process.env.OKC_RPC,
accounts: [process.env.DEPLOYER_PRIVATE_KEY!],
},
bsc: {
url: process.env.BSC_RPC,
accounts: [process.env.DEPLOYER_PRIVATE_KEY!],
},
hardhat: {
// accounts: {
// mnemonic: "test test test test test test test test test test test junk",
// // count: 1000,
// },
// initialBaseFeePerGas: 0,
forking: {
url: "https://rpc.ankr.com/bsc",
// blockNumber: 21329229,
},
// mining: {
// auto: true,
// interval: 3000,
// },
// chainId: 56,
},
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
currency: "USD",
},
etherscan: {
apiKey: {
bsc: process.env.BSCSCAN_API_KEY,
bscTestnet: process.env.BSCSCAN_API_KEY,
okc: process.env.OKCSCAN_API_KEY,
} as any,
customChains: [
{
network: "okc",
chainId: 65,
urls: {
apiURL: "https://www.oklink.com/api",
browserURL: "https://www.oklink.com/okc-test/",
},
},
],
} as any,
abiExporter: {
runOnCompile: true,
flat: true,
},
typechain: {
outDir: "types",
externalArtifacts: [
"./abi/Router.json",
"./abi/PancakeFactory.json",
"./abi/PancakePair.json",
"./abi/WrappedBNB.json",
],
alwaysGenerateOverloads: true,
},
};
export default config;