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

package types

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

Index

Package Files

errors.go keys.go module.go router.go utils.go

Constants

const (
    // SubModuleName defines the IBC port name
    SubModuleName = "port"

    // StoreKey is the store key string for IBC ports
    StoreKey = SubModuleName

    // RouterKey is the message route for IBC ports
    RouterKey = SubModuleName

    // QuerierRoute is the querier route for IBC ports
    QuerierRoute = SubModuleName
)

Variables

var (
    ErrPortExists   = sdkerrors.Register(SubModuleName, 2, "port is already binded")
    ErrPortNotFound = sdkerrors.Register(SubModuleName, 3, "port not found")
    ErrInvalidPort  = sdkerrors.Register(SubModuleName, 4, "invalid port")
    ErrInvalidRoute = sdkerrors.Register(SubModuleName, 5, "route not found")
)

IBC port sentinel errors

func GetModuleOwner Uses

func GetModuleOwner(modules []string) string

GetModuleOwner enforces that only IBC and the module bound to port can own the capability while future implementations may allow multiple modules to bind to a port, currently we only allow one module to be bound to a port at any given time

type IBCModule Uses

type IBCModule interface {
    OnChanOpenInit(
        ctx sdk.Context,
        order channeltypes.Order,
        connectionHops []string,
        portID string,
        channelID string,
        channelCap *capabilitytypes.Capability,
        counterParty channeltypes.Counterparty,
        version string,
    ) error

    OnChanOpenTry(
        ctx sdk.Context,
        order channeltypes.Order,
        connectionHops []string,
        portID,
        channelID string,
        channelCap *capabilitytypes.Capability,
        counterparty channeltypes.Counterparty,
        version,
        counterpartyVersion string,
    ) error

    OnChanOpenAck(
        ctx sdk.Context,
        portID,
        channelID string,
        counterpartyVersion string,
    ) error

    OnChanOpenConfirm(
        ctx sdk.Context,
        portID,
        channelID string,
    ) error

    OnChanCloseInit(
        ctx sdk.Context,
        portID,
        channelID string,
    ) error

    OnChanCloseConfirm(
        ctx sdk.Context,
        portID,
        channelID string,
    ) error

    // OnRecvPacket must return the acknowledgement bytes
    OnRecvPacket(
        ctx sdk.Context,
        packet channeltypes.Packet,
    ) (*sdk.Result, []byte, error)

    OnAcknowledgementPacket(
        ctx sdk.Context,
        packet channeltypes.Packet,
        acknowledgement []byte,
    ) (*sdk.Result, error)

    OnTimeoutPacket(
        ctx sdk.Context,
        packet channeltypes.Packet,
    ) (*sdk.Result, error)
}

IBCModule defines an interface that implements all the callbacks that modules must define as specified in ICS-26

type Router Uses

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

The router is a map from module name to the IBCModule which contains all the module-defined callbacks required by ICS-26

func NewRouter Uses

func NewRouter() *Router

func (*Router) AddRoute Uses

func (rtr *Router) AddRoute(module string, cbs IBCModule) *Router

AddRoute adds IBCModule for a given module name. It returns the Router so AddRoute calls can be linked. It will panic if the Router is sealed.

func (*Router) GetRoute Uses

func (rtr *Router) GetRoute(module string) (IBCModule, bool)

GetRoute returns a IBCModule for a given module.

func (*Router) HasRoute Uses

func (rtr *Router) HasRoute(module string) bool

HasRoute returns true if the Router has a module registered or false otherwise.

func (*Router) Seal Uses

func (rtr *Router) Seal()

Seal prevents the Router from any subsequent route handlers to be registered. Seal will panic if called more than once.

func (Router) Sealed Uses

func (rtr Router) Sealed() bool

Sealed returns a boolean signifying if the Router is sealed or not.

Package types imports 5 packages (graph) and is imported by 6 packages. Updated 2020-06-30. Refresh now. Tools for package owners.