keeper

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 79 Imported by: 0

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 DeterministicAccountAddress

func DeterministicAccountAddress(_ testing.TB, v byte) sdk.AccAddress

DeterministicAccountAddress creates a test address with v repeated to valid address size

func ExportGenesis

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

ExportGenesis returns a GenesisState for a given context and keeper.

func GenerateSortedBech32Address added in v0.2.0

func GenerateSortedBech32Address(addrs ...[]byte) []string

func InitGenesis

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

func MakeEncodingConfig

func MakeEncodingConfig(_ testing.TB) wasmappparams.EncodingConfig

func MakeTestCodec

func MakeTestCodec(t testing.TB) codec.Codec

func ModuleLogger

func ModuleLogger(ctx sdk.Context) log.Logger

func NewWasmProposalHandler

func NewWasmProposalHandler(k *Keeper, enabledProposalType []wasmtypes.ProposalType) govtypes.Handler

NewWasmProposalHandler creates a new governance Handler for wasm proposals

func NewWasmProposalHandlerX

func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []wasmtypes.ProposalType) govtypes.Handler

NewWasmProposalHandlerX creates a new governance Handler for wasm proposals

func Querier

func Querier(k *Keeper) types.QueryServer

func RandomAccountAddress

func RandomAccountAddress(_ testing.TB) sdk.AccAddress

func RandomBech32AccountAddress

func RandomBech32AccountAddress(t testing.TB) string

func TestHandler

func TestHandler(k types.ContractOpsKeeper) sdk.Handler

TestHandler returns a wasm handler for tests (to avoid circular imports)

func WasmQuerier

func WasmQuerier(k *Keeper) wasmtypes.QueryServer

Types

type BurnerExampleInitMsg

type BurnerExampleInitMsg struct {
	Payout sdk.AccAddress `json:"payout"`
}

func (BurnerExampleInitMsg) GetBytes

func (m BurnerExampleInitMsg) GetBytes(t testing.TB) []byte

type ExampleContract

type ExampleContract struct {
	InitialAmount sdk.Coins
	Creator       crypto.PrivKey
	CreatorAddr   sdk.AccAddress
	CodeID        uint64
	Checksum      []byte
}

func StoreBurnerExampleContract

func StoreBurnerExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract

func StoreExampleContract

func StoreExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract

func StoreHackatomExampleContract

func StoreHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract

func StoreIBCReflectContract

func StoreIBCReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract

func StoreReflectContract

func StoreReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract

type ExampleContractInstance

type ExampleContractInstance struct {
	ExampleContract
	Contract sdk.AccAddress
}

type ExampleInstance

type ExampleInstance struct {
	ExampleContract
	Contract sdk.AccAddress
	Label    string
	Deposit  sdk.Coins
}

func InstantiateReflectExampleContract

func InstantiateReflectExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleInstance

InstantiateReflectExampleContract load and instantiate the "./testdata/reflect.wasm" contract

type HackatomExampleInitMsg

type HackatomExampleInitMsg struct {
	Verifier    sdk.AccAddress `json:"verifier"`
	Beneficiary sdk.AccAddress `json:"beneficiary"`
}

func (HackatomExampleInitMsg) GetBytes

func (m HackatomExampleInitMsg) GetBytes(t testing.TB) []byte

type HackatomExampleInstance

type HackatomExampleInstance struct {
	ExampleContract
	Contract        sdk.AccAddress
	Verifier        crypto.PrivKey
	VerifierAddr    sdk.AccAddress
	Beneficiary     crypto.PrivKey
	BeneficiaryAddr sdk.AccAddress
	Label           string
	Deposit         sdk.Coins
}

func InstantiateHackatomExampleContract

func InstantiateHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) HackatomExampleInstance

InstantiateHackatomExampleContract load and instantiate the "./testdata/hackatom.wasm" contract

type IBCReflectExampleInstance

type IBCReflectExampleInstance struct {
	Contract      sdk.AccAddress
	Admin         sdk.AccAddress
	CodeID        uint64
	ReflectCodeID uint64
}

func InstantiateIBCReflectContract

func InstantiateIBCReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) IBCReflectExampleInstance

InstantiateIBCReflectContract load and instantiate the "./testdata/ibc_reflect.wasm" contract

type IBCReflectInitMsg

type IBCReflectInitMsg struct {
	ReflectCodeID uint64 `json:"reflect_code_id"`
}

func (IBCReflectInitMsg) GetBytes

func (m IBCReflectInitMsg) GetBytes(t testing.TB) []byte

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 wasmtypes.AccountKeeper,
	bankKeeper wasmtypes.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,
	homeDir string,
	wasmConfig wasmtypes.WasmConfig,
	availableCapabilities string,
	opts ...wasmkeeper.Option,
) Keeper

func (Keeper) IsInactiveContract

func (k Keeper) IsInactiveContract(ctx sdk.Context, contractAddress sdk.AccAddress) bool

func (Keeper) IterateInactiveContracts

func (k Keeper) IterateInactiveContracts(ctx sdk.Context, fn func(contractAddress sdk.AccAddress) (stop bool))

func (Keeper) Logger

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

type PermissionedKeeper

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

func NewPermissionedKeeper

func NewPermissionedKeeper(k wasmkeeper.PermissionedKeeper, extended decoratedKeeper) *PermissionedKeeper

func (PermissionedKeeper) ActivateContract

func (p PermissionedKeeper) ActivateContract(ctx sdk.Context, contractAddress sdk.AccAddress) error

func (PermissionedKeeper) ClearContractAdmin

func (p PermissionedKeeper) ClearContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress) error

func (PermissionedKeeper) DeactivateContract

func (p PermissionedKeeper) DeactivateContract(ctx sdk.Context, contractAddress sdk.AccAddress) error

func (PermissionedKeeper) Execute

func (p PermissionedKeeper) Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error)

func (PermissionedKeeper) Migrate

func (p PermissionedKeeper) Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte) ([]byte, error)

func (PermissionedKeeper) UpdateContractAdmin

func (p PermissionedKeeper) UpdateContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newAdmin sdk.AccAddress) error

type TestKeepers

type TestKeepers struct {
	AccountKeeper  authkeeper.AccountKeeper
	StakingKeeper  stakingkeeper.Keeper
	DistKeeper     distributionkeeper.Keeper
	BankKeeper     bankkeeper.Keeper
	GovKeeper      govkeeper.Keeper
	ContractKeeper types.ContractOpsKeeper
	WasmKeeper     *Keeper
	IBCKeeper      *ibckeeper.Keeper
	Router         *baseapp.Router
	EncodingConfig wasmappparams.EncodingConfig
	Faucet         *wasmkeeper.TestFaucet
	MultiStore     sdk.CommitMultiStore
}

func CreateDefaultTestInput

func CreateDefaultTestInput(t testing.TB) (sdk.Context, TestKeepers)

CreateDefaultTestInput common settings for CreateTestInput

func CreateTestInput

func CreateTestInput(
	t testing.TB,
	isCheckTx bool,
	availableCapabilities 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)

Jump to

Keyboard shortcuts

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