ibc

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoIBCVoucherDenom = errors.New("denom is not an IBC voucher")
	ErrDenomNotFound     = errors.New("denom not found")
	ErrInvalidBaseDenom  = errors.New("invalid base denomination")
)

Functions

func DeriveDecimalsFromDenom

func DeriveDecimalsFromDenom(baseDenom string) (uint8, error)

DeriveDecimalsFromDenom returns the number of decimals of an IBC coin depending on the prefix of the base denomination

func GetDenom added in v0.2.0

func GetDenom(
	transferKeeper TransferKeeper,
	ctx sdk.Context,
	voucherDenom string,
) (transfertypes.Denom, error)

GetDenom returns the denomination from the corresponding IBC denomination. If the denomination is not an IBC voucher or the trace is not found, it returns an error.

func GetReceivedCoin

func GetReceivedCoin(packet channeltypes.Packet, token transfertypes.Token) sdk.Coin

GetReceivedCoin returns the transferred coin from an ICS20 FungibleTokenPacketData as seen from the destination chain. If the receiving chain is the source chain of the tokens, it removes the prefix path added by source (i.e sender) chain to the denom. Otherwise, it adds the prefix path from the destination chain to the denom.

func GetSentCoin

func GetSentCoin(rawDenom, rawAmt string) sdk.Coin

GetSentCoin returns the sent coin from an ICS20 FungibleTokenPacketData.

func GetTransferAmount

func GetTransferAmount(packet channeltypes.Packet) (string, error)

GetTransferAmount returns the amount from an ICS20 FungibleTokenPacketData as a string.

Types

type ClientKeeper added in v0.7.0

type ClientKeeper interface {
	// VerifyMembership retrieves the light client module for the clientID and verifies the proof of the existence of a key-value pair at a specified height.
	VerifyMembership(ctx sdk.Context, clientID string, height ibcexported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path ibcexported.Path, value []byte) error
	// VerifyNonMembership retrieves the light client module for the clientID and verifies the absence of a given key at a specified height.
	VerifyNonMembership(ctx sdk.Context, clientID string, height ibcexported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path ibcexported.Path) error
	// UpdateClient updates the light client state with a new header
	UpdateClient(ctx sdk.Context, clientID string, clientMsg ibcexported.ClientMessage) error
	// GetClientStatus returns the status of a client given the client ID
	GetClientStatus(ctx sdk.Context, clientID string) ibcexported.Status
	// GetClientTimestampAtHeight returns the timestamp for a given height on the client
	// given its client ID and height
	GetClientTimestampAtHeight(ctx sdk.Context, clientID string, height ibcexported.Height) (uint64, error)
	// GetClientState gets a particular client from the store
	GetClientState(ctx sdk.Context, clientID string) (ibcexported.ClientState, bool)
}

type Module

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

Module a concrete type for a module boilerplate.

func NewModule

func NewModule(app porttypes.IBCModule) *Module

NewModule creates a new IBC Module boilerplate given the underlying IBC app

func (Module) OnAcknowledgementPacket

func (im Module) OnAcknowledgementPacket(
	ctx sdk.Context,
	channelVersion string,
	packet channeltypes.Packet,
	acknowledgement []byte,
	relayer sdk.AccAddress,
) error

OnAcknowledgementPacket implements the Module interface. It calls the underlying app's OnAcknowledgementPacket callback.

func (Module) OnChanCloseConfirm

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

OnChanCloseConfirm implements the Module interface. It calls the underlying app's OnChanCloseConfirm callback.

func (Module) OnChanCloseInit

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

OnChanCloseInit implements the Module interface It calls the underlying app's OnChanCloseInit callback.

func (Module) OnChanOpenAck

func (im Module) OnChanOpenAck(
	ctx sdk.Context,
	portID,
	channelID,
	counterpartyChannelID,
	counterpartyVersion string,
) error

OnChanOpenAck implements the Module interface. It calls the underlying app's OnChanOpenAck callback.

func (Module) OnChanOpenConfirm

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

OnChanOpenConfirm implements the Module interface. It calls the underlying app's OnChanOpenConfirm callback.

func (Module) OnChanOpenInit

func (im Module) OnChanOpenInit(
	ctx sdk.Context,
	order channeltypes.Order,
	connectionHops []string,
	portID string,
	channelID string,
	counterparty channeltypes.Counterparty,
	version string,
) (string, error)

OnChanOpenInit implements the Module interface It calls the underlying app's OnChanOpenInit callback.

func (Module) OnChanOpenTry

func (im Module) OnChanOpenTry(
	ctx sdk.Context,
	order channeltypes.Order,
	connectionHops []string,
	portID,
	channelID string,
	counterparty channeltypes.Counterparty,
	counterpartyVersion string,
) (version string, err error)

OnChanOpenTry implements the Module interface. It calls the underlying app's OnChanOpenTry callback.

func (Module) OnRecvPacket

func (im Module) OnRecvPacket(
	ctx sdk.Context,
	channelVersion string,
	packet channeltypes.Packet,
	relayer sdk.AccAddress,
) exported.Acknowledgement

OnRecvPacket implements the Module interface. It calls the underlying app's OnRecvPacket callback.

func (Module) OnTimeoutPacket

func (im Module) OnTimeoutPacket(
	ctx sdk.Context,
	channelVersion string,
	packet channeltypes.Packet,
	relayer sdk.AccAddress,
) error

OnTimeoutPacket implements the Module interface. It calls the underlying app's OnTimeoutPacket callback.

func (Module) SetICS4Wrapper added in v0.7.0

func (im Module) SetICS4Wrapper(wrapper porttypes.ICS4Wrapper)

func (Module) UnmarshalPacketData added in v0.4.0

func (im Module) UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (any, string, error)

type TransferKeeper added in v0.5.0

type TransferKeeper interface {
	GetDenom(ctx sdk.Context, denomHash cmtbytes.HexBytes) (ibctypes.Denom, bool)
}

Jump to

Keyboard shortcuts

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