-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhardhat.config.ts
101 lines (92 loc) · 2.68 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
import * as dotenv from 'dotenv'
import { HardhatUserConfig } from 'hardhat/config'
import '@nomiclabs/hardhat-etherscan'
import '@nomiclabs/hardhat-waffle'
import '@typechain/hardhat'
import 'hardhat-gas-reporter'
import 'solidity-coverage'
import 'hardhat-tracer'
import * as tdly from '@tenderly/hardhat-tenderly'
import { HardhatNetworkConfig } from 'hardhat/types'
import './scripts/tasks'
dotenv.config()
tdly.setup()
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
export const blockNumber = process.env.BLOCK_NUMBER || '16047227'
function createHardhatNetwork(network: string, node: string | undefined, key: string | undefined, gasPrice: number) {
if (!node || !key) {
return null
}
return [
network,
{
url: node,
accounts: [key],
gasPrice,
},
]
}
const config: HardhatUserConfig = {
solidity: {
version: '0.8.13',
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
mocha: {
timeout: 60000,
grep: '@skip-on-coverage',
invert: true,
},
networks: {
local: {
url: 'http://127.0.0.1:8545',
timeout: 100000,
},
hardhat: {
forking: {
url: process.env.ALCHEMY_NODE!,
blockNumber: parseInt(blockNumber),
},
chainId: 2137,
mining: {
auto: true,
interval: 2000,
},
hardfork: 'london',
gas: 'auto',
initialBaseFeePerGas: 1000000000,
allowUnlimitedContractSize: false,
},
...Object.fromEntries(
[
createHardhatNetwork('mainnet', process.env.ALCHEMY_NODE, process.env.PRIVATE_KEY!, 35000000000),
createHardhatNetwork('tenderly', process.env.TENDERLY_NODE, process.env.PRIVATE_KEY!, 35000000000),
createHardhatNetwork(
'goerli',
process.env.ALCHEMY_NODE_GOERLI,
process.env.PRIVATE_KEY_GOERLI!,
5000000000,
),
].filter(Boolean) as [string, HardhatNetworkConfig][],
),
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
tenderly: {
project: process.env.TENDERLY_PROJECT!,
username: process.env.TENDERLY_USERNAME!,
},
}
// tenderly fix
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
BigInt.prototype.toJSON = function () {
return this.toString()
}
export default config