Skip to content

Commit

Permalink
cntools: include reward in delegators stake (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmaugPool committed Jul 7, 2020
1 parent 6f9ded9 commit 433ccb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/cnode-helper-scripts/cntools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2203,9 +2203,9 @@ case $OPERATION in
for key in ${delegators}; do
printf "\r"
stake_address="581de0${key}"
stake=$(jq ".esLState._utxoState._utxo | .[] | select(.address | contains(\"${key}\")) | .amount" "${TMP_FOLDER}"/ledger-state.json | awk 'BEGIN{total = 0} {total = total + $1} END{print total}')
reward=$(jq -r ".esLState._delegationState._dstate._rewards | .[] | select(.[0][\"credential\"][\"key hash\"] == \"${key}\") | .[1]" "${TMP_FOLDER}"/ledger-state.json)
stake=$(jq ".esLState._utxoState._utxo | .[] | select(.address | contains(\"${key}\")) | .amount" "${TMP_FOLDER}"/ledger-state.json | awk '{total = total + $1} END {print total}')
total_stake=$((total_stake + stake))
total_stake=$((total_stake + stake + reward))
say "$(printf "%-21s : %s" "Delegator ${delegator} hex key" "${key}")" "log"
say "$(printf "%-21s : ${CYAN}%s${NC} ADA (%s ADA)" " Stake (reward)" "$(numfmt --grouping "$(lovelacetoADA ${stake})")" "$(numfmt --grouping "$(lovelacetoADA ${reward})")")" "log"
delegator=$((delegator+1))
Expand Down

0 comments on commit 433ccb3

Please sign in to comment.