-
Notifications
You must be signed in to change notification settings - Fork 3
/
hardhat.config.ts
90 lines (81 loc) · 2.14 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
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import "@nomiclabs/hardhat-waffle";
import "@typechain/hardhat";
import * as dotenv from "dotenv";
import { Wallet } from "ethers";
import "hardhat-deploy";
import "hardhat-gas-reporter";
import { HardhatUserConfig } from "hardhat/config";
import "solidity-coverage";
dotenv.config();
const MNEMONIC =
process.env.MNEMONIC ||
"fox sight canyon orphan hotel grow hedgehog build bless august weather swarm";
const INFURA_KEY = process.env.INFURA_KEY || "";
const ALCHEMY_KEY = process.env.ALCHEMY_KEY || "";
const MAINNET_FORK = process.env.MAINNET_FORK === "true";
const FORKING_BLOCK = parseInt(process.env.FORKING_BLOCK || "");
const mainnetFork =
MAINNET_FORK && FORKING_BLOCK
? {
blockNumber: FORKING_BLOCK,
url: ALCHEMY_KEY
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
: `https://main.infura.io/v3/${INFURA_KEY}`,
}
: undefined;
const accounts = Array.from(Array(20), (_, index) => {
const wallet = Wallet.fromMnemonic(MNEMONIC, `m/44'/60'/0'/0/${index}`);
return {
privateKey: wallet.privateKey,
balance: "1000000000000000000000000",
};
});
accounts[19] = {
privateKey:
"a76c3fe18125f9d784d95ccd8e0acb15e34c118511cfa158172d9b44820f260b",
balance: "1000000000000000000000000",
};
const LOCAL_CHAIN_ID = 31337;
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.4",
},
],
},
typechain: {
outDir: "types",
},
etherscan: {
apiKey: process.env.INFURA_KEY,
},
defaultNetwork: "hardhat",
paths: {
sources: "./package/contracts",
},
networks: {
hardhat: {
live: false,
hardfork: "london",
chainId: LOCAL_CHAIN_ID,
throwOnTransactionFailures: true,
throwOnCallFailures: true,
accounts,
forking: mainnetFork,
saveDeployments: false,
},
ganache: {
live: false,
url: "http://ganache:8545",
accounts: accounts.map((account) => account.privateKey),
},
coverage: {
live: false,
url: "http://localhost:8555",
},
},
};
export default config;