types

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeTimeout      = "timeout"
	EventTypePacket       = "fungible_token_packet"
	EventTypeChannelClose = "channel_closed"

	AttributeKeyReceiver       = "receiver"
	AttributeKeyValue          = "value"
	AttributeKeyRefundReceiver = "refund_receiver"
	AttributeKeyRefundValue    = "refund_value"
	AttributeKeyAckSuccess     = "success"
	AttributeKeyAckError       = "error"
)

IBC transfer events

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

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

	// Default PortID 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

	// Key to store portID in our store
	PortKey = "portID"

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

msg types

Variables

View Source
var (
	ErrInvalidPacketTimeout    = sdkerrors.Register(ModuleName, 2, "invalid packet timeout")
	ErrOnlyOneDenomAllowed     = sdkerrors.Register(ModuleName, 3, "only one denom allowed")
	ErrInvalidDenomForTransfer = sdkerrors.Register(ModuleName, 4, "invalid denomination for cross-chain transfer")
)

IBC channel sentinel errors

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	AttributeValueCategory = fmt.Sprintf("%s_%s", host.ModuleName, ModuleName)
)

IBC transfer events vars

View Source
var (

	// ModuleCdc references the global x/ibc/20-transfer module codec. Note, the codec
	// should ONLY be used in certain instances of tests and for JSON encoding as Amino
	// is still used for that purpose.
	//
	// The actual codec used for serialization should be provided to x/ibc/20-transfer and
	// defined at the application level.
	ModuleCdc = codec.NewHybridCodec(amino, cdctypes.NewInterfaceRegistry())
)

Functions

func GetDenomPrefix

func GetDenomPrefix(portID, channelID string) string

GetDenomPrefix returns the receiving denomination prefix

func GetEscrowAddress

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 GetModuleAccountName

func GetModuleAccountName() string

GetModuleAccountName returns the IBC transfer module account name for supply

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the IBC transfer types

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

RegisterInterfaces register the ibc transfer module interfaces to protobuf Any.

Types

type AccountKeeper

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

AccountKeeper defines the contract required for account APIs.

type BankKeeper

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

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 *capability.Capability, packet channelexported.PacketI) error
	PacketExecuted(ctx sdk.Context, chanCap *capability.Capability, packet channelexported.PacketI, acknowledgement []byte) error
	ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capability.Capability) error
}

ChannelKeeper defines the expected IBC channel keeper

type ClientKeeper

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

ClientKeeper defines the expected IBC client keeper

type ConnectionKeeper

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

ConnectionKeeper defines the expected IBC connection keeper

type FungibleTokenPacketAcknowledgement

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

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

func (FungibleTokenPacketAcknowledgement) GetBytes

func (ack FungibleTokenPacketAcknowledgement) GetBytes() []byte

GetBytes is a helper for serialising

func (*FungibleTokenPacketAcknowledgement) GetError

func (*FungibleTokenPacketAcknowledgement) GetSuccess

func (m *FungibleTokenPacketAcknowledgement) GetSuccess() bool

func (*FungibleTokenPacketAcknowledgement) Marshal

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

func (*FungibleTokenPacketAcknowledgement) MarshalTo

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

func (*FungibleTokenPacketAcknowledgement) MarshalToSizedBuffer

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

func (*FungibleTokenPacketAcknowledgement) ProtoMessage

func (*FungibleTokenPacketAcknowledgement) ProtoMessage()

func (*FungibleTokenPacketAcknowledgement) Reset

func (*FungibleTokenPacketAcknowledgement) Size

func (*FungibleTokenPacketAcknowledgement) String

func (*FungibleTokenPacketAcknowledgement) Unmarshal

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

func (*FungibleTokenPacketAcknowledgement) XXX_DiscardUnknown

func (m *FungibleTokenPacketAcknowledgement) XXX_DiscardUnknown()

func (*FungibleTokenPacketAcknowledgement) XXX_Marshal

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

func (*FungibleTokenPacketAcknowledgement) XXX_Merge

func (*FungibleTokenPacketAcknowledgement) XXX_Size

func (*FungibleTokenPacketAcknowledgement) XXX_Unmarshal

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

type FungibleTokenPacketData

type FungibleTokenPacketData struct {
	// the tokens to be transferred
	Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/KiraCore/cosmos-sdk/types.Coins" json:"amount"`
	// the sender address
	Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"`
	// the recipient address on the destination chain
	Receiver string `protobuf:"bytes,3,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

func NewFungibleTokenPacketData(
	amount sdk.Coins, sender, receiver string) FungibleTokenPacketData

NewFungibleTokenPacketData contructs a new FungibleTokenPacketData instance

func (*FungibleTokenPacketData) Descriptor

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

func (*FungibleTokenPacketData) GetAmount

func (FungibleTokenPacketData) GetBytes

func (ftpd FungibleTokenPacketData) GetBytes() []byte

GetBytes is a helper for serialising

func (*FungibleTokenPacketData) GetReceiver

func (m *FungibleTokenPacketData) GetReceiver() string

func (*FungibleTokenPacketData) GetSender

func (m *FungibleTokenPacketData) GetSender() string

func (*FungibleTokenPacketData) Marshal

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

func (*FungibleTokenPacketData) MarshalTo

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

func (*FungibleTokenPacketData) MarshalToSizedBuffer

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

func (*FungibleTokenPacketData) ProtoMessage

func (*FungibleTokenPacketData) ProtoMessage()

func (*FungibleTokenPacketData) Reset

func (m *FungibleTokenPacketData) Reset()

func (*FungibleTokenPacketData) Size

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

func (*FungibleTokenPacketData) String

func (m *FungibleTokenPacketData) String() string

func (*FungibleTokenPacketData) Unmarshal

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

func (FungibleTokenPacketData) ValidateBasic

func (ftpd FungibleTokenPacketData) ValidateBasic() error

ValidateBasic is used for validating the token transfer

func (*FungibleTokenPacketData) XXX_DiscardUnknown

func (m *FungibleTokenPacketData) XXX_DiscardUnknown()

func (*FungibleTokenPacketData) XXX_Marshal

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

func (*FungibleTokenPacketData) XXX_Merge

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

func (*FungibleTokenPacketData) XXX_Size

func (m *FungibleTokenPacketData) XXX_Size() int

func (*FungibleTokenPacketData) XXX_Unmarshal

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

type GenesisState

type GenesisState struct {
	PortID string `json:"portid" yaml:"portid"`
}

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

func DefaultGenesis

func DefaultGenesis() GenesisState

type MsgTransfer

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 current height of the destination chain
	DestinationHeight uint64 `` /* 139-byte string literal not displayed */
	// the tokens to be transferred
	Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=amount,proto3,castrepeated=github.com/KiraCore/cosmos-sdk/types.Coins" json:"amount"`
	// the sender address
	Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=sender,proto3,casttype=github.com/KiraCore/cosmos-sdk/types.AccAddress" json:"sender,omitempty"`
	// the recipient address on the destination chain
	Receiver string `protobuf:"bytes,6,opt,name=receiver,proto3" json:"receiver,omitempty"`
}

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

func NewMsgTransfer(
	sourcePort, sourceChannel string, destHeight uint64, amount sdk.Coins, sender sdk.AccAddress, receiver string,
) MsgTransfer

NewMsgTransfer creates a new MsgTransfer instance

func (*MsgTransfer) Descriptor

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

func (*MsgTransfer) GetAmount

func (*MsgTransfer) GetDestinationHeight

func (m *MsgTransfer) GetDestinationHeight() uint64

func (*MsgTransfer) GetReceiver

func (m *MsgTransfer) GetReceiver() string

func (*MsgTransfer) GetSender

func (MsgTransfer) GetSignBytes

func (msg MsgTransfer) GetSignBytes() []byte

GetSignBytes implements sdk.Msg

func (MsgTransfer) GetSigners

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

GetSigners implements sdk.Msg

func (*MsgTransfer) GetSourceChannel

func (m *MsgTransfer) GetSourceChannel() string

func (*MsgTransfer) GetSourcePort

func (m *MsgTransfer) GetSourcePort() string

func (*MsgTransfer) Marshal

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

func (*MsgTransfer) MarshalTo

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

func (*MsgTransfer) MarshalToSizedBuffer

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

func (*MsgTransfer) ProtoMessage

func (*MsgTransfer) ProtoMessage()

func (*MsgTransfer) Reset

func (m *MsgTransfer) Reset()

func (MsgTransfer) Route

func (MsgTransfer) Route() string

Route implements sdk.Msg

func (*MsgTransfer) Size

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

func (*MsgTransfer) String

func (m *MsgTransfer) String() string

func (MsgTransfer) Type

func (MsgTransfer) Type() string

Type implements sdk.Msg

func (*MsgTransfer) Unmarshal

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

func (MsgTransfer) ValidateBasic

func (msg MsgTransfer) ValidateBasic() error

ValidateBasic implements sdk.Msg

func (*MsgTransfer) XXX_DiscardUnknown

func (m *MsgTransfer) XXX_DiscardUnknown()

func (*MsgTransfer) XXX_Marshal

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

func (*MsgTransfer) XXX_Merge

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

func (*MsgTransfer) XXX_Size

func (m *MsgTransfer) XXX_Size() int

func (*MsgTransfer) XXX_Unmarshal

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

type PortKeeper

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

PortKeeper defines the expected IBC port keeper

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL