Created
July 23, 2021 10:55
-
-
Save atsiarenia/6bab84aa815c4156cc462f67e9d2eff8 to your computer and use it in GitHub Desktop.
Claiming, getting reward from delegation and delegating rewards for Rizon
This file contains 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 | |
GREEN_COLOR='\033[0;32m' | |
RED_COLOR='\033[0;31m' | |
WITHOU_COLOR='\033[0m' | |
DELEGATOR_ADDRESS='rizon1_BLA_BLA' | |
VALIDATOR_ADDRESS='rizonvaloper1_BLA_BLA' | |
PWD='YOUR_PASSWORD' | |
DELAY=3600 #in secs - how often restart the script | |
ACC_NAME=YOU_WALLET_WITHOUT_QUOTES #example: = ACC_NAME=wallet_qwwq_54 | |
NODE=http://localhost:26657 #change it only if you use another rpc port of your node | |
for (( ;; )); do | |
echo -e "Get reward from Delegation" | |
echo -e "${PWD}\ny\n" | rizond tx distribution withdraw-all-rewards --from ${ACC_NAME} --fees 20uatolo --chain-id groot-07 --yes | |
for (( timer=10; timer>0; timer-- )) | |
do | |
printf "* sleep for ${RED_COLOR}%02d${WITHOUT_COLOR} sec\r" $timer | |
sleep 1 | |
done | |
BAL=$(rizond query bank balances ${DELEGATOR_ADDRESS} --node ${NODE}); | |
# BAL=$(($BAL -100000)) | |
echo -e "BALANCE: ${GREEN_COLOR}${BAL}${WITHOU_COLOR} uatolo\n" | |
echo -e "Claim rewards\n" | |
echo -e "${PWD}\n${PWD}\n" | rizond tx distribution withdraw-rewards ${VALIDATOR_ADDRESS} --chain-id groot-07 --from ${ACC_NAME} --node ${NODE} --commission -y --fees 5000uatolo | |
for (( timer=10; timer>0; timer-- )) | |
do | |
printf "* sleep for ${RED_COLOR}%02d${WITHOU_COLOR} sec\r" $timer | |
sleep 1 | |
done | |
BAL=$(rizond query bank balances ${DELEGATOR_ADDRESS} --node ${NODE} -o json | jq -r '.balances | .[].amount'); | |
BAL=$(($BAL -100000)) | |
echo -e "BALANCE: ${GREEN_COLOR}${BAL}${WITHOU_COLOR} uatolo\n" | |
echo -e "Stake ALL 11111\n" | |
echo -e "${PWD}\n${PWD}\n" | rizond tx staking delegate ${VALIDATOR_ADDRESS} ${BAL}uatolo --chain-id groot-07 --from ${ACC_NAME} --node ${NODE} -y --fees 5000uatolo | |
for (( timer=${DELAY}; timer>0; timer-- )) | |
do | |
printf "* sleep for ${RED_COLOR}%02d${WITHOU_COLOR} sec\r" $timer | |
sleep 1 | |
done | |
done |
If You have some problems with the script try to uncomment String 22 - # BAL=$(($BAL -100000))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +x auto_stake_rizon.sh
screen -S magic_stake
bash auto_stake_rizon.sh