keeper

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 65 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestingStakeParams = stakingtypes.Params{
	UnbondingTime:     100,
	MaxValidators:     10,
	MaxEntries:        10,
	HistoricalEntries: 10,
	BondDenom:         "stake",
}

Functions

func ExportGenesis

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

ExportGenesis returns a GenesisState for a given context and keeper.

func InitGenesis

func InitGenesis(
	ctx sdk.Context,
	keeper *Keeper,
	data types.GenesisState,
	msgHandler sdk.Handler,
) ([]abci.ValidatorUpdate, error)

InitGenesis sets supply information for genesis.

CONTRACT: all types of accounts must have been already initialized/created

func MakeEncodingConfig

func MakeEncodingConfig(_ testing.TB) appparams.EncodingConfig

func ModuleLogger

func ModuleLogger(ctx sdk.Context) log.Logger

func NewGrpcQuerier

func NewGrpcQuerier(keeper queryKeeper) *grpcQuerier

func NewProposalHandler

func NewProposalHandler(k Keeper) govtypes.Handler

NewProposalHandler creates a new governance Handler for wasm proposals

func NewProposalHandlerX

func NewProposalHandlerX(k govKeeper, wasmProposalHandler govtypes.Handler) govtypes.Handler

NewProposalHandlerX creates a new governance Handler for wasm proposals

func NewWasmVMMock

func NewWasmVMMock(mutators ...func(*wasmtesting.MockWasmer)) *wasmtesting.MockWasmer

NewWasmVMMock creates a new WasmerEngine mock with basic ops for create/instantiation set to noops.

func RandomAddress

func RandomAddress(_ *testing.T) sdk.AccAddress

func WasmQuerier

func WasmQuerier(k *Keeper) wasmtypes.QueryServer

Types

type ConsensusParamsUpdater

type ConsensusParamsUpdater interface {
	GetConsensusParams(ctx sdk.Context) *abci.ConsensusParams
	StoreConsensusParams(ctx sdk.Context, cp *abci.ConsensusParams)
}

ConsensusParamsUpdater is a subset of baseapp to store the consensus params

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey sdk.StoreKey,
	paramSpace paramtypes.Subspace,
	accountKeeper authkeeper.AccountKeeper,
	bankKeeper types.BankKeeper,
	stakingKeeper wasmtypes.StakingKeeper,
	distKeeper wasmtypes.DistributionKeeper,
	channelKeeper wasmtypes.ChannelKeeper,
	portKeeper wasmtypes.PortKeeper,
	capabilityKeeper wasmtypes.CapabilityKeeper,
	portSource wasmtypes.ICS20TransferPortSource,
	router wasmkeeper.MessageRouter,
	queryRouter wasmkeeper.GRPCQueryRouter,
	govRouter govtypes.Router,
	homeDir string,
	twasmConfig types.TWasmConfig,
	supportedFeatures string,
	opts ...wasmkeeper.Option,
) Keeper

func (Keeper) ExistsAnyPrivilegedContract

func (k Keeper) ExistsAnyPrivilegedContract(ctx sdk.Context, privilegeType types.PrivilegeType) bool

ExistsAnyPrivilegedContract returns if any contract is registered for the given type

func (Keeper) GetContractKeeper

func (k Keeper) GetContractKeeper() wasmtypes.ContractOpsKeeper

GetContractKeeper returns the contract keeper instance with default permissions set

func (Keeper) HasPrivilegedContract

func (k Keeper) HasPrivilegedContract(ctx sdk.Context, contractAddr sdk.AccAddress, privilegeType types.PrivilegeType) (bool, error)

HasPrivilegedContract returns if the contract has the given privilege type registered. Returns error for unknown contract addresses.

func (Keeper) IsPrivileged

func (k Keeper) IsPrivileged(ctx sdk.Context, contractAddr sdk.AccAddress) bool

IsPrivileged returns if a contract has the privileges flag set.

func (Keeper) IteratePrivileged

func (k Keeper) IteratePrivileged(ctx sdk.Context, cb func(sdk.AccAddress) bool)

IteratePrivileged iterates through the list of privileged contacts by type and position ASC

func (Keeper) IteratePrivilegedContractsByType

func (k Keeper) IteratePrivilegedContractsByType(ctx sdk.Context, privilegeType types.PrivilegeType, cb func(prio uint8, contractAddr sdk.AccAddress) bool)

IteratePrivilegedContractsByType iterates through all contracts for the given type by position and address ASC

func (Keeper) Logger

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

func (Keeper) SetPrivileged

func (k Keeper) SetPrivileged(ctx sdk.Context, contractAddr sdk.AccAddress) error

SetPrivileged does - pin to cache - set privileged flag - call Sudo with PrivilegeChangeMsg{Promoted{}}

func (Keeper) UnsetPrivileged

func (k Keeper) UnsetPrivileged(ctx sdk.Context, contractAddr sdk.AccAddress) error

UnsetPrivileged does: - call Sudo with PrivilegeChangeMsg{Demoted{}} - remove contract from cache - remove privileged flag - remove all privileges for the contract

type TestKeepers

type TestKeepers struct {
	AccountKeeper authkeeper.AccountKeeper
	BankKeeper    bankkeeper.Keeper
	GovKeeper     govkeeper.Keeper
	TWasmKeeper   *Keeper
	IBCKeeper     *ibckeeper.Keeper
	Router        wasmkeeper.MessageRouter
	Faucet        *wasmkeeper.TestFaucet
}

func CreateDefaultTestInput

func CreateDefaultTestInput(t *testing.T, opts ...wasmkeeper.Option) (sdk.Context, TestKeepers)

CreateDefaultTestInput common settings for CreateTestInput

func CreateTestInput

func CreateTestInput(t *testing.T, isCheckTx bool, supportedFeatures string, opts ...wasmkeeper.Option) (sdk.Context, TestKeepers)

CreateTestInput encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default)

type TgradeHandler

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

TgradeHandler is a custom message handler plugin for wasmd.

func NewTgradeHandler

func NewTgradeHandler(
	cdc codec.Codec,
	keeper TgradeWasmHandlerKeeper,
	bankKeeper bankKeeper,
	consensusParamsUpdater ConsensusParamsUpdater,
	govRouter govtypes.Router,
) *TgradeHandler

NewTgradeHandler constructor

func (TgradeHandler) DispatchMsg

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

DispatchMsg handles wasmVM message for privileged contracts

type TgradeWasmHandlerKeeper

type TgradeWasmHandlerKeeper interface {
	IsPrivileged(ctx sdk.Context, contract sdk.AccAddress) bool

	GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *wasmtypes.ContractInfo
	// contains filtered or unexported methods
}

TgradeWasmHandlerKeeper defines a subset of Keeper

Jump to

Keyboard shortcuts

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