keeper

package
v0.3.0-dev1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DispatchMessagesForBlock

func DispatchMessagesForBlock(k types.DelayMsgKeeper, ctx sdk.Context)

DispatchMessagesForBlock executes all delayed messages scheduled for the given block height and deletes the messages. If there are no delayed messages scheduled for this block, this function does nothing. It is expected that this function is called at the end of every block.

func NewMsgServerImpl

func NewMsgServerImpl(keeper types.DelayMsgKeeper) types.MsgServer

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	router *baseapp.MsgServiceRouter,
	authorities []string,
) *Keeper

NewKeeper creates a new x/delaymsg keeper.

func (Keeper) BlockMessageIds

BlockMessageIds processes a query request/response for the BlockMessageIds from state.

func (Keeper) DelayMessageByBlocks

func (k Keeper) DelayMessageByBlocks(
	ctx sdk.Context,
	msg sdk.Msg,
	blockDelay uint32,
) (
	id uint32,
	err error,
)

DelayMessageByBlocks registers an sdk.Msg to be executed after blockDelay blocks.

func (Keeper) DeleteMessage

func (k Keeper) DeleteMessage(
	ctx sdk.Context,
	id uint32,
) (
	err error,
)

DeleteMessage deletes a message from the store.

func (Keeper) GetAllDelayedMessages

func (k Keeper) GetAllDelayedMessages(ctx sdk.Context) []*types.DelayedMessage

GetAllDelayedMessages returns all messages in the store, sorted by id ascending. This is primarily used to export the genesis state.

func (Keeper) GetBlockMessageIds

func (k Keeper) GetBlockMessageIds(
	ctx sdk.Context,
	blockHeight int64,
) (
	blockMessageIds types.BlockMessageIds,
	found bool,
)

GetBlockMessageIds gets the ids of delayed messages to execute at a given block.

func (Keeper) GetMessage

func (k Keeper) GetMessage(
	ctx sdk.Context,
	id uint32,
) (
	delayedMessage types.DelayedMessage,
	found bool,
)

GetMessage returns a message from its id.

func (Keeper) GetNumMessages

func (k Keeper) GetNumMessages(
	ctx sdk.Context,
) uint32

GetNumMessages returns the number of messages in the store.

func (Keeper) HasAuthority

func (k Keeper) HasAuthority(authority string) bool

func (Keeper) InitializeForGenesis

func (k Keeper) InitializeForGenesis(ctx sdk.Context)

InitializeForGenesis initializes the x/delaymsg keeper for genesis.

func (Keeper) Logger

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

Logger returns a module-specific logger for x/delaymsg.

func (Keeper) Message

Message processes a query request/response for the Message from state.

func (Keeper) NumMessages

NumMessages processes a query request/response for the NumMessages from state.

func (Keeper) Router

func (k Keeper) Router() lib.MsgRouter

Router returns the x/delaymsg router.

func (Keeper) SetDelayedMessage

func (k Keeper) SetDelayedMessage(
	ctx sdk.Context,
	msg *types.DelayedMessage,
) (
	err error,
)

SetDelayedMessage delays a message to be executed at the specified block height. The delayed message is assigned the specified id. This method is suitable for initializing from genesis state.

func (Keeper) SetNumMessages

func (k Keeper) SetNumMessages(
	ctx sdk.Context,
	numMessages uint32,
)

SetNumMessages sets the number of messages in the store.

Jump to

Keyboard shortcuts

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