Created
November 20, 2021 00:17
-
-
Save doma2k/78d2dd8c54f5fa7d472d48688852429b to your computer and use it in GitHub Desktop.
Asset-Mantle Auto-delegation Script
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
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
NC='\033[0m' # No Color | |
DELEGATOR=xxxxxxxxx #account address | |
VALIDATOR=xxxxxxx #validator address | |
PASWD=xxxxxx #account pass | |
DELAY=3600 #in secs - how often restart the script | |
ACC_NAME=xxxxxxxxxx #account name | |
for (( ;; )); do | |
BAL=$(assetClient query account ${DELEGATOR}); | |
echo -e "BALANCE: ${GREEN}${BAL}${NC} umantle\n" | |
echo -e "Claim rewards\n" | |
echo -e "${PASWD}\n${PASWD}\n" | assetClient tx distribution withdraw-rewards ${VALIDATOR} --chain-id test-mantle-1 --from ${ACC_NAME} --commission -y --fees 1000umantle | |
for (( timer=10; timer>0; timer-- )) | |
do | |
printf "* sleep for ${RED}%02d${NC} sec\r" $timer | |
sleep 1 | |
done | |
BAL=$(assetClient query account ${DELEGATOR} -o json | jq -r '.value.coins | .[] | .amount'); | |
bal=$((${BAL} - 1000)) | |
echo -e "BALANCE: ${GREEN}${BAL}${NC} umantle\n" | |
echo -e "Stake ALL\n" | |
echo -e "${PASWD}\n${PASWD}\n" | assetClient tx staking delegate ${VALIDATOR} ${bal}umantle --chain-id test-mantle-1 --from ${ACC_NAME} -y --fees 1000umantle | |
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