Documentation ¶
Index ¶
- Constants
- Variables
- func BankQuerier(bankKeeper bankkeeper.ViewKeeper) func(ctx sdk.Context, request *wasmvmtypes.BankQuery) ([]byte, error)
- func EncodeBankMsg(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg, error)
- func EncodeStakingMsg(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk.Msg, error)
- func EncodeWasmMsg(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg, error)
- func ExportGenesis(ctx sdk.Context, keeper *Keeper) *types.GenesisState
- func FuzzAbsoluteTxPosition(m *types.AbsoluteTxPosition, c fuzz.Continue)
- func FuzzAccessConfig(m *types.AccessConfig, c fuzz.Continue)
- func FuzzAccessType(m *types.AccessType, c fuzz.Continue)
- func FuzzAddr(m *sdk.AccAddress, c fuzz.Continue)
- func FuzzAddrString(m *string, c fuzz.Continue)
- func FuzzContractCodeHistory(m *types.ContractCodeHistoryEntry, c fuzz.Continue)
- func FuzzContractInfo(m *types.ContractInfo, c fuzz.Continue)
- func FuzzStateModel(m *types.Model, c fuzz.Continue)
- func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) error
- func LimitReader(r io.Reader, n int64) io.Reader
- func MakeEncodingConfig() params2.EncodingConfig
- func MakeTestCodec() codec.Marshaler
- func NewLegacyQuerier(keeper *Keeper) sdk.Querier
- func NewQuerier(keeper *Keeper) grpcQuerier
- func NewWasmProposalHandler(k Keeper, enabledProposalTypes []types.ProposalType) govtypes.Handler
- func NoCustomMsg(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error)
- func NoCustomQuerier(sdk.Context, json.RawMessage) ([]byte, error)
- func RandomBech32AccountAddress(_ *testing.T) string
- func StakingQuerier(keeper stakingkeeper.Keeper, distKeeper distributionkeeper.Keeper) func(ctx sdk.Context, request *wasmvmtypes.StakingQuery) ([]byte, error)
- func TestHandler(k *Keeper) sdk.Handler
- func WasmQuerier(wasm *Keeper) func(ctx sdk.Context, request *wasmvmtypes.WasmQuery) ([]byte, error)
- type AuthorizationPolicy
- type BankEncoder
- type BurnerExampleInitMsg
- type CustomEncoder
- type CustomQuerier
- type DefaultAuthorizationPolicy
- func (p DefaultAuthorizationPolicy) CanCreateCode(config types.AccessConfig, actor sdk.AccAddress) bool
- func (p DefaultAuthorizationPolicy) CanInstantiateContract(config types.AccessConfig, actor sdk.AccAddress) bool
- func (p DefaultAuthorizationPolicy) CanModifyContract(admin, actor sdk.AccAddress) bool
- type ExampleContract
- func StoreBurnerExampleContract(t *testing.T, ctx sdk.Context, keepers TestKeepers) ExampleContract
- func StoreExampleContract(t *testing.T, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract
- func StoreHackatomExampleContract(t *testing.T, ctx sdk.Context, keepers TestKeepers) ExampleContract
- type GovAuthorizationPolicy
- type HackatomExampleInitMsg
- type HackatomExampleInstance
- type Keeper
- func (k Keeper) ClearContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress) error
- func (k Keeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, source string, ...) (codeID uint64, err error)
- func (k Keeper) Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, ...) (*sdk.Result, error)
- func (k Keeper) GetByteCode(ctx sdk.Context, codeID uint64) ([]byte, error)
- func (k Keeper) GetCodeInfo(ctx sdk.Context, codeID uint64) *types.CodeInfo
- func (k Keeper) GetContractHistory(ctx sdk.Context, contractAddr sdk.AccAddress) []types.ContractCodeHistoryEntry
- func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo
- func (k Keeper) GetContractState(ctx sdk.Context, contractAddress sdk.AccAddress) sdk.Iterator
- func (k Keeper) GetMaxWasmCodeSize(ctx sdk.Context) uint64
- func (k Keeper) GetNextCodeID(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, ...) (sdk.AccAddress, error)
- func (k Keeper) IterateCodeInfos(ctx sdk.Context, cb func(uint64, types.CodeInfo) bool)
- func (k Keeper) IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, ...) (*sdk.Result, error)
- func (k Keeper) QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []byte
- func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error)
- func (k Keeper) UpdateContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, ...) error
- type LimitedReader
- type MessageEncoders
- type MessageHandler
- type MockWasmer
- func (m *MockWasmer) Cleanup()
- func (m *MockWasmer) Create(code cosmwasm.WasmCode) (cosmwasm.CodeID, error)
- func (m *MockWasmer) Execute(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, ...) (*wasmvmtypes.HandleResponse, uint64, error)
- func (m *MockWasmer) GetCode(code cosmwasm.CodeID) (cosmwasm.WasmCode, error)
- func (m *MockWasmer) Instantiate(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, ...) (*wasmvmtypes.InitResponse, uint64, error)
- func (m *MockWasmer) Migrate(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, ...) (*wasmvmtypes.MigrateResponse, uint64, error)
- func (m *MockWasmer) Query(code cosmwasm.CodeID, env wasmvmtypes.Env, queryMsg []byte, ...) ([]byte, uint64, error)
- type MultipiedGasMeter
- type QueryHandler
- type QueryPlugins
- type StakingEncoder
- type TestKeepers
- type WasmEncoder
Constants ¶
const ( QueryListContractByCode = "list-contracts-by-code" QueryGetContract = "contract-info" QueryGetContractState = "contract-state" QueryGetCode = "code" QueryListCode = "list-code" QueryContractHistory = "contract-history" )
const ( QueryMethodContractStateSmart = "smart" QueryMethodContractStateAll = "all" QueryMethodContractStateRaw = "raw" )
const CompileCost uint64 = 2
CompileCost is how much SDK gas we charge *per byte* for compiling WASM code.
const GasMultiplier uint64 = 100
GasMultiplier is how many cosmwasm gas points = 1 sdk gas point SDK reference costs can be found here: https://github.com/cosmos/cosmos-sdk/blob/02c6c9fafd58da88550ab4d7d494724a477c8a68/store/types/gas.go#L153-L164 A write at ~3000 gas and ~200us = 10 gas per us (microsecond) cpu/io Rough timing have 88k gas at 90us, which is equal to 1k sdk gas... (one read)
Please not that all gas prices returned to the wasmer engine should have this multiplied
const InstanceCost uint64 = 40_000
InstanceCost is how much SDK gas we charge each time we load a WASM instance. Creating a new instance is costly, and this helps put a recursion limit to contracts calling contracts.
const MaxGas = 10_000_000_000
MaxGas for a contract is 10 billion wasmer gas (enforced in rust to prevent overflow) The limit for v0.9.3 is defined here: https://github.com/CosmWasm/cosmwasm/blob/v0.9.3/packages/vm/src/backends/singlepass.rs#L15-L23 (this will be increased in future releases)
Variables ¶
var ( CostHumanize = 5 * GasMultiplier CostCanonical = 4 * GasMultiplier )
var ModelFuzzers = []interface{}{FuzzAddr, FuzzAddrString, FuzzAbsoluteTxPosition, FuzzContractInfo, FuzzStateModel, FuzzAccessType, FuzzAccessConfig, FuzzContractCodeHistory}
var ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distribution.AppModuleBasic{}, gov.NewAppModuleBasic( paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, ibc.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, transfer.AppModuleBasic{}, )
var TestingStakeParams = stakingtypes.Params{
UnbondingTime: 100,
MaxValidators: 10,
MaxEntries: 10,
HistoricalEntries: 10,
BondDenom: "stake",
}
Functions ¶
func BankQuerier ¶
func BankQuerier(bankKeeper bankkeeper.ViewKeeper) func(ctx sdk.Context, request *wasmvmtypes.BankQuery) ([]byte, error)
func EncodeBankMsg ¶
func EncodeBankMsg(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg, error)
func EncodeStakingMsg ¶
func EncodeStakingMsg(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk.Msg, error)
func EncodeWasmMsg ¶
func EncodeWasmMsg(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg, error)
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper *Keeper) *types.GenesisState
ExportGenesis returns a GenesisState for a given context and keeper.
func FuzzAbsoluteTxPosition ¶ added in v0.9.0
func FuzzAbsoluteTxPosition(m *types.AbsoluteTxPosition, c fuzz.Continue)
func FuzzAccessConfig ¶ added in v0.10.0
func FuzzAccessConfig(m *types.AccessConfig, c fuzz.Continue)
func FuzzAccessType ¶ added in v0.10.0
func FuzzAccessType(m *types.AccessType, c fuzz.Continue)
func FuzzAddrString ¶ added in v0.12.0
func FuzzContractCodeHistory ¶ added in v0.10.0
func FuzzContractCodeHistory(m *types.ContractCodeHistoryEntry, c fuzz.Continue)
func FuzzContractInfo ¶ added in v0.9.0
func FuzzContractInfo(m *types.ContractInfo, c fuzz.Continue)
func InitGenesis ¶
InitGenesis sets supply information for genesis.
CONTRACT: all types of accounts must have been already initialized/created
func LimitReader ¶ added in v0.12.0
LimitReader returns a Reader that reads from r but stops with types.ErrLimit after n bytes. The underlying implementation is a *io.LimitedReader.
func MakeEncodingConfig ¶ added in v0.12.0
func MakeEncodingConfig() params2.EncodingConfig
func MakeTestCodec ¶
func NewLegacyQuerier ¶ added in v0.12.0
NewLegacyQuerier creates a new querier
func NewQuerier ¶
func NewQuerier(keeper *Keeper) grpcQuerier
func NewWasmProposalHandler ¶ added in v0.10.0
func NewWasmProposalHandler(k Keeper, enabledProposalTypes []types.ProposalType) govtypes.Handler
NewWasmProposalHandler creates a new governance Handler for wasm proposals
func NoCustomMsg ¶
func NoCustomMsg(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error)
func NoCustomQuerier ¶
func RandomBech32AccountAddress ¶ added in v0.12.0
func StakingQuerier ¶
func StakingQuerier(keeper stakingkeeper.Keeper, distKeeper distributionkeeper.Keeper) func(ctx sdk.Context, request *wasmvmtypes.StakingQuery) ([]byte, error)
func TestHandler ¶
TestHandler returns a wasm handler for tests (to avoid circular imports)
func WasmQuerier ¶
Types ¶
type AuthorizationPolicy ¶ added in v0.10.0
type AuthorizationPolicy interface { CanCreateCode(c types.AccessConfig, creator sdk.AccAddress) bool CanInstantiateContract(c types.AccessConfig, actor sdk.AccAddress) bool CanModifyContract(admin, actor sdk.AccAddress) bool }
type BankEncoder ¶
type BankEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg, error)
type BurnerExampleInitMsg ¶ added in v0.12.1
type BurnerExampleInitMsg struct {
Payout sdk.AccAddress `json:"payout"`
}
type CustomEncoder ¶
type CustomEncoder func(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error)
type CustomQuerier ¶
type DefaultAuthorizationPolicy ¶ added in v0.10.0
type DefaultAuthorizationPolicy struct { }
func (DefaultAuthorizationPolicy) CanCreateCode ¶ added in v0.10.0
func (p DefaultAuthorizationPolicy) CanCreateCode(config types.AccessConfig, actor sdk.AccAddress) bool
func (DefaultAuthorizationPolicy) CanInstantiateContract ¶ added in v0.10.0
func (p DefaultAuthorizationPolicy) CanInstantiateContract(config types.AccessConfig, actor sdk.AccAddress) bool
func (DefaultAuthorizationPolicy) CanModifyContract ¶ added in v0.10.0
func (p DefaultAuthorizationPolicy) CanModifyContract(admin, actor sdk.AccAddress) bool
type ExampleContract ¶ added in v0.12.1
type ExampleContract struct { InitialAmount sdk.Coins Creator crypto.PrivKey CreatorAddr sdk.AccAddress CodeID uint64 }
func StoreBurnerExampleContract ¶ added in v0.12.1
func StoreBurnerExampleContract(t *testing.T, ctx sdk.Context, keepers TestKeepers) ExampleContract
func StoreExampleContract ¶ added in v0.12.1
func StoreExampleContract(t *testing.T, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract
func StoreHackatomExampleContract ¶ added in v0.12.0
func StoreHackatomExampleContract(t *testing.T, ctx sdk.Context, keepers TestKeepers) ExampleContract
type GovAuthorizationPolicy ¶ added in v0.10.0
type GovAuthorizationPolicy struct { }
func (GovAuthorizationPolicy) CanCreateCode ¶ added in v0.10.0
func (p GovAuthorizationPolicy) CanCreateCode(types.AccessConfig, sdk.AccAddress) bool
func (GovAuthorizationPolicy) CanInstantiateContract ¶ added in v0.10.0
func (p GovAuthorizationPolicy) CanInstantiateContract(types.AccessConfig, sdk.AccAddress) bool
func (GovAuthorizationPolicy) CanModifyContract ¶ added in v0.10.0
func (p GovAuthorizationPolicy) CanModifyContract(sdk.AccAddress, sdk.AccAddress) bool
type HackatomExampleInitMsg ¶ added in v0.12.0
type HackatomExampleInitMsg struct { Verifier sdk.AccAddress `json:"verifier"` Beneficiary sdk.AccAddress `json:"beneficiary"` }
type HackatomExampleInstance ¶ added in v0.12.0
type HackatomExampleInstance struct { ExampleContract Contract sdk.AccAddress Verifier crypto.PrivKey VerifierAddr sdk.AccAddress Beneficiary crypto.PrivKey BeneficiaryAddr sdk.AccAddress }
func InstantiateHackatomExampleContract ¶ added in v0.12.0
func InstantiateHackatomExampleContract(t *testing.T, ctx sdk.Context, keepers TestKeepers) HackatomExampleInstance
InstantiateHackatomExampleContract load and instantiate the "./testdata/hackatom.wasm" contract
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper will have a reference to Wasmer with it's own data directory.
func NewKeeper ¶
func NewKeeper( cdc codec.Marshaler, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper, stakingKeeper stakingkeeper.Keeper, distKeeper distributionkeeper.Keeper, router sdk.Router, homeDir string, wasmConfig types.WasmConfig, supportedFeatures string, customEncoders *MessageEncoders, customPlugins *QueryPlugins, ) Keeper
NewKeeper creates a new contract Keeper instance If customEncoders is non-nil, we can use this to override some of the message handler, especially custom
func (Keeper) ClearContractAdmin ¶ added in v0.9.0
func (k Keeper) ClearContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress) error
ClearContractAdmin sets the admin value on the ContractInfo to nil, to disable further migrations/ updates.
func (Keeper) Create ¶
func (k Keeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, source string, builder string, instantiateAccess *types.AccessConfig) (codeID uint64, err error)
Create uploads and compiles a WASM contract, returning a short identifier for the contract
func (Keeper) Execute ¶
func (k Keeper) Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) (*sdk.Result, error)
Execute executes the contract instance
func (Keeper) GetByteCode ¶
func (Keeper) GetCodeInfo ¶
func (Keeper) GetContractHistory ¶ added in v0.10.0
func (k Keeper) GetContractHistory(ctx sdk.Context, contractAddr sdk.AccAddress) []types.ContractCodeHistoryEntry
func (Keeper) GetContractInfo ¶
func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo
func (Keeper) GetContractState ¶
func (Keeper) GetMaxWasmCodeSize ¶ added in v0.12.0
func (Keeper) Instantiate ¶
func (k Keeper) Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, error)
Instantiate creates an instance of a WASM contract
func (Keeper) IterateCodeInfos ¶ added in v0.10.0
func (Keeper) IterateContractInfo ¶ added in v0.10.0
func (k Keeper) IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool)
func (Keeper) Migrate ¶ added in v0.9.0
func (k Keeper) Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte) (*sdk.Result, error)
Migrate allows to upgrade a contract to a new code with data migration.
func (Keeper) QueryRaw ¶
QueryRaw returns the contract's state for give key. Returns `nil` when key is `nil`.
func (Keeper) QuerySmart ¶
func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error)
QuerySmart queries the smart contract itself.
func (Keeper) UpdateContractAdmin ¶ added in v0.9.0
func (k Keeper) UpdateContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newAdmin sdk.AccAddress) error
UpdateContractAdmin sets the admin value on the ContractInfo. It must be a valid address (use ClearContractAdmin to remove it)
type LimitedReader ¶ added in v0.12.0
type LimitedReader struct {
// contains filtered or unexported fields
}
type MessageEncoders ¶
type MessageEncoders struct { Bank BankEncoder Custom CustomEncoder Staking StakingEncoder Wasm WasmEncoder }
func DefaultEncoders ¶
func DefaultEncoders() MessageEncoders
func (MessageEncoders) Encode ¶
func (e MessageEncoders) Encode(contractAddr sdk.AccAddress, msg wasmvmtypes.CosmosMsg) ([]sdk.Msg, error)
func (MessageEncoders) Merge ¶
func (e MessageEncoders) Merge(o *MessageEncoders) MessageEncoders
type MessageHandler ¶
type MessageHandler struct {
// contains filtered or unexported fields
}
func NewMessageHandler ¶
func NewMessageHandler(router sdk.Router, customEncoders *MessageEncoders) MessageHandler
func (MessageHandler) Dispatch ¶
func (h MessageHandler) Dispatch(ctx sdk.Context, contractAddr sdk.AccAddress, msg wasmvmtypes.CosmosMsg) error
type MockWasmer ¶ added in v0.12.0
type MockWasmer struct { CreateFn func(code cosmwasm.WasmCode) (cosmwasm.CodeID, error) InstantiateFn func(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store cosmwasm.KVStore, goapi cosmwasm.GoAPI, querier cosmwasm.Querier, gasMeter cosmwasm.GasMeter, gasLimit uint64) (*wasmvmtypes.InitResponse, uint64, error) ExecuteFn func(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store cosmwasm.KVStore, goapi cosmwasm.GoAPI, querier cosmwasm.Querier, gasMeter cosmwasm.GasMeter, gasLimit uint64) (*wasmvmtypes.HandleResponse, uint64, error) QueryFn func(code cosmwasm.CodeID, env wasmvmtypes.Env, queryMsg []byte, store cosmwasm.KVStore, goapi cosmwasm.GoAPI, querier cosmwasm.Querier, gasMeter cosmwasm.GasMeter, gasLimit uint64) ([]byte, uint64, error) MigrateFn func(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, migrateMsg []byte, store cosmwasm.KVStore, goapi cosmwasm.GoAPI, querier cosmwasm.Querier, gasMeter cosmwasm.GasMeter, gasLimit uint64) (*wasmvmtypes.MigrateResponse, uint64, error) GetCodeFn func(code cosmwasm.CodeID) (cosmwasm.WasmCode, error) CleanupFn func() }
MockWasmer implements types.WasmerEngine for testing purpose. One or multiple messages can be stubbed. Without a stub function a panic is thrown.
func (*MockWasmer) Cleanup ¶ added in v0.12.0
func (m *MockWasmer) Cleanup()
func (*MockWasmer) Create ¶ added in v0.12.0
func (m *MockWasmer) Create(code cosmwasm.WasmCode) (cosmwasm.CodeID, error)
func (*MockWasmer) Execute ¶ added in v0.12.0
func (m *MockWasmer) Execute(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store cosmwasm.KVStore, goapi cosmwasm.GoAPI, querier cosmwasm.Querier, gasMeter cosmwasm.GasMeter, gasLimit uint64) (*wasmvmtypes.HandleResponse, uint64, error)
func (*MockWasmer) GetCode ¶ added in v0.12.0
func (m *MockWasmer) GetCode(code cosmwasm.CodeID) (cosmwasm.WasmCode, error)
func (*MockWasmer) Instantiate ¶ added in v0.12.0
func (m *MockWasmer) Instantiate(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store cosmwasm.KVStore, goapi cosmwasm.GoAPI, querier cosmwasm.Querier, gasMeter cosmwasm.GasMeter, gasLimit uint64) (*wasmvmtypes.InitResponse, uint64, error)
func (*MockWasmer) Migrate ¶ added in v0.12.0
func (m *MockWasmer) Migrate(code cosmwasm.CodeID, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, migrateMsg []byte, store cosmwasm.KVStore, goapi cosmwasm.GoAPI, querier cosmwasm.Querier, gasMeter cosmwasm.GasMeter, gasLimit uint64) (*wasmvmtypes.MigrateResponse, uint64, error)
func (*MockWasmer) Query ¶ added in v0.12.0
func (m *MockWasmer) Query(code cosmwasm.CodeID, env wasmvmtypes.Env, queryMsg []byte, store cosmwasm.KVStore, goapi cosmwasm.GoAPI, querier cosmwasm.Querier, gasMeter cosmwasm.GasMeter, gasLimit uint64) ([]byte, uint64, error)
type MultipiedGasMeter ¶ added in v0.10.0
type MultipiedGasMeter struct {
// contains filtered or unexported fields
}
MultipliedGasMeter wraps the GasMeter from context and multiplies all reads by out defined multiplier
func (MultipiedGasMeter) GasConsumed ¶ added in v0.10.0
func (m MultipiedGasMeter) GasConsumed() sdk.Gas
type QueryHandler ¶
type QueryHandler struct { Ctx sdk.Context Plugins QueryPlugins }
func (QueryHandler) GasConsumed ¶ added in v0.9.0
func (q QueryHandler) GasConsumed() uint64
func (QueryHandler) Query ¶
func (q QueryHandler) Query(request wasmvmtypes.QueryRequest, gasLimit uint64) ([]byte, error)
type QueryPlugins ¶
type QueryPlugins struct { Bank func(ctx sdk.Context, request *wasmvmtypes.BankQuery) ([]byte, error) Custom CustomQuerier Staking func(ctx sdk.Context, request *wasmvmtypes.StakingQuery) ([]byte, error) Wasm func(ctx sdk.Context, request *wasmvmtypes.WasmQuery) ([]byte, error) }
func DefaultQueryPlugins ¶
func DefaultQueryPlugins(bank bankkeeper.ViewKeeper, staking stakingkeeper.Keeper, distKeeper distributionkeeper.Keeper, wasm *Keeper) QueryPlugins
func (QueryPlugins) Merge ¶
func (e QueryPlugins) Merge(o *QueryPlugins) QueryPlugins
type StakingEncoder ¶
type StakingEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk.Msg, error)
type TestKeepers ¶
type TestKeepers struct { AccountKeeper authkeeper.AccountKeeper StakingKeeper stakingkeeper.Keeper DistKeeper distributionkeeper.Keeper BankKeeper bankkeeper.Keeper GovKeeper govkeeper.Keeper WasmKeeper *Keeper }
func CreateTestInput ¶
func CreateTestInput(t *testing.T, isCheckTx bool, supportedFeatures string, encoders *MessageEncoders, queriers *QueryPlugins) (sdk.Context, TestKeepers)
encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default)
type WasmEncoder ¶
type WasmEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg, error)