-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·38 lines (34 loc) · 1.02 KB
/
run.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
verify_arg=""
extra_argument=""
for arg in "$@"; do
case $arg in
--trezor)
extra_argument+=trezor@
;;
--no-postcheck)
set -- "${@/#--no-postcheck/}"
extra_argument+=no-postcheck@
;;
--generate-artifacts)
set -- "${@/#--generate-artifacts/}"
extra_argument+=generate-artifact@
;;
-atf)
set -- "${@/#-atf/}"
extra_argument+=generate-artifact@
;;
*) ;;
esac
done
# Remove the @ character from the end of extra_argument
extra_argument="${extra_argument%%@}"
op_command=""
## Check if the private key is stored in the .env file
if [[ ! $extra_argument == *"sender"* ]] && [[ ! $extra_argument == *"trezor"* ]]; then
source .env
if [[ $MAINNET_PK == op* ]] || [[ $TESTNET_PK == op* ]] || [[ $LOCAL_PK == op* ]]; then
op_command="op run --env-file="./.env" --"
fi
fi
calldata=$(cast calldata 'run()')
${op_command} forge script ${verify_arg} ${@} -g 200 --sig 'run(bytes,string)' ${calldata} "${extra_argument}"