#!/bin/bash # Exit on error set -e set -u # Note: Needs to be run in a docker container with image cerc/laconicd:local KEYRING="test" NODE_HOME="/root/.laconicd" EARLY_SUPPORTS_ACC_ADDRESS=${EARLY_SUPPORTS_ACC_ADDRESS} if [ -z "$EARLY_SUPPORTS_ACC_ADDRESS" ]; then echo "EARLY_SUPPORTS_ACC_ADDRESS not provided, exiting..." exit 1 fi # alps allocations # Total supply: 129600 * 10^18 alps EARLY_SUPPORTS_ALLOC="12960000000000000000000" # Early supports: 12960 * 10^18 alps (10% of total supply) LOCKUP_ALLOC="116640000000000000000000" # Lockup: 116640 * 10^18 alps (90% of total supply) LPS_LOCKUP_MODULE_ACCOUNT="lps_lockup" LPS_DENOM="alps" testnet_state_file="$NODE_HOME/testnet-state.json" mainnet_genesis_file="$NODE_HOME/config/genesis.json" # Update any module params if required here update_genesis() { jq "$1" $NODE_HOME/config/genesis.json > $NODE_HOME/config/tmp_genesis.json && mv $NODE_HOME/config/tmp_genesis.json $NODE_HOME/config/genesis.json } # Set distribution community tax to 1 for disabling staking rewards and redirect them to the community pool update_genesis '.app_state["distribution"]["params"]["community_tax"]="1.000000000000000000"' # Increase threshold in gov proposals for making it difficult to spend community pool funds echo "Setting high threshold for accepting governance proposal" update_genesis '.app_state["gov"]["params"]["quorum"]="1.000000000000000000"' # Set expedited threshold to 100% update_genesis '.app_state["gov"]["params"]["expedited_threshold"]="1.000000000000000000"' # Set normal threshold to 99% since it needs to be lesser than expedited threshold update_genesis '.app_state["gov"]["params"]["threshold"]="0.990000000000000000"' # Perform alps allocations laconicd genesis add-genesis-account $EARLY_SUPPORTS_ACC_ADDRESS $EARLY_SUPPORTS_ALLOC$LPS_DENOM --keyring-backend $KEYRING --append # Use zero address to add an account for lps_lockup zero_address="laconic1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqklcls0" laconicd genesis add-genesis-account $zero_address $LOCKUP_ALLOC$LPS_DENOM --keyring-backend $KEYRING --module-name $LPS_LOCKUP_MODULE_ACCOUNT # Update the lps_lockup address in bank module state lps_lockup_address=$(jq -r '.app_state.auth.accounts[] | select(.name == "lps_lockup") | .base_account.address' $HOME/.laconicd/config/genesis.json) jq --arg old "$zero_address" --arg new "$lps_lockup_address" \ '.app_state.bank.balances |= map(if .address == $old then .address = $new else . end)' "$mainnet_genesis_file" > tmp.$$.json \ && mv tmp.$$.json "$mainnet_genesis_file" jq '(.app_state.auth.accounts[] | select(.name == "lps_lockup") | .permissions) = []' "$mainnet_genesis_file" > tmp.$$.json \ && mv tmp.$$.json "$mainnet_genesis_file" # TODO: Dump JSON for allocations in LPS_LOCKUP_MODULE_ACCOUNT state # Ensure that resulting genesis file is valid laconicd genesis validate