Documentation ¶
Index ¶
- func ChainedCustomQuerier(k ViewKeeper, next wasmkeeper.WasmVMQueryHandler) wasmkeeper.WasmVMQueryHandler
- func NewIntegrityHandler(k integrityHandlerSource) wasmkeeper.MessageHandlerFunc
- func NewMsgServer(k *Keeper) *msgServer
- func NewQuerier(cdc codec.Codec, k *Keeper) *querier
- func NewQueryDecorator(k ViewKeeper) func(wasmkeeper.WasmVMQueryHandler) wasmkeeper.WasmVMQueryHandler
- type AuthSource
- type AuthSourceFn
- type CustomMsgHandler
- type Keeper
- func (k *Keeper) BeginBlocker(ctx context.Context) error
- func (k Keeper) CanInvokeStakingMsg(ctx sdk.Context, actor sdk.AccAddress) bool
- func (k *Keeper) EndBlocker(ctx context.Context) ([]abci.ValidatorUpdate, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetMaxSudoGas(ctx sdk.Context) storetypes.Gas
- func (k Keeper) GetParams(clientCtx sdk.Context) (params types.Params)
- func (k Keeper) GetTest(ctx sdk.Context, actor sdk.AccAddress) string
- func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) SendBeginBlockMsg(c context.Context) error
- func (k Keeper) SendEndBlockMsg(c context.Context) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- type Option
- type QueryHandlerFn
- type ViewKeeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainedCustomQuerier ¶
func ChainedCustomQuerier(k ViewKeeper, next wasmkeeper.WasmVMQueryHandler) wasmkeeper.WasmVMQueryHandler
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 NewQueryDecorator ¶
func NewQueryDecorator(k ViewKeeper) func(wasmkeeper.WasmVMQueryHandler) wasmkeeper.WasmVMQueryHandler
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) CanInvokeStakingMsg ¶
func (*Keeper) EndBlocker ¶
EndBlocker is called after every block
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
func (Keeper) GetAuthority ¶
GetAuthority returns the module's authority.
func (Keeper) GetMaxSudoGas ¶
func (k Keeper) GetMaxSudoGas(ctx sdk.Context) storetypes.Gas
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)
func (Keeper) SendBeginBlockMsg ¶
SendBeginBlockMsg sends a BeginBlock sudo message to the BTC finality contract via sudo
func (Keeper) SendEndBlockMsg ¶
SendEndBlockMsg sends a EndBlock sudo message to the BTC finality contract via sudo
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