From 2032410f8013038d7f70cfc363ce19e47b8339c7 Mon Sep 17 00:00:00 2001 From: stubbsta Date: Fri, 1 Aug 2025 13:36:39 +0200 Subject: [PATCH] Remove test token address and minting procedures --- .env.example.rln | 2 +- register_rln.sh | 36 ++++++++++++------------------------ setup_wizard.sh | 20 ++++++++++---------- 3 files changed, 23 insertions(+), 35 deletions(-) diff --git a/.env.example.rln b/.env.example.rln index a9c71e5..998e639 100644 --- a/.env.example.rln +++ b/.env.example.rln @@ -6,7 +6,7 @@ ETH_TESTNET_ACCOUNT= # Address of the RLN Membership Token contract on Linea Sepolia used to pay for membership. -TOKEN_CONTRACT_ADDRESS=0x185A0015aC462a0aECb81beCc0497b649a64B9ea +TOKEN_CONTRACT_ADDRESS= # Private key of testnet where you have Linea Sepolia ETH that would be staked into RLN contract. # Note: make sure you don't use the '0x' prefix. diff --git a/register_rln.sh b/register_rln.sh index c48a365..1b33a42 100755 --- a/register_rln.sh +++ b/register_rln.sh @@ -17,7 +17,7 @@ if test -n "${ETH_CLIENT_ADDRESS}"; then exit 1 fi -# Ensure Foundry (cast & foundryup) is available for token mint/approve calls +# Ensure Foundry (cast & foundryup) is available for token approve calls if ! command -v cast >/dev/null 2>&1; then echo "Foundry toolkit (cast) not found. Installing Foundry..." curl -L https://foundry.paradigm.xyz | bash @@ -26,42 +26,30 @@ if ! command -v cast >/dev/null 2>&1; then foundryup fi -# default: do mint/approve -NEED_MINTING=1 +# default: do approve +NEED_APPROVAL=1 for arg in "$@"; do case "$arg" in - --no-mint) NEED_MINTING=0 ;; - --mint) NEED_MINTING=1 ;; + --no-approve) NEED_APPROVAL=0 ;; + --approve) NEED_APPROVAL=1 ;; esac done RLN_CONTRACT_ADDRESS=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6 -TOKEN_CONTRACT_ADDRESS=0x185A0015aC462a0aECb81beCc0497b649a64B9ea -TTT_AMOUNT_WEI=5000000000000000000 +TST_AMOUNT_WEI=5000000000000000000 -# Mint -if [ "$NEED_MINTING" = "1" ]; then - echo "\nMinting test token" - if ! cast send "$TOKEN_CONTRACT_ADDRESS" "mint(address,uint256)" \ - "$ETH_TESTNET_ACCOUNT" "$TTT_AMOUNT_WEI" \ +# Approve +if [ "$NEED_APPROVAL" = "1" ]; then + echo "Approve to spend TestStableToken" + if ! cast send "$TOKEN_CONTRACT_ADDRESS" "approve(address,uint256)" \ + "$RLN_CONTRACT_ADDRESS" "$TST_AMOUNT_WEI" \ --private-key "$ETH_TESTNET_KEY" \ --rpc-url "$RLN_RELAY_ETH_CLIENT_ADDRESS" then - echo " Mint transaction failed." + echo "Approve transaction failed." exit 1 fi -fi - -# Approve -echo "\nApprove to spend the test tokens" -if ! cast send "$TOKEN_CONTRACT_ADDRESS" "approve(address,uint256)" \ - "$RLN_CONTRACT_ADDRESS" "$TTT_AMOUNT_WEI" \ - --private-key "$ETH_TESTNET_KEY" \ - --rpc-url "$RLN_RELAY_ETH_CLIENT_ADDRESS" -then - echo "Approve transaction failed." - exit 1 fi docker run -v "$(pwd)/keystore":/keystore/:Z wakuorg/nwaku:v0.36.0 generateRlnKeystore \ diff --git a/setup_wizard.sh b/setup_wizard.sh index 1c4e5b9..8d7da18 100755 --- a/setup_wizard.sh +++ b/setup_wizard.sh @@ -8,7 +8,7 @@ echocol() } RLN_CONTRACT_ADDRESS=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6 -TOKEN_CONTRACT_ADDRESS=0x185A0015aC462a0aECb81beCc0497b649a64B9ea +TOKEN_CONTRACT_ADDRESS= REQUIRED_AMOUNT=5 check_eth_balance() { @@ -46,7 +46,7 @@ if [ -f keystore/keystore.json ]; then fi fi -# Ensure Foundry (cast & foundryup) is available for token mint/approve calls +# Ensure Foundry (cast & foundryup) is available for token approve calls if ! command -v cast >/dev/null 2>&1; then echocol "\n Foundry toolkit (cast) not found. Installing Foundry... \n" curl -L https://foundry.paradigm.xyz | bash @@ -152,7 +152,7 @@ STORAGE_SIZE=$STORAGE_SIZE POSTGRES_SHM=$POSTGRES_SHM" > ./.env echocol "" -echocol "Checking your TTT token balance..." +echocol "Checking your TST token balance..." USER_BALANCE_RAW=$(cast call $TOKEN_CONTRACT_ADDRESS "balanceOf(address)(uint256)" $ETH_TESTNET_ACCOUNT --rpc-url $RLN_RELAY_ETH_CLIENT_ADDRESS 2>/dev/null) USER_BALANCE=$(echo "$USER_BALANCE_RAW" | awk '{print $1}') USER_BALANCE=$(echo "$USER_BALANCE / 10^18" | bc) @@ -162,20 +162,20 @@ if [ -z "$USER_BALANCE" ]; then exit 1 fi -echocol "Your current TTT token balance is: $USER_BALANCE" +echocol "Your current TST token balance is: $USER_BALANCE" echocol "Required amount: $REQUIRED_AMOUNT" echocol "" -MINT_CHOICE="y" +APPROVE_CHOICE="y" if [ "$USER_BALANCE" -ge "$REQUIRED_AMOUNT" ]; then - echocol "You already have enough TTT tokens to register." - read -p "Do you want to mint more tokens? (y/N): " MINT_CHOICE + echocol "You already have enough TST tokens to register." + read -p "Do you want to approve more tokens? (y/N): " APPROVE_CHOICE fi -if [ "$MINT_CHOICE" = "y" ] || [ "$MINT_CHOICE" = "Y" ]; then - ./register_rln.sh --mint; +if [ "$APPROVE_CHOICE" = "y" ] || [ "$APPROVE_CHOICE" = "Y" ]; then + ./register_rln.sh --approve; else - ./register_rln.sh --no-mint; + ./register_rln.sh --no-approve; fi echocol ""