Skip to content

Commit

Permalink
feat: Add IBC TransferV2
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikthebird committed Jan 27, 2025
1 parent 0b82922 commit 2a1a4ad
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 14 deletions.
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
40 changes: 40 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,45 @@ type TransferMsg struct {
Memo string `json:"memo,omitempty"`
}

type Token struct {
Amount string `json:"amount"`
Base string `json:"base"`
Trace Array[Hop] `json:"trace"`
}

type Forwarding struct {
Hops Array[Hop] `json:"hops"`
Memo string `json:"memo"`
}

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"`
Forwarding Forwarding `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"`
// packet data only supports one coin
// https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20
Tokens Array[Token] `json:"tokens"`
}

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

0 comments on commit 2a1a4ad

Please sign in to comment.