-
Notifications
You must be signed in to change notification settings - Fork 4
/
hardhat.config.zksync.ts
145 lines (135 loc) · 3.7 KB
/
hardhat.config.zksync.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
import "module-alias/register";
import "@matterlabs/hardhat-zksync";
import "@matterlabs/hardhat-zksync-solc";
import "@matterlabs/hardhat-zksync-verify";
import "@nomicfoundation/hardhat-chai-matchers";
import "@nomiclabs/hardhat-ethers";
import "@typechain/hardhat";
import * as dotenv from "dotenv";
import "hardhat-dependency-compiler";
import "hardhat-deploy";
import "hardhat-gas-reporter";
import { HardhatUserConfig, extendConfig, task } from "hardhat/config";
import { HardhatConfig } from "hardhat/types";
import "solidity-coverage";
import "solidity-docgen";
dotenv.config();
const DEPLOYER_PRIVATE_KEY = process.env.DEPLOYER_PRIVATE_KEY;
extendConfig((config: HardhatConfig) => {
if (process.env.EXPORT !== "true") {
config.external = {
...config.external,
deployments: {
zksyncsepolia: [
"node_modules/@venusprotocol/governance-contracts/deployments/zksyncsepolia",
"node_modules/@venusprotocol/oracle/deployments/zksyncsepolia",
],
},
};
}
});
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: "0.8.25",
settings: {
optimizer: {
enabled: true,
details: {
yul: !process.env.CI,
},
},
evmVersion: "paris",
outputSelection: {
"*": {
"*": ["storageLayout"],
},
},
},
},
],
},
zksolc: {
version: "1.5.0",
},
networks: {
hardhat: isFork(),
zksyncsepolia: {
url: process.env.ARCHIVE_NODE_zksyncsepolia || "https://sepolia.era.zksync.dev",
ethNetwork: "sepolia",
verifyURL: "https://explorer.sepolia.era.zksync.dev/contract_verification",
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
zksync: true,
live: true,
},
zksyncmainnet: {
url: process.env.ARCHIVE_NODE_zksyncmainnet || "https://mainnet.era.zksync.io",
ethNetwork: "mainnet",
verifyURL: "https://zksync2-mainnet-explorer.zksync.io/contract_verification",
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
zksync: true,
live: true,
},
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
currency: "USD",
},
// Hardhat deploy
namedAccounts: {
deployer: 0,
acc1: 1,
acc2: 2,
proxyAdmin: 3,
acc3: 4,
},
docgen: {
outputDir: "./docs",
pages: "files",
templates: "./docgen-templates",
},
dependencyCompiler: {
paths: [
"hardhat-deploy/solc_0.8/proxy/OptimizedTransparentUpgradeableProxy.sol",
"hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol",
],
},
paths: {
tests: "./tests",
cache: "./cache-zk",
artifacts: "./artifacts-zk",
},
};
function isFork() {
return process.env.FORK === "true"
? {
allowUnlimitedContractSize: false,
loggingEnabled: false,
forking: {
url: process.env[`ARCHIVE_NODE_${process.env.FORKED_NETWORK}`] || "https://sepolia.era.zksync.dev",
},
accounts: {
accountsBalance: "1000000000000000000",
},
live: false,
saveDeployments: false,
zksync: true,
}
: {
allowUnlimitedContractSize: true,
loggingEnabled: false,
live: false,
saveDeployments: false,
zksync: true,
};
}
export default config;