diff --git a/README.md b/README.md index 692a735..13ef585 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,12 @@ export the following variables: ```shell export ROLLAPP_CHAIN_ID="rollappwasm_1234-1" export KEY_NAME_ROLLAPP="rol-user" -export DENOM="urax" +export BASE_DENOM="awsm" +export DENOM=$(echo "$BASE_DENOM" | sed 's/^.//') export MONIKER="$ROLLAPP_CHAIN_ID-sequencer" + +export ROLLAPP_HOME_DIR="$HOME/.rollapp" +export ROLLAPP_SETTLEMENT_INIT_DIR_PATH="${ROLLAPP_HOME_DIR}/init" ``` And initialize the rollapp: @@ -82,6 +86,20 @@ You should have a running local rollapp! Follow the instructions on [Dymension docs](https://docs.dymension.xyz/validate/dymension/build-dymd?network=localhost) to run local dymension hub node +all scripts are adjusted to use local hub node that's hosted on the default port `localhost:36657`. + +configuration with a remote hub node is also supported, the following variables must be set: + +```shell +export HUB_RPC_ENDPOINT="http://localhost" +export HUB_RPC_PORT="36657" # default: 36657 +export HUB_RPC_URL="http://${HUB_RPC_ENDPOINT}:${HUB_RPC_PORT}" +export HUB_CHAIN_ID="dymension_100-1" + +dymd config chain-id ${HUB_CHAIN_ID} +dymd config node ${HUB_RPC_URL} +``` + ### Create sequencer keys create sequencer key using `dymd` @@ -94,7 +112,13 @@ SEQUENCER_ADDR=`dymd keys show sequencer --address --keyring-backend test --keyr fund the sequencer account ```shell -dymd tx bank send local-user $SEQUENCER_ADDR 10000000000000000000000adym --keyring-backend test --broadcast-mode block --fees 20000000000000adym -y +# this will retrieve the min bond amount from the hub +# if you're using an new address for registering a sequencer, +# you have to account for gas fees so it should the final value should be increased +BOND_AMOUNT="$(dymd q sequencer params -o json | jq -r '.params.min_bond.amount')$(dymd q sequencer params -o jsono | jq -r '.params.min_bond.denom')" +echo $BOND_AMOUNT + +dymd tx bank send local-user dym1978q3tcxwg0ldzgv7ynfr3mzytr9qfsuwjt7tl 100000000000000000000000adym --keyring-backend test --broadcast-mode block --fees 20000000000000adym -y ``` ### Register rollapp on settlement @@ -115,8 +139,9 @@ Modify `dymint.toml` in the chain directory (`~/.rollapp/config`) set: ```shell -settlement_layer = "dymension" -gas_prices = "0.025adym" +sed -i 's/settlement_layer.*/settlement_layer = "dymension"/' ${ROLLAPP_HOME_DIR}/config/dymint.toml +sed -i '/node_address =/c\node_address = '\"$HUB_RPC_URL\" "${ROLLAPP_HOME_DIR}/config/dymint.toml" +sed -i '/rollapp_id =/c\rollapp_id = '\"$ROLLAPP_CHAIN_ID\" "${ROLLAPP_HOME_DIR}/config/dymint.toml" ``` ### Run rollapp locally diff --git a/README.with-advanced-features.md b/README.with-advanced-features.md new file mode 100644 index 0000000..f663565 --- /dev/null +++ b/README.with-advanced-features.md @@ -0,0 +1,244 @@ +# Dymension WASM Rollapp + +## rollappd - A template WASM RollApp chain + +This repository hosts `rollappd`, a template implementation of a dymension rollapp with `WASM` execution layer. + +`rollappd` is an example of a working RollApp using `dymension-RDK` and `dymint`. + +It uses Cosmos-SDK's [simapp](https://github.com/cosmos/cosmos-sdk/tree/main/simapp) as a reference, but with the following changes: + +- minimal app setup +- wired IBC for [ICS 20 Fungible Token Transfers](https://github.com/cosmos/ibc/tree/main/spec/app/ics-020-fungible-token-transfer) +- Uses `dymint` for block sequencing and replacing `tendermint` +- Uses modules from `dymension-RDK` to sync with `dymint` and provide RollApp custom logic + +## Overview + +**Note**: Requires [Go 1.20](https://go.dev/) + +## Quick guide + +Get started with [building RollApps](https://docs.dymension.xyz/develop/get-started/setup) + +## Installing / Getting started + +Build and install the ```rollappd``` binary: + +```shell +make install +``` + +### Initial configuration + +export the following variables: + +```shell +export ROLLAPP_CHAIN_ID="rollappwasm_1234-1" +export KEY_NAME_ROLLAPP="rol-user" +export BASE_DENOM="awsm" +export DENOM=$(echo "$BASE_DENOM" | sed 's/^.//') +export MONIKER="$ROLLAPP_CHAIN_ID-sequencer" + +export ROLLAPP_HOME_DIR="$HOME/.rollapp" +export ROLLAPP_SETTLEMENT_INIT_DIR_PATH="${ROLLAPP_HOME_DIR}/init" +``` + +if you want to change the max wasm size: + +```shell +export MAX_WASM_SIZE=WASM_SIZE_IN_BYTES +``` + +And initialize the rollapp: + +```shell +sh scripts/init.sh +``` + +### Download cw20-ics20 smartcontract + +Download cw20-ics20 smartcontract with a specific version: + +```shell +bash scripts/download_release.sh v1.0.0 +``` + +### Run rollapp + +```shell +rollappd start +``` + +You should have a running local rollapp! + +## Run a rollapp with a settlement node + +### Run local dymension hub node + +Follow the instructions on [Dymension Hub docs](https://docs.dymension.xyz/develop/get-started/run-base-layers) to run local dymension hub node + +all scripts are adjusted to use local hub node that's hosted on the default port `localhost:36657`. + +configuration with a remote hub node is also supported, the following variables must be set: + +```shell +export HUB_RPC_ENDPOINT="http://localhost" +export HUB_RPC_PORT="36657" # default: 36657 +export HUB_RPC_URL="http://${HUB_RPC_ENDPOINT}:${HUB_RPC_PORT}" +export HUB_CHAIN_ID="dymension_100-1" + +dymd config chain-id ${HUB_CHAIN_ID} +dymd config node ${HUB_RPC_URL} +``` + +### Create sequencer keys + +create sequencer key using `dymd` + +```shell +dymd keys add sequencer --keyring-dir ${ROLLAPP_HOME_DIR}/sequencer_keys --keyring-backend test +SEQUENCER_ADDR=`dymd keys show sequencer --address --keyring-backend test --keyring-dir ${ROLLAPP_HOME_DIR}/sequencer_keys` +``` + +fund the sequencer account (if you're using a remote hub node, you must fund the sequencer account or you must have an account with enough funds in your keyring) + +```shell +# this will retrieve the min bond amount from the hub +# if you're using an new address for registering a sequencer, +# you have to account for gas fees so it should the final value should be increased +BOND_AMOUNT="$(dymd q sequencer params -o json | jq -r '.params.min_bond.amount')$(dymd q sequencer params -o json | jq -r '.params.min_bond.denom')" + +dymd tx bank send local-user $SEQUENCER_ADDR ${BOND_AMOUNT} --keyring-backend test --broadcast-mode block --fees 1dym -y +``` + +### Generate denommetadata + +```shell + +sh scripts/settlement/generate_denom_metadata.sh +``` + +### Add genesis accounts + + +```shell +sh scripts/settlement/add_genesis_accounts.sh +``` + +### Register rollapp on settlement + +```shell +# for permissioned deployment setup, you must have access to an account whitelisted for rollapp +# registration, assuming you want to import an existing account, you can do: +dymd keys add local-user --recover +# input mnemonic from the account that has the permission to register rollapp + +sh scripts/settlement/register_rollapp_to_hub.sh +``` + +### Register sequencer for rollapp on settlement + +```shell +sh scripts/settlement/register_sequencer_to_hub.sh +``` + +### Configure the rollapp + +Modify `dymint.toml` in the chain directory (`${ROLLAPP_HOME_DIR}/config`) + +set: + +```shell +sed -i 's/settlement_layer.*/settlement_layer = "dymension"/' ${ROLLAPP_HOME_DIR}/config/dymint.toml +sed -i '/node_address =/c\node_address = '\"$HUB_RPC_URL\" "${ROLLAPP_HOME_DIR}/config/dymint.toml" +sed -i '/rollapp_id =/c\rollapp_id = '\"$ROLLAPP_CHAIN_ID\" "${ROLLAPP_HOME_DIR}/config/dymint.toml" +``` + +### Update the Genesis file to include the denommetadata, genesis accounts, module account and elevated accounts + +```shell +sh scripts/update_genesis_file.sh +``` + +### Update the Genesis file to include the denommetadata, genesis accounts, module account and elevated accounts + +```shell +# this script automatically adds 2 vesting accounts, adjust the timestampts to your liking or skip this step +sh scripts/add_vesting_accounts_to_genesis_file.sh +``` + +### Run rollapp locally + +```shell +rollappd start +``` + +or as a systemd service: + +```shell +sudo tee /etc/systemd/system/rollapp.service > /dev/null < /dev/null </dev/null; then echo "$RELAYER_EXECUTABLE does not exist" @@ -30,6 +30,10 @@ if ! command -v $RELAYER_EXECUTABLE >/dev/null; then exit 1 fi +# --------------------------------- change block time to easily create ibc channels --------------------------------- # +sed -i 's/empty_blocks_max_time =.*/empty_blocks_max_time = "3s"/' ${ROLLAPP_HOME_DIR}/config/dymint.toml +sudo systemctl restart rollapp + # --------------------------------- rly init --------------------------------- # RLY_PATH="$HOME/.relayer" RLY_CONFIG_FILE="$RLY_PATH/config/config.yaml" @@ -52,14 +56,14 @@ rly config init echo '# ------------------------- adding chains to rly config ------------------------- #' tmp=$(mktemp) -jq --arg key "$RELAYER_KEY_FOR_ROLLAP" '.value.key = $key' $ROLLAPP_IBC_CONF_FILE > "$tmp" && mv "$tmp" $ROLLAPP_IBC_CONF_FILE -jq --arg chain "$ROLLAPP_CHAIN_ID" '.value."chain-id" = $chain' $ROLLAPP_IBC_CONF_FILE > "$tmp" && mv "$tmp" $ROLLAPP_IBC_CONF_FILE -jq --arg rpc "$ROLLAPP_RPC_FOR_RELAYER" '.value."rpc-addr" = $rpc' $ROLLAPP_IBC_CONF_FILE > "$tmp" && mv "$tmp" $ROLLAPP_IBC_CONF_FILE -jq --arg denom "0.0$DENOM" '.value."gas-prices" = $denom' $ROLLAPP_IBC_CONF_FILE > "$tmp" && mv "$tmp" $ROLLAPP_IBC_CONF_FILE +jq --arg key "$RELAYER_KEY_FOR_ROLLAP" '.value.key = $key' $ROLLAPP_IBC_CONF_FILE >"$tmp" && mv "$tmp" $ROLLAPP_IBC_CONF_FILE +jq --arg chain "$ROLLAPP_CHAIN_ID" '.value."chain-id" = $chain' $ROLLAPP_IBC_CONF_FILE >"$tmp" && mv "$tmp" $ROLLAPP_IBC_CONF_FILE +jq --arg rpc "$ROLLAPP_RPC_FOR_RELAYER" '.value."rpc-addr" = $rpc' $ROLLAPP_IBC_CONF_FILE >"$tmp" && mv "$tmp" $ROLLAPP_IBC_CONF_FILE +jq --arg denom "0.0$BASE_DENOM" '.value."gas-prices" = $denom' $ROLLAPP_IBC_CONF_FILE >"$tmp" && mv "$tmp" $ROLLAPP_IBC_CONF_FILE -jq --arg key "$RELAYER_KEY_FOR_HUB" '.value.key = $key' $HUB_IBC_CONF_FILE > "$tmp" && mv "$tmp" $HUB_IBC_CONF_FILE -jq --arg chain "$SETTLEMENT_CHAIN_ID" '.value."chain-id" = $chain' $HUB_IBC_CONF_FILE > "$tmp" && mv "$tmp" $HUB_IBC_CONF_FILE -jq --arg rpc "$SETTLEMENT_RPC_FOR_RELAYER" '.value."rpc-addr" = $rpc' $HUB_IBC_CONF_FILE > "$tmp" && mv "$tmp" $HUB_IBC_CONF_FILE +jq --arg key "$RELAYER_KEY_FOR_HUB" '.value.key = $key' $HUB_IBC_CONF_FILE >"$tmp" && mv "$tmp" $HUB_IBC_CONF_FILE +jq --arg chain "$SETTLEMENT_CHAIN_ID" '.value."chain-id" = $chain' $HUB_IBC_CONF_FILE >"$tmp" && mv "$tmp" $HUB_IBC_CONF_FILE +jq --arg rpc "$SETTLEMENT_RPC_FOR_RELAYER" '.value."rpc-addr" = $rpc' $HUB_IBC_CONF_FILE >"$tmp" && mv "$tmp" $HUB_IBC_CONF_FILE rly chains add --file "$ROLLAPP_IBC_CONF_FILE" "$ROLLAPP_CHAIN_ID" rly chains add --file "$HUB_IBC_CONF_FILE" "$SETTLEMENT_CHAIN_ID" @@ -72,16 +76,16 @@ RLY_HUB_ADDR=$(rly keys show "$SETTLEMENT_CHAIN_ID") RLY_ROLLAPP_ADDR=$(rly keys show "$ROLLAPP_CHAIN_ID") echo '# -------------------------------- funding for rly account ------------------------------- #' -$SETTLEMENT_EXECUTABLE tx bank send $SETTLEMENT_KEY_NAME_GENESIS "$(rly keys show "$SETTLEMENT_CHAIN_ID")" 1000000000000000000000adym --keyring-backend test --broadcast-mode block --fees 20000000000000adym -y --node "$SETTLEMENT_RPC_FOR_RELAYER" -$EXECUTABLE tx bank send $ROLLAPP_KEY_NAME_GENESIS "$(rly keys show "$ROLLAPP_CHAIN_ID")" 1000000000000000000000$DENOM --keyring-backend test --broadcast-mode block -y --node "$ROLLAPP_RPC_FOR_RELAYER" +$SETTLEMENT_EXECUTABLE tx bank send $SETTLEMENT_KEY_NAME_GENESIS "$(rly keys show "$SETTLEMENT_CHAIN_ID")" 1000000000000000000000${SETTLEMENT_BASE_DENOM} --keyring-backend test --broadcast-mode block --fees 20000000000000${SETTLEMENT_BASE_DENOM} -y +$EXECUTABLE tx bank send $ROLLAPP_KEY_NAME_GENESIS "$(rly keys show "$ROLLAPP_CHAIN_ID")" 1000000000000000000000$BASE_DENOM --keyring-backend test --broadcast-mode block -y --node "$ROLLAPP_RPC_FOR_RELAYER" echo "# ------------------------------- balance of rly account on hub [$RLY_HUB_ADDR]------------------------------ #" -$SETTLEMENT_EXECUTABLE q bank balances "$(rly keys show "$SETTLEMENT_CHAIN_ID")" --node "$SETTLEMENT_RPC_FOR_RELAYER" -echo "From within the hub node: \"$SETTLEMENT_EXECUTABLE tx bank send $SETTLEMENT_KEY_NAME_GENESIS $RLY_HUB_ADDR 100000000000000000000udym --keyring-backend test --broadcast-mode block\"" +$SETTLEMENT_EXECUTABLE q bank balances "$(rly keys show "$SETTLEMENT_CHAIN_ID")" +echo "From within the hub node: \n\"$SETTLEMENT_EXECUTABLE tx bank send $SETTLEMENT_KEY_NAME_GENESIS $RLY_HUB_ADDR 100000000000000000000${SETTLEMENT_BASE_DENOM} --keyring-backend test --broadcast-mode block\"" echo "# ------------------------------- balance of rly account on rollapp [$RLY_ROLLAPP_ADDR] ------------------------------ #" $EXECUTABLE q bank balances "$(rly keys show "$ROLLAPP_CHAIN_ID")" --node "$ROLLAPP_RPC_FOR_RELAYER" -echo "From within the rollapp node: \"$EXECUTABLE tx bank send $KEY_NAME_ROLLAPP $RLY_ROLLAPP_ADDR 100000000$DENOM --keyring-backend test --broadcast-mode block\"" +echo "From within the rollapp node: \n\"$EXECUTABLE tx bank send $KEY_NAME_ROLLAPP $RLY_ROLLAPP_ADDR 100000000$BASE_DENOM --keyring-backend test --broadcast-mode block\"" echo '# -------------------------------- creating IBC link ------------------------------- #' @@ -94,5 +98,9 @@ rly tx link "$RELAYER_PATH" --src-port "$IBC_PORT" --dst-port "$IBC_PORT" --vers sleep 5 echo '# -------------------------------- IBC channel established ------------------------------- #' -echo "ROLLAPP_CHANNEL: $(rly q channels "$ROLLAPP_CHAIN_ID")" -echo "HUB_CHANNEL: $(rly q channels "$SETTLEMENT_CHAIN_ID")" +echo "Channel Information:" +echo $(rly q channels "$ROLLAPP_CHAIN_ID" | jq '{ "rollapp-channel": .channel_id, "hub-channel": .counterparty.channel_id }') + +# --------------------------------- revert empty block time to 1h --------------------------------- # +sed -i 's/empty_blocks_max_time =.*/empty_blocks_max_time = "3600s"/' ${ROLLAPP_HOME_DIR}/config/dymint.toml +sudo systemctl restart rollapp diff --git a/scripts/init.sh b/scripts/init.sh index 6ffde27..4f589fe 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -6,17 +6,16 @@ ROLLAPP_CHAIN_DIR="$HOME/.rollapp" set_denom() { denom=$1 - jq --arg denom $denom '.app_state.mint.params.mint_denom = $denom' "$GENESIS_FILE" > "$tmp" && mv "$tmp" "$GENESIS_FILE" - jq --arg denom $denom '.app_state.staking.params.bond_denom = $denom' "$GENESIS_FILE" > "$tmp" && mv "$tmp" "$GENESIS_FILE" - jq --arg denom $denom '.app_state.gov.deposit_params.min_deposit[0].denom = $denom' "$GENESIS_FILE" > "$tmp" && mv "$tmp" "$GENESIS_FILE" + jq --arg denom $denom '.app_state.mint.params.mint_denom = $denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + jq --arg denom $denom '.app_state.staking.params.bond_denom = $denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + jq --arg denom $denom '.app_state.gov.deposit_params.min_deposit[0].denom = $denom' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" } # ---------------------------- initial parameters ---------------------------- # # Assuming 1,000,000 tokens #half is staked -TOKEN_AMOUNT="1000000000000000000000000$DENOM" -STAKING_AMOUNT="500000000000000000000000$DENOM" - +TOKEN_AMOUNT="1000000000000000000000000$BASE_DENOM" +STAKING_AMOUNT="500000000000000000000000$BASE_DENOM" CONFIG_DIRECTORY="$ROLLAPP_CHAIN_DIR/config" GENESIS_FILE="$CONFIG_DIRECTORY/genesis.json" @@ -56,8 +55,8 @@ $EXECUTABLE config keyring-backend test $EXECUTABLE config chain-id "$ROLLAPP_CHAIN_ID" # -------------------------------- app config -------------------------------- # -sed -i'' -e "s/^minimum-gas-prices *= .*/minimum-gas-prices = \"0$DENOM\"/" "$APP_CONFIG_FILE" -set_denom "$DENOM" +sed -i'' -e "s/^minimum-gas-prices *= .*/minimum-gas-prices = \"0$BASE_DENOM\"/" "$APP_CONFIG_FILE" +set_denom "$BASE_DENOM" # --------------------- adding keys and genesis accounts --------------------- # #local genesis account @@ -68,12 +67,17 @@ $EXECUTABLE add-genesis-account "$KEY_NAME_ROLLAPP" "$TOKEN_AMOUNT" --keyring-ba operator_address=$($EXECUTABLE keys show "$KEY_NAME_ROLLAPP" -a --keyring-backend test --bech val) jq --arg addr $operator_address '.app_state["sequencers"]["genesis_operator_address"] = $addr' "$GENESIS_FILE" > "$tmp" && mv "$tmp" "$GENESIS_FILE" +# set sequencer's operator address +operator_address=$($EXECUTABLE keys show "$KEY_NAME_ROLLAPP" -a --keyring-backend test --bech val) +jq --arg addr $operator_address '.app_state["sequencers"]["genesis_operator_address"] = $addr' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + echo "Do you want to include staker on genesis? (Y/n) " read -r answer -if [ ! "$answer" != "${answer#[Nn]}" ] ;then +if [ ! "$answer" != "${answer#[Nn]}" ]; then + set -x $EXECUTABLE gentx "$KEY_NAME_ROLLAPP" "$STAKING_AMOUNT" --chain-id "$ROLLAPP_CHAIN_ID" --keyring-backend test --home "$ROLLAPP_CHAIN_DIR" $EXECUTABLE collect-gentxs --home "$ROLLAPP_CHAIN_DIR" + set +x fi - $EXECUTABLE validate-genesis diff --git a/scripts/settlement/add_genesis_accounts.sh b/scripts/settlement/add_genesis_accounts.sh new file mode 100644 index 0000000..fb6d289 --- /dev/null +++ b/scripts/settlement/add_genesis_accounts.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +if [ ! -d "$ROLLAPP_SETTLEMENT_INIT_DIR_PATH" ]; then + mkdir -p "$ROLLAPP_SETTLEMENT_INIT_DIR_PATH" + echo "Creating the ROLLAPP_SETTLEMENT_INIT_DIR_PATH: $ROLLAPP_SETTLEMENT_INIT_DIR_PATH" +else + echo "ROLLAPP_SETTLEMENT_INIT_DIR_PATH already exists: $ROLLAPP_SETTLEMENT_INIT_DIR_PATH" +fi + +dymd keys add alice-genesis --keyring-backend test +dymd keys add bob-genesis --keyring-backend test + +tee "$ROLLAPP_SETTLEMENT_INIT_DIR_PATH/genesis_accounts.json" >/dev/null </dev/null <"$tmp" && mv "$tmp" "$GENESIS_FILE" +jq '.consensus_params["block"]["max_bytes"] = "5242880"' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + +jq '.app_state.gov.voting_params.voting_period = "300s"' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + +# this is a static module account for the hubgenesis module +# retrieved using 'rollappd q auth module-accounts' command +module_account_address="ethm1748tamme3jj3v9wq95fc3pmglxtqscljdy7483" + +# Construct the JSON object with the obtained address +module_account=$(jq -n \ + --arg address "$module_account_address" \ + '[{ + "@type": "/cosmos.auth.v1beta1.ModuleAccount", + "base_account": { + "account_number": "0", + "address": $address, + "pub_key": null, + "sequence": "0" + }, + "name": "hubgenesis", + "permissions": [] + }]') + +jq --argjson module_account "$module_account" '.app_state.auth.accounts += $module_account' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + +module_account_balance=$( + jq -n \ + --arg address "$module_account_address" \ + --arg denom "$BASE_DENOM" \ + '[{ + "address": $address, + "coins": [ + { + "denom": $denom, + "amount": "60000000000000000000000" + } + ] + }]' +) + +jq '.app_state.bank.balances[0].coins[0].amount = "2000000000000000000000000000"' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" +jq --argjson module_account_balance "$module_account_balance" '.app_state.bank.balances += $module_account_balance' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + +jq '.app_state.bank.supply[0].amount = "2000060000000000000000000000"' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + +# ---------------------------- add elevated account ---------------------------- # +elevated_address=$(${EXECUTABLE} keys show ${KEY_NAME_ROLLAPP} --keyring-backend test --output json | jq -r .address) +elevated_address_json=$(jq -n \ + --arg address "$elevated_address" \ + '[{ + "address": $address + }]') +jq --argjson elevated_address_json "$elevated_address_json" '.app_state.hubgenesis.params.genesis_triggerer_whitelist += $elevated_address_json' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" +jq --arg hub_chain_id "$HUB_CHAIN_ID" '.app_state.hubgenesis.hub.hub_id = $hub_chain_id' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + +# ---------------------------- add denom metadata ---------------------------- # +denom_metadata=$(cat $ROLLAPP_SETTLEMENT_INIT_DIR_PATH/denommetadata.json) +jq --argjson denom_metadata "$denom_metadata" '.app_state.bank.denom_metadata = $denom_metadata' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" +jq --arg elevated_address "$elevated_address" '.app_state.denommetadata.params.allowed_addresses += [$elevated_address]' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE"