-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeploy-zksync.sh
More file actions
executable file
·74 lines (60 loc) · 1.62 KB
/
deploy-zksync.sh
File metadata and controls
executable file
·74 lines (60 loc) · 1.62 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
#!/usr/bin/env bash
# Compile 'zk' artifacts.
echo "[deploy-zksync] Compiling zkSync artifacts.."
if [ -d "./artifacts-zk" ]; then
rm -rf ./artifacts-zk
fi
if [ -d "./cache-zk" ]; then
rm -rf ./cache-zk
fi
yarn hardhat compile --network zksync
# Replace 'normal' artifacts with 'zk' artifacts.
echo "[deploy-zksync] Moving zkSync artifacts.."
if [ -d "./artifacts-normal" ]; then
rm -rf ./artifacts-normal
fi
if [ -d "./cache-normal" ]; then
rm -rf ./cache-normal
fi
if [ -d "./artifacts" ]; then
mv ./artifacts ./artifacts-normal
fi
if [ -d "./cache" ]; then
mv ./cache ./cache-normal
fi
if [[ ! -d "./artifacts-zk" || ! -d "./cache-zk" ]]; then
echo "[deploy-zksync] Not found zkSync artifacts, please compile it first."
exit 1
else
mv ./artifacts-zk ./artifacts
mv ./cache-zk ./cache
fi
# Deploy into zkSync
# yarn hardhat deploy-zksync --script {name}.ts
echo "[deploy-zksync] Deploying zkSync artifacts.."
script=""
if [[ "$skippedCompile" == 0 && "$1" ]]; then
script=$1
else
if [[ "$skippedCompile" == 1 && "$2" ]]; then
script=$2
fi
fi
if [[ ! -z "$script" ]]; then
echo "[deploy-zksync] Use deploy script: $script"
yarn hardhat deploy-zksync --script "$script".ts
else
echo "[deploy-zksync] Use all deploy scripts."
yarn hardhat deploy-zksync
fi
# Rename artifacts back
echo "[deploy-zksync] Restoring artifact files"
mv ./artifacts ./artifacts-zk
mv ./cache ./cache-zk
if [ -d "./artifacts-normal" ]; then
mv ./artifacts-normal ./artifacts
fi
if [ -d "./cache-normal" ]; then
mv ./cache-normal ./cache
fi
echo "[deploy-zksync] zkSync artifacts deployed successfully."