Last active
April 28, 2022 18:41
-
-
Save mnugumanova/e94823cebffbba044732bdb44f56e04b to your computer and use it in GitHub Desktop.
Script that withdraws commission and reward from the Regen network account and auto-delegates these tokens to the validator every 3 hours
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
echo "Enter your key password:" | |
read -s password | |
while true | |
do | |
echo "About to withdraw commission and reward" | |
echo "${password}" | xrncli tx distr withdraw-rewards <xrn:valoperAddress> --commission --from <key-name> --chain-id=$(cat ~/.xrnd/config/genesis.json | jq -r .chain_id) -y | |
sleep 60 | |
amount=$(xrncli query account <xrn:address> --chain-id=$(cat ~/.xrnd/config/genesis.json | jq -r .chain_id) -o json --indent | jq -r '.value.coins[1].amount') | |
if [[ $amount > 0 && $amount != "null" ]]; then | |
echo "About to stake ${amount} uTREEs" | |
echo "${password}" | xrncli tx staking delegate xrn:valoper1c934d8gjup8e680ljmp3jxfqc5vwh28zd24t7m ${amount}tree --chain-id=$(cat ~/.xrnd/config/genesis.json | jq -r .chain_id) --trust-node --from <key-name> --gas-adjustment 1.1 -y | |
fi | |
sleep 10800 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment