--- title: ExecuteMsg sidebar_label: ExecuteMsg sidebar_position: 2 slug: /contract-api/execute-msg --- # `ExecuteMsg` The `ExecuteMsg` is the message that is used to interact with the `cw-ica-controller` contract. **All execute messages are only callable by the owner of the contract.** ## `CreateChannel` ```rust reference https://github.com/srdtrk/cw-ica-controller/blob/7773fbd8d4e227b6c942f0c88575f9800809b4bf/src/types/msg.rs#L29-L39 ``` This message is used to initiate an ICS-27 channel open handshake. It is only callable by the owner. This message only takes one optional parameter: `channel_open_init_options`. If this parameter is left empty, then the contract will use the `channel_open_init_options` that were last passed to the `InstantiateMsg` or `CreateChannel` messages. If this parameter is set, then the contract will use the `channel_open_init_options` that are passed to this message and save them for future `CreateChannel` messages. ## `CloseChannel` ```rust reference https://github.com/srdtrk/cw-ica-controller/blob/7773fbd8d4e227b6c942f0c88575f9800809b4bf/src/types/msg.rs#L40-L41 ``` This message is used to close the ICS-27 channel. It is only callable by the owner. The channel can then be reopened with parameters (e.g. channel ordering and version) that are different from the original channel open handshake. ## `SendCosmosMsgs` ```rust reference https://github.com/srdtrk/cw-ica-controller/blob/7773fbd8d4e227b6c942f0c88575f9800809b4bf/src/types/msg.rs#L42-L64 ``` Once an ICS-27 channel open handshake is complete, the owner can control the interchain account on the counterparty chain. To give the owner a familiar interface, this message allows the owner to take actions with the interchain account using `CosmosMsg`s. This is the recommended way to use the interchain account. We will go over the fields of this message in detail. ### `messages` This is a list of `CosmosMsg`s that the contract will execute on the counterparty chain using the interchain account. This execution is atomic. If any of the `CosmosMsg`s fail, then the entire execution will fail. :::note All applicable `CosmosMsg`s are supported if the channel was opened with `tx_encoding` set to `proto3`. The `proto3json` encoding is not supported by this contract anymore. | **CosmosMsg** | **Supported** | |:------------------------------------------:|:-------------:| | `Stargate` | ✅ | | `BankMsg::Send` | ✅ | | `BankMsg::Burn` | ❌ | | `IbcMsg::Transfer` | ✅ | | `IbcMsg::SendPacket` | N/A | | `IbcMsg::CloseChannel` | N/A | | `WasmMsg::*` | ✅ | | `GovMsg::*` | ✅ | | `StakingMsg::Delegate` | ✅ | | `StakingMsg::*` | 🟢 | | `DistributionMsg::WithdrawDelegatorReward` | 🟢 | | `DistributionMsg::*` | ✅ | Note that `🟢` means that the `CosmosMsg` is supported but not tested in the contract's test suite. These will be tested in the future. ::: ### `queries` This is a list of `QueryRequest`s that the contract will execute on the counterparty chain using the interchain account. :::warning This feature only works if the host (counterparty) chain is on ibc-go v7.5+. If the host chain is on an older version, then the packet will return an error acknowledgement. ::: :::info If both `messages` and `queries` are provided, then the `messages` will be executed first. If the `messages` are successful, then the `queries` will be executed. If any of the `queries` fail, then the entire execution will fail. ::: :::note In CosmosSDK, query execution is not generally deterministic. This is the main reason why not all query requests are supported. The supported query requests are: | **QueryRequest** | **Supported** | |:-------------------------:|:-------------:| | `BankQuery` | ✅ | | `Stargate` | ✅ | | `WasmQuery::Smart` | ✅ | | `WasmQuery::Raw` | ✅ | | `WasmQuery::ContractInfo` | ✅ | | `WasmQuery::CodeInfo` | ❌ | | `IbcQuery` | ❌ | | `DistributionQuery` | ❌ | Note that not all Stargate queries are supported. Only queries which are marked with [`module_query_safe`](https://github.com/cosmos/cosmos-sdk/blob/27a231ae4816fd8c3ee39a1cc02eccf977fb1b79/proto/cosmos/query/v1/query.proto#L36) tag are supported. You can find a list of supported queries in the [ibc-go documentation](https://ibc.cosmos.network/main/apps/interchain-accounts/messages/#queries) for different versions of ibc-go. Note that `WasmQuery` support works only if the counterparty chain is using wasmd `v0.52+`. Moreover, governance queries (as stargate queries) and `DistributionQuery` will be supported in the next version of the SDK. ::: ### `packet_memo` This is the IBC packet memo that will be included in the ICS-27 packet. It is optional and defaults to `""`. Additionally, the memo field is used by some IBC middleware to execute custom logic on the counterparty chain. But most of these middlewares do not yet support ICS-27 channels. ### `timeout_seconds` This is the timeout in seconds that will be used for the ICS-27 packet. It is optional and defaults to [`DEFAULT_TIMEOUT_SECONDS`](https://github.com/srdtrk/cw-ica-controller/blob/v0.5.0/src/ibc/types/packet.rs#L15-L16). ## `UpdateCallbackAddress` ```rust reference https://github.com/srdtrk/cw-ica-controller/blob/v0.5.0/src/types/msg.rs#L92-L97 ``` This message is used to update the contract address that this contract will send callbacks to. This is useful if the owner wants to change the contract that receives the callbacks. If set to `None`, then no callbacks will be sent. ## `UpdateOwnership` ```rust reference https://github.com/larry0x/cw-plus-plus/blob/ownable-v0.5.0/packages/ownable/derive/src/lib.rs#L86-L90 ``` This message type is provided by the [cw-ownable](https://crates.io/crates/cw-ownable) crate. It wraps a `cw_ownable::Action` enum. ```rust reference https://github.com/larry0x/cw-plus-plus/blob/ownable-v0.5.0/packages/ownable/src/lib.rs#L31-L57 ``` The owner can propose to transfer the ownership of the contract to a new address using `Action::TransferOwnership` and set and expiry time for the proposal. If the proposal is accepted before the expiry time through `Action::AcceptOwnership`, then the ownership of the contract is transferred to the new address. You can learn more about `cw-ownable` in its crate documentation.