Skip to content

Commit 95ce6ed

Browse files
authored
update magicdrop cli for Abstract (me-foundation#171)
* abstract Signed-off-by: Adam Wolf <[email protected]> * fix Signed-off-by: Adam Wolf <[email protected]> * fix Signed-off-by: Adam Wolf <[email protected]> --------- Signed-off-by: Adam Wolf <[email protected]>
1 parent 5bf8b9b commit 95ce6ed

4 files changed

Lines changed: 56 additions & 14 deletions

File tree

cli/cmds/const

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ SUPPORTED_CHAINS=(
1010
"11155111:Sepolia"
1111
"56:BSC"
1212
"43114:Avalanche"
13+
"2741:Abstract"
1314
)
1415

1516
MAGIC_DROP_KEYSTORE="MAGIC_DROP_KEYSTORE"
@@ -22,10 +23,24 @@ LIMITBREAK_TRANSFER_VALIDATOR_V3="0x721C0078c2328597Ca70F5451ffF5A7B38D4E947"
2223
ICREATOR_TOKEN_INTERFACE_ID="0xad0d7f6c" # type(ICreatorToken).interfaceId
2324
TRUE_HEX="0x0000000000000000000000000000000000000000000000000000000000000001"
2425

26+
MAGIC_EDEN_DEFAULT_LIST_ID="1"
27+
# We use list 3 for Polygon because list 1 was already taken.
28+
MAGIC_EDEN_POLYGON_LIST_ID="3"
29+
2530
get_factory_address() {
26-
echo "0x000000009e44eBa131196847C685F20Cd4b68aC4"
31+
# abstract factory address
32+
if [ "$chain_id" == "2741" ]; then
33+
echo "0x4a08d3F6881c4843232EFdE05baCfb5eAaB35d19"
34+
else # default
35+
echo "0x000000009e44eBa131196847C685F20Cd4b68aC4"
36+
fi
2737
}
2838

2939
get_registry_address() {
30-
echo "0x00000000caF1E3978e291c5Fb53FeedB957eC146"
31-
}
40+
# abstract registry address
41+
if [ "$chain_id" == "2741" ]; then
42+
echo "0x9b60ad31F145ec7EE3c559153bB57928B65C0F87"
43+
else # default
44+
echo "0x00000000caF1E3978e291c5Fb53FeedB957eC146"
45+
fi
46+
}

cli/cmds/contract

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ DEFAULT_IMPL_ID="0"
66

77
get_impl_id() {
88
if [ "$token_standard" == "ERC721" ] && [ "$use_erc721c" == "true" ]; then
9-
echo "2" # ERC721C implementation ID
9+
if [ "$chain_id" == "2741" ]; then
10+
echo "3" # ERC721C implementation ID / abstract
11+
else
12+
echo "1" # ERC721C implementation ID / all other chains
13+
fi
1014
else
1115
echo $DEFAULT_IMPL_ID
1216
fi
@@ -53,6 +57,7 @@ deploy_contract() {
5357
"$standard_id" \
5458
"$SIGNER" \
5559
$impl_id \
60+
$(zksync_flag) \
5661
$password \
5762
$value \
5863
--json)
@@ -79,7 +84,7 @@ deploy_contract() {
7984
set_transfer_list
8085
fi
8186

82-
if [ $is_icreatortoken -eq 0 ] || [ "$token_standard" == "ERC1155" ]; then
87+
if [ $is_icreatortoken -eq 0 ]; then
8388
if gum confirm "Would you like to freeze the collection?" --default=true; then
8489
freeze_contract
8590
fi
@@ -105,7 +110,7 @@ supports_icreatortoken() {
105110
set_transfer_validator() {
106111
tf_address=$(get_transfer_validator_address $chain_id)
107112
echo "Setting transfer validator to $tf_address..."
108-
output=$(cast send $contract_address "setTransferValidator(address)" $tf_address $password --rpc-url "$RPC_URL" --json)
113+
output=$(cast send $contract_address "setTransferValidator(address)" $tf_address $password $(zksync_flag) --rpc-url "$RPC_URL" --json)
109114
print_transaction_hash $output
110115
echo "Transfer validator set."
111116
echo ""
@@ -114,7 +119,7 @@ set_transfer_validator() {
114119
set_transfer_list() {
115120
tf_list_id=$(get_transfer_validator_list_id $chain_id)
116121
echo "Setting transfer list to list ID $tf_list_id..."
117-
output=$(cast send $tf_address "applyListToCollection(address,uint120)" $contract_address $tf_list_id $password --rpc-url "$RPC_URL" --json)
122+
output=$(cast send $tf_address "applyListToCollection(address,uint120)" $contract_address $tf_list_id $password $(zksync_flag) --rpc-url "$RPC_URL" --json)
118123
print_transaction_hash $output
119124
echo "Transfer list set."
120125
echo ""
@@ -142,7 +147,7 @@ freeze_thaw_contract() {
142147
freeze_contract() {
143148
echo "Freezing contract... this will take a moment."
144149

145-
output=$(cast send $contract_address "setTransferable(bool)" false $password --rpc-url "$RPC_URL" --json)
150+
output=$(cast send $contract_address "setTransferable(bool)" false $password $(zksync_flag) --rpc-url "$RPC_URL" --json)
146151

147152
print_transaction_hash $output
148153
echo "Token transfers frozen."
@@ -152,7 +157,7 @@ freeze_contract() {
152157
thaw_contract() {
153158
echo "Thawing contract... this will take a moment."
154159

155-
output=$(cast send $contract_address "setTransferable(bool)" true $password --rpc-url "$RPC_URL" --json)
160+
output=$(cast send $contract_address "setTransferable(bool)" true $password $(zksync_flag) --rpc-url "$RPC_URL" --json)
156161

157162
print_transaction_hash $output
158163
echo "Token transfers thawed."
@@ -233,6 +238,7 @@ setup_contract() {
233238
"$royalty_receiver" \
234239
"$royalty_fee" \
235240
$password \
241+
$(zksync_flag) \
236242
--rpc-url "$RPC_URL" \
237243
--json)
238244

@@ -266,6 +272,7 @@ set_base_uri_contract() {
266272
$base_uri_selector \
267273
$base_uri \
268274
$password \
275+
$(zksync_flag) \
269276
--chain-id $chain_id \
270277
--rpc-url "$RPC_URL" \
271278
--json)
@@ -317,6 +324,7 @@ set_global_wallet_limit_contract() {
317324
"$global_wallet_limit_selector" \
318325
$token_id \
319326
"$global_wallet_limit" \
327+
$(zksync_flag) \
320328
$password \
321329
--rpc-url "$RPC_URL" \
322330
--json)
@@ -373,6 +381,7 @@ set_max_mintable_supply_contract() {
373381
$token_id \
374382
$max_mintable_supply \
375383
$password \
384+
$(zksync_flag) \
376385
--chain-id $chain_id \
377386
--rpc-url "$RPC_URL" \
378387
--json)
@@ -415,6 +424,7 @@ set_mintable_contract() {
415424
$set_mintable_selector \
416425
$mintable \
417426
$password \
427+
$(zksync_flag) \
418428
--chain-id $chain_id \
419429
--rpc-url "$RPC_URL" \
420430
--json)
@@ -468,6 +478,7 @@ set_stages_contract() {
468478
"$set_stages_selector" \
469479
"$stages_data" \
470480
$password \
481+
$(zksync_flag) \
471482
--rpc-url "$RPC_URL" \
472483
--json)
473484

@@ -504,6 +515,7 @@ set_cosigner_contract() {
504515
$set_cosigner_selector \
505516
$cosigner \
506517
$password \
518+
$(zksync_flag) \
507519
--chain-id $chain_id \
508520
--rpc-url "$RPC_URL" \
509521
--json)
@@ -541,6 +553,7 @@ set_timestamp_expiry_contract() {
541553
$timestamp_expiry_selector \
542554
$timestamp_expiry \
543555
$password \
556+
$(zksync_flag) \
544557
--chain-id $chain_id \
545558
--rpc-url "$RPC_URL" \
546559
--json)
@@ -590,6 +603,7 @@ transfer_ownership_contract() {
590603
$complete_ownership_handover_selector \
591604
$new_owner \
592605
$password \
606+
$(zksync_flag) \
593607
--chain-id $chain_id \
594608
--rpc-url "$RPC_URL" \
595609
--json)
@@ -622,6 +636,7 @@ set_token_uri_suffix_contract() {
622636
$token_uri_suffix_selector \
623637
$token_uri_suffix \
624638
$password \
639+
$(zksync_flag) \
625640
--chain-id $chain_id \
626641
--rpc-url "$RPC_URL" \
627642
--json)
@@ -660,6 +675,7 @@ set_uri_contract() {
660675
$set_uri_selector \
661676
$uri \
662677
$password \
678+
$(zksync_flag) \
663679
--chain-id $chain_id \
664680
--rpc-url "$RPC_URL" \
665681
--json)
@@ -705,6 +721,7 @@ set_royalties_contract() {
705721
$receiver \
706722
$fee_numerator \
707723
$password \
724+
$(zksync_flag) \
708725
--chain-id $chain_id \
709726
--rpc-url "$RPC_URL" \
710727
--json)
@@ -758,6 +775,7 @@ owner_mint_contract() {
758775
"$mint_selector" \
759776
$mint_args \
760777
$password \
778+
$(zksync_flag) \
761779
--rpc-url "$RPC_URL" \
762780
--json)
763781

@@ -815,6 +833,7 @@ add_authorized_minter_contract() {
815833
"$add_authorized_minter_selector" \
816834
$minter \
817835
$password \
836+
$(zksync_flag) \
818837
--chain-id $chain_id \
819838
--rpc-url "$RPC_URL" \
820839
--json)
@@ -847,6 +866,7 @@ remove_authorized_minter_contract() {
847866
"$remove_authorized_minter_selector" \
848867
$minter \
849868
$password \
869+
$(zksync_flag) \
850870
--chain-id $chain_id \
851871
--rpc-url "$RPC_URL" \
852872
--json)
@@ -883,6 +903,7 @@ set_cosigner_contract() {
883903
"$set_cosigner_selector" \
884904
$cosigner \
885905
$password \
906+
$(zksync_flag) \
886907
--chain-id $chain_id \
887908
--rpc-url "$RPC_URL" \
888909
--json)

cli/cmds/getters

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/usr/bin/env bash
22

3-
MAGIC_EDEN_DEFAULT_LIST_ID="1"
4-
# We use list 3 for Polygon because list 1 was already taken.
5-
MAGIC_EDEN_POLYGON_LIST_ID="3"
6-
73

84
get_numeric_input() {
95
local prompt="$1"

cli/cmds/utils

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ set_rpc_url() {
3030
1329) RPC_URL="https://evm-rpc.sei-apis.com" ;; # Sei
3131
33139) RPC_URL="https://rpc.apechain.com/http" ;; # ApeChain
3232
11155111) RPC_URL="https://ethereum-sepolia-rpc.publicnode.com" ;; # Sepolia
33+
2741) RPC_URL="https://api.mainnet.abs.xyz" ;; # Abstract
3334
*) echo "Unsupported chain id"; exit 1 ;;
3435
esac
3536

@@ -144,6 +145,7 @@ chain_id_to_symbol() {
144145
33139) echo "APE" ;;
145146
56) echo "BNB" ;;
146147
11155111) echo "SEP" ;;
148+
2741) echo "ETH" ;;
147149
*) echo "Unknown" ;;
148150
esac
149151
}
@@ -159,6 +161,7 @@ chain_id_to_explorer_url() {
159161
1329) echo "https://seitrace.com" ;;
160162
33139) echo "https://apescan.io" ;;
161163
11155111) echo "https://sepolia.etherscan.io" ;;
164+
2741) echo "https://abscan.org" ;;
162165
*) echo "Unknown" ;;
163166
esac
164167
}
@@ -188,4 +191,11 @@ get_standard_id() {
188191
is_unset_or_null() {
189192
local var="$1"
190193
[ -z "$var" ] || [ "$var" = "null" ]
191-
}
194+
}
195+
196+
zksync_flag() {
197+
# Abstract is a zksync chain
198+
if [ "$chain_id" == "2741" ]; then
199+
echo "--zksync"
200+
fi
201+
}

0 commit comments

Comments
 (0)