keeper

package
v0.4.6-oracle.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

nolint:deadcode unused noalias

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier creates a new querier

func TestHandler

func TestHandler(k Keeper) sdk.Handler

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

Types

type InitMsg

type InitMsg struct {
	Verifier    sdk.AccAddress `json:"verifier"`
	Beneficiary sdk.AccAddress `json:"beneficiary"`
}

InitMsg 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.Codec, storeKey sdk.StoreKey,
	paramspace params.Subspace, accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper, supplyKeeper types.SupplyKeeper, treasuryKeeper types.TreasuryKeeper, router sdk.Router,
	supportedFeatures string,
	wasmConfig *config.Config) Keeper

NewKeeper creates a new contract Keeper instance

func (Keeper) CompileCode

func (k Keeper) CompileCode(ctx sdk.Context, wasmCode []byte) (codeHash []byte, err error)

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, caller sdk.AccAddress, exeMsg []byte, coins sdk.Coins) ([]byte, error)

ExecuteContract executes the contract instance

func (Keeper) GetByteCode

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

GetByteCode returns ByteCode of the given CodeHash

func (Keeper) GetCodeInfo

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

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

func (k Keeper) GetLastCodeID(ctx sdk.Context) (uint64, error)

GetLastCodeID return last code ID

func (Keeper) GetLastInstanceID

func (k Keeper) GetLastInstanceID(ctx sdk.Context) (uint64, error)

GetLastInstanceID return last instance ID

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of oracle parameters.

func (Keeper) InstantiateContract

func (k Keeper) InstantiateContract(
	ctx sdk.Context,
	codeID uint64,
	creator sdk.AccAddress,
	initMsg []byte,
	deposit sdk.Coins,
	migratable bool) (contractAddress sdk.AccAddress, err error)

InstantiateContract creates an instance of a WASM contract

func (Keeper) IterateContractInfo

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

IterateContractInfo iterates all contract infos

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MaxContractGas

func (k Keeper) MaxContractGas(ctx sdk.Context) (res uint64)

MaxContractGas defines allowed maximum gas usage per each contract execution

func (Keeper) MaxContractMsgSize

func (k Keeper) MaxContractMsgSize(ctx sdk.Context) (res uint64)

MaxContractMsgSize defines maximum bytes size of a contract

func (Keeper) MaxContractSize

func (k Keeper) MaxContractSize(ctx sdk.Context) (res uint64)

MaxContractSize defines maximum bytes size of a contract

func (Keeper) MigrateContract

func (k Keeper) MigrateContract(ctx sdk.Context, contractAddress sdk.AccAddress, caller 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)

RegisterMsgParsers register module msg parsers

func (*Keeper) RegisterQueriers

func (k *Keeper) RegisterQueriers(queriers map[string]types.WasmQuerierInterface)

RegisterQueriers register module queriers

func (Keeper) SetCodeInfo

func (k Keeper) SetCodeInfo(ctx sdk.Context, codeID uint64, codeInfo types.CodeInfo)

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

func (k Keeper) SetLastCodeID(ctx sdk.Context, id uint64)

SetLastCodeID set last code id

func (Keeper) SetLastInstanceID

func (k Keeper) SetLastInstanceID(ctx sdk.Context, id uint64)

SetLastInstanceID set last instance id

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the total set of oracle parameters.

func (Keeper) StoreCode

func (k Keeper) StoreCode(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte) (codeID uint64, err error)

StoreCode uploads and compiles a WASM contract bytecode, returning a short identifier for the stored code

func (Keeper) StoreConfig

func (k Keeper) StoreConfig()

StoreConfig store wasm config to local config file

type TestInput

type TestInput struct {
	Ctx            sdk.Context
	Cdc            *codec.Codec
	AccKeeper      auth.AccountKeeper
	BankKeeper     bank.Keeper
	SupplyKeeper   supply.Keeper
	StakingKeeper  staking.Keeper
	DistrKeeper    distr.Keeper
	OracleKeeper   oracle.Keeper
	MarketKeeper   market.Keeper
	TreasuryKeeper treasury.Keeper
	WasmKeeper     Keeper
}

TestInput nolint

func CreateTestInput

func CreateTestInput(t *testing.T) TestInput

CreateTestInput nolint

type WasmMsgParser

type WasmMsgParser struct{}

WasmMsgParser - wasm msg parser for staking msgs

func NewWasmMsgParser

func NewWasmMsgParser() WasmMsgParser

NewWasmMsgParser returns wasm msg parser

func (WasmMsgParser) Parse

func (WasmMsgParser) Parse(contractAddr sdk.AccAddress, wasmMsg wasmTypes.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 wasmTypes.QueryRequest) ([]byte, error)

Query - implement query function

func (WasmQuerier) QueryCustom

func (WasmQuerier) QueryCustom(ctx sdk.Context, data json.RawMessage) ([]byte, error)

QueryCustom implements custom query interface

Jump to

Keyboard shortcuts

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