-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
82 lines (74 loc) · 1.83 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
import * as dotenv from "dotenv";
import { HardhatUserConfig, task } from "hardhat/config";
import "hardhat-abi-exporter";
import "@nomiclabs/hardhat-waffle";
import { NetworkUserConfig } from "hardhat/types";
dotenv.config();
task("networks", "Prints the list of networks", async () => {
if (typeof config.networks === undefined) {
console.log("No supported network");
return;
}
const networks = Object.keys(config.networks as NetworkUserConfig).map(
(key, _) => {
return key;
}
);
console.log(networks);
});
/**
* @type import('hardhat/config').HardhatUserConfig
*/
function genPrivateKey(n: number): any {
const result = [];
for (let i = 0; i < n; i++) {
const buf = Buffer.alloc(32);
buf.writeInt32BE(i + 1);
result.push({
privateKey: buf.toString("hex"),
balance: "10000000000000000000000",
});
}
return result;
}
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.9",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
abiExporter: { runOnCompile: true, clear: true, flat: true, pretty: true },
defaultNetwork: "hardhat",
networks: {
hardhat: {
accounts: genPrivateKey(20),
},
mainnet: {
url: process.env.MAINNET_URL,
accounts: [process.env.PRIVATE_KEY as string],
},
ropsten: {
url: process.env.ROPSTEN_URL,
accounts: [process.env.PRIVATE_KEY as string],
},
polygonmMumbai: {
url: process.env.POLYGON_MUMBAI_URL,
accounts: [
"0xc1ce8c29ed57cb90819375354e72e5ad2a4c1b50fe5690fb52a841a454f74a2c",
],
},
polygonMainnet: {
url: process.env.POLYGON_MAINNET_URL,
accounts: [process.env.PRIVATE_KEY as string],
},
},
};
export default config;