Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: Add IBC TransferV2 #611

Open
wants to merge 5 commits into
base: feat/ibc_eureka
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
48 changes: 48 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,29 @@ type TransferMsg struct {
Memo string `json:"memo,omitempty"`
}

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

type TransferV2Msg struct {
// 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.
Memo string `json:"memo,omitempty"`
// 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"`
// The transfer can be of type:
// * Direct,
// * Forwarding,
// * Forwarding with unwind flag set.
TransferType TransferV2Type `json:"transfer_type"`
}

type SendPacketMsg struct {
ChannelID string `json:"channel_id"`
Data []byte `json:"data"`
Expand Down Expand Up @@ -429,3 +453,27 @@ type ClearAdminMsg struct {
// ContractAddr is the sdk.AccAddress of the target contract.
ContractAddr string `json:"contract_addr"`
}

type DirectType struct {
// Existing channel to send the tokens over.
ChannelID string `json:"channel_id"`
// When packet times out, measured on remote chain.
IBCTimeout IBCTimeout `json:"ibc_timeout"`
}
type MultiHopType struct {
// Existing channel to send the tokens over.
ChannelID string `json:"channel_id"`
Hops Array[Hop] `json:"hops"`
// When packet times out, measured on remote chain. TimestampHeight is not supported in ibc-go Transfer V2.
Timeout Uint64 `json:"timeout"`
}
type UnwindingType struct {
Hops Array[Hop] `json:"hops"`
// When packet times out, measured on remote chain. TimestampHeight is not supported in ibc-go Transfer V2.
Timeout Uint64 `json:"timeout"`
}
type TransferV2Type struct {
Direct *DirectType `json:"direct,omitempty"`
MultiHop *MultiHopType `json:"multi_hop,omitempty"`
Unwinding *UnwindingType `json:"unwinding,omitempty"`
}