This repository has been archived by the owner on Dec 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hardhat.config.ts
59 lines (53 loc) · 1.63 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
require("dotenv").config();
import { HardhatUserConfig } from "hardhat/src/types/config";
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-ethers";
import "hardhat-gas-reporter";
const getAccounts = (network: string) => {
const accounts = {
localhost: process.env.LOCAL_PRIVATE_KEY ? [process.env.LOCAL_PRIVATE_KEY] : [],
stagenet: process.env.STAGENET_PRIVATE_KEY ? [process.env.STAGENET_PRIVATE_KEY] : [],
};
if (!accounts[network]) {
throw new Error(`Your account environment variables for ${network} are not set`);
}
return accounts[network];
};
//We have multiple environments that we are using the hardhat config for
// localhost refers to the network hardhat is using to spin up a node
// devnet refers to the network we are using to connect to running our POA nodes locally
// stagenet refers to the network running our POA nodes on AWS
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
solidity: {
compilers: [{ version: "0.8.6", settings: {} }],
},
networks: {
hardhat: {},
localhost: {
gas: "auto",
gasPrice: "auto",
gasMultiplier: 1,
url: "http://127.0.0.1:8545",
chainId: 31337,
accounts: getAccounts("localhost"),
},
devnet: {
gas: "auto",
gasPrice: "auto",
gasMultiplier: 1,
url: "http://127.0.0.1:8545",
chainId: 1883,
accounts: getAccounts("localhost"),
},
stagenet: {
gas: "auto",
gasPrice: "auto",
gasMultiplier: 1,
url: `${process.env.STAGENET_CHAIN_URL}`,
chainId: 1884,
accounts: getAccounts("stagenet"),
},
},
};
export default config;