cosmos / ibc-go

Inter-Blockchain Communication Protocol (IBC) implementation in Golang.

Home Page:https://ibc.cosmos.network/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: IBC transfers of the entire balance of a particular denomination.

srdtrk opened this issue · comments

Summary

Enhance the UX of interchain workflows by enabling IBC transfers of the entire balance of a particular denomination.

Problem Definition

Consider two chains, Chain A and Chain B. Chain B has a DEX, while Chain A has an ICA controller. If an ICA user on Chain A wants to:

  1. Transfer coins from Chain A to Chain B
  2. Swap the transferred tokens on Chain B using the DEX
  3. Transfer the resulting tokens back to Chain A

Currently, each step of this workflow requires a new IBC packet. We aim to streamline this process by combining steps 2 and 3 into a single ICA packet. Though it may seem feasible to construct an ICA transaction that includes both SwapMsg and MsgTransfer together, in practice, slippage considerations during the swap complicate this. This makes it impossible to determine the exact amount to be transferred at the time of constructing the ICA transaction.

By introducing a CosmosSDK message that allows transferring all coins of a particular denomination, we can effectively combine steps 2 and 3 into a single packet.

This workflow has caused headaches for multiple users.

Use cases

  • Improved ICA workflows
  • Reduced need for ICQ by smart contracts in similar workflows

Proposal

This feature would require modifications only to the transfer message server, not the transfer packet itself. Below are two proposed implementations, though we welcome alternative approaches:

MsgTransferAll

Introduce a new MsgTransferAll to facilitate transfers:

message MsgTransferAll {
  option (cosmos.msg.v1.signer) = "sender";

  option (gogoproto.goproto_getters) = false;

  // the port on which the packet will be sent
  string source_port = 1;
  // the channel by which the packet will be sent
  string source_channel = 2;
  // the sender address
  string sender = 3;
  // the recipient address on the destination chain
  string receiver = 4;
  // Timeout timestamp in absolute nanoseconds since unix epoch.
  // The timeout is disabled when set to 0.
  uint64 timeout_timestamp = 5;
  // optional memo
  string memo = 6;
  // denoms to be transferred
  repeated string denoms = 7 [(gogoproto.nullable) = false];
}

Set amount to UnboundedSpendLimit

Alternatively, we could continue using MsgTransfer. If any amount for any denomination is set to UnboundedSpendLimit(), the sender's entire balance for that denomination will be used.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned

This feature was requested by Timewave and Nomos. Timewave would benefit from having the feature live on Cosmos Hub, Osmosis, Stride, Persistence and Celestia. As of 9/7/24 the version those chains are on:

  • Cosmos Hub 7.6.0
  • Osmosis 7.4.1, with 8.3.2 in main
  • Stride 7.4.0
  • Persistence 7.4.0
  • Celestia 6.2.2