keeper

package
v5.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 20 Imported by: 49

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitAcknowledgementEvent

func EmitAcknowledgementEvent(ctx sdk.Context, packet exported.PacketI, ack exported.Acknowledgement, err error)

EmitAcknowledgementEvent emits an event signalling a successful or failed acknowledgement and including the error details if any.

func ExportGenesis

func ExportGenesis(ctx sdk.Context, keeper Keeper) icatypes.ControllerGenesisState

ExportGenesis returns the interchain accounts controller exported genesis

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, state icatypes.ControllerGenesisState)

InitGenesis initializes the interchain accounts controller application state from a provided genesis state

Types

type Keeper

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

Keeper defines the IBC interchain accounts controller keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace,
	ics4Wrapper icatypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper,
	scopedKeeper capabilitykeeper.ScopedKeeper, msgRouter icatypes.MessageRouter,
) Keeper

NewKeeper creates a new interchain accounts controller Keeper instance

func (Keeper) AuthenticateCapability

func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool

AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function

func (Keeper) BindPort

func (k Keeper) BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability

BindPort stores the provided portID and binds to it, returning the associated capability

func (Keeper) ClaimCapability

func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error

ClaimCapability wraps the scopedKeeper's ClaimCapability function

func (Keeper) GetActiveChannelID

func (k Keeper) GetActiveChannelID(ctx sdk.Context, connectionID, portID string) (string, bool)

GetActiveChannelID retrieves the active channelID from the store, keyed by the provided connectionID and portID

func (Keeper) GetAllActiveChannels

func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []icatypes.ActiveChannel

GetAllActiveChannels returns a list of all active interchain accounts controller channels and their associated connection and port identifiers

func (Keeper) GetAllInterchainAccounts

func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []icatypes.RegisteredInterchainAccount

GetAllInterchainAccounts returns a list of all registered interchain account addresses and their associated connection and controller port identifiers

func (Keeper) GetAllPorts

func (k Keeper) GetAllPorts(ctx sdk.Context) []string

GetAllPorts returns all ports to which the interchain accounts controller module is bound. Used in ExportGenesis

func (Keeper) GetAppVersion

func (k Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool)

GetAppVersion calls the ICS4Wrapper GetAppVersion function.

func (Keeper) GetInterchainAccountAddress

func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, connectionID, portID string) (string, bool)

GetInterchainAccountAddress retrieves the InterchainAccount address from the store associated with the provided connectionID and portID

func (Keeper) GetOpenActiveChannel

func (k Keeper) GetOpenActiveChannel(ctx sdk.Context, connectionID, portID string) (string, bool)

GetOpenActiveChannel retrieves the active channelID from the store, keyed by the provided connectionID and portID & checks if the channel in question is in state OPEN

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams returns the total set of the controller submodule parameters.

func (Keeper) InterchainAccount

InterchainAccount implements the Query/InterchainAccount gRPC method

func (Keeper) IsActiveChannel

func (k Keeper) IsActiveChannel(ctx sdk.Context, connectionID, portID string) bool

IsActiveChannel returns true if there exists an active channel for the provided connectionID and portID, otherwise false

func (Keeper) IsBound

func (k Keeper) IsBound(ctx sdk.Context, portID string) bool

IsBound checks if the interchain account controller module is already bound to the desired port

func (Keeper) IsControllerEnabled

func (k Keeper) IsControllerEnabled(ctx sdk.Context) bool

IsControllerEnabled retrieves the controller enabled boolean from the paramstore. True is returned if the controller submodule is enabled.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns the application logger, scoped to the associated module

func (Keeper) OnChanCloseConfirm

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

OnChanCloseConfirm removes the active channel stored in state

func (Keeper) OnChanOpenAck

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

OnChanOpenAck sets the active channel for the interchain account/owner pair and stores the associated interchain account address in state keyed by it's corresponding port identifier

func (Keeper) OnChanOpenInit

func (k Keeper) OnChanOpenInit(
	ctx sdk.Context,
	order channeltypes.Order,
	connectionHops []string,
	portID string,
	channelID string,
	chanCap *capabilitytypes.Capability,
	counterparty channeltypes.Counterparty,
	version string,
) (string, error)

OnChanOpenInit performs basic validation of channel initialization. The channel order must be ORDERED, the counterparty port identifier must be the host chain representation as defined in the types package, the channel version must be equal to the version in the types package, there must not be an active channel for the specfied port identifier, and the interchain accounts module must be able to claim the channel capability.

func (Keeper) OnTimeoutPacket

func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error

OnTimeoutPacket removes the active channel associated with the provided packet, the underlying channel end is closed due to the semantics of ORDERED channels

func (Keeper) Params

Params implements the Query/Params gRPC method

func (Keeper) RegisterInterchainAccount

func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner, version string) error

RegisterInterchainAccount is the entry point to registering an interchain account: - It generates a new port identifier using the provided owner string, binds to the port identifier and claims the associated capability. - Callers are expected to provide the appropriate application version string. - For example, this could be an ICS27 encoded metadata type or an ICS29 encoded metadata type with a nested application version. - A new MsgChannelOpenInit is routed through the MsgServiceRouter, executing the OnOpenChanInit callback stack as configured. - An error is returned if the port identifier is already in use. Gaining access to interchain accounts whose channels have closed cannot be done with this function. A regular MsgChannelOpenInit must be used.

func (Keeper) SendTx

func (k Keeper) SendTx(ctx sdk.Context, chanCap *capabilitytypes.Capability, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error)

SendTx takes pre-built packet data containing messages to be executed on the host chain from an authentication module and attempts to send the packet. The packet sequence for the outgoing packet is returned as a result. If the base application has the capability to send on the provided portID. An appropriate absolute timeoutTimestamp must be provided. If the packet is timed out, the channel will be closed. In the case of channel closure, a new channel may be reopened to reconnect to the host chain.

func (Keeper) SetActiveChannelID

func (k Keeper) SetActiveChannelID(ctx sdk.Context, connectionID, portID, channelID string)

SetActiveChannelID stores the active channelID, keyed by the provided connectionID and portID

func (Keeper) SetInterchainAccountAddress

func (k Keeper) SetInterchainAccountAddress(ctx sdk.Context, connectionID, portID, address string)

SetInterchainAccountAddress stores the InterchainAccount address, keyed by the associated connectionID and portID

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the total set of the controller submodule parameters.

Jump to

Keyboard shortcuts

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