generated from GemStarterIo/synapsenetwork-contracts-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.network.ts
75 lines (66 loc) · 1.56 KB
/
hardhat.network.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
import { config as dotenvConfig } from "dotenv";
import { resolve } from "path";
dotenvConfig({ path: resolve(__dirname, "./.env") });
import { HardhatUserConfig } from "hardhat/config";
// Ensure that we have all the environment variables we need.
let mnemonic: string;
if (!process.env.MNEMONIC) {
throw new Error("Please set your MNEMONIC in a .env file");
} else {
mnemonic = process.env.MNEMONIC;
}
let alchemyUrl: string;
if (!process.env.ALCHEMY_URL) {
throw new Error("Please set your ALCHEMY_URL in a .env file");
} else {
alchemyUrl = process.env.ALCHEMY_URL;
}
const networks: HardhatUserConfig["networks"] = {
coverage: {
url: "http://127.0.0.1:8555",
blockGasLimit: 200000000,
allowUnlimitedContractSize: true,
},
localhost: {
chainId: 1337,
url: "http://127.0.0.1:8545",
allowUnlimitedContractSize: true,
},
};
if (alchemyUrl && process.env.FORK_ENABLED && mnemonic) {
networks.hardhat = {
chainId: 1,
forking: {
url: alchemyUrl,
},
accounts: {
mnemonic,
},
};
} else {
console.log(alchemyUrl, process.env.FORK_ENABLED, mnemonic);
networks.hardhat = {
allowUnlimitedContractSize: true,
mining: {
auto: true,
interval: 30000, // 30 sec per block
},
};
}
if (mnemonic) {
networks.mumbai = {
chainId: 80001,
url: "https://rpc-mumbai.maticvigil.com",
accounts: {
mnemonic,
},
};
networks.goerli = {
chainId: 5,
url: `https://eth-goerli.g.alchemy.com/v2/${alchemyUrl}`,
accounts: {
mnemonic,
},
};
}
export default networks;