Skip to content

Commit

Permalink
fix: register ica controller
Browse files Browse the repository at this point in the history
  • Loading branch information
duvbell committed Jan 9, 2024
1 parent 6844edb commit c50be27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ test-alliance:
@echo "Testing alliance..."
./scripts/tests/alliance/delegate.sh

test-ica:
@echo "Testing ica..."
./scripts/tests/ica/delegate.sh

test-ibc-hooks:
@echo "Testing ibc-hooks..."
Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ func NewMigalooApp(

// Create static IBC router, add app routes, then set and seal it
ibcRouter := ibcporttypes.NewRouter().
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(ibctransfertypes.ModuleName, *app.TransferStack).
AddRoute(wasmtypes.ModuleName, wasmStack).
AddRoute(icahosttypes.SubModuleName, icaHostStack).
Expand Down
20 changes: 11 additions & 9 deletions scripts/tests/ica/delegate.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ echo "# ICA Cross Chain Delegation to Validator #"
echo "###########################################"
echo ""

BINARY=terrad
CHAIN_DIR=$(pwd)/data

WALLET_1=$($BINARY keys show wallet1 -a --keyring-backend test --home $CHAIN_DIR/test-1)
WALLET_2=$($BINARY keys show wallet2 -a --keyring-backend test --home $CHAIN_DIR/test-2)
export BINARY=migalood
export CHAIN_DIR=$(pwd)/data
export DENOM=uwhale

export WALLET_1=$($BINARY keys show wallet1 -a --keyring-backend test --home $CHAIN_DIR/test-1)
export WALLET_2=$($BINARY keys show wallet2 -a --keyring-backend test --home $CHAIN_DIR/test-2)

echo "Registering ICA on chain test-1"
ICA_REGISTER_RESPONSE=$($BINARY tx interchain-accounts controller register connection-0 --from $WALLET_1 --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 --keyring-backend test -y --gas 10000000)
ICA_REGISTER_RESPONSE=$($BINARY tx interchain-accounts controller register connection-0 --from $WALLET_1 --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 --keyring-backend test --fees 3000000$DENOM -y --gas 10000000)


ICS_TX_RESULT="Error:"
ICS_TX_ERROR="Error:"
Expand All @@ -24,7 +26,7 @@ while [[ "$ICS_TX_ERROR" == "$ICS_TX_RESULT"* ]]; do
done

echo "Sending tokens to ICA on chain test-2"
$BINARY tx bank send $WALLET_2 $ICS_TX_RESULT 10000000uluna --chain-id test-2 --home $CHAIN_DIR/test-2 --node tcp://localhost:26657 --keyring-backend test -y &> /dev/null
$BINARY tx bank send $WALLET_2 $ICS_TX_RESULT 10000000$DENOM --chain-id test-2 --home $CHAIN_DIR/test-2 --fees 3000000$DENOM --node tcp://localhost:26657 --keyring-backend test -y &> /dev/null
sleep 5
ICS_ACCOUNT_BALANCE=$($BINARY query bank balances $ICS_TX_RESULT --chain-id test-2 --node tcp://localhost:26657 -o json | jq -r '.balances[0].amount')

Expand All @@ -41,12 +43,12 @@ GENERATED_PACKET=$($BINARY tx interchain-accounts host generate-packet-data '{
"delegator_address": "'"$ICS_TX_RESULT"'",
"validator_address": "'"$VAL_ADDR_1"'",
"amount": {
"denom": "uluna",
"denom": "$DENOM",
"amount": "'"$ICS_ACCOUNT_BALANCE"'"
}
}')

$BINARY tx interchain-accounts controller send-tx connection-0 $GENERATED_PACKET --from $WALLET_1 --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 --keyring-backend test -y &> /dev/null
$BINARY tx interchain-accounts controller send-tx connection-0 $GENERATED_PACKET --from $WALLET_1 --chain-id test-1 --home $CHAIN_DIR/test-1 --fees 3000000$DENOM --node tcp://localhost:16657 --keyring-backend test -y &> /dev/null

VALIDATOR_DELEGATIONS=""
while [[ "$VALIDATOR_DELEGATIONS" != "$ICS_ACCOUNT_BALANCE" ]]; do
Expand Down

0 comments on commit c50be27

Please sign in to comment.