forked from CryptJS13/bookkeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardhat.config.js
More file actions
142 lines (131 loc) · 3.88 KB
/
hardhat.config.js
File metadata and controls
142 lines (131 loc) · 3.88 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");
require("@nomiclabs/hardhat-truffle5");
require("@nomiclabs/hardhat-ethers");
require("hardhat-gas-reporter");
require("hardhat-deploy");
require("@nomiclabs/hardhat-ethers");
require("@typechain/hardhat");
require('@openzeppelin/hardhat-upgrades');
require('hardhat-contract-sizer');
require("solidity-coverage");
const keys = require('./dev-keys.json');
const ethForkUrl = "https://eth-mainnet.alchemyapi.io/v2/" + keys.alchemyKeyMainnet;
// BSC JSON-RPC Endpoints: https://docs.binance.org/smart-chain/developer/rpc.html
// const bscForkUrl = "https://bsc-dataseed1.ninicoin.io/";
const bscForkUrl = "https://bsc-dataseed1.defibit.io/";
// const maticForkUrl = "https://rpc-mainnet.maticvigil.com/";
const maticForkUrl = "https://matic-mainnet.chainstacklabs.com";
const maticTestnetForkUrl = "https://matic-mumbai.chainstacklabs.com";
let chainId = 1
let forkUrl, blockNumber
if (process.env.FORK_MAINNET || keys.fork==='mainnet') {
chainId = 1
forkUrl = ethForkUrl
blockNumber = undefined // use last block number (no caching)
// let blockNumber = 12625928 //TODO update to latest from etherscan to test with caching
} else if (process.env.FORK_BSC || keys.fork==='bsc') {
chainId = 56
forkUrl = bscForkUrl
blockNumber = undefined // use last block number (no caching)
// blockNumber = 8857941 //TODO update to latest from bscscan to test with caching
} else if (process.env.FORK_MATIC || keys.fork==='matic') {
chainId = 137
forkUrl = maticForkUrl
blockNumber = undefined // use last block number (no caching)
}
let forking;
if (forkUrl) forking = {
url: forkUrl,
blockNumber: blockNumber,
}
// just couple of random private keys for testing purposes
const account1 = '0x4c9efe74ac899b09cba9bf1029b797ea250db03636d5b026c06157c84121c93c'
const account2 = '0x4c9efe74ac899b09cba9bf1029b797ea250db03636d5b026c06157c84121c93d'
const accounts = keys.DEPLOY_PRIVATE_KEY ?
[`0x${keys.DEPLOY_PRIVATE_KEY}`,account2] :
[account1,account2];
// console.log('forkUrl', forkUrl);
// console.log('chainId', chainId);
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
allowUnlimitedContractSize: true,
chainId: chainId,
forking: forking,
accounts: [{
privateKey:account1,
balance:(10**18).toString()
},{
privateKey:account2,
balance:(10**18).toString()
}]
},
ropsten: {
allowUnlimitedContractSize: true,
url: "https://eth-ropsten.alchemyapi.io/v2/" + keys.alchemyKeyRopsten,
accounts
},
mainnet: {
url: "https://eth-mainnet.alchemyapi.io/v2/" + keys.alchemyKeyMainnet,
accounts
},
bsc: {
// url: "https://bsc-dataseed.binance.org/",
// url: "https://bsc-dataseed1.defibit.io/",
url: "https://bsc-dataseed1.ninicoin.io/",
// url: "wss://bsc-ws-node.nariox.org:443",
chainId: 56,
accounts
},
matic: {
url: maticForkUrl,
chainId: 137,
accounts
},
maticTestnet: {
url: maticTestnetForkUrl,
chainId: 80001,
accounts
},
},
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
},
account2: {
default: 1,
},
},
etherscan: {
apiKey: (process.env.BSC) ? keys.bscscanAPI : (process.env.ETH)? keys.etherscanAPI : keys.polygonscanAPI
},
solidity: {
compilers: [
{version: "0.6.12",
settings: {
optimizer: {
enabled: true,
runs: 1
}
}},
]
},
mocha: {
"require": "hardhat/register",
timeout: 10000000
},
gasReporter: {
enabled: true,
currency: 'USD',
},
contractSizer: {
alphaSort: true,
runOnCompile: false, // set to true to print sizes
disambiguatePaths: false,
}
};