Skip to content

Commit b98d85a

Browse files
committed
fix: better script and make compatibility
1 parent dbcaff4 commit b98d85a

File tree

3 files changed

+21
-41
lines changed

3 files changed

+21
-41
lines changed

contracts/scripts/operator_remove_from_whitelist.sh

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ cd "$parent_path"
99
cd ../
1010

1111
# Check if the number of arguments is correct
12-
if [ "$#" -lt 1 ]; then
12+
if [ "$#" -ne 1 ]; then
1313
echo "Usage: operator_remove_from_whitelist.sh <OPERATOR_ADDRESS>"
1414
echo "or"
15-
echo "Usage: operator_remove_from_whitelist.sh <OPERATOR_ADDRESS_1> <OPERATOR_ADDRESS_2> ... <OPERATOR_ADDRESS_N>"
15+
echo "Usage: operator_remove_from_whitelist.sh <OPERATOR_ADDRESS_1,OPERATOR_ADDRESS_2,...,OPERATOR_ADDRESS_N>"
1616
exit 1
1717
fi
1818

@@ -39,19 +39,9 @@ if [ -z "$PRIVATE_KEY" ]; then
3939
exit 1
4040
fi
4141

42-
if [ "$#" -gt 1 ]; then
43-
OPERATORS=$(echo "$@" | sed 's/ /,/g') # separate the operators with a comma
44-
echo "Removing many operators from whitelist: $@"
45-
cast send \
46-
--rpc-url=$RPC_URL \
47-
--private-key=$PRIVATE_KEY \
48-
$REGISTRY_COORDINATOR 'remove_multiple(address[])' \
49-
"[$OPERATORS]"
50-
else
51-
echo "Removing operator from whitelist: $OPERATOR_ADDRESS"
52-
cast send \
53-
--rpc-url=$RPC_URL \
54-
--private-key=$PRIVATE_KEY \
55-
$REGISTRY_COORDINATOR 'remove(address)' \
56-
$OPERATOR_ADDRESS
57-
fi
42+
echo "Removing operators from whitelist: $@"
43+
cast send \
44+
--rpc-url=$RPC_URL \
45+
--private-key=$PRIVATE_KEY \
46+
$REGISTRY_COORDINATOR 'remove_multiple(address[])' \
47+
"[$OPERATORS]"

contracts/scripts/operator_whitelist.sh

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ cd "$parent_path"
99
cd ../
1010

1111
# Check if the number of arguments is correct
12-
if [ "$#" -lt 1 ]; then
12+
if [ "$#" -ne 1 ]; then
1313
echo "Usage: operator_whitelist.sh <OPERATOR_ADDRESS>"
1414
echo "or"
15-
echo "Usage: operator_whitelist.sh <OPERATOR_ADDRESS_1> <OPERATOR_ADDRESS_2> ... <OPERATOR_ADDRESS_N>"
15+
echo "Usage: operator_whitelist.sh <OPERATOR_ADDRESS_1,OPERATOR_ADDRESS_2,...,OPERATOR_ADDRESS_N>"
1616
exit 1
1717
fi
1818

@@ -39,19 +39,9 @@ if [ -z "$PRIVATE_KEY" ]; then
3939
exit 1
4040
fi
4141

42-
if [ "$#" -gt 1 ]; then
43-
OPERATORS=$(echo "$@" | sed 's/ /,/g') # separate the operators with a comma
44-
echo "Adding many operators to whitelist: $@"
45-
cast send \
46-
--rpc-url=$RPC_URL \
47-
--private-key=$PRIVATE_KEY \
48-
$REGISTRY_COORDINATOR 'add_multiple(address[])' \
49-
"[$OPERATORS]"
50-
else
51-
echo "Adding operator to whitelist: $OPERATOR_ADDRESS"
52-
cast send \
53-
--rpc-url=$RPC_URL \
54-
--private-key=$PRIVATE_KEY \
55-
$REGISTRY_COORDINATOR 'add(address)' \
56-
$OPERATOR_ADDRESS
57-
fi
42+
echo "Adding operators to whitelist: $@"
43+
cast send \
44+
--rpc-url=$RPC_URL \
45+
--private-key=$PRIVATE_KEY \
46+
$REGISTRY_COORDINATOR 'add_multiple(address[])' \
47+
"[$OPERATOR_ADDRESS]"

docs/0_internal/whitelist.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ To add only 1 Operator:
1717
make operator_whitelist OPERATOR_ADDRESS=<operator_address>
1818
```
1919

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

2626
### Removing an Operator
2727

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

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

4141
### Querying the state of an Operator
4242

0 commit comments

Comments
 (0)