Last active
August 7, 2019 18:36
-
-
Save alexanderbez/5101b1bf699f465c20298411705d11a4 to your computer and use it in GitHub Desktop.
Gaia v1.0.0-rc1 to rc3 custom migration script
This file contains hidden or 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 | |
# | |
# Example: | |
# sh ./gaia_v1_rc_migration.sh ./old_genesis.json ./new_genesis.json | |
INPUT_GENESIS=$1 | |
OUTPUT_GENESIS=$2 | |
if [ -z "$INPUT_GENESIS" ]; then | |
echo "no input genesis provided" | |
exit 1 | |
fi | |
SUPPLY_TOTAL=$(cat $INPUT_GENESIS | jq -c '.app_state["supply"]["supply"]["total"]') | |
OUTPUT=$(cat $INPUT_GENESIS | jq --argjson inp1 "$SUPPLY_TOTAL" '.app_state["supply"]={"supply":($inp1)}') | |
if [ -z "$OUTPUT_GENESIS" ]; | |
then | |
echo "$OUTPUT" | jq -S -c -M '' | |
else | |
echo "$OUTPUT" | jq -S -c -M '' > "$OUTPUT_GENESIS" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment