diff --git a/config.sh b/config.sh new file mode 100755 index 00000000..2a2a75c0 --- /dev/null +++ b/config.sh @@ -0,0 +1,93 @@ +# Function to print usage and exit +usage() { + echo "Usage: $0 -c " + echo " -c: Specify the network (ronin-testnet or ronin-mainnet)" + exit 1 +} + +loadConfig() { + local network="$1" + + if [ "$network" == 'ronin-mainnet' ]; then + RPC=https://api.roninchain.com/rpc + EXPLORER=https://app.roninchain.com/tx + FROM=0x968D0Cd7343f711216817E617d3f92a23dC91c07 + + RESOLVER=0xadb077d236d9E81fB24b96AE9cb8089aB9942d48 + CONTROLLER=0x662852853614cbBb5D04BF2E29955b97E3C50B69 + RNS_UNIFIED=0xf0c99c9677EDa0D13291C093b27E6512E4ACdF83 + RNS_AUCTION=0xD55e6d80aeA1FF4650BC952C1653ab3CF1b940A9 + RNS_DOMAIN_PRICE=0x2BdC555A87Db9207E5d175f0c12B237736181675 + OWNED_MULTICALLER=0x8975923D01132bEB6c412F827f63D44712726E13 + ERC721_BATCH_TRANSFER=0x2368dfed532842db89b470fde9fd584d48d4f644 + + CURRENT_GAS_PRICE=$(cast gas-price --rpc-url $RPC) + CURRENT_NONCE=$(cast nonce --rpc-url $RPC $FROM) + + PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") + else + RPC=https://saigon-archive.roninchain.com/rpc + FROM=0x057B3862d021f8931c96f789f2A7c4d3eA3C665f + EXPLORER=https://saigon-app.roninchain.com/tx + + RESOLVER=0x803c459dCB8771e5354D1fC567Ecc6885A9fd5E6 + CONTROLLER=0x512699B52ac2dC2b2aD505d9f29DcDad078FA799 + RNS_UNIFIED=0x67C409DaB0EE741A1B1Be874bd1333234cfDBF44 + RNS_AUCTION=0xb962eddeD164f55D136E491a3022246815e1B5A8 + RNS_DOMAIN_PRICE=0x51cAF51678f469e9DD4c878a7b0ceBEbbd4A4AB5 + OWNED_MULTICALLER=0x8975923D01132bEB6c412F827f63D44712726E13 + ERC721_BATCH_TRANSFER=0x2e889348bd37f192063bfec8ff39bd3635949e20 + + CURRENT_GAS_PRICE=$(cast gas-price --rpc-url $RPC) + CURRENT_NONCE=$(cast nonce --rpc-url $RPC $FROM) + + PK=$(op read "op://SC Vault/Testnet Admin/private key") + fi +} + +estimate() { + local target="$1" + local args="$2" + + gas=$(cast e --from $FROM --rpc-url $RPC $target $args) + echo estimated gas: $gas +} + +broadcast() { + local gasPrice="$1" + local nonce="$2" + local target="$3" + local args="$4" + + txHash=$(cast s --from $FROM --legacy --gas-price $gasPrice --async --confirmations 0 --nonce $nonce --private-key $PK --rpc-url $RPC $target $args) + + echo $EXPLORER/$txHash +} + +# Parse command-line options +if [ "$#" -eq 0 ]; then + usage +fi + +# Parse command-line options +while getopts "c:" opt; do + case $opt in + c) + case "$OPTARG" in + ronin-testnet) + loadConfig "ronin-testnet" + ;; + ronin-mainnet) + loadConfig "ronin-mainnet" + ;; + *) + echo "Unknown network specified: $OPTARG" + usage + ;; + esac + ;; + *) + usage + ;; + esac +done diff --git a/script/20231110-listing/claim-auction.sh b/script/20231110-listing/claim-auction.sh deleted file mode 100755 index c89f42a2..00000000 --- a/script/20231110-listing/claim-auction.sh +++ /dev/null @@ -1,22 +0,0 @@ -# Define an array of indices [0, 1, 2] -PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") -set -ex - -# Loop through each index -for index in {0..0}; do - # Read the JSON file - jsonData=$(cat "../RNS-names/finalfinalfinalauction.json") - - # Parse JSON data - labelsString=$( - node -e ' - const labels = JSON.parse(process.argv[1]).auctionNames.map(auction => auction.label); - console.log(labels.join(",")); - ' "$jsonData" - ) - - echo "Labels for AuctionNames${index}: $labelsString" - - # Execute shell command - cast s --legacy --from 0x0f68edbe14c8f68481771016d7e2871d6a35de11 --rpc-url https://api-partner.roninchain.com/rpc 0xD55e6d80aeA1FF4650BC952C1653ab3CF1b940A9 "bulkRegister(string[])" "[$labelsString]" --private-key $PK -done diff --git a/script/20231110-listing/place-bid.sh b/script/20231110-listing/place-bid.sh deleted file mode 100755 index b963f682..00000000 --- a/script/20231110-listing/place-bid.sh +++ /dev/null @@ -1,56 +0,0 @@ -RPC=https://api.roninchain.com/rpc -FROM=0x0f68edbe14c8f68481771016d7e2871d6a35de11 -TARGET=0xd55e6d80aea1ff4650bc952c1653ab3cf1b940a9 -CURRENT_GAS_PRICE=$(cast gas-price --rpc-url $RPC) -CURRENT_NONCE=$(cast nonce --rpc-url $RPC $FROM) -PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") -echo current nonce $CURRENT_NONCE -gasPrice=$((CURRENT_GAS_PRICE + 1000000000)) -# Define an array of indices [0, 1, 2] -indices=(1 2) - -namehashResults=() -# Read the JSON file -jsonData=$(cat "../RNS-names/GTMGamingAuctionNames.json") - -# Parse JSON data -labels=$( - node -e ' - const labels = JSON.parse(process.argv[1]).auctionNames.map(auction => auction.label + ".ron"); - labels.forEach(v => console.log(v)) - ' "$jsonData" -) - -# Loop through each label and call cast namehash -for label in ${labels}; do - result=$(cast namehash "$label") - echo "Label: $label, Namehash: $result" - namehashResults+=($result) -done - -index=0 -# Loop through each index -for id in "${namehashResults[@]}"; do - # Increment the index - ((index++)) - ( - - nextNonce=$((CURRENT_NONCE + index - 1)) - echo Nonce: $nextNonce - - # fee=$(cast e --from $FROM --rpc-url $RPC $TARGET "placeBid(uint256)" "$id") - # echo fee: $fee - - # TO-DO: remove --value - txHash=$(cast s --gas-price $gasPrice --value 0 --async --confirmations 0 --nonce $nextNonce --legacy --from $FROM --private-key $PK --rpc-url $RPC $TARGET "placeBid(uint256)" "$id") - - echo https://app.roninchain.com/tx/$txHash - ) & - - # Check if index is a multiple of 100, then wait - if [ $((index % 50)) -eq 0 ]; then - wait - fi -done - -wait diff --git a/script/20231110-listing/set-protected.sh b/script/20231110-listing/set-protected.sh deleted file mode 100755 index 27861e92..00000000 --- a/script/20231110-listing/set-protected.sh +++ /dev/null @@ -1,46 +0,0 @@ -# Define an array of indices [0, 1, 2] -indices=(0) - -PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") -# Declare an array to store results -namehashResults=() - -# Loop through each index -for index in "${indices[@]}"; do - # Read the JSON file - jsonData=$(cat "../RNS-names/removeProtectedNames.json") - echo $jsonData - - # Parse JSON data - labels=$( - node -e ' - const labels = JSON.parse(process.argv[1]).reservedNames.map(protected => protected.label + ".ron"); - labels.forEach(v => console.log(v)) - ' "$jsonData" - ) - - echo "Labels for ProtectedNames${index}: $labels" - - # Loop through each label and call cast namehash - for label in ${labels}; do - result=$(cast namehash "$label") - echo "Label: $label, Namehash: $result" - namehashResults+=($result) - done - - for res in "${namehashResults[@]}"; do - echo $res - done - - # Join array elements with "," - joinedString=$( - IFS=, - echo "${namehashResults[*]}" - ) - - # Print the result - echo "Joined String: $joinedString" - - # Execute shell command - cast s --legacy --private-key $PK --rpc-url https://api-partner.roninchain.com/rpc 0x67C409DaB0EE741A1B1Be874bd1333234cfDBF44 "bulkSetProtected(uint256[],bool)" "[$joinedString]" false -done diff --git a/script/20231110-listing/whitelist-protected.sh b/script/20231110-listing/whitelist-protected.sh deleted file mode 100755 index e91743aa..00000000 --- a/script/20231110-listing/whitelist-protected.sh +++ /dev/null @@ -1,53 +0,0 @@ -# Define an array of indices [0, 1, 2] -indices=(0) - -# Declare an array to store results -namehashResults=() - -# Loop through each index -for index in "${indices[@]}"; do - # Read the JSON file - jsonData=$(cat "script/20231110-listing/data/AddressProtectedNames${index}.json") - - # Parse JSON data - labels=$( - node -e ' - const labels = JSON.parse(process.argv[1]).protectedNames.map(protected => protected.label + ".ron"); - labels.forEach(v => console.log(v)) - ' "$jsonData" - ) - - owners=$( - node -e ' - const owners = JSON.parse(process.argv[1]).protectedNames.map(protected => protected.address); - console.log(owners.join(",")); - ' "$jsonData" - ) - - echo "Labels for ProtectedNames${index}: $labels" - echo "Whitelisted owners for ProtectedNames${index}: $owners" - - # Loop through each label and call cast namehash - for label in ${labels}; do - result=$(cast namehash "$label") - echo "Label: $label, Namehash: $result" - namehashResults+=($result) - done - - for res in "${namehashResults[@]}"; do - echo $res - done - - # Join array elements with "," - ids=$( - IFS=, - echo "${namehashResults[*]}" - ) - - # Print the result - echo "Ids String: $ids" - echo "Owners String: $owners" - - # Execute shell command - cast e --from 0x0f68edbe14c8f68481771016d7e2871d6a35de11 --rpc-url https://api-partner.roninchain.com/rpc 0x662852853614cbBb5D04BF2E29955b97E3C50B69 "bulkWhitelistProtectedNames(uint256[],address[],bool)" "[$ids]" "[$owners]" true -done diff --git a/script/20231110-listing/batch-transfer.sh b/script/operations/batch-transfer.sh similarity index 58% rename from script/20231110-listing/batch-transfer.sh rename to script/operations/batch-transfer.sh index f13893d3..2526b874 100755 --- a/script/20231110-listing/batch-transfer.sh +++ b/script/operations/batch-transfer.sh @@ -1,19 +1,13 @@ -set -ex +source config.sh -FROM=0x0f68edbe14c8f68481771016d7e2871d6a35de11 -RPC=https://api.roninchain.com/rpc -TARGET=0x2368dfed532842db89b470fde9fd584d48d4f644 -CURRENT_GAS_PRICE=$(cast gas-price --rpc-url $RPC) -CURRENT_NONCE=$(cast nonce --rpc-url $RPC $FROM) -PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") - -gasPrice=$((CURRENT_GAS_PRICE + 1000000000)) # Define an array of indices [0, 1, 2] - indices=(0) # Loop through each index for index in "${indices[@]}"; do ( + nextNonce=$((CURRENT_NONCE + index)) + + # Declare an array to store results namehashResults=() # Read the JSON file jsonData=$(cat "../RNS-names/AirDropNames.json") @@ -32,7 +26,6 @@ for index in "${indices[@]}"; do ' "$jsonData" ) - # Loop through each label and call cast namehash for label in ${labels}; do result=$(cast namehash "$label") @@ -43,21 +36,13 @@ for index in "${indices[@]}"; do # Join array elements with "," joinedString=$(IFS=, echo "${labels[*]}") - nextNonce=$((CURRENT_NONCE + index)) - # Join array elements with "," joinedString=$( IFS=, echo "${namehashResults[*]}" ) - echo Nonce: $nextNonce - echo addresses $addresses - echo "Joined String: $joinedString" - - # cast call --trace --from $FROM --rpc-url $RPC $TARGET "safeBatchTransfer(address,uint256[],address[])" 0x67C409DaB0EE741A1B1Be874bd1333234cfDBF44 "[$joinedString]" "[$addresses]" - txHash=$(cast s --gas-price $gasPrice --async --confirmations 0 --nonce $nextNonce --legacy --private-key $PK --rpc-url $RPC $TARGET "safeBatchTransfer(address,uint256[],address[])" 0x67C409DaB0EE741A1B1Be874bd1333234cfDBF44 "[$joinedString]" "[$addresses]" ) - echo https://app.roninchain.com/tx/$txHash + broadcast $CURRENT_GAS_PRICE $nextNonce $ERC721_BATCH_TRANSFER $(cast calldata "safeBatchTransfer(address,uint256[],address[])" $RNS_UNIFIED "[$joinedString]" "[$addresses]") ) & # Check if index is a multiple of 100, then wait diff --git a/script/20231110-listing/bulk-claim.sh b/script/operations/bulk-claim.sh similarity index 62% rename from script/20231110-listing/bulk-claim.sh rename to script/operations/bulk-claim.sh index 7d44b3bb..d212c044 100755 --- a/script/20231110-listing/bulk-claim.sh +++ b/script/operations/bulk-claim.sh @@ -1,17 +1,13 @@ -set -ex -FROM=0x0f68edbe14c8f68481771016d7e2871d6a35de11 -RPC=https://api.roninchain.com/rpc -TARGET=0xd55e6d80aea1ff4650bc952c1653ab3cf1b940a9 -CURRENT_GAS_PRICE=$(cast gas-price --rpc-url $RPC) -CURRENT_NONCE=$(cast nonce --rpc-url $RPC $FROM) -PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") +source config.sh -gasPrice=$((CURRENT_GAS_PRICE + 1000000000)) # Define an array of indices [0, 1, 2] indices=(0) # Loop through each index for index in "${indices[@]}"; do ( + nextNonce=$((CURRENT_NONCE + index)) + + # Declare an array to store results namehashResults=() # Read the JSON file jsonData=$(cat "../RNS-names/finalReservedNames.json") @@ -43,16 +39,7 @@ for index in "${indices[@]}"; do echo "${namehashResults[*]}" ) - auctionId=$(echo "$jsonData" | jq -r '.auctionId') - - nextNonce=$((CURRENT_NONCE + index)) - echo Nonce: $nextNonce - - echo auctionId $auctionId - echo startingPrices $startingPrices - - txHash=$(cast s --gas-price $gasPrice --async --confirmations 0 --nonce $nextNonce --legacy --private-key $PK --rpc-url $RPC $TARGET "bulkClaimBidNames(uint256[])" "[$joinedString]" ) - echo https://app.roninchain.com/tx/$txHash + broadcast $CURRENT_GAS_PRICE $nextNonce $RNS_AUCTION $(cast calldata "bulkClaimBidNames(uint256[])" "[$joinedString]") ) & # Check if index is a multiple of 100, then wait diff --git a/script/operations/claim-auction.sh b/script/operations/claim-auction.sh new file mode 100755 index 00000000..1698ab9d --- /dev/null +++ b/script/operations/claim-auction.sh @@ -0,0 +1,30 @@ +source config.sh + +# Loop through each index +for index in {0..0}; do + ( + nextNonce=$((CURRENT_NONCE + index)) + + # Read the JSON file + jsonData=$(cat "../RNS-names/finalfinalfinalauction.json") + + # Parse JSON data + labelsString=$( + node -e ' + const labels = JSON.parse(process.argv[1]).auctionNames.map(auction => auction.label); + console.log(labels.join(",")); + ' "$jsonData" + ) + + echo "Labels for AuctionNames${index}: $labelsString" + + broadcast $CURRENT_GAS_PRICE $nextNonce $RNS_AUCTION $(cast calldata "bulkRegister(string[])" "[$labelsString]") + ) & + + # Check if index is a multiple of 100, then wait + if [ $((index % 50)) -eq 0 ]; then + wait + fi +done + +wait diff --git a/script/20231110-listing/list-auction.sh b/script/operations/list-auction.sh similarity index 59% rename from script/20231110-listing/list-auction.sh rename to script/operations/list-auction.sh index d8e6d581..5f3ead74 100755 --- a/script/20231110-listing/list-auction.sh +++ b/script/operations/list-auction.sh @@ -1,17 +1,11 @@ -set -ex -FROM=0x0f68edbe14c8f68481771016d7e2871d6a35de11 -RPC=https://api-partner.roninchain.com/rpc -TARGET=0xd55e6d80aea1ff4650bc952c1653ab3cf1b940a9 -CURRENT_GAS_PRICE=$(cast gas-price --rpc-url $RPC) -CURRENT_NONCE=$(cast nonce --rpc-url $RPC $FROM) -PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") +source config.sh -gasPrice=$((CURRENT_GAS_PRICE + 1000000000)) -# Define an array of indices [0, 1, 2] -# indices=(0) # Loop through each index for index in {0..0}; do ( + nextNonce=$((CURRENT_NONCE + index)) + + # Declare an array to store results namehashResults=() # Read the JSON file jsonData=$(cat "../RNS-names/AuctionTest.json") @@ -45,17 +39,10 @@ for index in {0..0}; do auctionId=$(echo "$jsonData" | jq -r '.auctionId') - nextNonce=$((CURRENT_NONCE + index)) - echo Nonce: $nextNonce - echo auctionId $auctionId echo startingPrices $startingPrices - # fee=$(cast e --from $FROM --rpc-url $RPC $TARGET "listNamesForAuction(bytes32,uint256[],uint256[])" "$auctionId" "[$joinedString]" "[$startingPrices]") - # echo fee: $fee - - txHash=$(cast s --gas-price $gasPrice --async --confirmations 0 --nonce $nextNonce --legacy --from $FROM --private-key $PK --rpc-url $RPC $TARGET "listNamesForAuction(bytes32,uint256[],uint256[])" "$auctionId" "[$joinedString]" "[$startingPrices]") - echo https://app.roninchain.com/tx/$txHash + broadcast $CURRENT_GAS_PRICE $nextNonce $RNS_AUCTION $(cast calldata "listNamesForAuction(bytes32,uint256[],uint256[])" "$auctionId" "[$joinedString]" "[$startingPrices]") ) & # Check if index is a multiple of 100, then wait diff --git a/script/20231110-listing/mint-reseved-names.sh b/script/operations/mint-reseved-names.sh similarity index 53% rename from script/20231110-listing/mint-reseved-names.sh rename to script/operations/mint-reseved-names.sh index 70e53d71..d085195c 100755 --- a/script/20231110-listing/mint-reseved-names.sh +++ b/script/operations/mint-reseved-names.sh @@ -1,23 +1,16 @@ -set -ex -FROM=0x0f68edbe14c8f68481771016d7e2871d6a35de11 -RPC=https://api.roninchain.com/rpc -TARGET=0x8975923D01132bEB6c412F827f63D44712726E13 -CURRENT_GAS_PRICE=$(cast gas-price --rpc-url $RPC) -CURRENT_NONCE=$(cast nonce --rpc-url $RPC $FROM) -PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") - -gasPrice=$((CURRENT_GAS_PRICE + 1000000000)) -# Define an array of indices [0, 1, 2] +source config.sh -RNS=0x67C409DaB0EE741A1B1Be874bd1333234cfDBF44 RON_ID=84316718148691062097763301062091587921872078571554862844431317764698029807240 -RESOLVER=0xadb077d236d9E81fB24b96AE9cb8089aB9942d48 DURATION=31536000 +# Define an array of indices [0, 1, 2] indices=(0) # Loop through each index for index in "${indices[@]}"; do ( + nextNonce=$((CURRENT_NONCE + index)) + + # Declare an array to store results namehashResults=() # Read the JSON file jsonData=$(cat "../RNS-names/finalfinalReservedNames.json") @@ -36,22 +29,15 @@ for index in "${indices[@]}"; do ' "$jsonData" ) - - # Join array elements with "," joinedString=$(IFS=, echo "${labels[*]}") auctionId=$(echo "$jsonData" | jq -r '.auctionId') - nextNonce=$((CURRENT_NONCE + index)) - echo Nonce: $nextNonce - echo auctionId $auctionId echo addresses $addresses - # cast e --from $FROM --rpc-url $RPC $TARGET "multiMint(address,uint256,address,uint64,address[],string[])" $RNS $RON_ID $RESOLVER $DURATION "[$(IFS=, echo "${addresses[*]}")]" "[$(IFS=, echo "${labels[*]}")]" - txHash=$(cast s --gas-price $gasPrice --async --confirmations 0 --nonce $nextNonce --legacy --private-key $PK --rpc-url $RPC $TARGET "multiMint(address,uint256,address,uint64,address[],string[])" $RNS $RON_ID $RESOLVER $DURATION "[$(IFS=, echo "${addresses[*]}")]" "[$(IFS=, echo "${labels[*]}")]" ) - echo https://app.roninchain.com/tx/$txHash + broadcast $CURRENT_GAS_PRICE $nextNonce $OWNED_MULTICALLER $(cast calldata "multiMint(address,uint256,address,uint64,address[],string[])" $RNS_UNIFIED $RON_ID $RESOLVER $DURATION "[$(IFS=, echo "${addresses[*]}")]" "[$(IFS=, echo "${labels[*]}")]") ) & # Check if index is a multiple of 100, then wait diff --git a/script/20231110-listing/override-fee.sh b/script/operations/override-fee.sh similarity index 63% rename from script/20231110-listing/override-fee.sh rename to script/operations/override-fee.sh index 69546148..85711137 100755 --- a/script/20231110-listing/override-fee.sh +++ b/script/operations/override-fee.sh @@ -1,10 +1,4 @@ -RPC=https://api.roninchain.com/rpc -FROM=0x0f68edbe14c8f68481771016d7e2871d6a35de11 -TARGET=0x2BdC555A87Db9207E5d175f0c12B237736181675 -CURRENT_GAS_PRICE=$(cast gas-price --rpc-url $RPC) -CURRENT_NONCE=$(cast nonce --rpc-url $RPC $FROM) -PK=$(op read "op://Private/Ronin Mainnet Deployer/private key") -TX_EXPLORER=https://app.roninchain.com/tx/ +source config.sh start=0 end=0 @@ -13,7 +7,8 @@ for index in $(seq $start $end); do ( # Declare an array to store results nextNonce=$((CURRENT_NONCE + index - start)) - echo Nonce: $nextNonce + + # Declare an array to store results labelhashResults=() # Read the JSON file jsonData=$(cat "../RNS-names/FeeProtectedNames10.json") @@ -51,12 +46,7 @@ for index in $(seq $start $end); do echo "${labelhashResults[*]}" ) - # gas=$(cast e --from $FROM --rpc-url $RPC $TARGET "bulkOverrideRenewalFees(bytes32[],uint256[])" "[$lbHash]" "[$fees]") - # echo gas $gas - - # Execute shell command - txHash=$(cast s --private-key $PK --nonce $nextNonce --async --confirmations 0 --legacy --rpc-url $RPC $TARGET "bulkOverrideRenewalFees(bytes32[],uint256[])" "[$lbHash]" "[$fees]") - echo ${TX_EXPLORER}${txHash} + broadcast $CURRENT_GAS_PRICE $nextNonce $RNS_DOMAIN_PRICE $(cast calldata "bulkOverrideRenewalFees(bytes32[],uint256[])" "[$lbHash]" "[$fees]") ) & done diff --git a/script/operations/place-bid.sh b/script/operations/place-bid.sh new file mode 100755 index 00000000..0735fd9c --- /dev/null +++ b/script/operations/place-bid.sh @@ -0,0 +1,41 @@ +source config.sh + +# Define an array of indices [0, 1, 2] +indices=(1 2) +namehashResults=() +# Read the JSON file +jsonData=$(cat "../RNS-names/GTMGamingAuctionNames.json") + +# Parse JSON data +labels=$( + node -e ' + const labels = JSON.parse(process.argv[1]).auctionNames.map(auction => auction.label + ".ron"); + labels.forEach(v => console.log(v)) + ' "$jsonData" +) + +# Loop through each label and call cast namehash +for label in ${labels}; do + result=$(cast namehash "$label") + echo "Label: $label, Namehash: $result" + namehashResults+=($result) +done + +index=0 +# Loop through each index +for id in "${namehashResults[@]}"; do + ( + nextNonce=$((CURRENT_NONCE + index)) + broadcast $CURRENT_GAS_PRICE $nextNonce $RNS_AUCTION $(cast calldata "placeBid(uint256)" "$id") + ) & + + # Increment the index + ((index++)) + + # Check if index is a multiple of 100, then wait + if [ $((index % 50)) -eq 0 ]; then + wait + fi +done + +wait diff --git a/script/operations/set-protected.sh b/script/operations/set-protected.sh new file mode 100755 index 00000000..7138fb57 --- /dev/null +++ b/script/operations/set-protected.sh @@ -0,0 +1,55 @@ +source config.sh + +# Define an array of indices [0, 1, 2] +indices=(0) +# Loop through each index +for index in "${indices[@]}"; do + ( + nextNonce=$((CURRENT_NONCE + index)) + + # Declare an array to store results + namehashResults=() + # Read the JSON file + jsonData=$(cat "../RNS-names/removeProtectedNames.json") + echo $jsonData + + # Parse JSON data + labels=$( + node -e ' + const labels = JSON.parse(process.argv[1]).reservedNames.map(protected => protected.label + ".ron"); + labels.forEach(v => console.log(v)) + ' "$jsonData" + ) + + echo "Labels for ProtectedNames${index}: $labels" + + # Loop through each label and call cast namehash + for label in ${labels}; do + result=$(cast namehash "$label") + echo "Label: $label, Namehash: $result" + namehashResults+=($result) + done + + for res in "${namehashResults[@]}"; do + echo $res + done + + # Join array elements with "," + joinedString=$( + IFS=, + echo "${namehashResults[*]}" + ) + + # Print the result + echo "Joined String: $joinedString" + + broadcast $CURRENT_GAS_PRICE $nextNonce $RNS_UNIFIED $(cast calldata "bulkSetProtected(uint256[],bool)" "[$joinedString]" false) + ) & + + # Check if index is a multiple of 100, then wait + if [ $((index % 50)) -eq 0 ]; then + wait + fi +done + +wait diff --git a/script/operations/whitelist-protected.sh b/script/operations/whitelist-protected.sh new file mode 100755 index 00000000..0e4ab4f7 --- /dev/null +++ b/script/operations/whitelist-protected.sh @@ -0,0 +1,64 @@ +source config.sh + +# Define an array of indices [0, 1, 2] +indices=(0) +# Loop through each index +for index in "${indices[@]}"; do + ( + nextNonce=$((CURRENT_NONCE + index)) + + # Declare an array to store results + namehashResults=() + + # Read the JSON file + jsonData=$(cat "script/20231110-listing/data/AddressProtectedNames${index}.json") + + # Parse JSON data + labels=$( + node -e ' + const labels = JSON.parse(process.argv[1]).protectedNames.map(protected => protected.label + ".ron"); + labels.forEach(v => console.log(v)) + ' "$jsonData" + ) + + owners=$( + node -e ' + const owners = JSON.parse(process.argv[1]).protectedNames.map(protected => protected.address); + console.log(owners.join(",")); + ' "$jsonData" + ) + + echo "Labels for ProtectedNames${index}: $labels" + echo "Whitelisted owners for ProtectedNames${index}: $owners" + + # Loop through each label and call cast namehash + for label in ${labels}; do + result=$(cast namehash "$label") + echo "Label: $label, Namehash: $result" + namehashResults+=($result) + done + + for res in "${namehashResults[@]}"; do + echo $res + done + + # Join array elements with "," + ids=$( + IFS=, + echo "${namehashResults[*]}" + ) + + # Print the result + echo "Ids String: $ids" + echo "Owners String: $owners" + + broadcast $CURRENT_GAS_PRICE $nextNonce $CONTROLLER $(cast calldata "bulkWhitelistProtectedNames(uint256[],address[],bool)" "[$ids]" "[$owners]" true) + ) & + + # Check if index is a multiple of 100, then wait + if [ $((index % 50)) -eq 0 ]; then + wait + fi +done + +wait