-
Notifications
You must be signed in to change notification settings - Fork 12
/
hardhat.config.ts
159 lines (149 loc) · 4.73 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import { config as dotEnvConfig } from 'dotenv';
dotEnvConfig();
import '@openzeppelin/hardhat-upgrades';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-etherscan';
import 'hardhat-gas-reporter';
import 'hardhat-typechain';
import 'hardhat-deploy';
import 'hardhat-contract-sizer';
import './tasks/faucet';
import './tasks/checkbalance';
import './tasks/checkbalances';
import './tasks/buyzap';
import './tasks/initProvider';
import './tasks/initProviderCurve';
import './tasks/setEndpointParams';
import './tasks/bond';
import './tasks/dispatch';
// import './tasks/dispatchCoinGecko';
// import './tasks/dispatchCGPriceClient';
// import './tasks/dispatchBittrex';
// import './tasks/checkClient';
import './tasks/verifyContract.js';
// import './tasks/mine';
import './tasks/zapVaultInitOwnership';
import './tasks/zapVaultClaim';
import './tasks/zapMarketInitOwnership';
import './tasks/zapMarketClaim';
import './tasks/mediaFactoryTransfer';
import './tasks/zapMediaInitOwnership';
import './tasks/zapMediaClaim';
require('hardhat-tracer');
import { getBSCGasPrice } from './scripts/getGasPrice';
const fs = require('fs'); // required for reading BSC gas price
// TODO: reenable solidity-coverage when it works
// import "solidity-coverage";
const INFURA_API_KEY = process.env.INFURA_API_KEY || '';
const RINKEBY_PRIVATE_KEY =
process.env.RINKEBY_PRIVATE_KEY! ||
'0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3'; // well known private key
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY;
const BSC_API_KEY = process.env.BSC_API_KEY;
const KOVAN_PRIVATE_KEY =
process.env.KOVAN_PRIVATE_KEY ||
'0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3';
getBSCGasPrice();
const config = {
solidity: {
compilers: [
{ version: '0.4.24', settings: {} },
{ version: '0.5.16', settings: {} },
{ version: '0.6.8', settings: {} },
{ version: '0.7.3', settings: {} },
{ version: '0.7.6', settings: {} },
{
version: '0.8.4',
settings: {
optimizer: {
enabled: true
// runs
}
}
}
]
},
gasReporter: {
enabled: true,
currency: 'USD',
gasPrice: 0.0,
coinmarketcap: process.env.COINMARKETCAP_API_KEY
},
networks: {
// mainnet: {
// url: 'https://mainnet.infura.io/v3/bc0266c92ce34146865122a0b095f44c',
// accounts: { mnemonic: process.env.MNEMONIC },
// gasPrice: 160463534099,
// gas: 2000000,
// gasMultiplier: 2,
// blockGasLimit: 30000000,
// timeout: 900000,
// },
rinkeby: {
url: 'https://speedy-nodes-nyc.moralis.io/732ab4a941019375863742e4/eth/rinkeby',
accounts: [RINKEBY_PRIVATE_KEY]
},
kovan: {
url: 'https://speedy-nodes-nyc.moralis.io/732ab4a941019375863742e4/eth/kovan',
accounts: [KOVAN_PRIVATE_KEY]
},
binanceMainnet: {
url: 'https://bsc-dataseed1.binance.org/',
chainId: 56,
gas: 30000000,
gasPrice: 20000000000,
accounts: process.env.MNEMONIC ? { mnemonic: process.env.MNEMONIC } : undefined,
timeout: 300000
},
bscTestnet: {
url: 'https://data-seed-prebsc-1-s1.binance.org:8545/',
chainId: 97,
gasPrice: 20000000000,
accounts: process.env.BSC_TESTNET_KEY ? [process.env.BSC_TESTNET_KEY] : undefined,
timeout: 300000
},
hardhat: {
gas: 12000000,
gasPrice: 10000000000,
blockGasLimit: 0x1fffffffffffff,
allowUnlimitedContractSize: true,
timeout: 300000,
// forking: {
// url: "https://eth-mainnet.alchemyapi.io/v2/purTbbUAOxZZnq4jSom9OiNTfeF7nUWy",
// blockNumber: 13710736
// }
},
localhost: {
url: 'http://127.0.0.1:8545/'
},
coverage: {
url: 'http://127.0.0.1:8555' // Coverage launches its own ganache-cli client
}
},
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
// apiKey: BSC_API_KEY
},
mocha: {
timeout: 1000000,
// parallel: true
},
namedAccounts: {
deployer: {
default: 0 // here this will by default take the first account as deployer
}
}
};
// read BSC gas price and assign the gas reporter and hardhat network's gas price to it
try {
let data = fs.readFileSync('./output/bscGas.txt', 'utf8');
data = data.replaceAll('"', '');
data = Number.parseInt(data);
config.networks.hardhat.gasPrice = data;
let parsedData = (data / 1000000000).toFixed(2); // round to 2 decimal places
config.gasReporter.gasPrice = Number(parsedData);
} catch (err) {
console.error(err);
}
export default config;