-
-
Save spac3unit/a4b33c047790147b93cf32ed66221fc8 to your computer and use it in GitHub Desktop.
massa auto buy roll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DELAY=300 #in secs - how often restart the script | |
ROLL_PRICE=100 | |
for (( ;; )); do | |
WALLET=$(massa-client wallet_info) | |
ADDRESS=$(echo -e $WALLET | grep -oP 'Address:\s*\K.*(?=\s+State)') | |
FINAL_BAL=$(echo -e $WALLET | grep -oP 'final balance:\s*\K.*(?=\s+candidate balance)') | |
CANDIDATE_BAL=$(echo -e $WALLET | grep -oP 'candidate balance:\s*\K.*(?=\s+locked balance)') | |
LOCKED_BAL=$(echo -e $WALLET | grep -oP 'locked balance:\s*\K.*(?=\s+final rolls)') | |
FINAL_ROLL=$(echo -e $WALLET | grep -oP 'final rolls:\s*\K.*(?=\s+candidate rolls)') | |
CANDIDATE_ROLL=$(echo -e $WALLET | grep -oP 'candidate rolls:\s*\K.*(?=\s+active rolls)') | |
ACTIVE_ROLL=$(echo -e $WALLET | grep -oP 'active rolls:\s*\K.*') | |
ROLL=$(bc -l <<<"scale=0; $FINAL_BAL/$ROLL_PRICE") | |
echo -e "================================== Wallet ==================================" | |
echo -e "[>] Address: ${ADDRESS}" | |
echo -e "================================= Balances =================================" | |
echo -e "[>] Final Balance: ${FINAL_BAL}" | |
echo -e "[>] Candidate Balance: ${CANDIDATE_BAL}" | |
echo -e "[>] Locked Balance: ${LOCKED_BAL}" | |
echo -e "================================== Rolls ===================================" | |
echo -e "[>] Final Roll: ${FINAL_ROLL}" | |
echo -e "[>] Candidate Roll: ${CANDIDATE_ROLL}" | |
echo -e "[>] Active Roll: ${ACTIVE_ROLL}" | |
if [ "$ROLL" -gt 0 ]; then | |
echo -e "================================= Success =================================" | |
echo -e "[+] Balance : ${FINAL_BAL}" | |
echo -e "[+] Buyable : ${ROLL}" | |
echo -e $(massa-client buy_rolls ${ADDRESS} ${ROLL} 0) | |
else | |
echo -e "================================= Failed! =================================" | |
echo -e "[x] You don't have enough coins to buy roll" | |
fi | |
echo -e "================================== Delay! ==================================" | |
for (( timer=${DELAY}; timer>0; timer-- )) | |
do | |
printf "[+] Sleep for ${RED}%02d${NC} sec\r" $timer | |
sleep 1 | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment