keeper

package
v1.4.1-patch.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: AGPL-3.0 Imports: 101 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryListContractByCode   = "list-contracts-by-code"
	QueryGetContract          = "contract-info"
	QueryGetContractState     = "contract-state"
	QueryGetCode              = "code"
	QueryListCode             = "list-code"
	QueryContractAddress      = "label"
	QueryContractKey          = "contract-key"
	QueryContractHash         = "contract-hash"
	QueryContractHashByCodeID = "contract-hash-by-id"
)
View Source
const QueryMethodContractStateSmart = "smart"

Variables

View Source
var (
	CostHumanize  = 5 * types.GasMultiplier
	CostCanonical = 4 * types.GasMultiplier
)
View Source
var TestConfig = TestConfigType{
	ChainID: "test-secret-X",
}
View Source
var TestContractPaths = map[string]string{
	// contains filtered or unexported fields
}
View Source
var TestingStakeParams = stakingtypes.Params{
	UnbondingTime:     100,
	MaxValidators:     10,
	MaxEntries:        10,
	HistoricalEntries: 10,
	BondDenom:         sdk.DefaultBondDenom,
}
View Source
var VoteOptionMap = map[v1wasmTypes.VoteOption]string{
	v1wasmTypes.Yes:        "VOTE_OPTION_YES",
	v1wasmTypes.Abstain:    "VOTE_OPTION_ABSTAIN",
	v1wasmTypes.No:         "VOTE_OPTION_NO",
	v1wasmTypes.NoWithVeto: "VOTE_OPTION_NO_WITH_VETO",
}

Functions

func BankQuerier

func BankQuerier(bankKeeper bankkeeper.ViewKeeper) func(ctx sdk.Context, request *wasmTypes.BankQuery) ([]byte, error)

func ContractFromPortID

func ContractFromPortID(portID string) (sdk.AccAddress, error)

func CreateFakeFundedAccount

func CreateFakeFundedAccount(ctx sdk.Context, am authkeeper.AccountKeeper, bk bankkeeper.Keeper, coins sdk.Coins) (sdk.AccAddress, crypto.PrivKey)

func DistQuerier

func DistQuerier(keeper distrkeeper.Keeper) func(ctx sdk.Context, request *wasmTypes.DistQuery) ([]byte, error)

func EncodeBankMsg

func EncodeBankMsg(sender sdk.AccAddress, msg *v1wasmTypes.BankMsg) ([]sdk.Msg, error)

func EncodeDistributionMsg

func EncodeDistributionMsg(sender sdk.AccAddress, msg *v1wasmTypes.DistributionMsg) ([]sdk.Msg, error)

func EncodeGovMsg

func EncodeGovMsg(sender sdk.AccAddress, msg *v1wasmTypes.GovMsg) ([]sdk.Msg, error)

func EncodeIBCMsg

func EncodeIBCMsg(portSource types.ICS20TransferPortSource) func(ctx sdk.Context, sender sdk.AccAddress, contractIBCPortID string, msg *v1wasmTypes.IBCMsg) ([]sdk.Msg, error)

func EncodeStakingMsg

func EncodeStakingMsg(sender sdk.AccAddress, msg *v1wasmTypes.StakingMsg) ([]sdk.Msg, error)

func EncodeWasmMsg

func EncodeWasmMsg(sender sdk.AccAddress, msg *v1wasmTypes.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

func FuzzAbsoluteTxPosition(m *types.AbsoluteTxPosition, c fuzz.Continue)

func FuzzAddr

func FuzzAddr(m *sdk.AccAddress, c fuzz.Continue)

func FuzzContractInfo

func FuzzContractInfo(m *types.ContractInfo, c fuzz.Continue)

func FuzzStateModel

func FuzzStateModel(m *types.Model, c fuzz.Continue)

func GovQuerier

func GovQuerier(keeper govkeeper.Keeper) func(ctx sdk.Context, request *wasmTypes.GovQuery) ([]byte, error)

func IBCQuerier

func IBCQuerier(wasm *Keeper, channelKeeper types.ChannelKeeper) func(ctx sdk.Context, caller sdk.AccAddress, request *wasmTypes.IBCQuery) ([]byte, error)

func InitGenesis

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

InitGenesis sets supply information for genesis.

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

func MakeEncodingConfig

func MakeEncodingConfig() simappparams.EncodingConfig

func MakeTestCodec

func MakeTestCodec() codec.Codec

func MintQuerier

func MintQuerier(keeper mintkeeper.Keeper) func(ctx sdk.Context, request *wasmTypes.MintQuery) ([]byte, error)

func NewLegacyQuerier

func NewLegacyQuerier(keeper Keeper) sdk.Querier

NewLegacyQuerier creates a new querier

func NewMsgServerImpl

func NewMsgServerImpl(k Keeper) types.MsgServer

func NewTestTx

func NewTestTx(msg sdk.Msg, creatorAcc authtypes.AccountI, privKey crypto.PrivKey) *tx.Tx

func NewTestTxMultiple

func NewTestTxMultiple(msgs []sdk.Msg, creatorAccs []authtypes.AccountI, privKeys []crypto.PrivKey) *tx.Tx

func NoCustomMsg

func NoCustomMsg(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error)

func NoCustomQuerier

func NoCustomQuerier(sdk.Context, json.RawMessage) ([]byte, error)

func PortIDForContract

func PortIDForContract(addr sdk.AccAddress) string

func PrepareExecSignedTx

func PrepareExecSignedTx(t *testing.T, keeper Keeper, ctx sdk.Context, sender sdk.AccAddress, privKey crypto.PrivKey, encMsg []byte, contract sdk.AccAddress, funds sdk.Coins) sdk.Context

func PrepareIBCOpenAck

func PrepareIBCOpenAck(t *testing.T, keeper Keeper, ctx sdk.Context, ibcOpenAck v1types.IBCOpenAck, ibcOpenConfirm v1types.IBCOpenConfirm) sdk.Context

func PrepareInitSignedTx

func PrepareInitSignedTx(t *testing.T, keeper Keeper, ctx sdk.Context, creator sdk.AccAddress, privKey crypto.PrivKey, encMsg []byte, codeID uint64, funds sdk.Coins) sdk.Context

func StakingQuerier

func StakingQuerier(keeper stakingkeeper.Keeper, distKeeper distrkeeper.Keeper) func(ctx sdk.Context, request *wasmTypes.StakingQuery) ([]byte, error)

func StargateQuerier

func StargateQuerier(queryRouter GRPCQueryRouter) func(ctx sdk.Context, request *wasmTypes.StargateQuery) ([]byte, error)

func TestHandler

func TestHandler(k Keeper) sdk.Handler

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

func V010MsgToV1SubMsg

func V010MsgToV1SubMsg(contractAddress string, msg v010wasmTypes.CosmosMsg) (v1wasmTypes.SubMsg, error)

func V010MsgsToV1SubMsgs

func V010MsgsToV1SubMsgs(contractAddr string, msgs []v010wasmTypes.CosmosMsg) ([]v1wasmTypes.SubMsg, error)

func WasmQuerier

func WasmQuerier(wasm *Keeper) func(ctx sdk.Context, request *wasmTypes.WasmQuery, queryDepth uint32) ([]byte, error)

Types

type BankEncoder

type BankEncoder func(sender sdk.AccAddress, msg *v1wasmTypes.BankMsg) ([]sdk.Msg, error)

type ContractResponseHandler

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

ContractResponseHandler default implementation that first dispatches submessage then normal messages. The Submessage execution may include an success/failure response handling by the contract that can overwrite the original

func NewContractResponseHandler

func NewContractResponseHandler(md MsgDispatcher) *ContractResponseHandler

func (ContractResponseHandler) Handle

func (h ContractResponseHandler) Handle(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, messages []v1wasmTypes.SubMsg, origRspData []byte, ogTx []byte, ogSigInfo wasmTypes.VerificationInfo, ogCosmosMessageVersion wasmTypes.CosmosMsgVersion) ([]byte, error)

Handle processes the data returned by a contract invocation.

type CountTXDecorator

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

CountTXDecorator ante handler to count the tx position in a block.

func NewCountTXDecorator

func NewCountTXDecorator(storeKey sdk.StoreKey) *CountTXDecorator

NewCountTXDecorator constructor

func (CountTXDecorator) AnteHandle

func (a CountTXDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

AnteHandle handler stores a tx counter with current height encoded in the store to let the app handle global rollback behavior instead of keeping state in the handler itself. The ante handler passes the counter value via sdk.Context upstream. See `types.TXCounter(ctx)` to read the value. Simulations don't get a tx counter value assigned.

type CustomEncoder

type CustomEncoder func(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error)

type CustomQuerier

type CustomQuerier func(ctx sdk.Context, request json.RawMessage) ([]byte, error)

type DistributionEncoder

type DistributionEncoder func(sender sdk.AccAddress, msg *v1wasmTypes.DistributionMsg) ([]sdk.Msg, error)

type GRPCQueryRouter

type GRPCQueryRouter interface {
	Route(path string) baseapp.GRPCQueryHandler
}

type GovEncoder

type GovEncoder func(sender sdk.AccAddress, msg *v1wasmTypes.GovMsg) ([]sdk.Msg, error)

type GrpcQuerier

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

func NewGrpcQuerier

func NewGrpcQuerier(keeper Keeper) GrpcQuerier

func (GrpcQuerier) Code

func (GrpcQuerier) CodeHashByCodeID

func (GrpcQuerier) CodeHashByContractAddress

func (GrpcQuerier) Codes

type IBCEncoder

type IBCEncoder func(ctx sdk.Context, sender sdk.AccAddress, contractIBCPortID string, msg *v1wasmTypes.IBCMsg) ([]sdk.Msg, error)

type IBCRawPacketHandler

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

IBCRawPacketHandler handels IBC.SendPacket messages which are published to an IBC channel.

func (IBCRawPacketHandler) DispatchMsg

func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, contractIBCPortID string, msg v1wasmTypes.CosmosMsg, ogMessageVersion wasmTypes.CosmosMsgVersion) (events []sdk.Event, data [][]byte, err error)

DispatchMsg publishes a raw IBC packet onto the channel.

type InvalidRequest

type InvalidRequest struct {
	Err     string `json:"error"`
	Request []byte `json:"request"`
}

func (InvalidRequest) Error

func (e InvalidRequest) Error() string

type InvalidResponse

type InvalidResponse struct {
	Err      string `json:"error"`
	Response []byte `json:"response"`
}

func (InvalidResponse) Error

func (e InvalidResponse) Error() string

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.Codec,
	legacyAmino codec.LegacyAmino,
	storeKey sdk.StoreKey,
	accountKeeper authkeeper.AccountKeeper,
	bankKeeper bankkeeper.Keeper,
	govKeeper govkeeper.Keeper,
	distKeeper distrkeeper.Keeper,
	mintKeeper mintkeeper.Keeper,
	stakingKeeper stakingkeeper.Keeper,
	capabilityKeeper capabilitykeeper.ScopedKeeper,
	portKeeper portkeeper.Keeper,
	portSource types.ICS20TransferPortSource,
	channelKeeper channelkeeper.Keeper,
	legacyMsgRouter sdk.Router,
	msgRouter MessageRouter,
	queryRouter GRPCQueryRouter,
	homeDir string,
	wasmConfig *types.WasmConfig,
	supportedFeatures string,
	customEncoders *MessageEncoders,
	customPlugins *QueryPlugins,
) Keeper

func (Keeper) AuthenticateCapability

func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool

AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function

func (Keeper) ClaimCapability

func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error

ClaimCapability allows the transfer module to claim a capability that IBC module passes to it

func (Keeper) Create

func (k Keeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, source string, builder string) (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, callbackSig []byte) (*sdk.Result, error)

Execute executes the contract instance

func (Keeper) GetCodeInfo

func (k Keeper) GetCodeInfo(ctx sdk.Context, codeID uint64) (types.CodeInfo, error)

func (Keeper) GetContractAddress

func (k Keeper) GetContractAddress(ctx sdk.Context, label string) sdk.AccAddress

func (Keeper) GetContractHash

func (k Keeper) GetContractHash(ctx sdk.Context, contractAddress sdk.AccAddress) ([]byte, error)

func (Keeper) GetContractInfo

func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo

func (Keeper) GetContractKey

func (k Keeper) GetContractKey(ctx sdk.Context, contractAddress sdk.AccAddress) []byte

func (Keeper) GetContractState

func (k Keeper) GetContractState(ctx sdk.Context, contractAddress sdk.AccAddress) sdk.Iterator

func (Keeper) GetNextCodeID

func (k Keeper) GetNextCodeID(ctx sdk.Context) uint64

func (Keeper) GetSignerInfo

func (k Keeper) GetSignerInfo(ctx sdk.Context, signer sdk.AccAddress) ([]byte, sdktxsigning.SignMode, []byte, []byte, []byte, error)

func (Keeper) GetWasm

func (k Keeper) GetWasm(ctx sdk.Context, codeID uint64) ([]byte, error)

func (Keeper) Instantiate

func (k Keeper) Instantiate(ctx sdk.Context, codeID uint64, creator sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, callbackSig []byte) (sdk.AccAddress, []byte, error)

Instantiate creates an instance of a WASM contract

func (Keeper) IterateCodeInfos

func (k Keeper) IterateCodeInfos(ctx sdk.Context, cb func(uint64, types.CodeInfo) bool)

func (Keeper) IterateContractInfo

func (k Keeper) IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo, types.ContractCustomInfo) bool)

func (Keeper) OnAckPacket

func (k Keeper) OnAckPacket(
	ctx sdk.Context,
	contractAddress sdk.AccAddress,
	msg v1types.IBCPacketAckMsg,
) error

OnAckPacket calls the contract to handle the "acknowledgement" data which can contain success or failure of a packet acknowledgement written on the receiving chain for example. This is application level data and fully owned by the contract. The use of the standard acknowledgement envelope is recommended: https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope

On application errors the contract can revert an operation like returning tokens as in ibc-transfer.

For more information see: https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#packet-flow--handling

func (Keeper) OnCloseChannel

func (k Keeper) OnCloseChannel(
	ctx sdk.Context,
	contractAddress sdk.AccAddress,
	msg v1types.IBCChannelCloseMsg,
) error

OnCloseChannel calls the contract to let it know the IBC channel is closed. Calling modules MAY atomically execute appropriate application logic in conjunction with calling chanCloseConfirm.

Once closed, channels cannot be reopened and identifiers cannot be reused. Identifier reuse is prevented because we want to prevent potential replay of previously sent packets See https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#channel-lifecycle-management

func (Keeper) OnConnectChannel

func (k Keeper) OnConnectChannel(
	ctx sdk.Context,
	contractAddress sdk.AccAddress,
	msg v1types.IBCChannelConnectMsg,
) error

OnConnectChannel calls the contract to let it know the IBC channel was established. In the IBC protocol this is either the `Channel Open Ack` event on the initiating chain or `Channel Open Confirm` on the counterparty chain.

There is an open issue with the [cosmos-sdk](https://github.com/cosmos/cosmos-sdk/issues/8334) that the counterparty channelID is empty on the initiating chain See https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#channel-lifecycle-management

func (Keeper) OnOpenChannel

func (k Keeper) OnOpenChannel(
	ctx sdk.Context,
	contractAddress sdk.AccAddress,
	msg v1types.IBCChannelOpenMsg,
) (string, error)

OnOpenChannel calls the contract to participate in the IBC channel handshake step. In the IBC protocol this is either the `Channel Open Init` event on the initiating chain or `Channel Open Try` on the counterparty chain. Protocol version and channel ordering should be verified for example. See https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#channel-lifecycle-management

func (Keeper) OnRecvPacket

func (k Keeper) OnRecvPacket(
	ctx sdk.Context,
	contractAddress sdk.AccAddress,
	msg v1types.IBCPacketReceiveMsg,
) ([]byte, error)

OnRecvPacket calls the contract to process the incoming IBC packet. The contract fully owns the data processing and returns the acknowledgement data for the chain level. This allows custom applications and protocols on top of IBC. Although it is recommended to use the standard acknowledgement envelope defined in https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope

For more information see: https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#packet-flow--handling

func (Keeper) OnTimeoutPacket

func (k Keeper) OnTimeoutPacket(
	ctx sdk.Context,
	contractAddress sdk.AccAddress,
	msg v1types.IBCPacketTimeoutMsg,
) error

OnTimeoutPacket calls the contract to let it know the packet was never received on the destination chain within the timeout boundaries. The contract should handle this on the application level and undo the original operation

func (Keeper) QueryRaw

func (k Keeper) QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []types.Model

We don't use this function since we have an encrypted state. It's here for upstream compatibility QueryRaw returns the contract's state for give key. For a `nil` key a empty slice result is returned.

func (Keeper) QuerySmart

func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte, useDefaultGasLimit bool) ([]byte, error)

QuerySmart queries the smart contract itself.

type MessageDispatcher

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

MessageDispatcher coordinates message sending and submessage reply/ state commits

func NewMessageDispatcher

func NewMessageDispatcher(messenger Messenger, keeper Replyer) *MessageDispatcher

NewMessageDispatcher constructor

func (MessageDispatcher) DispatchSubmessages

func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []v1wasmTypes.SubMsg, ogTx []byte, ogSigInfo wasmTypes.VerificationInfo, ogCosmosMessageVersion wasmTypes.CosmosMsgVersion) ([]byte, error)

DispatchSubmessages builds a sandbox to execute these messages and returns the execution result to the contract that dispatched them, both on success as well as failure

type MessageEncoders

type MessageEncoders struct {
	Bank         BankEncoder
	Custom       CustomEncoder
	Distribution DistributionEncoder
	Gov          GovEncoder
	IBC          IBCEncoder
	Staking      StakingEncoder
	Stargate     StargateEncoder
	Wasm         WasmEncoder
}

func DefaultEncoders

func DefaultEncoders(portSource types.ICS20TransferPortSource, unpacker codectypes.AnyUnpacker) MessageEncoders

func (MessageEncoders) Encode

func (e MessageEncoders) Encode(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg v1wasmTypes.CosmosMsg) ([]sdk.Msg, error)

func (MessageEncoders) Merge

type MessageHandlerChain

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

MessageHandlerChain defines a chain of handlers that are called one by one until it can be handled.

func NewMessageHandlerChain

func NewMessageHandlerChain(first Messenger, others ...Messenger) *MessageHandlerChain

func (MessageHandlerChain) DispatchMsg

func (m MessageHandlerChain) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg v1wasmTypes.CosmosMsg, ogMessageVersion wasmTypes.CosmosMsgVersion) ([]sdk.Event, [][]byte, error)

DispatchMsg dispatch message and calls chained handlers one after another in order to find the right one to process given message. If a handler cannot process given message (returns ErrUnknownMsg), its result is ignored and the next handler is executed.

type MessageRouter

type MessageRouter interface {
	Handler(msg sdk.Msg) baseapp.MsgServiceHandler
}

MessageRouter ADR 031 request type routing

type Messenger

type Messenger interface {
	// DispatchMsg encodes the wasmVM message and dispatches it.
	DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg v1wasmTypes.CosmosMsg, ogMessageVersion wasmTypes.CosmosMsgVersion) (events []sdk.Event, data [][]byte, err error)
}

func NewMessageHandler

func NewMessageHandler(
	msgRouter MessageRouter,
	legacyMsgRouter sdk.Router,
	customEncoders *MessageEncoders,
	channelKeeper channelkeeper.Keeper,
	capabilityKeeper capabilitykeeper.ScopedKeeper,
	portSource types.ICS20TransferPortSource,
	unpacker codectypes.AnyUnpacker,
) Messenger

type Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

type MockIBCTransferKeeper

type MockIBCTransferKeeper struct {
	GetPortFn func(ctx sdk.Context) string
}

func (MockIBCTransferKeeper) GetPort

func (m MockIBCTransferKeeper) GetPort(ctx sdk.Context) string

type MsgDispatcher

type MsgDispatcher interface {
	DispatchSubmessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []v1wasmTypes.SubMsg, ogTx []byte, ogSigInfo wasmTypes.VerificationInfo, ogCosmosMessageVersion wasmTypes.CosmosMsgVersion) ([]byte, error)
}

type MultipiedGasMeter

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

func (m MultipiedGasMeter) GasConsumed() sdk.Gas

type NoSuchContract

type NoSuchContract struct {
	Addr string `json:"addr,omitempty"`
}

func (NoSuchContract) Error

func (e NoSuchContract) Error() string

type QueryHandler

type QueryHandler struct {
	Ctx     sdk.Context
	Plugins QueryPlugins
	Caller  sdk.AccAddress
}

func (QueryHandler) GasConsumed

func (q QueryHandler) GasConsumed() uint64

func (QueryHandler) Query

func (q QueryHandler) Query(request wasmTypes.QueryRequest, queryDepth uint32, gasLimit uint64) ([]byte, error)

type QueryPlugins

type QueryPlugins struct {
	Bank     func(ctx sdk.Context, request *wasmTypes.BankQuery) ([]byte, error)
	Custom   CustomQuerier
	Staking  func(ctx sdk.Context, request *wasmTypes.StakingQuery) ([]byte, error)
	Wasm     func(ctx sdk.Context, request *wasmTypes.WasmQuery, queryDepth uint32) ([]byte, error)
	Dist     func(ctx sdk.Context, request *wasmTypes.DistQuery) ([]byte, error)
	Mint     func(ctx sdk.Context, request *wasmTypes.MintQuery) ([]byte, error)
	Gov      func(ctx sdk.Context, request *wasmTypes.GovQuery) ([]byte, error)
	IBC      func(ctx sdk.Context, caller sdk.AccAddress, request *wasmTypes.IBCQuery) ([]byte, error)
	Stargate func(ctx sdk.Context, request *wasmTypes.StargateQuery) ([]byte, error)
}

func DefaultQueryPlugins

func DefaultQueryPlugins(gov govkeeper.Keeper, dist distrkeeper.Keeper, mint mintkeeper.Keeper, bank bankkeeper.Keeper, staking stakingkeeper.Keeper, stargateQueryRouter GRPCQueryRouter, wasm *Keeper, channelKeeper types.ChannelKeeper) QueryPlugins

func (QueryPlugins) Merge

type Replyer

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

Replyer is a subset of keeper that can handle replies to submessages

type ResponseHandler

type ResponseHandler interface {
	// Handle processes the data returned by a contract invocation.
	Handle(
		ctx sdk.Context,
		contractAddr sdk.AccAddress,
		ibcPort string,
		messages []v1wasmTypes.SubMsg,
		origRspData []byte,
		ogTx []byte,
		sigInfo wasmTypes.VerificationInfo,
	) ([]byte, error)
}

type SDKMessageHandler

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

SDKMessageHandler can handles messages that can be encoded into sdk.Message types and routed.

func NewSDKMessageHandler

func NewSDKMessageHandler(router MessageRouter, legacyRouter sdk.Router, encoders MessageEncoders) SDKMessageHandler

func (SDKMessageHandler) DispatchMsg

func (h SDKMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg v1wasmTypes.CosmosMsg, ogMessageVersion wasmTypes.CosmosMsgVersion) ([]sdk.Event, [][]byte, error)

type StakingEncoder

type StakingEncoder func(sender sdk.AccAddress, msg *v1wasmTypes.StakingMsg) ([]sdk.Msg, error)

type StargateEncoder

type StargateEncoder func(sender sdk.AccAddress, msg *v1wasmTypes.StargateMsg) ([]sdk.Msg, error)

func EncodeStargateMsg

func EncodeStargateMsg(unpacker codectypes.AnyUnpacker) StargateEncoder

type TestConfigType

type TestConfigType struct {
	ChainID string
}

type TestKeepers

type TestKeepers struct {
	AccountKeeper authkeeper.AccountKeeper
	StakingKeeper stakingkeeper.Keeper
	WasmKeeper    Keeper
	DistKeeper    distrkeeper.Keeper
	GovKeeper     govkeeper.Keeper
	BankKeeper    bankkeeper.Keeper
	MintKeeper    mintkeeper.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 Unknown

type Unknown struct{}

func (Unknown) Error

func (e Unknown) Error() string

type UnsupportedRequest

type UnsupportedRequest struct {
	Kind string `json:"kind,omitempty"`
}

func (UnsupportedRequest) Error

func (e UnsupportedRequest) Error() string

type WasmEncoder

type WasmEncoder func(sender sdk.AccAddress, msg *v1wasmTypes.WasmMsg) ([]sdk.Msg, error)

type WasmSnapshotter

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

func NewWasmSnapshotter

func NewWasmSnapshotter(cms storetypes.MultiStore, keeper *Keeper) *WasmSnapshotter

func (*WasmSnapshotter) Restore

func (ws *WasmSnapshotter) Restore(
	height uint64, format uint32, protoReader protoio.Reader,
) (snapshottypes.SnapshotItem, error)

func (*WasmSnapshotter) Snapshot

func (ws *WasmSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error

func (*WasmSnapshotter) SnapshotFormat

func (ws *WasmSnapshotter) SnapshotFormat() uint32

func (*WasmSnapshotter) SnapshotName

func (ws *WasmSnapshotter) SnapshotName() string

func (*WasmSnapshotter) SupportedFormats

func (ws *WasmSnapshotter) SupportedFormats() []uint32

Jump to

Keyboard shortcuts

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