Documentation ¶
Index ¶
- Constants
- Variables
- func AcceptListStargateQuerier(acceptList AcceptedStargateQueries, queryRouter GRPCQueryRouter, ...) func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error)
- func BankQuerier(bankKeeper types.BankViewKeeper) func(ctx sdk.Context, request *wasmvmtypes.BankQuery) ([]byte, error)
- func BuildContractAddressClassic(codeID, instanceID uint64) sdk.AccAddress
- func BuildContractAddressPredictable(checksum []byte, creator sdk.AccAddress, ...) sdk.AccAddress
- func ContractFromPortID(portID string) (sdk.AccAddress, error)
- func ConvertProtoToJSONMarshal(cdc codec.Codec, protoResponse codec.ProtoMarshaler, bz []byte) ([]byte, error)
- func ConvertSdkCoinToWasmCoin(coin sdk.Coin) wasmvmtypes.Coin
- func ConvertSdkCoinsToWasmCoins(coins []sdk.Coin) wasmvmtypes.Coins
- func ConvertWasmCoinToSdkCoin(coin wasmvmtypes.Coin) (sdk.Coin, error)
- func ConvertWasmCoinsToSdkCoins(coins []wasmvmtypes.Coin) (sdk.Coins, error)
- func ConvertWasmIBCTimeoutHeightToCosmosHeight(ibcTimeoutBlock *wasmvmtypes.IBCTimeoutBlock) ibcclienttypes.Height
- func DefaultPerByteUncompressCost() wasmvmtypes.UFraction
- func DeterministicAccountAddress(_ testing.TB, v byte) sdk.AccAddress
- func EncodeBankMsg(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg, error)
- func EncodeDistributionMsg(sender sdk.AccAddress, msg *wasmvmtypes.DistributionMsg) ([]sdk.Msg, error)
- func EncodeGovMsg(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, error)
- func EncodeIBCMsg(portSource types.ICS20TransferPortSource) ...
- 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 IBCQuerier(wasm contractMetaDataSource, channelKeeper types.ChannelKeeper) ...
- func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]abci.ValidatorUpdate, error)
- func MakeEncodingConfig(_ testing.TB) wasmappparams.EncodingConfig
- func MakeTestCodec(tb testing.TB) codec.Codec
- func NewMsgServerImpl(k *Keeper) types.MsgServer
- func NewWasmProposalHandler(k decoratedKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handlerdeprecated
- func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handlerdeprecated
- func NoCustomMsg(_ sdk.AccAddress, _ json.RawMessage) ([]sdk.Msg, error)
- func NoCustomQuerier(sdk.Context, json.RawMessage) ([]byte, error)
- func PortIDForContract(addr sdk.AccAddress) string
- func RandomAccountAddress(_ testing.TB) sdk.AccAddress
- func RandomBech32AccountAddress(tb testing.TB) string
- func RejectStargateQuerier() func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error)
- func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKeeper) func(ctx sdk.Context, request *wasmvmtypes.StakingQuery) ([]byte, error)
- func UInt64LengthPrefix(bz []byte) []byte
- func WasmQuerier(k wasmQueryKeeper) func(ctx sdk.Context, request *wasmvmtypes.WasmQuery) ([]byte, error)
- type AcceptedStargateQueries
- type AccountPruner
- type AddressGenerator
- type AuthorizationPolicy
- type BankCoinTransferrer
- type BankEncoder
- type BurnerExampleInitMsg
- type ChainAccessConfigs
- type CoinTransferrer
- type CountTXDecorator
- type CustomEncoder
- type CustomQuerier
- type DefaultAuthorizationPolicy
- func (p DefaultAuthorizationPolicy) CanCreateCode(chainConfigs ChainAccessConfigs, actor sdk.AccAddress, ...) bool
- func (p DefaultAuthorizationPolicy) CanInstantiateContract(config types.AccessConfig, actor sdk.AccAddress) bool
- func (p DefaultAuthorizationPolicy) CanModifyCodeAccessConfig(creator, actor sdk.AccAddress, isSubset bool) bool
- func (p DefaultAuthorizationPolicy) CanModifyContract(admin, actor sdk.AccAddress) bool
- type DefaultWasmVMContractResponseHandler
- type DistributionEncoder
- type ExampleContract
- func StoreBurnerExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract
- func StoreExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract
- func StoreExampleContractWasm(tb testing.TB, ctx sdk.Context, keepers TestKeepers, wasmCode []byte) ExampleContract
- func StoreHackatomExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract
- func StoreIBCReflectContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract
- func StoreRandomContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmerEngine) ExampleContract
- func StoreRandomContractWithAccessConfig(tb testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmerEngine, ...) ExampleContract
- func StoreReflectContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract
- type ExampleContractInstance
- type ExampleInstance
- type GRPCQueryRouter
- type GasRegister
- type GovAuthorizationPolicy
- func (p GovAuthorizationPolicy) CanCreateCode(ChainAccessConfigs, sdk.AccAddress, types.AccessConfig) bool
- func (p GovAuthorizationPolicy) CanInstantiateContract(types.AccessConfig, sdk.AccAddress) bool
- func (p GovAuthorizationPolicy) CanModifyCodeAccessConfig(sdk.AccAddress, sdk.AccAddress, bool) bool
- func (p GovAuthorizationPolicy) CanModifyContract(sdk.AccAddress, sdk.AccAddress) bool
- type GrpcQuerier
- func (q GrpcQuerier) AllContractState(c context.Context, req *types.QueryAllContractStateRequest) (*types.QueryAllContractStateResponse, error)
- func (q GrpcQuerier) Code(c context.Context, req *types.QueryCodeRequest) (*types.QueryCodeResponse, error)
- func (q GrpcQuerier) Codes(c context.Context, req *types.QueryCodesRequest) (*types.QueryCodesResponse, error)
- func (q GrpcQuerier) ContractHistory(c context.Context, req *types.QueryContractHistoryRequest) (*types.QueryContractHistoryResponse, error)
- func (q GrpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInfoRequest) (*types.QueryContractInfoResponse, error)
- func (q GrpcQuerier) ContractsByCode(c context.Context, req *types.QueryContractsByCodeRequest) (*types.QueryContractsByCodeResponse, error)
- func (q GrpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContractsByCreatorRequest) (*types.QueryContractsByCreatorResponse, error)
- func (q GrpcQuerier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (q GrpcQuerier) PinnedCodes(c context.Context, req *types.QueryPinnedCodesRequest) (*types.QueryPinnedCodesResponse, error)
- func (q GrpcQuerier) RawContractState(c context.Context, req *types.QueryRawContractStateRequest) (*types.QueryRawContractStateResponse, error)
- func (q GrpcQuerier) SmartContractState(c context.Context, req *types.QuerySmartContractStateRequest) (rsp *types.QuerySmartContractStateResponse, err error)
- type HackatomExampleInitMsg
- type HackatomExampleInstance
- type IBCEncoder
- type IBCRawPacketHandler
- type IBCReflectExampleInstance
- type IBCReflectInitMsg
- 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) ClassicAddressGenerator() AddressGenerator
- func (k Keeper) GetAuthority() string
- 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) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) HasContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) bool
- func (k Keeper) InitializePinnedCodes(ctx sdk.Context) error
- func (k Keeper) IsPinnedCode(ctx sdk.Context, codeID uint64) bool
- 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) IterateContractState(ctx sdk.Context, contractAddress sdk.AccAddress, ...)
- func (k Keeper) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(address sdk.AccAddress) bool)
- func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) OnAckPacket(ctx sdk.Context, contractAddr sdk.AccAddress, msg wasmvmtypes.IBCPacketAckMsg) error
- func (k Keeper) OnCloseChannel(ctx sdk.Context, contractAddr sdk.AccAddress, ...) error
- func (k Keeper) OnConnectChannel(ctx sdk.Context, contractAddr sdk.AccAddress, ...) error
- func (k Keeper) OnOpenChannel(ctx sdk.Context, contractAddr sdk.AccAddress, ...) (string, error)
- func (k Keeper) OnRecvPacket(ctx sdk.Context, contractAddr sdk.AccAddress, ...) ([]byte, error)
- func (k Keeper) OnTimeoutPacket(ctx sdk.Context, contractAddr sdk.AccAddress, ...) error
- func (k Keeper) PeekAutoIncrementID(ctx sdk.Context, lastIDKey []byte) uint64
- func (k Keeper) QueryGasLimit() sdk.Gas
- 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) SetParams(ctx sdk.Context, ps types.Params) error
- func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
- type LimitSimulationGasDecorator
- type MessageDispatcher
- type MessageEncoders
- type MessageHandlerChain
- type MessageHandlerFunc
- type MessageRouter
- type MessageRouterFunc
- type Messenger
- type Migrator
- type MultipliedGasMeter
- type Option
- func WithAPICosts(human, canonical uint64) Option
- func WithAcceptedAccountTypesOnContractInstantiation(accts ...authtypes.AccountI) Option
- func WithAccountPruner(x AccountPruner) Option
- func WithCoinTransferrer(x CoinTransferrer) Option
- func WithGasRegister(x GasRegister) Option
- func WithMaxQueryStackSize(m uint32) Option
- func WithMessageEncoders(x *MessageEncoders) Option
- func WithMessageHandler(x Messenger) Option
- func WithMessageHandlerDecorator(d func(old Messenger) Messenger) Option
- func WithQueryHandler(x WasmVMQueryHandler) Option
- func WithQueryHandlerDecorator(d func(old WasmVMQueryHandler) WasmVMQueryHandler) Option
- func WithQueryPlugins(x *QueryPlugins) Option
- func WithVMCacheMetrics(r prometheus.Registerer) Option
- func WithWasmEngine(x types.WasmerEngine) Option
- type PermissionedKeeper
- func (p PermissionedKeeper) ClearContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress) error
- func (p PermissionedKeeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, ...) (codeID uint64, checksum []byte, err error)
- func (p PermissionedKeeper) Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, ...) ([]byte, error)
- func (p PermissionedKeeper) Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, ...) (sdk.AccAddress, []byte, error)
- func (p PermissionedKeeper) Instantiate2(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, ...) (sdk.AccAddress, []byte, error)
- func (p PermissionedKeeper) Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, ...) ([]byte, error)
- func (p PermissionedKeeper) PinCode(ctx sdk.Context, codeID uint64) error
- func (p PermissionedKeeper) SetAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, ...) error
- func (p PermissionedKeeper) SetContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error
- func (p PermissionedKeeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
- func (p PermissionedKeeper) UnpinCode(ctx sdk.Context, codeID uint64) error
- func (p PermissionedKeeper) UpdateContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, ...) error
- type QueryHandler
- type QueryPlugins
- type SDKMessageHandler
- type StakingEncoder
- type StargateEncoder
- type TestFaucet
- type TestKeepers
- type ValidatorSetSource
- type VestingCoinBurner
- type WasmEncoder
- type WasmGasRegister
- func (g WasmGasRegister) CompileCosts(byteLength int) storetypes.Gas
- func (g WasmGasRegister) EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Events) sdk.Gas
- func (g WasmGasRegister) FromWasmVMGas(source uint64) sdk.Gas
- func (g WasmGasRegister) InstantiateContractCosts(pinned bool, msgLen int) sdk.Gas
- func (g WasmGasRegister) NewContractInstanceCosts(pinned bool, msgLen int) storetypes.Gas
- func (g WasmGasRegister) ReplyCosts(pinned bool, reply wasmvmtypes.Reply) sdk.Gas
- func (g WasmGasRegister) ToWasmVMGas(source storetypes.Gas) uint64
- func (g WasmGasRegister) UncompressCosts(byteLength int) sdk.Gas
- type WasmGasRegisterConfig
- type WasmSnapshotter
- func (ws *WasmSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshot.ExtensionPayloadReader) error
- func (ws *WasmSnapshotter) SnapshotExtension(height uint64, payloadWriter snapshot.ExtensionPayloadWriter) error
- func (ws *WasmSnapshotter) SnapshotFormat() uint32
- func (ws *WasmSnapshotter) SnapshotName() string
- func (ws *WasmSnapshotter) SupportedFormats() []uint32
- type WasmVMMetricsCollector
- type WasmVMQueryHandler
- type WasmVMQueryHandlerFn
- type WasmVMResponseHandler
Constants ¶
const ( // DefaultGasCostHumanAddress is how much SDK gas we charge to convert to a human address format DefaultGasCostHumanAddress = 5 // DefaultGasCostCanonicalAddress is how much SDK gas we charge to convert to a canonical address format DefaultGasCostCanonicalAddress = 4 // DefaultDeserializationCostPerByte The formula should be `len(data) * deserializationCostPerByte` DefaultDeserializationCostPerByte = 1 )
const ( // DefaultGasMultiplier is how many CosmWasm gas points = 1 Cosmos SDK gas point. // // CosmWasm gas strategy is documented in https://github.com/CosmWasm/cosmwasm/blob/v1.0.0-beta/docs/GAS.md. // Cosmos SDK reference costs can be found here: https://github.com/cosmos/cosmos-sdk/blob/v0.42.10/store/types/gas.go#L198-L209. // // The original multiplier of 100 up to CosmWasm 0.16 was based on // "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)" // as well as manual Wasmer benchmarks from 2019. This was then multiplied by 150_000 // in the 0.16 -> 1.0 upgrade (https://github.com/CosmWasm/cosmwasm/pull/1120). // // The multiplier deserves more reproducible benchmarking and a strategy that allows easy adjustments. // This is tracked in https://github.com/terpnetwork/terp-core/issues/566 and https://github.com/terpnetwork/terp-core/issues/631. // Gas adjustments are consensus breaking but may happen in any release marked as consensus breaking. // Do not make assumptions on how much gas an operation will consume in places that are hard to adjust, // such as hardcoding them in contracts. // // Please note that all gas prices returned to wasmvm should have this multiplied. // Benchmarks and numbers were discussed in: https://github.com/terpnetwork/terp-core/pull/634#issuecomment-938055852 DefaultGasMultiplier uint64 = 140_000_000 // DefaultInstanceCost 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. // Benchmarks and numbers were discussed in: https://github.com/terpnetwork/terp-core/pull/634#issuecomment-938056803 DefaultInstanceCost uint64 = 60_000 // DefaultCompileCost is how much SDK gas is charged *per byte* for compiling WASM code. // Benchmarks and numbers were discussed in: https://github.com/terpnetwork/terp-core/pull/634#issuecomment-938056803 DefaultCompileCost uint64 = 3 // DefaultEventAttributeDataCost is how much SDK gas is charged *per byte* for attribute data in events. // This is used with len(key) + len(value) DefaultEventAttributeDataCost uint64 = 1 // DefaultContractMessageDataCost is how much SDK gas is charged *per byte* of the message that goes to the contract // This is used with len(msg). Note that the message is deserialized in the receiving contract and this is charged // with wasm gas already. The derserialization of results is also charged in wasmvm. I am unsure if we need to add // additional costs here. // Note: also used for error fields on reply, and data on reply. Maybe these should be pulled out to a different (non-zero) field DefaultContractMessageDataCost uint64 = 0 // DefaultPerAttributeCost is how much SDK gas we charge per attribute count. DefaultPerAttributeCost uint64 = 10 // DefaultPerCustomEventCost is how much SDK gas we charge per event count. DefaultPerCustomEventCost uint64 = 20 // DefaultEventAttributeDataFreeTier number of bytes of total attribute data we do not charge. DefaultEventAttributeDataFreeTier = 100 )
const SnapshotFormat = 1
SnapshotFormat format 1 is just gzipped wasm byte code for each item payload. No protobuf envelope, no metadata.
Variables ¶
var ModelFuzzers = []interface{}{FuzzAddr, FuzzAddrString, FuzzAbsoluteTxPosition, FuzzContractInfo, FuzzStateModel, FuzzAccessType, FuzzAccessConfig, FuzzContractCodeHistory}
var TestingStakeParams = stakingtypes.Params{ UnbondingTime: 100, MaxValidators: 10, MaxEntries: 10, HistoricalEntries: 10, BondDenom: "stake", MinCommissionRate: stakingtypes.DefaultMinCommissionRate, }
Functions ¶
func AcceptListStargateQuerier ¶ added in v0.2.0
func AcceptListStargateQuerier(acceptList AcceptedStargateQueries, queryRouter GRPCQueryRouter, codec codec.Codec) func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error)
AcceptListStargateQuerier supports a preconfigured set of stargate queries only. All arguments must be non nil.
Warning: Chains need to test and maintain their accept list carefully. There were critical consensus breaking issues in the past with non-deterministic behaviour in the SDK.
This queries can be set via WithQueryPlugins option in the wasm keeper constructor: WithQueryPlugins(&QueryPlugins{Stargate: AcceptListStargateQuerier(acceptList, queryRouter, codec)})
func BankQuerier ¶
func BankQuerier(bankKeeper types.BankViewKeeper) func(ctx sdk.Context, request *wasmvmtypes.BankQuery) ([]byte, error)
func BuildContractAddressClassic ¶ added in v0.2.0
func BuildContractAddressClassic(codeID, instanceID uint64) sdk.AccAddress
BuildContractAddressClassic builds an sdk account address for a contract.
func BuildContractAddressPredictable ¶ added in v0.2.0
func BuildContractAddressPredictable(checksum []byte, creator sdk.AccAddress, salt, initMsg types.RawContractMessage) sdk.AccAddress
BuildContractAddressPredictable generates a contract address for the wasm module with len = types.ContractAddrLen using the Cosmos SDK address.Module function. Internally a key is built containing: (len(checksum) | checksum | len(sender_address) | sender_address | len(salt) | salt| len(initMsg) | initMsg).
All method parameter values must be valid and not nil.
func ContractFromPortID ¶
func ContractFromPortID(portID string) (sdk.AccAddress, error)
func ConvertProtoToJSONMarshal ¶ added in v0.2.0
func ConvertProtoToJSONMarshal(cdc codec.Codec, protoResponse codec.ProtoMarshaler, bz []byte) ([]byte, error)
ConvertProtoToJSONMarshal unmarshals the given bytes into a proto message and then marshals it to json. This is done so that clients calling stargate queries do not need to define their own proto unmarshalers, being able to use response directly by json marshalling, which is supported in cosmwasm.
func ConvertSdkCoinToWasmCoin ¶
func ConvertSdkCoinToWasmCoin(coin sdk.Coin) wasmvmtypes.Coin
ConvertSdkCoinToWasmCoin covert sdk type to wasmvm coin type
func ConvertSdkCoinsToWasmCoins ¶
func ConvertSdkCoinsToWasmCoins(coins []sdk.Coin) wasmvmtypes.Coins
ConvertSdkCoinsToWasmCoins covert sdk type to wasmvm coins type
func ConvertWasmCoinToSdkCoin ¶
func ConvertWasmCoinToSdkCoin(coin wasmvmtypes.Coin) (sdk.Coin, error)
ConvertWasmCoinToSdkCoin converts a wasm vm type coin to sdk type coin
func ConvertWasmCoinsToSdkCoins ¶
func ConvertWasmCoinsToSdkCoins(coins []wasmvmtypes.Coin) (sdk.Coins, error)
ConvertWasmCoinsToSdkCoins converts the wasm vm type coins to sdk type coins
func ConvertWasmIBCTimeoutHeightToCosmosHeight ¶
func ConvertWasmIBCTimeoutHeightToCosmosHeight(ibcTimeoutBlock *wasmvmtypes.IBCTimeoutBlock) ibcclienttypes.Height
ConvertWasmIBCTimeoutHeightToCosmosHeight converts a wasmvm type ibc timeout height to ibc module type height
func DefaultPerByteUncompressCost ¶ added in v0.2.0
func DefaultPerByteUncompressCost() wasmvmtypes.UFraction
DefaultPerByteUncompressCost is how much SDK gas we charge per source byte to unpack
func DeterministicAccountAddress ¶ added in v0.2.0
func DeterministicAccountAddress(_ testing.TB, v byte) sdk.AccAddress
DeterministicAccountAddress creates a test address with v repeated to valid address size
func EncodeBankMsg ¶
func EncodeBankMsg(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg, error)
func EncodeDistributionMsg ¶
func EncodeDistributionMsg(sender sdk.AccAddress, msg *wasmvmtypes.DistributionMsg) ([]sdk.Msg, error)
func EncodeGovMsg ¶
func EncodeGovMsg(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, error)
func EncodeIBCMsg ¶
func EncodeIBCMsg(portSource types.ICS20TransferPortSource) func(ctx sdk.Context, sender sdk.AccAddress, contractIBCPortID string, msg *wasmvmtypes.IBCMsg) ([]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.2.0
func FuzzAbsoluteTxPosition(m *types.AbsoluteTxPosition, c fuzz.Continue)
func FuzzAccessConfig ¶ added in v0.2.0
func FuzzAccessConfig(m *types.AccessConfig, c fuzz.Continue)
func FuzzAccessType ¶ added in v0.2.0
func FuzzAccessType(m *types.AccessType, c fuzz.Continue)
func FuzzAddrString ¶ added in v0.2.0
func FuzzContractCodeHistory ¶ added in v0.2.0
func FuzzContractCodeHistory(m *types.ContractCodeHistoryEntry, c fuzz.Continue)
func FuzzContractInfo ¶ added in v0.2.0
func FuzzContractInfo(m *types.ContractInfo, c fuzz.Continue)
func IBCQuerier ¶
func IBCQuerier(wasm contractMetaDataSource, channelKeeper types.ChannelKeeper) func(ctx sdk.Context, caller sdk.AccAddress, request *wasmvmtypes.IBCQuery) ([]byte, error)
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]abci.ValidatorUpdate, error)
InitGenesis sets supply information for genesis.
CONTRACT: all types of accounts must have been already initialized/created
func MakeEncodingConfig ¶ added in v0.2.0
func MakeEncodingConfig(_ testing.TB) wasmappparams.EncodingConfig
func NewMsgServerImpl ¶
NewMsgServerImpl default constructor
func NewWasmProposalHandler
deprecated
func NewWasmProposalHandler(k decoratedKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handler
NewWasmProposalHandler creates a new governance Handler for wasm proposals
Deprecated: Do not use.
func NewWasmProposalHandlerX
deprecated
func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handler
NewWasmProposalHandlerX creates a new governance Handler for wasm proposals
Deprecated: Do not use.
func NoCustomMsg ¶
func NoCustomMsg(_ sdk.AccAddress, _ json.RawMessage) ([]sdk.Msg, error)
func NoCustomQuerier ¶
func PortIDForContract ¶
func PortIDForContract(addr sdk.AccAddress) string
func RandomAccountAddress ¶ added in v0.2.0
func RandomAccountAddress(_ testing.TB) sdk.AccAddress
func RandomBech32AccountAddress ¶ added in v0.2.0
func RejectStargateQuerier ¶ added in v0.2.0
func RejectStargateQuerier() func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error)
RejectStargateQuerier rejects all stargate queries
func StakingQuerier ¶
func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKeeper) func(ctx sdk.Context, request *wasmvmtypes.StakingQuery) ([]byte, error)
func UInt64LengthPrefix ¶ added in v0.2.0
UInt64LengthPrefix prepend big endian encoded byte length
func WasmQuerier ¶
Types ¶
type AcceptedStargateQueries ¶ added in v0.2.0
type AcceptedStargateQueries map[string]codec.ProtoMarshaler
AcceptedStargateQueries define accepted Stargate queries as a map with path as key and response type as value. For example: acceptList["/cosmos.auth.v1beta1.Query/Account"]= &authtypes.QueryAccountResponse{}
type AccountPruner ¶ added in v0.2.0
type AccountPruner interface { // CleanupExistingAccount handles the cleanup process for balances and data of the given account. The persisted account // type is already reset to base account at this stage. // The method returns true when the account address can be reused. Unsupported account types are rejected by returning false CleanupExistingAccount(ctx sdk.Context, existingAccount authtypes.AccountI) (handled bool, err error) }
AccountPruner handles the balances and data cleanup for accounts that are pruned on contract instantiate. This is an extension point to attach custom logic
type AddressGenerator ¶ added in v0.2.0
AddressGenerator abstract address generator to be used for a single contract address
func PredicableAddressGenerator ¶ added in v0.2.0
func PredicableAddressGenerator(creator sdk.AccAddress, salt []byte, msg []byte, fixMsg bool) AddressGenerator
PredicableAddressGenerator generates a predictable contract address
type AuthorizationPolicy ¶
type AuthorizationPolicy interface { CanCreateCode(chainConfigs ChainAccessConfigs, actor sdk.AccAddress, contractConfig types.AccessConfig) bool CanInstantiateContract(c types.AccessConfig, actor sdk.AccAddress) bool CanModifyContract(admin, actor sdk.AccAddress) bool CanModifyCodeAccessConfig(creator, actor sdk.AccAddress, isSubset bool) bool }
type BankCoinTransferrer ¶
type BankCoinTransferrer struct {
// contains filtered or unexported fields
}
BankCoinTransferrer replicates the cosmos-sdk behaviour as in https://github.com/cosmos/cosmos-sdk/blob/v0.41.4/x/bank/keeper/msg_server.go#L26
func NewBankCoinTransferrer ¶
func NewBankCoinTransferrer(keeper types.BankKeeper) BankCoinTransferrer
func (BankCoinTransferrer) TransferCoins ¶
func (c BankCoinTransferrer) TransferCoins(parentCtx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amount sdk.Coins) error
TransferCoins transfers coins from source to destination account when coin send was enabled for them and the recipient is not in the blocked address list.
type BankEncoder ¶
type BankEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg, error)
type BurnerExampleInitMsg ¶ added in v0.2.0
type BurnerExampleInitMsg struct {
Payout sdk.AccAddress `json:"payout"`
}
type ChainAccessConfigs ¶ added in v0.2.0
type ChainAccessConfigs struct { Upload types.AccessConfig Instantiate types.AccessConfig }
ChainAccessConfigs chain settings
func NewChainAccessConfigs ¶ added in v0.2.0
func NewChainAccessConfigs(upload types.AccessConfig, instantiate types.AccessConfig) ChainAccessConfigs
NewChainAccessConfigs constructor
type CoinTransferrer ¶
type CoinTransferrer interface { // TransferCoins sends the coin amounts from the source to the destination with rules applied. TransferCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error }
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 storetypes.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 DefaultAuthorizationPolicy ¶
type DefaultAuthorizationPolicy struct{}
func (DefaultAuthorizationPolicy) CanCreateCode ¶
func (p DefaultAuthorizationPolicy) CanCreateCode(chainConfigs ChainAccessConfigs, actor sdk.AccAddress, contractConfig types.AccessConfig) bool
func (DefaultAuthorizationPolicy) CanInstantiateContract ¶
func (p DefaultAuthorizationPolicy) CanInstantiateContract(config types.AccessConfig, actor sdk.AccAddress) bool
func (DefaultAuthorizationPolicy) CanModifyCodeAccessConfig ¶ added in v0.2.0
func (p DefaultAuthorizationPolicy) CanModifyCodeAccessConfig(creator, actor sdk.AccAddress, isSubset bool) bool
func (DefaultAuthorizationPolicy) CanModifyContract ¶
func (p DefaultAuthorizationPolicy) CanModifyContract(admin, actor sdk.AccAddress) bool
type DefaultWasmVMContractResponseHandler ¶
type DefaultWasmVMContractResponseHandler struct {
// contains filtered or unexported fields
}
DefaultWasmVMContractResponseHandler 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 NewDefaultWasmVMContractResponseHandler ¶
func NewDefaultWasmVMContractResponseHandler(md msgDispatcher) *DefaultWasmVMContractResponseHandler
func (DefaultWasmVMContractResponseHandler) Handle ¶
func (h DefaultWasmVMContractResponseHandler) Handle(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, messages []wasmvmtypes.SubMsg, origRspData []byte) ([]byte, error)
Handle processes the data returned by a contract invocation.
type DistributionEncoder ¶
type DistributionEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.DistributionMsg) ([]sdk.Msg, error)
type ExampleContract ¶ added in v0.2.0
type ExampleContract struct { InitialAmount sdk.Coins Creator crypto.PrivKey CreatorAddr sdk.AccAddress CodeID uint64 Checksum []byte }
func StoreBurnerExampleContract ¶ added in v0.2.0
func StoreBurnerExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract
func StoreExampleContract ¶ added in v0.2.0
func StoreExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract
func StoreExampleContractWasm ¶ added in v1.0.0
func StoreExampleContractWasm(tb testing.TB, ctx sdk.Context, keepers TestKeepers, wasmCode []byte) ExampleContract
func StoreHackatomExampleContract ¶ added in v0.2.0
func StoreHackatomExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract
func StoreIBCReflectContract ¶ added in v0.2.0
func StoreIBCReflectContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract
func StoreRandomContract ¶ added in v0.2.0
func StoreRandomContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmerEngine) ExampleContract
StoreRandomContract sets the mock wasmerEngine in keeper and calls store
func StoreRandomContractWithAccessConfig ¶ added in v0.2.0
func StoreRandomContractWithAccessConfig( tb testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmerEngine, cfg *types.AccessConfig, ) ExampleContract
func StoreReflectContract ¶ added in v0.2.0
func StoreReflectContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract
type ExampleContractInstance ¶ added in v0.2.0
type ExampleContractInstance struct { ExampleContract Contract sdk.AccAddress }
func SeedNewContractInstance ¶ added in v0.2.0
func SeedNewContractInstance(tb testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmerEngine) ExampleContractInstance
SeedNewContractInstance sets the mock wasmerEngine in keeper and calls store + instantiate to init the contract's metadata
type ExampleInstance ¶ added in v0.2.0
type ExampleInstance struct { ExampleContract Contract sdk.AccAddress Label string Deposit sdk.Coins }
func InstantiateReflectExampleContract ¶ added in v0.2.0
func InstantiateReflectExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleInstance
InstantiateReflectExampleContract load and instantiate the "./testdata/reflect.wasm" contract
type GRPCQueryRouter ¶
type GRPCQueryRouter interface {
Route(path string) baseapp.GRPCQueryHandler
}
type GasRegister ¶
type GasRegister interface { // NewContractInstanceCosts costs to create a new contract instance from code NewContractInstanceCosts(pinned bool, msgLen int) sdk.Gas // CompileCosts costs to persist and "compile" a new wasm contract CompileCosts(byteLength int) sdk.Gas // UncompressCosts costs to unpack a new wasm contract UncompressCosts(byteLength int) sdk.Gas // InstantiateContractCosts costs when interacting with a wasm contract InstantiateContractCosts(pinned bool, msgLen int) sdk.Gas // ReplyCosts costs to to handle a message reply ReplyCosts(pinned bool, reply wasmvmtypes.Reply) sdk.Gas // EventCosts costs to persist an event EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Events) sdk.Gas // ToWasmVMGas converts from sdk gas to wasmvm gas ToWasmVMGas(source sdk.Gas) uint64 // FromWasmVMGas converts from wasmvm gas to sdk gas FromWasmVMGas(source uint64) sdk.Gas }
GasRegister abstract source for gas costs
type GovAuthorizationPolicy ¶
type GovAuthorizationPolicy struct{}
func (GovAuthorizationPolicy) CanCreateCode ¶
func (p GovAuthorizationPolicy) CanCreateCode(ChainAccessConfigs, sdk.AccAddress, types.AccessConfig) bool
CanCreateCode implements AuthorizationPolicy.CanCreateCode to allow gov actions. Always returns true.
func (GovAuthorizationPolicy) CanInstantiateContract ¶
func (p GovAuthorizationPolicy) CanInstantiateContract(types.AccessConfig, sdk.AccAddress) bool
func (GovAuthorizationPolicy) CanModifyCodeAccessConfig ¶ added in v0.2.0
func (p GovAuthorizationPolicy) CanModifyCodeAccessConfig(sdk.AccAddress, sdk.AccAddress, bool) bool
func (GovAuthorizationPolicy) CanModifyContract ¶
func (p GovAuthorizationPolicy) CanModifyContract(sdk.AccAddress, sdk.AccAddress) bool
type GrpcQuerier ¶ added in v1.0.0
type GrpcQuerier struct {
// contains filtered or unexported fields
}
func NewGrpcQuerier ¶
func NewGrpcQuerier(cdc codec.Codec, storeKey storetypes.StoreKey, keeper types.ViewKeeper, queryGasLimit sdk.Gas) *GrpcQuerier
NewGrpcQuerier constructor
func (GrpcQuerier) AllContractState ¶ added in v1.0.0
func (q GrpcQuerier) AllContractState(c context.Context, req *types.QueryAllContractStateRequest) (*types.QueryAllContractStateResponse, error)
func (GrpcQuerier) Code ¶ added in v1.0.0
func (q GrpcQuerier) Code(c context.Context, req *types.QueryCodeRequest) (*types.QueryCodeResponse, error)
func (GrpcQuerier) Codes ¶ added in v1.0.0
func (q GrpcQuerier) Codes(c context.Context, req *types.QueryCodesRequest) (*types.QueryCodesResponse, error)
func (GrpcQuerier) ContractHistory ¶ added in v1.0.0
func (q GrpcQuerier) ContractHistory(c context.Context, req *types.QueryContractHistoryRequest) (*types.QueryContractHistoryResponse, error)
func (GrpcQuerier) ContractInfo ¶ added in v1.0.0
func (q GrpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInfoRequest) (*types.QueryContractInfoResponse, error)
func (GrpcQuerier) ContractsByCode ¶ added in v1.0.0
func (q GrpcQuerier) ContractsByCode(c context.Context, req *types.QueryContractsByCodeRequest) (*types.QueryContractsByCodeResponse, error)
ContractsByCode lists all smart contracts for a code id
func (GrpcQuerier) ContractsByCreator ¶ added in v1.0.0
func (q GrpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContractsByCreatorRequest) (*types.QueryContractsByCreatorResponse, error)
func (GrpcQuerier) Params ¶ added in v1.0.0
func (q GrpcQuerier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params returns params of the module.
func (GrpcQuerier) PinnedCodes ¶ added in v1.0.0
func (q GrpcQuerier) PinnedCodes(c context.Context, req *types.QueryPinnedCodesRequest) (*types.QueryPinnedCodesResponse, error)
func (GrpcQuerier) RawContractState ¶ added in v1.0.0
func (q GrpcQuerier) RawContractState(c context.Context, req *types.QueryRawContractStateRequest) (*types.QueryRawContractStateResponse, error)
func (GrpcQuerier) SmartContractState ¶ added in v1.0.0
func (q GrpcQuerier) SmartContractState(c context.Context, req *types.QuerySmartContractStateRequest) (rsp *types.QuerySmartContractStateResponse, err error)
type HackatomExampleInitMsg ¶ added in v0.2.0
type HackatomExampleInitMsg struct { Verifier sdk.AccAddress `json:"verifier"` Beneficiary sdk.AccAddress `json:"beneficiary"` }
type HackatomExampleInstance ¶ added in v0.2.0
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 ¶ added in v0.2.0
func InstantiateHackatomExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) HackatomExampleInstance
InstantiateHackatomExampleContract load and instantiate the "./testdata/hackatom.wasm" contract
type IBCEncoder ¶
type IBCEncoder func(ctx sdk.Context, sender sdk.AccAddress, contractIBCPortID string, msg *wasmvmtypes.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 types.ChannelKeeper, cak types.CapabilityKeeper) IBCRawPacketHandler
func (IBCRawPacketHandler) DispatchMsg ¶
func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, error)
DispatchMsg publishes a raw IBC packet onto the channel.
type IBCReflectExampleInstance ¶ added in v0.2.0
type IBCReflectExampleInstance struct { Contract sdk.AccAddress Admin sdk.AccAddress CodeID uint64 ReflectCodeID uint64 }
func InstantiateIBCReflectContract ¶ added in v0.2.0
func InstantiateIBCReflectContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) IBCReflectExampleInstance
InstantiateIBCReflectContract load and instantiate the "./testdata/ibc_reflect.wasm" contract
type IBCReflectInitMsg ¶ added in v0.2.0
type IBCReflectInitMsg struct {
ReflectCodeID uint64 `json:"reflect_code_id"`
}
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, storeKey storetypes.StoreKey, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, distrKeeper types.DistributionKeeper, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, capabilityKeeper types.CapabilityKeeper, portSource types.ICS20TransferPortSource, router MessageRouter, _ GRPCQueryRouter, homeDir string, wasmConfig types.WasmConfig, availableCapabilities string, authority string, opts ...Option, ) 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) 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) ClassicAddressGenerator ¶ added in v0.2.0
func (k Keeper) ClassicAddressGenerator() AddressGenerator
ClassicAddressGenerator generates a contract address using codeID and instanceID sequence
func (Keeper) GetAuthority ¶ added in v1.0.0
GetAuthority returns the x/wasm module's authority.
func (Keeper) GetByteCode ¶
func (Keeper) GetCodeInfo ¶
func (Keeper) GetContractHistory ¶
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) HasContractInfo ¶
func (Keeper) InitializePinnedCodes ¶
InitializePinnedCodes updates wasmvm to pin to cache all contracts marked as pinned
func (Keeper) IsPinnedCode ¶
IsPinnedCode returns true when codeID is pinned in wasmvm cache
func (Keeper) IterateCodeInfos ¶
func (Keeper) IterateContractInfo ¶
func (k Keeper) IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool)
func (Keeper) IterateContractState ¶
func (k Keeper) IterateContractState(ctx sdk.Context, contractAddress sdk.AccAddress, cb func(key, value []byte) bool)
IterateContractState iterates through all elements of the key value store for the given contract address and passes them to the provided callback function. The callback method can return true to abort early.
func (Keeper) IterateContractsByCode ¶
func (k Keeper) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(address sdk.AccAddress) bool)
IterateContractsByCode iterates over all contracts with given codeID ASC on code update time.
func (Keeper) IterateContractsByCreator ¶ added in v0.2.0
func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool)
IterateContractsByCreator iterates over all contracts with given creator address in order of creation time asc.
func (Keeper) OnAckPacket ¶
func (k Keeper) OnAckPacket( ctx sdk.Context, contractAddr sdk.AccAddress, msg wasmvmtypes.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, contractAddr sdk.AccAddress, msg wasmvmtypes.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, contractAddr sdk.AccAddress, msg wasmvmtypes.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, contractAddr sdk.AccAddress, msg wasmvmtypes.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, contractAddr sdk.AccAddress, msg wasmvmtypes.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, contractAddr sdk.AccAddress, msg wasmvmtypes.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) PeekAutoIncrementID ¶
PeekAutoIncrementID reads the current value without incrementing it.
func (Keeper) QueryGasLimit ¶
QueryGasLimit returns the gas limit for smart queries.
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) Sudo ¶
Sudo allows priviledged access to a contract. This can never be called by an external tx, but only by another native Go module directly, or on-chain governance (if sudo proposals are enabled). Thus, the keeper doesn't place any access controls on it, that is the responsibility or the app developer (who passes the wasm.Keeper in app.go)
type LimitSimulationGasDecorator ¶
type LimitSimulationGasDecorator struct {
// contains filtered or unexported fields
}
LimitSimulationGasDecorator ante decorator to limit gas in simulation calls
func NewLimitSimulationGasDecorator ¶
func NewLimitSimulationGasDecorator(gasLimit *sdk.Gas) *LimitSimulationGasDecorator
NewLimitSimulationGasDecorator constructor accepts nil value to fallback to block gas limit.
func (LimitSimulationGasDecorator) AnteHandle ¶
func (d LimitSimulationGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)
AnteHandle that limits the maximum gas available in simulations only. A custom max value can be configured and will be applied when set. The value should not exceed the max block gas limit. Different values on nodes are not consensus breaking as they affect only simulations but may have effect on client user experience.
When no custom value is set then the max block gas is used as default limit.
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) DispatchMessages ¶
func (d MessageDispatcher) DispatchMessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []wasmvmtypes.CosmosMsg) error
DispatchMessages sends all messages.
func (MessageDispatcher) DispatchSubmessages ¶
func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []wasmvmtypes.SubMsg) ([]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 func(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg, error) Custom func(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error) Distribution func(sender sdk.AccAddress, msg *wasmvmtypes.DistributionMsg) ([]sdk.Msg, error) IBC func(ctx sdk.Context, sender sdk.AccAddress, contractIBCPortID string, msg *wasmvmtypes.IBCMsg) ([]sdk.Msg, error) Staking func(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk.Msg, error) Stargate func(sender sdk.AccAddress, msg *wasmvmtypes.StargateMsg) ([]sdk.Msg, error) Wasm func(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg, error) Gov func(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, error) }
func DefaultEncoders ¶
func DefaultEncoders(unpacker codectypes.AnyUnpacker, portSource types.ICS20TransferPortSource) MessageEncoders
func (MessageEncoders) Encode ¶
func (e MessageEncoders) Encode(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.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 wasmvmtypes.CosmosMsg) ([]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 MessageHandlerFunc ¶
type MessageHandlerFunc func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error)
MessageHandlerFunc is a helper to construct a function based message handler.
func NewBurnCoinMessageHandler ¶
func NewBurnCoinMessageHandler(burner types.Burner) MessageHandlerFunc
NewBurnCoinMessageHandler handles wasmvm.BurnMsg messages
func (MessageHandlerFunc) DispatchMsg ¶
func (m MessageHandlerFunc) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error)
DispatchMsg delegates dispatching of provided message into the MessageHandlerFunc.
type MessageRouter ¶
type MessageRouter interface {
Handler(msg sdk.Msg) baseapp.MsgServiceHandler
}
MessageRouter ADR 031 request type routing
func TestHandler ¶ added in v0.2.0
func TestHandler(k types.ContractOpsKeeper) MessageRouter
TestHandler returns a wasm handler for tests (to avoid circular imports)
type MessageRouterFunc ¶ added in v1.0.0
func (MessageRouterFunc) Handler ¶ added in v1.0.0
func (m MessageRouterFunc) Handler(msg sdk.Msg) baseapp.MsgServiceHandler
type Messenger ¶
type Messenger interface { // DispatchMsg encodes the wasmVM message and dispatches it. DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) }
Messenger is an extension point for custom wasmd message handling
func NewDefaultMessageHandler ¶
func NewDefaultMessageHandler( router MessageRouter, channelKeeper types.ChannelKeeper, capabilityKeeper types.CapabilityKeeper, bankKeeper types.Burner, unpacker codectypes.AnyUnpacker, portSource types.ICS20TransferPortSource, customEncoders ...*MessageEncoders, ) Messenger
type Migrator ¶ added in v0.2.0
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶ added in v0.2.0
NewMigrator returns a new Migrator.
func (Migrator) Migrate1to2 ¶ added in v0.2.0
Migrate1to2 migrates from version 1 to 2.
type MultipliedGasMeter ¶
type MultipliedGasMeter struct { GasRegister GasRegister // contains filtered or unexported fields }
MultipliedGasMeter wraps the GasMeter from context and multiplies all reads by out defined multiplier
func NewMultipliedGasMeter ¶
func NewMultipliedGasMeter(originalMeter sdk.GasMeter, gr GasRegister) MultipliedGasMeter
func (MultipliedGasMeter) GasConsumed ¶
func (m MultipliedGasMeter) GasConsumed() sdk.Gas
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an extension point to instantiate keeper with non default values
func WithAPICosts ¶
WithAPICosts sets custom api costs. Amounts are in cosmwasm gas Not SDK gas.
func WithAcceptedAccountTypesOnContractInstantiation ¶ added in v0.2.0
WithAcceptedAccountTypesOnContractInstantiation sets the accepted account types. Account types of this list won't be overwritten or cause a failure when they exist for an address on contract instantiation.
Values should be references and contain the `*authtypes.BaseAccount` as default bank account type.
func WithAccountPruner ¶ added in v0.2.0
func WithAccountPruner(x AccountPruner) Option
WithAccountPruner is an optional constructor parameter to set a custom type that handles balances and data cleanup for accounts pruned on contract instantiate
func WithCoinTransferrer ¶
func WithCoinTransferrer(x CoinTransferrer) Option
WithCoinTransferrer is an optional constructor parameter to set a custom coin transferrer
func WithGasRegister ¶
func WithGasRegister(x GasRegister) Option
WithGasRegister set a new gas register to implement custom gas costs. When the "gas multiplier" for wasmvm gas conversion is modified inside the new register, make sure to also use `WithApiCosts` option for non default values
func WithMaxQueryStackSize ¶ added in v0.2.0
WithMaxQueryStackSize overwrites the default limit for maximum query stacks
func WithMessageEncoders ¶
func WithMessageEncoders(x *MessageEncoders) Option
WithMessageEncoders is an optional constructor parameter to pass custom message encoder to the default wasm message handler. This option expects the `DefaultMessageHandler` set and should not be combined with Option `WithMessageHandler` or `WithMessageHandlerDecorator`.
func WithMessageHandler ¶
WithMessageHandler is an optional constructor parameter to set a custom handler for wasmVM messages. This option should not be combined with Option `WithMessageEncoders` or `WithMessageHandlerDecorator`
func WithMessageHandlerDecorator ¶
WithMessageHandlerDecorator is an optional constructor parameter to decorate the wasm handler for wasmVM messages. This option should not be combined with Option `WithMessageEncoders` or `WithMessageHandler`
func WithQueryHandler ¶
func WithQueryHandler(x WasmVMQueryHandler) Option
WithQueryHandler is an optional constructor parameter to set custom query handler for wasmVM requests. This option should not be combined with Option `WithQueryPlugins` or `WithQueryHandlerDecorator`
func WithQueryHandlerDecorator ¶
func WithQueryHandlerDecorator(d func(old WasmVMQueryHandler) WasmVMQueryHandler) Option
WithQueryHandlerDecorator is an optional constructor parameter to decorate the default wasm query handler for wasmVM requests. This option should not be combined with Option `WithQueryPlugins` or `WithQueryHandler`
func WithQueryPlugins ¶
func WithQueryPlugins(x *QueryPlugins) Option
WithQueryPlugins is an optional constructor parameter to pass custom query plugins for wasmVM requests. This option expects the default `QueryHandler` set and should not be combined with Option `WithQueryHandler` or `WithQueryHandlerDecorator`.
func WithVMCacheMetrics ¶
func WithVMCacheMetrics(r prometheus.Registerer) Option
func WithWasmEngine ¶
func WithWasmEngine(x types.WasmerEngine) Option
WithWasmEngine is an optional constructor parameter to replace the default wasmVM engine with the given one.
type PermissionedKeeper ¶
type PermissionedKeeper struct {
// contains filtered or unexported fields
}
func NewDefaultPermissionKeeper ¶
func NewDefaultPermissionKeeper(nested decoratedKeeper) *PermissionedKeeper
func NewGovPermissionKeeper ¶
func NewGovPermissionKeeper(nested decoratedKeeper) *PermissionedKeeper
func NewPermissionedKeeper ¶
func NewPermissionedKeeper(nested decoratedKeeper, authZPolicy AuthorizationPolicy) *PermissionedKeeper
func (PermissionedKeeper) ClearContractAdmin ¶
func (p PermissionedKeeper) ClearContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress) error
func (PermissionedKeeper) Create ¶
func (p PermissionedKeeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig) (codeID uint64, checksum []byte, err 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) Instantiate ¶
func (p PermissionedKeeper) Instantiate( ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, ) (sdk.AccAddress, []byte, error)
Instantiate creates an instance of a WASM contract using the classic sequence based address generator
func (PermissionedKeeper) Instantiate2 ¶ added in v0.2.0
func (p PermissionedKeeper) Instantiate2( ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, salt []byte, fixMsg bool, ) (sdk.AccAddress, []byte, error)
Instantiate2 creates an instance of a WASM contract using the predictable address generator
func (PermissionedKeeper) Migrate ¶
func (p PermissionedKeeper) Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte) ([]byte, error)
func (PermissionedKeeper) PinCode ¶
func (p PermissionedKeeper) PinCode(ctx sdk.Context, codeID uint64) error
func (PermissionedKeeper) SetAccessConfig ¶
func (p PermissionedKeeper) SetAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig) error
SetAccessConfig updates the access config of a code id.
func (PermissionedKeeper) SetContractInfoExtension ¶
func (p PermissionedKeeper) SetContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error
SetContractInfoExtension updates the extra attributes that can be stored with the contract info
func (PermissionedKeeper) Sudo ¶
func (p PermissionedKeeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
func (PermissionedKeeper) UnpinCode ¶
func (p PermissionedKeeper) UnpinCode(ctx sdk.Context, codeID uint64) error
func (PermissionedKeeper) UpdateContractAdmin ¶
func (p PermissionedKeeper) UpdateContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newAdmin sdk.AccAddress) error
type QueryHandler ¶
type QueryHandler struct { Ctx sdk.Context Plugins WasmVMQueryHandler Caller sdk.AccAddress // contains filtered or unexported fields }
func NewQueryHandler ¶
func NewQueryHandler(ctx sdk.Context, vmQueryHandler WasmVMQueryHandler, caller sdk.AccAddress, gasRegister GasRegister) QueryHandler
func (QueryHandler) GasConsumed ¶
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 IBC func(ctx sdk.Context, caller sdk.AccAddress, request *wasmvmtypes.IBCQuery) ([]byte, error) Staking func(ctx sdk.Context, request *wasmvmtypes.StakingQuery) ([]byte, error) Stargate func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) Wasm func(ctx sdk.Context, request *wasmvmtypes.WasmQuery) ([]byte, error) }
func DefaultQueryPlugins ¶
func DefaultQueryPlugins( bank types.BankViewKeeper, staking types.StakingKeeper, distKeeper types.DistributionKeeper, channelKeeper types.ChannelKeeper, wasm wasmQueryKeeper, ) QueryPlugins
func (QueryPlugins) HandleQuery ¶
func (e QueryPlugins) HandleQuery(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error)
HandleQuery executes the requested query
func (QueryPlugins) Merge ¶
func (e QueryPlugins) Merge(o *QueryPlugins) QueryPlugins
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, encoders msgEncoder) SDKMessageHandler
func (SDKMessageHandler) DispatchMsg ¶
func (h SDKMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error)
type StakingEncoder ¶
type StakingEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk.Msg, error)
type StargateEncoder ¶
type StargateEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.StargateMsg) ([]sdk.Msg, error)
func EncodeStargateMsg ¶
func EncodeStargateMsg(unpacker codectypes.AnyUnpacker) StargateEncoder
type TestFaucet ¶ added in v0.2.0
type TestFaucet struct {
// contains filtered or unexported fields
}
func NewTestFaucet ¶ added in v0.2.0
func NewTestFaucet(tb testing.TB, ctx sdk.Context, bankKeeper bankkeeper.Keeper, minterModuleName string, initialAmount ...sdk.Coin) *TestFaucet
func (*TestFaucet) Fund ¶ added in v0.2.0
func (f *TestFaucet) Fund(parentCtx sdk.Context, receiver sdk.AccAddress, amounts ...sdk.Coin)
func (*TestFaucet) Mint ¶ added in v0.2.0
func (f *TestFaucet) Mint(parentCtx sdk.Context, addr sdk.AccAddress, amounts ...sdk.Coin)
func (*TestFaucet) NewFundedRandomAccount ¶ added in v0.2.0
func (f *TestFaucet) NewFundedRandomAccount(ctx sdk.Context, amounts ...sdk.Coin) sdk.AccAddress
type TestKeepers ¶ added in v0.2.0
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 MessageRouter EncodingConfig wasmappparams.EncodingConfig Faucet *TestFaucet MultiStore sdk.CommitMultiStore ScopedWasmKeeper capabilitykeeper.ScopedKeeper WasmStoreKey *storetypes.KVStoreKey }
func CreateDefaultTestInput ¶ added in v0.2.0
func CreateDefaultTestInput(tb testing.TB) (sdk.Context, TestKeepers)
CreateDefaultTestInput common settings for CreateTestInput
func CreateTestInput ¶ added in v0.2.0
func CreateTestInput(tb testing.TB, isCheckTx bool, availableCapabilities string, opts ...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 ValidatorSetSource ¶
type ValidatorSetSource interface {
ApplyAndReturnValidatorSetUpdates(sdk.Context) (updates []abci.ValidatorUpdate, err error)
}
ValidatorSetSource is a subset of the staking keeper
type VestingCoinBurner ¶ added in v0.2.0
type VestingCoinBurner struct {
// contains filtered or unexported fields
}
VestingCoinBurner default implementation for AccountPruner to burn the coins
func NewVestingCoinBurner ¶ added in v0.2.0
func NewVestingCoinBurner(bank types.BankKeeper) VestingCoinBurner
NewVestingCoinBurner constructor
func (VestingCoinBurner) CleanupExistingAccount ¶ added in v0.2.0
func (b VestingCoinBurner) CleanupExistingAccount(ctx sdk.Context, existingAcc authtypes.AccountI) (handled bool, err error)
CleanupExistingAccount accepts only vesting account types to burns all their original vesting coin balances. Other account types will be rejected and returned as unhandled.
type WasmEncoder ¶
type WasmEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg, error)
type WasmGasRegister ¶
type WasmGasRegister struct {
// contains filtered or unexported fields
}
WasmGasRegister implements GasRegister interface
func NewDefaultWasmGasRegister ¶
func NewDefaultWasmGasRegister() WasmGasRegister
NewDefaultWasmGasRegister creates instance with default values
func NewWasmGasRegister ¶
func NewWasmGasRegister(c WasmGasRegisterConfig) WasmGasRegister
NewWasmGasRegister constructor
func (WasmGasRegister) CompileCosts ¶
func (g WasmGasRegister) CompileCosts(byteLength int) storetypes.Gas
CompileCosts costs to persist and "compile" a new wasm contract
func (WasmGasRegister) EventCosts ¶
func (g WasmGasRegister) EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Events) sdk.Gas
EventCosts costs to persist an event
func (WasmGasRegister) FromWasmVMGas ¶
func (g WasmGasRegister) FromWasmVMGas(source uint64) sdk.Gas
FromWasmVMGas converts to SDK gas unit
func (WasmGasRegister) InstantiateContractCosts ¶
func (g WasmGasRegister) InstantiateContractCosts(pinned bool, msgLen int) sdk.Gas
InstantiateContractCosts costs when interacting with a wasm contract
func (WasmGasRegister) NewContractInstanceCosts ¶
func (g WasmGasRegister) NewContractInstanceCosts(pinned bool, msgLen int) storetypes.Gas
NewContractInstanceCosts costs to create a new contract instance from code
func (WasmGasRegister) ReplyCosts ¶
func (g WasmGasRegister) ReplyCosts(pinned bool, reply wasmvmtypes.Reply) sdk.Gas
ReplyCosts costs to to handle a message reply
func (WasmGasRegister) ToWasmVMGas ¶
func (g WasmGasRegister) ToWasmVMGas(source storetypes.Gas) uint64
ToWasmVMGas convert to wasmVM contract runtime gas unit
func (WasmGasRegister) UncompressCosts ¶ added in v0.2.0
func (g WasmGasRegister) UncompressCosts(byteLength int) sdk.Gas
UncompressCosts costs to unpack a new wasm contract
type WasmGasRegisterConfig ¶
type WasmGasRegisterConfig struct { // InstanceCost costs when interacting with a wasm contract InstanceCost sdk.Gas // CompileCosts costs to persist and "compile" a new wasm contract CompileCost sdk.Gas // UncompressCost costs per byte to unpack a contract UncompressCost wasmvmtypes.UFraction // 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 GasMultiplier sdk.Gas // EventPerAttributeCost is how much SDK gas is charged *per byte* for attribute data in events. // This is used with len(key) + len(value) EventPerAttributeCost sdk.Gas // EventAttributeDataCost is how much SDK gas is charged *per byte* for attribute data in events. // This is used with len(key) + len(value) EventAttributeDataCost sdk.Gas // EventAttributeDataFreeTier number of bytes of total attribute data that is free of charge EventAttributeDataFreeTier uint64 // ContractMessageDataCost SDK gas charged *per byte* of the message that goes to the contract // This is used with len(msg) ContractMessageDataCost sdk.Gas // CustomEventCost cost per custom event CustomEventCost uint64 }
WasmGasRegisterConfig config type
func DefaultGasRegisterConfig ¶
func DefaultGasRegisterConfig() WasmGasRegisterConfig
DefaultGasRegisterConfig default values
type WasmSnapshotter ¶
type WasmSnapshotter struct {
// contains filtered or unexported fields
}
func NewWasmSnapshotter ¶
func NewWasmSnapshotter(cms sdk.MultiStore, wasm *Keeper) *WasmSnapshotter
func (*WasmSnapshotter) RestoreExtension ¶ added in v1.0.0
func (ws *WasmSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshot.ExtensionPayloadReader) error
func (*WasmSnapshotter) SnapshotExtension ¶ added in v1.0.0
func (ws *WasmSnapshotter) SnapshotExtension(height uint64, payloadWriter snapshot.ExtensionPayloadWriter) 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
type WasmVMMetricsCollector ¶
type WasmVMMetricsCollector struct { CacheHitsDescr *prometheus.Desc CacheMissesDescr *prometheus.Desc CacheElementsDescr *prometheus.Desc CacheSizeDescr *prometheus.Desc // contains filtered or unexported fields }
WasmVMMetricsCollector custom metrics collector to be used with Prometheus
func NewWasmVMMetricsCollector ¶
func NewWasmVMMetricsCollector(s metricSource) *WasmVMMetricsCollector
NewWasmVMMetricsCollector constructor
func (*WasmVMMetricsCollector) Collect ¶
func (p *WasmVMMetricsCollector) Collect(c chan<- prometheus.Metric)
Collect is called by the Prometheus registry when collecting metrics.
func (*WasmVMMetricsCollector) Describe ¶
func (p *WasmVMMetricsCollector) Describe(descs chan<- *prometheus.Desc)
Describe sends the super-set of all possible descriptors of metrics
func (*WasmVMMetricsCollector) Register ¶
func (p *WasmVMMetricsCollector) Register(r prometheus.Registerer)
Register registers all metrics
type WasmVMQueryHandler ¶
type WasmVMQueryHandler interface { // HandleQuery executes the requested query HandleQuery(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error) }
WasmVMQueryHandler is an extension point for custom query handler implementations
type WasmVMQueryHandlerFn ¶
type WasmVMQueryHandlerFn func(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error)
WasmVMQueryHandlerFn is a helper to construct a function based query handler.
func (WasmVMQueryHandlerFn) HandleQuery ¶
func (w WasmVMQueryHandlerFn) HandleQuery(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error)
HandleQuery delegates call into wrapped WasmVMQueryHandlerFn
type WasmVMResponseHandler ¶
type WasmVMResponseHandler interface { // Handle processes the data returned by a contract invocation. Handle( ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, messages []wasmvmtypes.SubMsg, origRspData []byte, ) ([]byte, error) }
WasmVMResponseHandler is an extension point to handles the response data returned by a contract call.
Source Files ¶
- addresses.go
- ante.go
- api.go
- authz_policy.go
- contract_keeper.go
- events.go
- gas_register.go
- genesis.go
- handler_plugin.go
- handler_plugin_encoders.go
- ibc.go
- keeper.go
- keeper_cgo.go
- metrics.go
- migrations.go
- msg_dispatcher.go
- msg_server.go
- options.go
- proposal_handler.go
- querier.go
- query_plugins.go
- relay.go
- snapshotter.go
- test_common.go
- test_fuzz.go