Skip to content

Instantly share code, notes, and snippets.

@rnbguy
Created May 11, 2022 11:10
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 rnbguy/06ba3ec68b02f007d66bc6275e978953 to your computer and use it in GitHub Desktop.
Save rnbguy/06ba3ec68b02f007d66bc6275e978953 to your computer and use it in GitHub Desktop.
Computes current loss to burn UST for LUNA
#!/bin/bash
# prints current loss percentage due to burning UST for LUNA
# requires: curl, jq, bc
luna_rate_via_burn=`curl -s "https://fcd.terra.dev/terra/market/v1beta1/swap?ask_denom=uluna&offer_coin=100000000uusd" | jq -r ".return_coin.amount"`
luna_to_ust_exchange_rate=`curl -s "https://fcd.terra.dev/terra/oracle/v1beta1/denoms/uusd/exchange_rate" | jq -r ".exchange_rate"`
echo "(100 - ((${luna_rate_via_burn} * ${luna_to_ust_exchange_rate}) / 10^6))" | bc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment