keeper

package
v0.0.0-...-9b24046 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChainedCustomQuerier

ChainedCustomQuerier implements the babylon custom query handler. The given WasmVMQueryHandler is receiving all unhandled queries and must therefore not be nil.

This CustomQuerier is designed as an extension point. See the NewQueryDecorator impl how to set this up for wasmd.

func NewIntegrityHandler

func NewIntegrityHandler(k integrityHandlerSource) wasmkeeper.MessageHandlerFunc

NewIntegrityHandler prevents any contract with max cap set to use staking or stargate messages. This ensures that staked "virtual" tokens are not bypassing the instant undelegate and burn mechanism provided by babylon.

This handler should be chained before any other. TODO: access control for msg call from contracts

func NewMsgServer

func NewMsgServer(k *Keeper) *msgServer

NewMsgServer constructor

func NewQuerier

func NewQuerier(cdc codec.Codec, k *Keeper) *querier

NewQuerier constructor

func NewQueryDecorator

NewQueryDecorator constructor to build a chained custom querier. The babylon custom query handler is placed at the first position and delegates to the next in chain for any queries that do not match the babylon custom query namespace.

To be used with `wasmkeeper.WithQueryHandlerDecorator(BabylonKeeper.NewQueryDecorator(app.BabylonKeeper)))`

Types

type AuthSource

type AuthSource interface {
	// IsAuthorized returns if the contract authorized to execute a virtual stake message
	IsAuthorized(ctx sdk.Context, contractAddr sdk.AccAddress) bool
}

AuthSource abstract type that provides contract authorization. This is an extension point for custom implementations.

type AuthSourceFn

type AuthSourceFn func(ctx sdk.Context, contractAddr sdk.AccAddress) bool

AuthSourceFn is helper for simple AuthSource types

func (AuthSourceFn) IsAuthorized

func (a AuthSourceFn) IsAuthorized(ctx sdk.Context, contractAddr sdk.AccAddress) bool

IsAuthorized returns if the contract authorized to execute a virtual stake message

type CustomMsgHandler

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

func NewCustomMsgHandler

func NewCustomMsgHandler(k msKeeper, auth AuthSource) *CustomMsgHandler

NewCustomMsgHandler constructor to set up CustomMsgHandler with an individual auth source. This is an extension point for non default contract authorization logic.

func NewDefaultCustomMsgHandler

func NewDefaultCustomMsgHandler(k *Keeper) *CustomMsgHandler

NewDefaultCustomMsgHandler constructor to set up the CustomMsgHandler with default max cap authorization

func (CustomMsgHandler) DispatchMsg

func (h CustomMsgHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, _ string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, [][]*codectypes.Any, error)

DispatchMsg handle contract message of type Custom in the babylon namespace

type Keeper

type Keeper struct {
	Staking types.StakingKeeper
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey storetypes.StoreKey,
	memoryStoreKey storetypes.StoreKey,
	bank types.BankKeeper,
	staking types.StakingKeeper,
	wasm types.WasmKeeper,
	authority string,
	opts ...Option,
) *Keeper

NewKeeper constructor with vanilla sdk keepers

func (*Keeper) BeginBlocker

func (k *Keeper) BeginBlocker(ctx context.Context) error

func (Keeper) CanInvokeStakingMsg

func (k Keeper) CanInvokeStakingMsg(ctx sdk.Context, actor sdk.AccAddress) bool

func (*Keeper) EndBlocker

func (k *Keeper) EndBlocker(ctx context.Context) ([]abci.ValidatorUpdate, error)

EndBlocker is called after every block

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the module's authority.

func (Keeper) GetMaxSudoGas

func (k Keeper) GetMaxSudoGas(ctx sdk.Context) storetypes.Gas

func (Keeper) GetParams

func (k Keeper) GetParams(clientCtx sdk.Context) (params types.Params)

GetParams gets the module's parameters.

func (Keeper) GetTest

func (k Keeper) GetTest(ctx sdk.Context, actor sdk.AccAddress) string

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)

func (Keeper) Logger

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

func (Keeper) SendBeginBlockMsg

func (k Keeper) SendBeginBlockMsg(c context.Context) error

SendBeginBlockMsg sends a BeginBlock sudo message to the BTC finality contract via sudo

func (Keeper) SendEndBlockMsg

func (k Keeper) SendEndBlockMsg(c context.Context) error

SendEndBlockMsg sends a EndBlock sudo message to the BTC finality contract via sudo

func (Keeper) SetParams

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

SetParams sets the module's parameters.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is an extension point to instantiate keeper with non default values

func WithWasmKeeperDecorated

func WithWasmKeeperDecorated(cb func(types.WasmKeeper) types.WasmKeeper) Option

WithWasmKeeperDecorated can set a decorator to the wasm keeper

type QueryHandlerFn

type QueryHandlerFn func(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error)

QueryHandlerFn helper type that implements wasmkeeper.WasmVMQueryHandler

func (QueryHandlerFn) HandleQuery

func (q QueryHandlerFn) HandleQuery(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error)

HandleQuery handles contract query

type ViewKeeper

type ViewKeeper interface {
	GetTest(ctx sdk.Context, actor sdk.AccAddress) string
}

abstract query keeper

Jump to

Keyboard shortcuts

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