-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
43 lines (36 loc) · 687 Bytes
/
deploy.sh
File metadata and controls
43 lines (36 loc) · 687 Bytes
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
#!/bin/bash
while getopts ":u:k:" opt; do
case $opt in
u) rpc="$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 ${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/.env
# Use the RPC environment variable if rpc isn't set.
if [ -z ${rpc+x} ];
then
rpc=$RPC
fi
forge script $FORGE_SCRIPTS/Deploy.s.sol \
--rpc-url $rpc \
--broadcast \
--private-key $private_key \
--skip test