ibc

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = "ibc"

	// IBC errors reserve 200 - 299.
	CodeInvalidSequence sdk.CodeType = 200
	CodeIdenticalChains sdk.CodeType = 201
	CodeUnknownRequest  sdk.CodeType = sdk.CodeUnknownRequest
)

IBC errors reserve 200 ~ 299.

Variables

This section is empty.

Functions

func EgressKey

func EgressKey(destChain string, index uint64) []byte

Stores an outgoing IBC packet under "egress/chain_id/index".

func EgressLengthKey

func EgressLengthKey(destChain string) []byte

Stores the number of outgoing IBC packets under "egress/index".

func ErrIdenticalChains

func ErrIdenticalChains(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidSequence

func ErrInvalidSequence(codespace sdk.CodespaceType) sdk.Error

nolint

func IngressSequenceKey

func IngressSequenceKey(srcChain string) []byte

Stores the sequence number of incoming IBC packet under "ingress/index".

func NewHandler

func NewHandler(ibcm Mapper, ck BankKeeper) sdk.Handler

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

Types

type BankKeeper

type BankKeeper interface {
	AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
	SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
}

expected bank keeper

type IBCPacket

type IBCPacket struct {
	SrcAddr   sdk.AccAddress `json:"src_addr"`
	DestAddr  sdk.AccAddress `json:"dest_addr"`
	Coins     sdk.Coins      `json:"coins"`
	SrcChain  string         `json:"src_chain"`
	DestChain string         `json:"dest_chain"`
}

nolint - TODO rename to Packet as IBCPacket stutters (golint) IBCPacket defines a piece of data that can be send between two separate blockchains.

func NewIBCPacket

func NewIBCPacket(srcAddr sdk.AccAddress, destAddr sdk.AccAddress, coins sdk.Coins,
	srcChain string, destChain string) IBCPacket

func (IBCPacket) GetSignBytes

func (p IBCPacket) GetSignBytes() []byte

nolint

func (IBCPacket) ValidateBasic

func (p IBCPacket) ValidateBasic() sdk.Error

validator the ibc packey

type Mapper

type Mapper struct {
	// contains filtered or unexported fields
}

IBC Mapper

func NewMapper

func NewMapper(cdc *codec.Codec, key sdk.StoreKey, codespace sdk.CodespaceType) Mapper

XXX: The Mapper should not take a CoinKeeper. Rather have the CoinKeeper take an Mapper.

func (Mapper) GetIngressSequence

func (ibcm Mapper) GetIngressSequence(ctx sdk.Context, srcChain string) uint64

TODO add description

func (Mapper) PostIBCPacket

func (ibcm Mapper) PostIBCPacket(ctx sdk.Context, packet IBCPacket) sdk.Error

XXX: This is not the public API. This will change in MVP2 and will henceforth only be invoked from another module directly and not through a user transaction. TODO: Handle invalid IBC packets and return errors.

func (Mapper) ReceiveIBCPacket

func (ibcm Mapper) ReceiveIBCPacket(ctx sdk.Context, packet IBCPacket) sdk.Error

XXX: In the future every module is able to register it's own handler for handling it's own IBC packets. The "ibc" handler will only route the packets to the appropriate callbacks. XXX: For now this handles all interactions with the CoinKeeper. XXX: This needs to do some authentication checking.

func (Mapper) SetIngressSequence

func (ibcm Mapper) SetIngressSequence(ctx sdk.Context, srcChain string, sequence uint64)

TODO add description

type MsgIBCReceive

type MsgIBCReceive struct {
	IBCPacket
	Relayer  sdk.AccAddress
	Sequence uint64
}

nolint - TODO rename to ReceiveMsg as folks will reference with ibc.ReceiveMsg MsgIBCReceive defines the message that a relayer uses to post an IBCPacket to the destination chain.

func (MsgIBCReceive) GetSignBytes

func (msg MsgIBCReceive) GetSignBytes() []byte

get the sign bytes for ibc receive message

func (MsgIBCReceive) GetSigners

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

x/bank/tx.go MsgSend.GetSigners()

func (MsgIBCReceive) Route

func (msg MsgIBCReceive) Route() string

nolint

func (MsgIBCReceive) Type

func (msg MsgIBCReceive) Type() string

func (MsgIBCReceive) ValidateBasic

func (msg MsgIBCReceive) ValidateBasic() sdk.Error

type MsgIBCTransfer

type MsgIBCTransfer struct {
	IBCPacket
}

nolint - TODO rename to TransferMsg as folks will reference with ibc.TransferMsg MsgIBCTransfer defines how another module can send an IBCPacket.

func (MsgIBCTransfer) GetSignBytes

func (msg MsgIBCTransfer) GetSignBytes() []byte

get the sign bytes for ibc transfer message

func (MsgIBCTransfer) GetSigners

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

x/bank/tx.go MsgSend.GetSigners()

func (MsgIBCTransfer) Route

func (msg MsgIBCTransfer) Route() string

nolint

func (MsgIBCTransfer) Type

func (msg MsgIBCTransfer) Type() string

func (MsgIBCTransfer) ValidateBasic

func (msg MsgIBCTransfer) ValidateBasic() sdk.Error

validate ibc transfer message

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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