Created
December 7, 2021 17:04
-
-
Save torfbolt/116ce2a81d2ef19f7b492ff8df6aae39 to your computer and use it in GitHub Desktop.
Script to wait for the right time to make a rocketpool deposit
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
#!/bin/bash | |
# usage example: ./rocketpool-deposit-loop 20 100 && rocketpool -f 120 -i 10 n d -a 16 -s 5 -l 0xSEED -y | |
gasprice () { | |
echo $(($(curl -X post http://ethnode:8545 -H "content-type: application/json" --data "{\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}" -s | sed -nr "s/.*(0x[0-9a-f]*).*/\1/p"))) / 1000000000 | bc | |
} | |
commission () { | |
rocketpool e f | grep current | sed -n 's/.* \([0-9.]*\).*/\1/p' | |
} | |
until COM=$(commission) && GAS=$(gasprice) && echo "Commission is $COM, gas price is $GAS, waiting for $1 & $2" && (( $(echo "$COM >= $1" | bc -l) )) && [[ $GAS -le $2 ]]; do sleep 5; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment