diff --git a/scripts/ibc/setup_ibc.sh b/scripts/ibc/setup_ibc.sh index 5f60b46..d2fe9e8 100644 --- a/scripts/ibc/setup_ibc.sh +++ b/scripts/ibc/setup_ibc.sh @@ -103,6 +103,7 @@ rly keys add "$ROLLAPP_CHAIN_ID" "$RELAYER_KEY_FOR_ROLLAPP" rly keys add "$SETTLEMENT_CHAIN_ID" "$RELAYER_KEY_FOR_HUB" RLY_HUB_ADDR=$(rly keys show "$SETTLEMENT_CHAIN_ID") +RLY_ROLLAPP_ADDR=$(rly keys show "$ROLLAPP_CHAIN_ID") echo '--------------------------------- Funding rly account on hub ['"$RLY_HUB_ADDR"']... --------------------------------' DYM_BALANCE=$("$SETTLEMENT_EXECUTABLE" q bank balances "$RLY_HUB_ADDR" -o json | jq -r '.balances[0].amount') @@ -113,6 +114,16 @@ else "$SETTLEMENT_EXECUTABLE" tx bank send "$SETTLEMENT_KEY_NAME_GENESIS" "$RLY_HUB_ADDR" 100dym --keyring-backend test --fees 1dym --node "$SETTLEMENT_RPC_FOR_RELAYER" -y || exit 1 fi +echo '--------------------------------- Funding rly account on rollapp ['"$RLY_ROLLAPP_ADDR"']... --------------------------------' +ROLLAPP_BALANCE=$("$EXECUTABLE" q bank balances "$RLY_ROLLAPP_ADDR" -o json | jq -r '.balances[0].amount') + +if [ "$(echo "$ROLLAPP_BALANCE >= 100000000000000000000" | bc)" -eq 1 ]; then + echo "${RLY_ROLLAPP_ADDR} already funded" +else + "$EXECUTABLE" tx bank send "$KEY_NAME_ROLLAPP" "$RLY_ROLLAPP_ADDR" "100000000000000000000$BASE_DENOM" --keyring-backend test --fees "10000000000000000$BASE_DENOM" --node "$ROLLAPP_RPC_FOR_RELAYER" -y || exit 1 +fi + + echo '--------------------------------- Creating IBC path... --------------------------------' rly paths new "$SETTLEMENT_CHAIN_ID" "$ROLLAPP_CHAIN_ID" "$RELAYER_PATH" --src-port "$IBC_PORT" --dst-port "$IBC_PORT" --version "$IBC_VERSION"