diff --git a/stack-orchestrator/compose/docker-compose-mainnet-laconicd.yml b/stack-orchestrator/compose/docker-compose-mainnet-laconicd.yml index fd420ee..5a1a22f 100644 --- a/stack-orchestrator/compose/docker-compose-mainnet-laconicd.yml +++ b/stack-orchestrator/compose/docker-compose-mainnet-laconicd.yml @@ -9,9 +9,6 @@ services: CERC_PEERS: ${CERC_PEERS} MIN_GAS_PRICE: ${MIN_GAS_PRICE:-0.001} CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info} - INPUT_GENESIS_FILE: ${INPUT_GENESIS_FILE} - INPUT_NODE_KEY_FILE: ${INPUT_NODE_KEY_FILE} - INPUT_PRIV_VALIDATOR_KEY_FILE: ${INPUT_PRIV_VALIDATOR_KEY_FILE} volumes: - laconicd-data:/root/.laconicd - ../config/laconicd/run-laconicd.sh:/opt/run-laconicd.sh diff --git a/stack-orchestrator/config/mainnet-laconicd/allocate-lps.sh b/stack-orchestrator/config/mainnet-laconicd/allocate-lps.sh new file mode 100755 index 0000000..3dfc1c1 --- /dev/null +++ b/stack-orchestrator/config/mainnet-laconicd/allocate-lps.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then + set -x +fi + +set -e + +# Early supports: 12960 * 10^18 alps (10% of 129600 * 10^18 alps) +EARLY_SUPPORTS="12960000000000000000000" + +DENOM=alps + +input_genesis_file=$INPUT_GENESIS_FILE +if [ ! -f ${input_genesis_file} ]; then + echo "Genesis file not provided, exiting..." + exit 1 +fi + +if [ -z "$RECIPIENT_ADDRESS" ]; then + echo "Recipient address not provided, exiting..." + exit 1 +fi + +update_genesis() { + jq "$1" ${input_genesis_file} > ${input_genesis_file}.tmp && + mv ${input_genesis_file}.tmp ${input_genesis_file} +} + +# Add new account to auth.accounts +update_genesis '.app_state["auth"]["accounts"] += [{"@type": "/cosmos.auth.v1beta1.BaseAccount", "address": "'$RECIPIENT_ADDRESS'", "pub_key": null, "account_number": "0", "sequence": "0"}]' + +# Add balance for the new account +update_genesis '.app_state["bank"]["balances"] += [{"address": "'$RECIPIENT_ADDRESS'", "coins": [{"denom": "'$DENOM'", "amount": "'$EARLY_SUPPORTS'"}]}]' + +# Get current supply +CURRENT_SUPPLY=$(jq -r '.app_state["bank"]["supply"][0]["amount"]' ${input_genesis_file}) + +# Calculate new supply +NEW_SUPPLY=$((CURRENT_SUPPLY + EARLY_SUPPORTS)) + +# Update total supply +update_genesis '.app_state["bank"]["supply"][0]["amount"] = "'$NEW_SUPPLY'"' + +echo "Genesis file updated with new account ${RECIPIENT_ADDRESS} and allocated ${EARLY_SUPPORTS} ${DENOM}" diff --git a/stack-orchestrator/config/laconicd/run-laconicd.sh b/stack-orchestrator/config/mainnet-laconicd/run-laconicd.sh similarity index 91% rename from stack-orchestrator/config/laconicd/run-laconicd.sh rename to stack-orchestrator/config/mainnet-laconicd/run-laconicd.sh index c0ea753..0a6d363 100755 --- a/stack-orchestrator/config/laconicd/run-laconicd.sh +++ b/stack-orchestrator/config/mainnet-laconicd/run-laconicd.sh @@ -6,19 +6,21 @@ fi set -e -input_genesis_file=$INPUT_GENESIS_FILE +NODE_HOME=/root/.laconicd + +input_genesis_file=$NODE_HOME/tmp/genesis.json if [ ! -f ${input_genesis_file} ]; then echo "Genesis file not provided, exiting..." exit 1 fi -input_node_key_file=$INPUT_NODE_KEY_FILE +input_node_key_file=$NODE_HOME/tmp/node_key.json if [ ! -f ${input_node_key_file} ]; then echo "Node key file not provided, exiting..." exit 1 fi -input_priv_validator_key_file=$INPUT_PRIV_VALIDATOR_KEY_FILE +input_priv_validator_key_file=$NODE_HOME/tmp/priv_validator_key.json if [ ! -f ${input_priv_validator_key_file} ]; then echo "Priv validator key file not provided, exiting..." exit 1 @@ -36,8 +38,6 @@ echo "Persistent peers: $CERC_PEERS" echo "Min gas price: $MIN_GAS_PRICE" echo "Log level: $CERC_LOGLEVEL" -NODE_HOME=/root/.laconicd - # Set chain id in config laconicd config set client chain-id $CERC_CHAIN_ID --home $NODE_HOME diff --git a/stack-orchestrator/stacks/mainnet-laconicd/stack.yaml b/stack-orchestrator/stacks/mainnet-laconicd/stack.yml similarity index 100% rename from stack-orchestrator/stacks/mainnet-laconicd/stack.yaml rename to stack-orchestrator/stacks/mainnet-laconicd/stack.yml