Skip to content

Commit

Permalink
fix: better script and make compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
uri-99 committed Nov 26, 2024
1 parent dbcaff4 commit b98d85a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 41 deletions.
26 changes: 8 additions & 18 deletions contracts/scripts/operator_remove_from_whitelist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ cd "$parent_path"
cd ../

# Check if the number of arguments is correct
if [ "$#" -lt 1 ]; then
if [ "$#" -ne 1 ]; then
echo "Usage: operator_remove_from_whitelist.sh <OPERATOR_ADDRESS>"
echo "or"
echo "Usage: operator_remove_from_whitelist.sh <OPERATOR_ADDRESS_1> <OPERATOR_ADDRESS_2> ... <OPERATOR_ADDRESS_N>"
echo "Usage: operator_remove_from_whitelist.sh <OPERATOR_ADDRESS_1,OPERATOR_ADDRESS_2,...,OPERATOR_ADDRESS_N>"
exit 1
fi

Expand All @@ -39,19 +39,9 @@ if [ -z "$PRIVATE_KEY" ]; then
exit 1
fi

if [ "$#" -gt 1 ]; then
OPERATORS=$(echo "$@" | sed 's/ /,/g') # separate the operators with a comma
echo "Removing many operators from whitelist: $@"
cast send \
--rpc-url=$RPC_URL \
--private-key=$PRIVATE_KEY \
$REGISTRY_COORDINATOR 'remove_multiple(address[])' \
"[$OPERATORS]"
else
echo "Removing operator from whitelist: $OPERATOR_ADDRESS"
cast send \
--rpc-url=$RPC_URL \
--private-key=$PRIVATE_KEY \
$REGISTRY_COORDINATOR 'remove(address)' \
$OPERATOR_ADDRESS
fi
echo "Removing operators from whitelist: $@"
cast send \
--rpc-url=$RPC_URL \
--private-key=$PRIVATE_KEY \
$REGISTRY_COORDINATOR 'remove_multiple(address[])' \
"[$OPERATORS]"
26 changes: 8 additions & 18 deletions contracts/scripts/operator_whitelist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ cd "$parent_path"
cd ../

# Check if the number of arguments is correct
if [ "$#" -lt 1 ]; then
if [ "$#" -ne 1 ]; then
echo "Usage: operator_whitelist.sh <OPERATOR_ADDRESS>"
echo "or"
echo "Usage: operator_whitelist.sh <OPERATOR_ADDRESS_1> <OPERATOR_ADDRESS_2> ... <OPERATOR_ADDRESS_N>"
echo "Usage: operator_whitelist.sh <OPERATOR_ADDRESS_1,OPERATOR_ADDRESS_2,...,OPERATOR_ADDRESS_N>"
exit 1
fi

Expand All @@ -39,19 +39,9 @@ if [ -z "$PRIVATE_KEY" ]; then
exit 1
fi

if [ "$#" -gt 1 ]; then
OPERATORS=$(echo "$@" | sed 's/ /,/g') # separate the operators with a comma
echo "Adding many operators to whitelist: $@"
cast send \
--rpc-url=$RPC_URL \
--private-key=$PRIVATE_KEY \
$REGISTRY_COORDINATOR 'add_multiple(address[])' \
"[$OPERATORS]"
else
echo "Adding operator to whitelist: $OPERATOR_ADDRESS"
cast send \
--rpc-url=$RPC_URL \
--private-key=$PRIVATE_KEY \
$REGISTRY_COORDINATOR 'add(address)' \
$OPERATOR_ADDRESS
fi
echo "Adding operators to whitelist: $@"
cast send \
--rpc-url=$RPC_URL \
--private-key=$PRIVATE_KEY \
$REGISTRY_COORDINATOR 'add_multiple(address[])' \
"[$OPERATOR_ADDRESS]"
10 changes: 5 additions & 5 deletions docs/0_internal/whitelist.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ To add only 1 Operator:
make operator_whitelist OPERATOR_ADDRESS=<operator_address>
```

To add a list of Operators:
To add a list of Operators:
```
source contracts/scripts/.env
contracts/scripts/operator_whitelist.sh <operator_address_1> <operator_address_2> ... <operator_address_n>
make operator_whitelist OPERATOR_ADDRESS=<operator_address1,operator_address2,...,operator_addressN>
```
(Note how there is no spaces between the different operator addresses)

### Removing an Operator

Expand All @@ -34,9 +34,9 @@ make operator_remove_from_whitelist OPERATOR_ADDRESS=<operator_address>

To remove a list of Operators:
```
source contracts/scripts/.env
contracts/scripts/operator_remove_from_whitelist.sh <operator_address_1> <operator_address_2> ... <operator_address_n>
make operator_remove_from_whitelist OPERATOR_ADDRESS=<operator_address1,operator_address2,...,operator_addressN>
```
(Note how there is no spaces between the different operator addresses)

### Querying the state of an Operator

Expand Down

0 comments on commit b98d85a

Please sign in to comment.