Skip to content

Instantly share code, notes, and snippets.

@gbuchukuri
Forked from mnugumanova/Regen-autodelegate.sh
Last active April 28, 2022 18:47
Show Gist options
  • Save gbuchukuri/70065cdb5e94e1e91e35d38da725c485 to your computer and use it in GitHub Desktop.
Save gbuchukuri/70065cdb5e94e1e91e35d38da725c485 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
echo "Enter your key password:"
read -s password
while true
do
echo "About to withdraw commission and reward"
echo "${password}" | defundd tx distribution withdraw-all-rewards --from w1 --gas auto -y
sleep 20
amount=$(defundd q bank balances defund1sq70esujl9swtjrk9hxts990uwgxgavk2lyfpv
if [[ $amount > 0 && $amount != "null" ]]; then
echo "About to stake ${amount} ufetfs"
echo "${password}" | defundd tx staking delegate defundvaloper1sq70esujl9swtjrk9hxts990uwgxgavkrhld8w ${amount}ufetf --from w1 --gas auto -y
fi
sleep 120
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment