Skip to content

Instantly share code, notes, and snippets.

@jjangg96
Created May 14, 2021 13:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjangg96/c50c98e37e163c10eb9d8da9ffd88011 to your computer and use it in GitHub Desktop.
Save jjangg96/c50c98e37e163c10eb9d8da9ffd88011 to your computer and use it in GitHub Desktop.
Increase your voting power automatically.
If you want to increase your voting power, you have to get a reward and delegate it to your validator.
I share scripts that use `expect` and TCL script code.
[reward.exp]
#!/usr/bin/expect
spawn ag-cosmos-helper tx distribution withdraw-rewards {your validator} --from {your key} --commission --chain-id agorictest-12 --broadcast-mode block -y
expect {
"Enter keyring passphrase:" {
send "{your password of key}\n"
exp_continue
}
}
[delegate.exp]
#!/usr/bin/expect
spawn ag-cosmos-helper tx staking delegate {your validator} {amount of stake token} --from {your key} --chain-id=agorictest-12 --broadcast-mode block -y
expect {
"Enter keyring passphrase:" {
send "{your password of key}\n"
exp_continue
}
}
You can make a cron job with `pm2`
[cron.json]
{
"apps": [
{
"name": "delegate",
"script": "sh",
"args": [
"-c" ,"/usr/bin/expect /root/scripts/reward.exp ; sleep 180; /usr/bin/expect /root/scripts/delegate.exp ; sleep 1800"
],
"exec_interpreter": "none",
"exec_mode": "fork_mode"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment