Documentation ¶
Index ¶
- Variables
- func FundAccount(input TestInput, addr sdk.AccAddress, amounts sdk.Coins) error
- func LimitReader(r io.Reader, n int64) io.Reader
- func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig
- func MakeTestCodec(t *testing.T) codec.Codec
- func NewLegacyQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper) types.QueryServer
- type ContractInfoQueryParams
- type ContractInfoQueryResponse
- type CosmosQuery
- type HackatomExampleInitMsg
- type Keeper
- func (k Keeper) CompileCode(ctx sdk.Context, wasmCode []byte) (codeHash []byte, err error)
- func (k Keeper) ExecuteContract(ctx sdk.Context, contractAddress sdk.AccAddress, sender sdk.AccAddress, ...) ([]byte, error)
- func (k Keeper) GetByteCode(ctx sdk.Context, codeID uint64) ([]byte, error)
- func (k Keeper) GetCodeInfo(ctx sdk.Context, codeID uint64) (codeInfo types.CodeInfo, err error)
- func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) (contractInfo types.ContractInfo, err error)
- func (k Keeper) GetContractStoreIterator(ctx sdk.Context, contractAddress sdk.AccAddress) sdk.Iterator
- func (k Keeper) GetLastCodeID(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetLastInstanceID(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) InstantiateContract(ctx sdk.Context, codeID uint64, creator sdk.AccAddress, admin sdk.AccAddress, ...) (sdk.AccAddress, []byte, error)
- func (k Keeper) IterateContractInfo(ctx sdk.Context, cb func(types.ContractInfo) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MaxContractGas(ctx sdk.Context) (res uint64)
- func (k Keeper) MaxContractMsgSize(ctx sdk.Context) (res uint64)
- func (k Keeper) MaxContractSize(ctx sdk.Context) (res uint64)
- func (k Keeper) MigrateCode(ctx sdk.Context, codeID uint64, creator sdk.AccAddress, wasmCode []byte) error
- func (k Keeper) MigrateContract(ctx sdk.Context, contractAddress sdk.AccAddress, sender sdk.AccAddress, ...) ([]byte, error)
- func (k *Keeper) RegisterMsgParsers(parsers map[string]types.WasmMsgParserInterface, ...)
- func (k *Keeper) RegisterQueriers(queriers map[string]types.WasmQuerierInterface, ...)
- func (k Keeper) SetCodeInfo(ctx sdk.Context, codeID uint64, codeInfo types.CodeInfo)
- func (k Keeper) SetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress, codeInfo types.ContractInfo)
- func (k Keeper) SetContractStore(ctx sdk.Context, contractAddress sdk.AccAddress, models []types.Model)
- func (k Keeper) SetLastCodeID(ctx sdk.Context, id uint64)
- func (k Keeper) SetLastInstanceID(ctx sdk.Context, id uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) StoreCode(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte) (codeID uint64, err error)
- type LimitedReader
- type StargateWasmMsgParser
- type StargateWasmQuerier
- type TestInput
- type WasmMsgParser
- type WasmQuerier
Constants ¶
This section is empty.
Variables ¶
var ( PubKeys = []crypto.PubKey{ secp256k1.GenPrivKey().PubKey(), secp256k1.GenPrivKey().PubKey(), secp256k1.GenPrivKey().PubKey(), } Addrs = []sdk.AccAddress{ sdk.AccAddress(PubKeys[0].Address()), sdk.AccAddress(PubKeys[1].Address()), sdk.AccAddress(PubKeys[2].Address()), } ValAddrs = []sdk.ValAddress{ sdk.ValAddress(PubKeys[0].Address()), sdk.ValAddress(PubKeys[1].Address()), sdk.ValAddress(PubKeys[2].Address()), } InitTokens = sdk.TokensFromConsensusPower(200, sdk.DefaultPowerReduction) InitCoins = sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens)) )
Test Account
var ModuleBasics = module.NewBasicManager( customauth.AppModuleBasic{}, custombank.AppModuleBasic{}, customstaking.AppModuleBasic{}, customdistr.AppModuleBasic{}, customparams.AppModuleBasic{}, oracle.AppModuleBasic{}, market.AppModuleBasic{}, ibc.AppModuleBasic{}, transfer.AppModuleBasic{}, capability.AppModuleBasic{}, )
ModuleBasics nolint
Functions ¶
func FundAccount ¶
FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!
func LimitReader ¶
LimitReader returns LimitedReader
func MakeEncodingConfig ¶
func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig
MakeEncodingConfig nolint
func NewLegacyQuerier ¶
func NewLegacyQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
NewLegacyQuerier creates a new querier
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the wasm MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(keeper Keeper) types.QueryServer
NewQuerier returns an implementation of the market QueryServer interface for the provided Keeper.
Types ¶
type ContractInfoQueryParams ¶
type ContractInfoQueryParams struct {
ContractAddress string `json:"contract_address"`
}
ContractInfoQueryParams query request params for contract info
type ContractInfoQueryResponse ¶
type ContractInfoQueryResponse struct { Address string `json:"address"` Creator string `json:"creator"` Admin string `json:"admin,omitempty"` CodeID uint64 `json:"code_id"` }
ContractInfoQueryResponse - exchange rates query response for wasm module
type CosmosQuery ¶
type CosmosQuery struct {
ContractInfo *ContractInfoQueryParams `json:"contract_info,omitempty"`
}
CosmosQuery custom query interface for oracle querier
type HackatomExampleInitMsg ¶
type HackatomExampleInitMsg struct { Verifier sdk.AccAddress `json:"verifier"` Beneficiary sdk.AccAddress `json:"beneficiary"` }
HackatomExampleInitMsg nolint
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.BinaryCodec, storeKey sdk.StoreKey, paramspace paramstypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, treasuryKeeper types.TreasuryKeeper, serviceRouter types.MsgServiceRouter, queryRouter types.GRPCQueryRouter, supportedFeatures string, homePath string, wasmConfig *config.Config) Keeper
NewKeeper creates a new contract Keeper instance
func (Keeper) CompileCode ¶
CompileCode uncompress the wasm code bytes and store the code to local file system
func (Keeper) ExecuteContract ¶
func (k Keeper) ExecuteContract( ctx sdk.Context, contractAddress sdk.AccAddress, sender sdk.AccAddress, execMsg []byte, coins sdk.Coins) ([]byte, error)
ExecuteContract executes the contract instance
func (Keeper) GetByteCode ¶
GetByteCode returns ByteCode of the given CodeHash
func (Keeper) GetCodeInfo ¶
GetCodeInfo returns CodeInfo for the given codeID
func (Keeper) GetContractInfo ¶
func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) (contractInfo types.ContractInfo, err error)
GetContractInfo returns contract info of the given address
func (Keeper) GetContractStoreIterator ¶
func (k Keeper) GetContractStoreIterator(ctx sdk.Context, contractAddress sdk.AccAddress) sdk.Iterator
GetContractStoreIterator returns iterator for a contract store
func (Keeper) GetLastCodeID ¶
GetLastCodeID return last code ID
func (Keeper) GetLastInstanceID ¶
GetLastInstanceID return last instance ID
func (Keeper) InstantiateContract ¶
func (k Keeper) InstantiateContract( ctx sdk.Context, codeID uint64, creator sdk.AccAddress, admin sdk.AccAddress, initMsg []byte, deposit sdk.Coins) (sdk.AccAddress, []byte, error)
InstantiateContract creates an instance of a WASM contract
func (Keeper) IterateContractInfo ¶
IterateContractInfo iterates all contract infos
func (Keeper) MaxContractGas ¶
MaxContractGas defines allowed maximum gas usage per each contract execution
func (Keeper) MaxContractMsgSize ¶
MaxContractMsgSize defines maximum bytes size of a contract
func (Keeper) MaxContractSize ¶
MaxContractSize defines maximum bytes size of a contract
func (Keeper) MigrateCode ¶
func (k Keeper) MigrateCode(ctx sdk.Context, codeID uint64, creator sdk.AccAddress, wasmCode []byte) error
MigrateCode uploads and compiles a WASM contract bytecode for the existing code id. After columbus-5 update, all contract code will be removed from the store due to in-compatibility between CosmWasm@v0.10.x and CosmWasm@v0.16.x The migration can be executed by once after columbus-5 update. TODO - remove after columbus-5 update
func (Keeper) MigrateContract ¶
func (k Keeper) MigrateContract( ctx sdk.Context, contractAddress sdk.AccAddress, sender sdk.AccAddress, newCodeID uint64, migrateMsg []byte) ([]byte, error)
MigrateContract allows to upgrade a contract to a new code with data migration.
func (*Keeper) RegisterMsgParsers ¶
func (k *Keeper) RegisterMsgParsers( parsers map[string]types.WasmMsgParserInterface, stargateWasmMsgParser types.StargateWasmMsgParserInterface, )
RegisterMsgParsers register module msg parsers
func (*Keeper) RegisterQueriers ¶
func (k *Keeper) RegisterQueriers( queriers map[string]types.WasmQuerierInterface, stargateWasmQuerier types.StargateWasmQuerierInterface, )
RegisterQueriers register module queriers
func (Keeper) SetCodeInfo ¶
SetCodeInfo stores CodeInfo for the given codeID
func (Keeper) SetContractInfo ¶
func (k Keeper) SetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress, codeInfo types.ContractInfo)
SetContractInfo stores ContractInfo for the given contractAddress
func (Keeper) SetContractStore ¶
func (k Keeper) SetContractStore(ctx sdk.Context, contractAddress sdk.AccAddress, models []types.Model)
SetContractStore records all the Models on the contract store
func (Keeper) SetLastCodeID ¶
SetLastCodeID set last code id
func (Keeper) SetLastInstanceID ¶
SetLastInstanceID set last instance id
type LimitedReader ¶
type LimitedReader struct {
// contains filtered or unexported fields
}
LimitedReader is a Reader that reads from r but stops with types.ErrExceedMaxContractSize after n bytes.
type StargateWasmMsgParser ¶
type StargateWasmMsgParser struct {
// contains filtered or unexported fields
}
StargateWasmMsgParser - wasm msg parser for stargate msgs
func NewStargateWasmMsgParser ¶
func NewStargateWasmMsgParser(unpacker codectypes.AnyUnpacker) StargateWasmMsgParser
NewStargateWasmMsgParser returns stargate wasm msg parser
func (StargateWasmMsgParser) Parse ¶
func (parser StargateWasmMsgParser) Parse(wasmMsg wasmvmtypes.CosmosMsg) (sdk.Msg, error)
Parse implements wasm stargate msg parser
type StargateWasmQuerier ¶
type StargateWasmQuerier struct {
// contains filtered or unexported fields
}
StargateWasmQuerier - wasm query interface for wasm contract
func NewStargateWasmQuerier ¶
func NewStargateWasmQuerier(keeper Keeper) StargateWasmQuerier
NewStargateWasmQuerier returns stargate wasm querier
func (StargateWasmQuerier) Query ¶
func (querier StargateWasmQuerier) Query(ctx sdk.Context, request wasmvmtypes.QueryRequest) ([]byte, error)
Query - implement query function
type TestInput ¶
type TestInput struct { Ctx sdk.Context Cdc *codec.LegacyAmino AccKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper StakingKeeper stakingkeeper.Keeper DistributionKeeper distrkeeper.Keeper OracleKeeper oraclekeeper.Keeper MarketKeeper marketkeeper.Keeper TreasuryKeeper treasurykeeper.Keeper WasmKeeper Keeper }
TestInput nolint
type WasmMsgParser ¶
type WasmMsgParser struct{}
WasmMsgParser - wasm msg parser for wasm msgs
func NewWasmMsgParser ¶
func NewWasmMsgParser() WasmMsgParser
NewWasmMsgParser returns wasm msg parser
func (WasmMsgParser) Parse ¶
func (WasmMsgParser) Parse(contractAddr sdk.AccAddress, wasmMsg wasmvmtypes.CosmosMsg) (sdk.Msg, error)
Parse implements wasm staking msg parser
func (WasmMsgParser) ParseCustom ¶
func (parser WasmMsgParser) ParseCustom(contractAddr sdk.AccAddress, data json.RawMessage) (sdk.Msg, error)
ParseCustom implements custom parser
type WasmQuerier ¶
type WasmQuerier struct {
// contains filtered or unexported fields
}
WasmQuerier - wasm query interface for wasm contract
func NewWasmQuerier ¶
func NewWasmQuerier(keeper Keeper) WasmQuerier
NewWasmQuerier returns wasm querier
func (WasmQuerier) Query ¶
func (querier WasmQuerier) Query(ctx sdk.Context, request wasmvmtypes.QueryRequest) ([]byte, error)
Query - implement query function
func (WasmQuerier) QueryCustom ¶
func (querier WasmQuerier) QueryCustom(ctx sdk.Context, data json.RawMessage) ([]byte, error)
QueryCustom implements custom query interface