-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
62 lines (52 loc) · 1.04 KB
/
deploy.sh
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
#!/bin/bash
while getopts ":c:u:e:k:" opt; do
case $opt in
c) chain="$OPTARG"
;;
u) rpc="$OPTARG"
;;
e) etherscan_key="$OPTARG"
;;
k) private_key="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
exit 1
;;
esac
case $OPTARG in
-*) echo "Option $opt needs a valid argument" >&2
exit 1
;;
esac
done
if [ -z ${chain+x} ];
then
echo "chain (-c) is unset" >&2
exit 1
fi
if [ -z ${private_key+x} ];
then
echo "private key (-k) is unset" >&2
exit 1
fi
set -euo pipefail
ROOT=$(dirname $0)
FORGE_SCRIPTS=$ROOT/script
. $ROOT/$chain.env
# Use the RPC environment variable if rpc isn't set.
if [ -z ${rpc+x} ];
then
rpc=$RPC
fi
# Use the ETHERSCAN_KEY environment variable if etherscan_key isn't set.
if [ -z ${etherscan_key+x} ];
then
etherscan_key=$ETHERSCAN_KEY
fi
forge script $FORGE_SCRIPTS/DeployOptionMarket.s.sol \
--rpc-url $rpc \
--broadcast \
--private-key $private_key \
--verify --etherscan-api-key $etherscan_key \
--slow \
--skip test