#!/bin/bash # Exit on error set -e set -u # Note: Needs to be run in a docker container with image cerc/laconicd:local CHAINID=${CHAINID:-"laconic-mainnet"} MONIKER=${MONIKER:-"mainnet-node"} NODE_HOME="/root/.laconicd" EARLY_SUPPORTS_ACC_ADDRESS=${EARLY_SUPPORTS_ACC_ADDRESS} LPS_LOCKUP_ACC_ADDRESS=${LPS_LOCKUP_ACC_ADDRESS} if [ -z "$EARLY_SUPPORTS_ACC_ADDRESS" ] || [ -z "$LPS_LOCKUP_ACC_ADDRESS" ]; then echo "EARLY_SUPPORTS_ACC_ADDRESS or LPS_LOCKUP_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" testnet_state_file="$NODE_HOME/testnet-state.json" mainnet_genesis_file="$NODE_HOME/config/genesis.json" laconicd config set client chain-id $CHAINID laconicd init $MONIKER --chain-id $CHAINID --default-denom alnt # Import required state jq --slurpfile nested $testnet_state_file '.app_state.auth = $nested[0].app_state' "$mainnet_genesis_file" > tmp.$$.json && mv tmp.$$.json "$mainnet_genesis_file" jq --slurpfile nested $testnet_state_file '.consensus.auth = $nested[0].consensus' "$mainnet_genesis_file" > tmp.$$.json && mv tmp.$$.json "$mainnet_genesis_file" # Update any module params if required here # Perform alps allocations laconicd genesis add-genesis-account $ADDRESS $EARLY_SUPPORTS$DENOM --keyring-backend $KEYRING # Use zero address to add an account for lps_lockup zero_address="laconic1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqklcls0" laconicd genesis add-genesis-account $zero_address $EARLY_SUPPORTS$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" # Ensure that resulting genesis file is valid laconicd genesis validate