Skip to content

Instantly share code, notes, and snippets.

@mr0wnage
Forked from AGx10k/stegos-stake-cloak-all.sh
Last active November 7, 2019 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr0wnage/d8e4a817a490628678b59aa50449898b to your computer and use it in GitHub Desktop.
Save mr0wnage/d8e4a817a490628678b59aa50449898b to your computer and use it in GitHub Desktop.
#!/bin/bash
stegosout=$(echo "show balance" | /data/stegos/stegos --data-dir /data/stegos/db)
stegosexit=$?
if [ $stegosexit -gt 0 ]; then
echo stegosout: "$stegosout"
exit $stegosexit
fi
if grep -q -i error <<< "$stegosout"; then
echo stegos returned error:
echo "$stegosout"
exit 10
fi
public_balance=$(echo "$stegosout" | grep -w public_payment -A2 | grep available | awk '{ print $2 }')
re='^[0-9]+$'
if ! [[ $public_balance =~ $re ]] ; then
echo "public_balance=$public_balance"
echo "stegosout=$stegosout"
echo "error: \$public_balance is Not a number" >&2; exit 1
fi
if [ $public_balance -gt 4999999 ]; then
stegosout=$(echo "cloak" | /data/stegos/stegos --data-dir /data/stegos/db)
stegosexit=$?
if [ $stegosexit -gt 0 ]; then
echo stegosout: "$stegosout"
exit $stegosexit
fi
echo "$stegosout" | grep transaction_created -A7 #### check what output cloak does
fi
balance=$(echo "$stegosout" | grep -w payment -A2 | grep available | awk '{ print $2 }')
re='^[0-9]+$'
if ! [[ $balance =~ $re ]] ; then
echo "balance=$balance"
echo "stegosout=$stegosout"
echo "error: \$balance is Not a number" >&2; exit 1
fi
if [ $balance -gt 4999999 ]; then
stegosout=$(echo "stake $balance" | /data/stegos/stegos --data-dir /data/stegos/db)
stegosexit=$?
if [ $stegosexit -gt 0 ]; then
echo stegosout: "$stegosout"
exit $stegosexit
fi
echo "$stegosout" | grep transaction_created -A7
else
echo balance=$balance will not stake
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment