Skip to content

Instantly share code, notes, and snippets.

@torfbolt
Created December 7, 2021 17:04
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 torfbolt/116ce2a81d2ef19f7b492ff8df6aae39 to your computer and use it in GitHub Desktop.
Save torfbolt/116ce2a81d2ef19f7b492ff8df6aae39 to your computer and use it in GitHub Desktop.
Script to wait for the right time to make a rocketpool deposit
#!/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