cosmos-sdk: github.com/cosmos/cosmos-sdk/x/ibc-transfer/types Index | Files

package types

import "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"

Index

Package Files

codec.go coin.go errors.go events.go expected_keepers.go genesis.go genesis.pb.go keys.go msgs.go packet.go transfer.pb.go

Constants

const (
    EventTypeTimeout      = "timeout"
    EventTypePacket       = "fungible_token_packet"
    EventTypeTransfer     = "ibc_transfer"
    EventTypeChannelClose = "channel_closed"

    AttributeKeyReceiver       = "receiver"
    AttributeKeyDenom          = "denom"
    AttributeKeyAmount         = "amount"
    AttributeKeyRefundReceiver = "refund_receiver"
    AttributeKeyRefundDenom    = "refund_denom"
    AttributeKeyRefundAmount   = "refund_amount"
    AttributeKeyAckSuccess     = "success"
    AttributeKeyAckError       = "error"
)

IBC transfer events

const (
    // ModuleName defines the IBC transfer name
    ModuleName = "transfer"

    // Version defines the current version the IBC tranfer
    // module supports
    Version = "ics20-1"

    // PortID is the default port id that transfer module binds to
    PortID = "transfer"

    // StoreKey is the store key string for IBC transfer
    StoreKey = ModuleName

    // RouterKey is the message route for IBC transfer
    RouterKey = ModuleName

    // QuerierRoute is the querier route for IBC transfer
    QuerierRoute = ModuleName
)
const (
    TypeMsgTransfer = "transfer"
)

msg types

Variables

var (
    ErrInvalidPacketTimeout    = sdkerrors.Register(ModuleName, 2, "invalid packet timeout")
    ErrInvalidDenomForTransfer = sdkerrors.Register(ModuleName, 3, "invalid denomination for cross-chain transfer")
    ErrInvalidVersion          = sdkerrors.Register(ModuleName, 4, "invalid ICS20 version")
    ErrInvalidAmount           = sdkerrors.Register(ModuleName, 5, "invalid token amount")
)

IBC channel sentinel errors

var (
    ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
    ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
var (
    // DefaultRelativePacketTimeoutHeight is the default packet timeout height (in blocks) relative
    // to the current block height of the counterparty chain provided by the client state. The
    // timeout is disabled when set to 0.
    DefaultRelativePacketTimeoutHeight = uint64(1000)

    // DefaultRelativePacketTimeoutTimestamp is the default packet timeout timestamp (in nanoseconds)
    // relative to the current block timestamp of the counterparty chain provided by the client
    // state. The timeout is disabled when set to 0. The default is currently set to a 10 minute
    // timeout.
    DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
)
var (
    ErrInvalidLengthTransfer        = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowTransfer          = fmt.Errorf("proto: integer overflow")
    ErrUnexpectedEndOfGroupTransfer = fmt.Errorf("proto: unexpected end of group")
)
var (
    // ModuleCdc references the global x/ibc-transfer module codec. Note, the codec
    // should ONLY be used in certain instances of tests and for JSON encoding.
    //
    // The actual codec used for serialization should be provided to x/ibc-transfer and
    // defined at the application level.
    ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
)
var PortKey = []byte{0x01}

PortKey defines the key to store the port ID in store

func GetDenomPrefix Uses

func GetDenomPrefix(portID, channelID string) string

GetDenomPrefix returns the receiving denomination prefix

func GetEscrowAddress Uses

func GetEscrowAddress(portID, channelID string) sdk.AccAddress

GetEscrowAddress returns the escrow address for the specified channel

CONTRACT: this assumes that there's only one bank bridge module that owns the port associated with the channel ID so that the address created is actually unique.

func GetPrefixedCoin Uses

func GetPrefixedCoin(portID, channelID string, coin sdk.Coin) sdk.Coin

GetPrefixedCoin creates a copy of the given coin with the prefixed denom

func GetPrefixedDenom Uses

func GetPrefixedDenom(portID, channelID, baseDenom string) string

GetPrefixedDenom returns the denomination with the portID and channelID prefixed

func GetTransferCoin Uses

func GetTransferCoin(portID, channelID, baseDenom string, amount int64) sdk.Coin

GetTransferCoin creates a transfer coin with the port ID and channel ID prefixed to the base denom.

func ReceiverChainIsSource Uses

func ReceiverChainIsSource(sourcePort, sourceChannel, denom string) bool

ReceiverChainIsSource returns true if the denomination originally came from the receiving chain and false otherwise.

func RegisterInterfaces Uses

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

RegisterInterfaces register the ibc transfer module interfaces to protobuf Any.

func SenderChainIsSource Uses

func SenderChainIsSource(sourcePort, sourceChannel, denom string) bool

SenderChainIsSource returns false if the denomination originally came from the receiving chain and true otherwise.

type AccountKeeper Uses

type AccountKeeper interface {
    GetModuleAddress(name string) sdk.AccAddress
    GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI
}

AccountKeeper defines the contract required for account APIs.

type BankKeeper Uses

type BankKeeper interface {
    SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
    MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
    BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
    SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
    SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}

BankKeeper defines the expected bank keeper

type ChannelKeeper Uses

type ChannelKeeper interface {
    GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
    GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
    SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet channelexported.PacketI) error
    PacketExecuted(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet channelexported.PacketI, acknowledgement []byte) error
    ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
}

ChannelKeeper defines the expected IBC channel keeper

type ClientKeeper Uses

type ClientKeeper interface {
    GetClientConsensusState(ctx sdk.Context, clientID string) (connection clientexported.ConsensusState, found bool)
}

ClientKeeper defines the expected IBC client keeper

type ConnectionKeeper Uses

type ConnectionKeeper interface {
    GetConnection(ctx sdk.Context, connectionID string) (connection connectiontypes.ConnectionEnd, found bool)
}

ConnectionKeeper defines the expected IBC connection keeper

type FungibleTokenPacketAcknowledgement Uses

type FungibleTokenPacketAcknowledgement struct {
    Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
    Error   string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
}

FungibleTokenPacketAcknowledgement contains a boolean success flag and an optional error msg error msg is empty string on success See spec for onAcknowledgePacket: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#packet-relay

func (*FungibleTokenPacketAcknowledgement) Descriptor Uses

func (*FungibleTokenPacketAcknowledgement) Descriptor() ([]byte, []int)

func (FungibleTokenPacketAcknowledgement) GetBytes Uses

func (ack FungibleTokenPacketAcknowledgement) GetBytes() []byte

GetBytes is a helper for serialising

func (*FungibleTokenPacketAcknowledgement) GetError Uses

func (m *FungibleTokenPacketAcknowledgement) GetError() string

func (*FungibleTokenPacketAcknowledgement) GetSuccess Uses

func (m *FungibleTokenPacketAcknowledgement) GetSuccess() bool

func (*FungibleTokenPacketAcknowledgement) Marshal Uses

func (m *FungibleTokenPacketAcknowledgement) Marshal() (dAtA []byte, err error)

func (*FungibleTokenPacketAcknowledgement) MarshalTo Uses

func (m *FungibleTokenPacketAcknowledgement) MarshalTo(dAtA []byte) (int, error)

func (*FungibleTokenPacketAcknowledgement) MarshalToSizedBuffer Uses

func (m *FungibleTokenPacketAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*FungibleTokenPacketAcknowledgement) ProtoMessage Uses

func (*FungibleTokenPacketAcknowledgement) ProtoMessage()

func (*FungibleTokenPacketAcknowledgement) Reset Uses

func (m *FungibleTokenPacketAcknowledgement) Reset()

func (*FungibleTokenPacketAcknowledgement) Size Uses

func (m *FungibleTokenPacketAcknowledgement) Size() (n int)

func (*FungibleTokenPacketAcknowledgement) String Uses

func (m *FungibleTokenPacketAcknowledgement) String() string

func (*FungibleTokenPacketAcknowledgement) Unmarshal Uses

func (m *FungibleTokenPacketAcknowledgement) Unmarshal(dAtA []byte) error

func (*FungibleTokenPacketAcknowledgement) XXX_DiscardUnknown Uses

func (m *FungibleTokenPacketAcknowledgement) XXX_DiscardUnknown()

func (*FungibleTokenPacketAcknowledgement) XXX_Marshal Uses

func (m *FungibleTokenPacketAcknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FungibleTokenPacketAcknowledgement) XXX_Merge Uses

func (m *FungibleTokenPacketAcknowledgement) XXX_Merge(src proto.Message)

func (*FungibleTokenPacketAcknowledgement) XXX_Size Uses

func (m *FungibleTokenPacketAcknowledgement) XXX_Size() int

func (*FungibleTokenPacketAcknowledgement) XXX_Unmarshal Uses

func (m *FungibleTokenPacketAcknowledgement) XXX_Unmarshal(b []byte) error

type FungibleTokenPacketData Uses

type FungibleTokenPacketData struct {
    // the token denomination to be transferred
    Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
    // the token amount to be transferred
    Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
    // the sender address
    Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"`
    // the recipient address on the destination chain
    Receiver string `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"`
}

FungibleTokenPacketData defines a struct for the packet payload See FungibleTokenPacketData spec: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures

func NewFungibleTokenPacketData Uses

func NewFungibleTokenPacketData(
    denom string, amount uint64,
    sender, receiver string,
) FungibleTokenPacketData

NewFungibleTokenPacketData contructs a new FungibleTokenPacketData instance

func (*FungibleTokenPacketData) Descriptor Uses

func (*FungibleTokenPacketData) Descriptor() ([]byte, []int)

func (*FungibleTokenPacketData) GetAmount Uses

func (m *FungibleTokenPacketData) GetAmount() uint64

func (FungibleTokenPacketData) GetBytes Uses

func (ftpd FungibleTokenPacketData) GetBytes() []byte

GetBytes is a helper for serialising

func (*FungibleTokenPacketData) GetDenom Uses

func (m *FungibleTokenPacketData) GetDenom() string

func (*FungibleTokenPacketData) GetReceiver Uses

func (m *FungibleTokenPacketData) GetReceiver() string

func (*FungibleTokenPacketData) GetSender Uses

func (m *FungibleTokenPacketData) GetSender() string

func (*FungibleTokenPacketData) Marshal Uses

func (m *FungibleTokenPacketData) Marshal() (dAtA []byte, err error)

func (*FungibleTokenPacketData) MarshalTo Uses

func (m *FungibleTokenPacketData) MarshalTo(dAtA []byte) (int, error)

func (*FungibleTokenPacketData) MarshalToSizedBuffer Uses

func (m *FungibleTokenPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*FungibleTokenPacketData) ProtoMessage Uses

func (*FungibleTokenPacketData) ProtoMessage()

func (*FungibleTokenPacketData) Reset Uses

func (m *FungibleTokenPacketData) Reset()

func (*FungibleTokenPacketData) Size Uses

func (m *FungibleTokenPacketData) Size() (n int)

func (*FungibleTokenPacketData) String Uses

func (m *FungibleTokenPacketData) String() string

func (*FungibleTokenPacketData) Unmarshal Uses

func (m *FungibleTokenPacketData) Unmarshal(dAtA []byte) error

func (FungibleTokenPacketData) ValidateBasic Uses

func (ftpd FungibleTokenPacketData) ValidateBasic() error

ValidateBasic is used for validating the token transfer

func (*FungibleTokenPacketData) XXX_DiscardUnknown Uses

func (m *FungibleTokenPacketData) XXX_DiscardUnknown()

func (*FungibleTokenPacketData) XXX_Marshal Uses

func (m *FungibleTokenPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FungibleTokenPacketData) XXX_Merge Uses

func (m *FungibleTokenPacketData) XXX_Merge(src proto.Message)

func (*FungibleTokenPacketData) XXX_Size Uses

func (m *FungibleTokenPacketData) XXX_Size() int

func (*FungibleTokenPacketData) XXX_Unmarshal Uses

func (m *FungibleTokenPacketData) XXX_Unmarshal(b []byte) error

type GenesisState Uses

type GenesisState struct {
    PortID string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"`
}

GenesisState is currently only used to ensure that the InitGenesis gets run by the module manager

func DefaultGenesisState Uses

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a GenesisState with "transfer" as the default PortID.

func (*GenesisState) Descriptor Uses

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetPortID Uses

func (m *GenesisState) GetPortID() string

func (*GenesisState) Marshal Uses

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo Uses

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer Uses

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage Uses

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset Uses

func (m *GenesisState) Reset()

func (*GenesisState) Size Uses

func (m *GenesisState) Size() (n int)

func (*GenesisState) String Uses

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal Uses

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate Uses

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown Uses

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal Uses

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge Uses

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size Uses

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal Uses

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type MsgTransfer Uses

type MsgTransfer struct {
    // the port on which the packet will be sent
    SourcePort string `protobuf:"bytes,1,opt,name=source_port,json=sourcePort,proto3" json:"source_port,omitempty" yaml:"source_port"`
    // the channel by which the packet will be sent
    SourceChannel string `protobuf:"bytes,2,opt,name=source_channel,json=sourceChannel,proto3" json:"source_channel,omitempty" yaml:"source_channel"`
    // the tokens to be transferred
    Token types.Coin `protobuf:"bytes,3,opt,name=token,proto3" json:"token"`
    // the sender address
    Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"`
    // the recipient address on the destination chain
    Receiver string `protobuf:"bytes,5,opt,name=receiver,proto3" json:"receiver,omitempty"`
    // Timeout height relative to the current block height.
    // The timeout is disabled when set to 0.
    TimeoutHeight uint64 `protobuf:"varint,6,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty" yaml:"timeout_height"`
    // Timeout timestamp (in nanoseconds) relative to the current block timestamp.
    // The timeout is disabled when set to 0.
    TimeoutTimestamp uint64 `protobuf:"varint,7,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty" yaml:"timeout_timestamp"`
}

MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between ICS20 enabled chains. See ICS Spec here: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures

func NewMsgTransfer Uses

func NewMsgTransfer(
    sourcePort, sourceChannel string,
    token sdk.Coin, sender sdk.AccAddress, receiver string,
    timeoutHeight, timeoutTimestamp uint64,
) *MsgTransfer

NewMsgTransfer creates a new MsgTransfer instance

func (*MsgTransfer) Descriptor Uses

func (*MsgTransfer) Descriptor() ([]byte, []int)

func (*MsgTransfer) GetReceiver Uses

func (m *MsgTransfer) GetReceiver() string

func (*MsgTransfer) GetSender Uses

func (m *MsgTransfer) GetSender() github_com_cosmos_cosmos_sdk_types.AccAddress

func (MsgTransfer) GetSignBytes Uses

func (msg MsgTransfer) GetSignBytes() []byte

GetSignBytes implements sdk.Msg

func (MsgTransfer) GetSigners Uses

func (msg MsgTransfer) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (*MsgTransfer) GetSourceChannel Uses

func (m *MsgTransfer) GetSourceChannel() string

func (*MsgTransfer) GetSourcePort Uses

func (m *MsgTransfer) GetSourcePort() string

func (*MsgTransfer) GetTimeoutHeight Uses

func (m *MsgTransfer) GetTimeoutHeight() uint64

func (*MsgTransfer) GetTimeoutTimestamp Uses

func (m *MsgTransfer) GetTimeoutTimestamp() uint64

func (*MsgTransfer) GetToken Uses

func (m *MsgTransfer) GetToken() types.Coin

func (*MsgTransfer) Marshal Uses

func (m *MsgTransfer) Marshal() (dAtA []byte, err error)

func (*MsgTransfer) MarshalTo Uses

func (m *MsgTransfer) MarshalTo(dAtA []byte) (int, error)

func (*MsgTransfer) MarshalToSizedBuffer Uses

func (m *MsgTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgTransfer) ProtoMessage Uses

func (*MsgTransfer) ProtoMessage()

func (*MsgTransfer) Reset Uses

func (m *MsgTransfer) Reset()

func (MsgTransfer) Route Uses

func (MsgTransfer) Route() string

Route implements sdk.Msg

func (*MsgTransfer) Size Uses

func (m *MsgTransfer) Size() (n int)

func (*MsgTransfer) String Uses

func (m *MsgTransfer) String() string

func (MsgTransfer) Type Uses

func (MsgTransfer) Type() string

Type implements sdk.Msg

func (*MsgTransfer) Unmarshal Uses

func (m *MsgTransfer) Unmarshal(dAtA []byte) error

func (MsgTransfer) ValidateBasic Uses

func (msg MsgTransfer) ValidateBasic() error

ValidateBasic performs a basic check of the MsgTransfer fields. NOTE: timeout height or timestamp values can be 0 to disable the timeout.

func (*MsgTransfer) XXX_DiscardUnknown Uses

func (m *MsgTransfer) XXX_DiscardUnknown()

func (*MsgTransfer) XXX_Marshal Uses

func (m *MsgTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgTransfer) XXX_Merge Uses

func (m *MsgTransfer) XXX_Merge(src proto.Message)

func (*MsgTransfer) XXX_Size Uses

func (m *MsgTransfer) XXX_Size() int

func (*MsgTransfer) XXX_Unmarshal Uses

func (m *MsgTransfer) XXX_Unmarshal(b []byte) error

type PortKeeper Uses

type PortKeeper interface {
    BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability
}

PortKeeper defines the expected IBC port keeper

Package types imports 20 packages (graph) and is imported by 8 packages. Updated 2020-08-05. Refresh now. Tools for package owners.