Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add IBC TransferV2 #611

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified internal/api/libwasmvm.x86_64.so
Binary file not shown.
24 changes: 12 additions & 12 deletions libwasmvm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions libwasmvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ default = []
backtraces = []

[dependencies]
cosmwasm-std = { git = "https://github.com/CosmWasm/cosmwasm.git", rev = "v2.2.0", features = [
cosmwasm-std = { git = "https://github.com/CosmWasm/cosmwasm", branch = "tkulik/feat/ibc_transfer_v2", features = [
"staking",
"stargate",
"iterator",
] }
cosmwasm-vm = { git = "https://github.com/CosmWasm/cosmwasm.git", rev = "v2.2.0", features = [
cosmwasm-vm = { git = "https://github.com/CosmWasm/cosmwasm", branch = "tkulik/feat/ibc_transfer_v2", features = [
"staking",
"stargate",
"iterator",
Expand Down
30 changes: 30 additions & 0 deletions types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ type BurnMsg struct {

type IBCMsg struct {
Transfer *TransferMsg `json:"transfer,omitempty"`
TransferV2 *TransferV2Msg `json:"transfer_v2,omitempty"`
SendPacket *SendPacketMsg `json:"send_packet,omitempty"`
WriteAcknowledgement *WriteAcknowledgementMsg `json:"write_acknowledgement,omitempty"`
CloseChannel *CloseChannelMsg `json:"close_channel,omitempty"`
Expand Down Expand Up @@ -238,6 +239,35 @@ type TransferMsg struct {
Memo string `json:"memo,omitempty"`
}

type Hop struct {
ChannelID string `json:"channel_id"`
PortID string `json:"port_id"`
}

type TransferV2Msg struct {
// existing channel to send the tokens over
ChannelID string `json:"channel_id"`
// A struct containing the list of next hops,
// determining where the tokens must be forwarded next.
Forwarding Array[Hop] `json:"forwarding"`
// An optional memo. See the blog post
// ["Moving Beyond Simple Token Transfers"](https://medium.com/the-interchain-foundation/moving-beyond-simple-token-transfers-d42b2b1dc29b)
// for more information.
//
// There is no difference between setting this to `None` or an empty string.
//
// This field is only supported on chains with CosmWasm >= 2.0 and silently ignored on older chains.
// If you need support for both 1.x and 2.x chain with the same codebase, it is recommended to use
// `CosmosMsg::Stargate` with a custom MsgTransfer protobuf encoder instead.
Memo string `json:"memo,omitempty"`
// when packet times out, measured on remote chain
Timeout IBCTimeout `json:"timeout"`
// address on the remote chain to receive these tokens
ToAddress string `json:"to_address"`
// MsgTransfer in v2 version supports multiple coins
Tokens Array[Coin] `json:"tokens"`
}

type SendPacketMsg struct {
ChannelID string `json:"channel_id"`
Data []byte `json:"data"`
Expand Down