Skip to content

Commit

Permalink
Update scripts to operate as owner via configure script
Browse files Browse the repository at this point in the history
  • Loading branch information
lykhonis committed Oct 19, 2023
1 parent 7aaa13a commit 4dbfb4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
13 changes: 11 additions & 2 deletions tools/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ PROJECT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." &>/dev/null && pwd)

help() {
echo ""
echo "Usage: $0 -s SCRIPT_NAME -t NETWORK [-b]"
echo "Usage: $0 -s SCRIPT_NAME -t NETWORK [-b] [-p] [-n SCRIPT_NAME]"
echo -e "\t-s --script: Script to run"
echo -e "\t-t --target: Target network"
echo -e "\t-b --broadcast: Broadcast transactions to a network"
echo -e "\t-p --profile: Use Universal Page profile to transact on behalf"
echo -e "\t-n --name: Name of script contract or 'Configure' if not specified"
echo -e "\t-h --help: Prints this message"
exit 1
}
Expand All @@ -24,6 +25,10 @@ while [ -n "$1" ]; do
[[ ! "$2" =~ ^- ]] && SCRIPT=$2
shift 2
;;
-n | --name)
[[ ! "$2" =~ ^- ]] && SCRIPT_NAME=$2
shift 2
;;
-t | --target)
[[ ! "$2" =~ ^- ]] && TARGET=$2
shift 2
Expand Down Expand Up @@ -52,6 +57,10 @@ if [ -z "${TARGET}" ] || [ -z "${SCRIPT}" ]; then
help
fi

if [ -z "${SCRIPT_NAME}" ]; then
SCRIPT_NAME="Configure"
fi

case "${TARGET}" in
local | testnet | mainnet) ;;
*)
Expand Down Expand Up @@ -95,4 +104,4 @@ if [ -n "${LIBRARY_ROYALTIES_ADDRESS}" ]; then
ARGS+=" --libraries src/common/Royalties.sol:Royalties:${LIBRARY_ROYALTIES_ADDRESS}"
fi

forge script "${PROJECT_DIR}/scripts/${SCRIPT}:Configure" ${ARGS}
forge script "${PROJECT_DIR}/scripts/${SCRIPT}:${SCRIPT_NAME}" ${ARGS}
11 changes: 1 addition & 10 deletions tools/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ help() {
echo -e "\t-t --target: Target network to deploy to"
echo -e "\t-b --broadcast: Broadcast transactions to a network"
echo -e "\t-l --libraries: Deploys libraries only"
echo -e "\t-n --name: Name of script contract or 'Deploy' if not specified"
echo -e "\t-h --help: Prints this message"
exit 1
}
Expand All @@ -25,10 +24,6 @@ while [ -n "$1" ]; do
[[ ! "$2" =~ ^- ]] && SCRIPT=$2
shift 2
;;
-n | --name)
[[ ! "$2" =~ ^- ]] && SCRIPT_NAME=$2
shift 2
;;
-t | --target)
[[ ! "$2" =~ ^- ]] && TARGET=$2
shift 2
Expand Down Expand Up @@ -62,10 +57,6 @@ if [ -n "${SCRIPT}" ] && [ -n "${LIBRARIES}" ]; then
help
fi

if [ -z "${SCRIPT_NAME}" ]; then
SCRIPT_NAME="Deploy"
fi

case "${TARGET}" in
local | testnet | mainnet) ;;
*)
Expand Down Expand Up @@ -129,6 +120,6 @@ else
ARGS+=" --libraries src/common/Royalties.sol:Royalties:${LIBRARY_ROYALTIES_ADDRESS}"
fi

forge script "${PROJECT_DIR}/scripts/${SCRIPT}:${SCRIPT_NAME}" ${ARGS}
forge script "${PROJECT_DIR}/scripts/${SCRIPT}:Deploy" ${ARGS}

fi

0 comments on commit 4dbfb4b

Please sign in to comment.