-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathhardhat.config.ts
92 lines (87 loc) · 2.15 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
import 'dotenv/config'
import fs from 'fs'
import path from 'path'
import '@matterlabs/hardhat-zksync-solc'
import '@matterlabs/hardhat-zksync-deploy'
import '@matterlabs/hardhat-zksync-verify'
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-etherscan'
import '@typechain/hardhat'
import 'hardhat-deploy'
import 'hardhat-preprocessor'
import { node_url, accounts } from './script/utils/network'
import { HardhatUserConfig } from 'hardhat/types'
require('./tasks/generateDiamondABI.ts')
const PKEY = process.env.PRIVATE_KEY_PRODUCTION || null
function getRemappings() {
return fs
.readFileSync('remappings.txt', 'utf8')
.split('\n')
.filter(Boolean) // remove empty lines
.map((line) => line.trim().split('='))
}
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: '0.8.17',
settings: {
optimizer: {
enabled: true,
runs: 10000,
},
},
},
],
},
zksolc: {
version: '1.5.4',
compilerSource: 'binary',
settings: {},
},
namedAccounts: {
deployer: 0,
simpleERC20Beneficiary: 1,
},
networks: {
zksync: {
deploy: ['script/deploy/zksync'],
url: node_url('zksync'),
accounts: PKEY ? [PKEY] : accounts(),
chainId: 324,
zksync: true,
forceDeploy: true,
ethNetwork: 'mainnet',
verifyURL:
'https://zksync2-mainnet-explorer.zksync.io/contract_verification',
},
},
preprocess: {
eachLine: (hre) => ({
transform: (line: string, sourceInfo: { absolutePath: string }) => {
if (line.match(/^\s*import /i)) {
for (const [from, to] of getRemappings()) {
if (line.includes(from) && !to.includes('node_modules')) {
line = line.replace(
from,
`${path
.relative(sourceInfo.absolutePath, __dirname)
.slice(0, -2)}${to}`
)
break
}
}
}
return line
},
}),
},
paths: {
sources: 'src',
},
typechain: {
outDir: 'typechain',
target: 'ethers-v5',
},
}
export default config