keeper

package
v1.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: AGPL-3.0 Imports: 21 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 uint32,
) (
	blockMessageIds types.BlockMessageIds,
	found bool,
)

GetBlockMessageIds gets the ids of delayed messages to execute at a given block height. `found` is false is there is no delayed message for the given block height.

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) GetNextDelayedMessageId added in v0.4.0

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

GetNextDelayedMessageId returns the next delayed message id 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) NextDelayedMessageId added in v0.4.0

NextDelayedMessageId processes a query request/response for the NextDelayedMessageId 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) SetNextDelayedMessageId added in v0.4.0

func (k Keeper) SetNextDelayedMessageId(
	ctx sdk.Context,
	nextId uint32,
)

SetNextDelayedMessageId sets the next delayed message id in the store.

func (Keeper) ValidateMsg added in v0.4.0

func (k Keeper) ValidateMsg(msg sdk.Msg) error

ValidateMsg validates that a message is routable, passes ValidateBasic, and has the expected signer.

Jump to

Keyboard shortcuts

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