From 4dbfb4b9bb44f8a36787af934f193a464ee8b692 Mon Sep 17 00:00:00 2001 From: Volodymyr Lykhonis Date: Thu, 19 Oct 2023 14:06:55 +0200 Subject: [PATCH] Update scripts to operate as owner via configure script --- tools/configure.sh | 13 +++++++++++-- tools/deploy.sh | 11 +---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/configure.sh b/tools/configure.sh index 4aa8840..59ba105 100755 --- a/tools/configure.sh +++ b/tools/configure.sh @@ -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 } @@ -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 @@ -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) ;; *) @@ -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} diff --git a/tools/deploy.sh b/tools/deploy.sh index 42bb76f..de718eb 100755 --- a/tools/deploy.sh +++ b/tools/deploy.sh @@ -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 } @@ -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 @@ -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) ;; *) @@ -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