Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

47 Commits

Folders and files

Repository files navigation

cw-icq-controller

This CW ICQ Controller is cosmwasm contract to enable ICQ to host chain from chain that doesn't support ICQ as controller chain.

What is ICQ?

Cosmos Interchain Queries (ICQ) is a feature of the Inter-Blockchain Communication (IBC) protocol that enables smart contracts on one Cosmos chain (controller) to read data from another chain (host). It acts as a cross-chain read mechanism, allowing developers to query remote chain states—such as account balances—without needing oracle services.

Create ICQ Channel

This contract provides two ways to create an ICQ channel:

  • Using InstantiateMsg
  • Using ExecuteMsg::CreateChannel

Flow

  1. Contract will create ICQ channel on instantiation/create channel call
  2. Query the channel to get channel number and state using get_channel
  3. Call send_balance_query to query address balance on other chain using specific channel_id and denom, on callback it will update contract state balance for the address
  4. Query the address balances using balances query

How to Instantiate:

archwayd tx wasm instantiate codeid '{"channel_open_init_options":{"connection_id": "connection-120","counterparty_port_id": "icqhost","channel_ordering": "ORDER_UNORDERED"}}' --label icq-1 --from name --admin name

This instantiation will create new channel using connection-120 with counterparty_port_id set to icqhost

How to Query Channel:

archwayd query wasm contract-state smart cw-icq-contract '{ "get_channel": {}}'

Execute send_balance_query to Other chain:

archwayd tx wasm execute archway1wak8sp9ksjk39h4slcvu3q7t7da055nz6wtfsh592jg4snr69upq0gnkxl '{ "send_balance_query": { "channel_id": "channel-239", "address": "osmo1vnglhewf3w66cquy6hr7urjv3589srhelhn6df", "denom": "uosmo" }}'

Query the address balance from the contract:

archwayd query wasm contract-state smart archway1wak8sp9ksjk39h4slcvu3q7t7da055nz6wtfsh592jg4snr69upq0gnkxl '{"balances":{"address": "osmo1vnglhewf3w66cquy6hr7urjv3589srhelhn6df"}}'

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages