twasm

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 31 Imported by: 3

README

twasm

Extended version of CosmWasm/wasmd/x/wasm module.

Concepts

Tgrade is different than wasmd is.

Privileged

How nice would it be to build chain logic in wasm with all the flexibility that wasmd brings you today. Now imagine that you build the chain and can do what you want. This inspired us to create a new set of contracts that we call "privileged". They can interact with the native go modules or receive callbacks from the chain to do certain business logic. This power comes with some responsibility that we restrict to "privileged" contracts only. Technically it is a marker persisted as a secondary index that points to the contract and a set of predefined callbacks the contract can register.

Documentation

Index

Constants

View Source
const (
	ModuleName = types.ModuleName
	StoreKey   = types.StoreKey
	RouterKey  = types.RouterKey
)

Variables

This section is empty.

Functions

func AddModuleInitFlags

func AddModuleInitFlags(startCmd *cobra.Command)

AddModuleInitFlags implements servertypes.ModuleInitFlags interface.

func BeginBlocker

func BeginBlocker(ctx sdk.Context, k abciKeeper, b abci.RequestBeginBlock)

func ContractAddress

func ContractAddress(codeID, instanceID uint64) sdk.AccAddress

ContractAddress generator function. Same as in wasm

func EndBlocker

func EndBlocker(ctx sdk.Context, k abciKeeper) []abci.ValidatorUpdate

EndBlocker ABCI end block callback. Does not modify the validator set

func ReadWasmConfig

func ReadWasmConfig(opts servertypes.AppOptions) (types.TWasmConfig, error)

ReadWasmConfig reads the wasm specifig configuration

func RecoverToLog added in v1.0.0

func RecoverToLog(logger log.Logger, contractAddr sdk.AccAddress) func()

RecoverToLog catches panic and logs cause to error

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule implements an application module for the wasm module.

func NewAppModule

func NewAppModule(
	cdc codec.Codec,
	keeper *keeper.Keeper,
	validatorSetSource wasmkeeper.ValidatorSetSource,
	ak wasmtypes.AccountKeeper,
	bk simulation.BankKeeper,
) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx sdk.Context, b abci.RequestBeginBlock)

BeginBlock returns the begin blocker for the wasm module.

func (AppModule) ConsensusVersion added in v0.6.2

func (am AppModule) ConsensusVersion() uint64

ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1.

func (AppModule) EndBlock

EndBlock returns the end blocker for the wasm module. It returns no validator updates.

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the wasm module.

func (AppModule) GenerateGenesisState

func (AppModule) GenerateGenesisState(simState *module.SimulationState)

GenerateGenesisState creates a randomized GenState of the bank module.

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the wasm module. It returns no validator updates.

func (AppModule) LegacyQuerierHandler

func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier

func (AppModule) ProposalContents

func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent

ProposalContents doesn't return any content functions for governance proposals.

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute returns the wasm module's querier route name.

func (AppModule) RandomizedParams

func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange

RandomizedParams creates randomized bank param changes for the simulator.

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

RegisterInvariants registers the wasm module invariants.

func (AppModule) RegisterServices

func (am AppModule) RegisterServices(cfg module.Configurator)

func (AppModule) RegisterStoreDecoder

func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for supply module's types

func (AppModule) Route

func (am AppModule) Route() sdk.Route

Route returns the message routing key for the wasm module.

func (AppModule) WeightedOperations

func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation

WeightedOperations returns the all the gov module operations with their respective weights.

type AppModuleBasic

type AppModuleBasic struct{}

AppModuleBasic defines the basic application module used by the wasm module.

func (AppModuleBasic) DefaultGenesis

func (b AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the wasm module.

func (AppModuleBasic) GetQueryCmd

func (b AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns no root query command for the wasm module.

func (AppModuleBasic) GetTxCmd

func (b AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the root tx command for the wasm module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the wasm module's name.

func (AppModuleBasic) RegisterGRPCGatewayRoutes

func (b AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, serveMux *runtime.ServeMux)

func (AppModuleBasic) RegisterInterfaces

func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry)

RegisterInterfaceTypes implements InterfaceModule

func (AppModuleBasic) RegisterLegacyAminoCodec

func (b AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino)

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(cliCtx client.Context, rtr *mux.Router)

RegisterRESTRoutes registers the REST routes for the wasm module.

func (AppModuleBasic) ValidateGenesis

func (b AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, config client.TxEncodingConfig, message json.RawMessage) error

ValidateGenesis performs genesis state validation for the wasm module.

Directories

Path Synopsis
client
cli
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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