Documentation ¶
Index ¶
- Constants
- Variables
- func BankQuerier(bankKeeper bankkeeper.ViewKeeper) func(ctx sdk.Context, request *wasmTypes.BankQuery) ([]byte, error)
- func ContractFromPortID(portID string) (sdk.AccAddress, error)
- func CreateFakeFundedAccount(ctx sdk.Context, am authkeeper.AccountKeeper, bk bankkeeper.Keeper, ...) (sdk.AccAddress, crypto.PrivKey)
- func DistQuerier(keeper distrkeeper.Keeper) func(ctx sdk.Context, request *wasmTypes.DistQuery) ([]byte, error)
- func EncodeBankMsg(sender sdk.AccAddress, msg *v1wasmTypes.BankMsg) ([]sdk.Msg, error)
- func EncodeDistributionMsg(sender sdk.AccAddress, msg *v1wasmTypes.DistributionMsg) ([]sdk.Msg, error)
- func EncodeGovMsg(sender sdk.AccAddress, msg *v1wasmTypes.GovMsg) ([]sdk.Msg, error)
- func EncodeIBCMsg(portSource types.ICS20TransferPortSource) ...
- func EncodeStakingMsg(sender sdk.AccAddress, msg *v1wasmTypes.StakingMsg) ([]sdk.Msg, error)
- func EncodeWasmMsg(sender sdk.AccAddress, msg *v1wasmTypes.WasmMsg) ([]sdk.Msg, error)
- func ExportGenesis(ctx sdk.Context, keeper Keeper) *types.GenesisState
- func FuzzAbsoluteTxPosition(m *types.AbsoluteTxPosition, c fuzz.Continue)
- func FuzzAddr(m *sdk.AccAddress, c fuzz.Continue)
- func FuzzContractInfo(m *types.ContractInfo, c fuzz.Continue)
- func FuzzStateModel(m *types.Model, c fuzz.Continue)
- func GovQuerier(keeper govkeeper.Keeper) func(ctx sdk.Context, request *wasmTypes.GovQuery) ([]byte, error)
- func IBCQuerier(wasm *Keeper, channelKeeper types.ChannelKeeper) ...
- func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) error
- func MakeEncodingConfig() simappparams.EncodingConfig
- func MakeTestCodec() codec.Codec
- func MintQuerier(keeper mintkeeper.Keeper) func(ctx sdk.Context, request *wasmTypes.MintQuery) ([]byte, error)
- func NewLegacyQuerier(keeper Keeper) sdk.Querier
- func NewMsgServerImpl(k Keeper) types.MsgServer
- func NewTestTx(msg sdk.Msg, creatorAcc authtypes.AccountI, privKey crypto.PrivKey) *tx.Tx
- func NewTestTxMultiple(msgs []sdk.Msg, creatorAccs []authtypes.AccountI, privKeys []crypto.PrivKey) *tx.Tx
- func NoCustomMsg(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error)
- func NoCustomQuerier(sdk.Context, json.RawMessage) ([]byte, error)
- func PortIDForContract(addr sdk.AccAddress) string
- func PrepareExecSignedTx(t *testing.T, keeper Keeper, ctx sdk.Context, sender sdk.AccAddress, ...) sdk.Context
- func PrepareIBCOpenAck(t *testing.T, keeper Keeper, ctx sdk.Context, ibcOpenAck v1types.IBCOpenAck, ...) sdk.Context
- func PrepareInitSignedTx(t *testing.T, keeper Keeper, ctx sdk.Context, creator sdk.AccAddress, ...) sdk.Context
- func StakingQuerier(keeper stakingkeeper.Keeper, distKeeper distrkeeper.Keeper) func(ctx sdk.Context, request *wasmTypes.StakingQuery) ([]byte, error)
- func StargateQuerier(queryRouter GRPCQueryRouter) func(ctx sdk.Context, request *wasmTypes.StargateQuery) ([]byte, error)
- func TestHandler(k Keeper) sdk.Handler
- func V010MsgToV1SubMsg(contractAddress string, msg v010wasmTypes.CosmosMsg) (v1wasmTypes.SubMsg, error)
- func V010MsgsToV1SubMsgs(contractAddr string, msgs []v010wasmTypes.CosmosMsg) ([]v1wasmTypes.SubMsg, error)
- func WasmQuerier(wasm *Keeper) ...
- type BankEncoder
- type ContractResponseHandler
- type CountTXDecorator
- type CustomEncoder
- type CustomQuerier
- type DistributionEncoder
- type GRPCQueryRouter
- type GovEncoder
- type GrpcQuerier
- func (q GrpcQuerier) AddressByLabel(c context.Context, req *types.QueryByLabelRequest) (*types.QueryContractAddressResponse, error)
- func (q GrpcQuerier) Code(c context.Context, req *types.QueryByCodeIdRequest) (*types.QueryCodeResponse, error)
- func (q GrpcQuerier) CodeHashByCodeId(c context.Context, req *types.QueryByCodeIdRequest) (*types.QueryCodeHashResponse, error)
- func (q GrpcQuerier) CodeHashByContractAddress(c context.Context, req *types.QueryByContractAddressRequest) (*types.QueryCodeHashResponse, error)
- func (q GrpcQuerier) Codes(c context.Context, _ *empty.Empty) (*types.QueryCodesResponse, error)
- func (q GrpcQuerier) ContractInfo(c context.Context, req *types.QueryByContractAddressRequest) (*types.QueryContractInfoResponse, error)
- func (q GrpcQuerier) ContractsByCodeId(c context.Context, req *types.QueryByCodeIdRequest) (*types.QueryContractsByCodeIdResponse, error)
- func (q GrpcQuerier) LabelByAddress(c context.Context, req *types.QueryByContractAddressRequest) (*types.QueryContractLabelResponse, error)
- func (q GrpcQuerier) QuerySecretContract(c context.Context, req *types.QuerySecretContractRequest) (*types.QuerySecretContractResponse, error)
- type IBCEncoder
- type IBCRawPacketHandler
- type InvalidRequest
- type InvalidResponse
- type Keeper
- func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
- func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) 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) GetCodeInfo(ctx sdk.Context, codeID uint64) (types.CodeInfo, error)
- func (k Keeper) GetContractAddress(ctx sdk.Context, label string) sdk.AccAddress
- func (k Keeper) GetContractHash(ctx sdk.Context, contractAddress sdk.AccAddress) ([]byte, error)
- func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo
- func (k Keeper) GetContractKey(ctx sdk.Context, contractAddress sdk.AccAddress) []byte
- func (k Keeper) GetContractState(ctx sdk.Context, contractAddress sdk.AccAddress) sdk.Iterator
- func (k Keeper) GetNextCodeID(ctx sdk.Context) uint64
- func (k Keeper) GetSignerInfo(ctx sdk.Context, signer sdk.AccAddress) ([]byte, sdktxsigning.SignMode, []byte, []byte, []byte, error)
- func (k Keeper) GetWasm(ctx sdk.Context, codeID uint64) ([]byte, error)
- func (k Keeper) Instantiate(ctx sdk.Context, codeID uint64, creator sdk.AccAddress, initMsg []byte, ...) (sdk.AccAddress, []byte, error)
- func (k Keeper) IterateCodeInfos(ctx sdk.Context, cb func(uint64, types.CodeInfo) bool)
- func (k Keeper) IterateContractInfo(ctx sdk.Context, ...)
- func (k Keeper) OnAckPacket(ctx sdk.Context, contractAddress sdk.AccAddress, msg v1types.IBCPacketAckMsg) error
- func (k Keeper) OnCloseChannel(ctx sdk.Context, contractAddress sdk.AccAddress, ...) error
- func (k Keeper) OnConnectChannel(ctx sdk.Context, contractAddress sdk.AccAddress, ...) error
- func (k Keeper) OnOpenChannel(ctx sdk.Context, contractAddress sdk.AccAddress, msg v1types.IBCChannelOpenMsg) (string, error)
- func (k Keeper) OnRecvPacket(ctx sdk.Context, contractAddress sdk.AccAddress, ...) ([]byte, error)
- func (k Keeper) OnTimeoutPacket(ctx sdk.Context, contractAddress sdk.AccAddress, ...) error
- func (k Keeper) QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []types.Model
- func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte, ...) ([]byte, error)
- type MessageDispatcher
- type MessageEncoders
- type MessageHandlerChain
- type MessageRouter
- type Messenger
- type Migrator
- type MockIBCTransferKeeper
- type MsgDispatcher
- type MultipiedGasMeter
- type NoSuchContract
- type QueryHandler
- type QueryPlugins
- type Replyer
- type ResponseHandler
- type SDKMessageHandler
- type StakingEncoder
- type StargateEncoder
- type TestConfigType
- type TestKeepers
- type Unknown
- type UnsupportedRequest
- type WasmEncoder
- type WasmSnapshotter
- func (ws *WasmSnapshotter) Restore(height uint64, format uint32, protoReader protoio.Reader) (snapshottypes.SnapshotItem, error)
- func (ws *WasmSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error
- func (ws *WasmSnapshotter) SnapshotFormat() uint32
- func (ws *WasmSnapshotter) SnapshotName() string
- func (ws *WasmSnapshotter) SupportedFormats() []uint32
Constants ¶
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" )
const QueryMethodContractStateSmart = "smart"
Variables ¶
var ( CostHumanize = 5 * types.GasMultiplier CostCanonical = 4 * types.GasMultiplier )
var ModelFuzzers = []interface{}{FuzzAddr, FuzzAbsoluteTxPosition, FuzzContractInfo, FuzzStateModel}
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{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, registration.AppModuleBasic{}, )
var TestConfig = TestConfigType{
ChainID: "test-secret-X",
}
var TestContractPaths = map[string]string{ // contains filtered or unexported fields }
var TestingStakeParams = stakingtypes.Params{ UnbondingTime: 100, MaxValidators: 10, MaxEntries: 10, HistoricalEntries: 10, BondDenom: sdk.DefaultBondDenom, }
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 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 FuzzContractInfo ¶
func FuzzContractInfo(m *types.ContractInfo, c fuzz.Continue)
func GovQuerier ¶
func IBCQuerier ¶
func InitGenesis ¶
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 MintQuerier ¶
func NewLegacyQuerier ¶
NewLegacyQuerier creates a new querier
func NewMsgServerImpl ¶
func NewTestTxMultiple ¶
func NoCustomMsg ¶
func NoCustomMsg(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error)
func NoCustomQuerier ¶
func PortIDForContract ¶
func PortIDForContract(addr sdk.AccAddress) string
func PrepareExecSignedTx ¶
func PrepareIBCOpenAck ¶
func PrepareInitSignedTx ¶
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 ¶
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)
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 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) AddressByLabel ¶
func (q GrpcQuerier) AddressByLabel(c context.Context, req *types.QueryByLabelRequest) (*types.QueryContractAddressResponse, error)
func (GrpcQuerier) Code ¶
func (q GrpcQuerier) Code(c context.Context, req *types.QueryByCodeIdRequest) (*types.QueryCodeResponse, error)
func (GrpcQuerier) CodeHashByCodeId ¶ added in v1.5.0
func (q GrpcQuerier) CodeHashByCodeId(c context.Context, req *types.QueryByCodeIdRequest) (*types.QueryCodeHashResponse, error)
func (GrpcQuerier) CodeHashByContractAddress ¶
func (q GrpcQuerier) CodeHashByContractAddress(c context.Context, req *types.QueryByContractAddressRequest) (*types.QueryCodeHashResponse, error)
func (GrpcQuerier) Codes ¶
func (q GrpcQuerier) Codes(c context.Context, _ *empty.Empty) (*types.QueryCodesResponse, error)
func (GrpcQuerier) ContractInfo ¶
func (q GrpcQuerier) ContractInfo(c context.Context, req *types.QueryByContractAddressRequest) (*types.QueryContractInfoResponse, error)
func (GrpcQuerier) ContractsByCodeId ¶ added in v1.5.0
func (q GrpcQuerier) ContractsByCodeId(c context.Context, req *types.QueryByCodeIdRequest) (*types.QueryContractsByCodeIdResponse, error)
func (GrpcQuerier) LabelByAddress ¶
func (q GrpcQuerier) LabelByAddress(c context.Context, req *types.QueryByContractAddressRequest) (*types.QueryContractLabelResponse, error)
func (GrpcQuerier) QuerySecretContract ¶
func (q GrpcQuerier) QuerySecretContract(c context.Context, req *types.QuerySecretContractRequest) (*types.QuerySecretContractResponse, error)
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 NewIBCRawPacketHandler ¶
func NewIBCRawPacketHandler(chk channelkeeper.Keeper, cak capabilitykeeper.ScopedKeeper) IBCRawPacketHandler
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 ¶
func (InvalidRequest) Error ¶
func (e InvalidRequest) Error() string
type InvalidResponse ¶
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 (Keeper) GetContractAddress ¶
func (Keeper) GetContractHash ¶
func (Keeper) GetContractInfo ¶
func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo
func (Keeper) GetContractKey ¶
func (Keeper) GetContractState ¶
func (Keeper) GetSignerInfo ¶
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 (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
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 ¶
func (e MessageEncoders) Merge(o *MessageEncoders) MessageEncoders
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.
type MockIBCTransferKeeper ¶
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 ¶
func (e QueryPlugins) Merge(o *QueryPlugins) QueryPlugins
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 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