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..b45be9f 100755 --- a/setup_wizard.sh +++ b/setup_wizard.sh @@ -186,4 +186,4 @@ echocol "Your node is ready! enter the following command to start it:" read -p "Press ENTER to continue..." foo docker-compose up -d echocol "✅ Node started successfully!" -echocol "" +echocol "" \ No newline at end of file