api

package
v0.8.2-0...-f7797fa Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const GasMultiplier = 100

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 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)

Variables

This section is empty.

Functions

func Create

func Create(cache Cache, wasm []byte) ([]byte, error)

func GetCode

func GetCode(cache Cache, code_id []byte) ([]byte, error)

func Handle

func Handle(
	cache Cache,
	code_id []byte,
	params []byte,
	msg []byte,
	gasMeter *GasMeter,
	store *KVStore,
	api *GoAPI,
	querier *Querier,
	gasLimit uint64,
) ([]byte, uint64, error)

func Instantiate

func Instantiate(
	cache Cache,
	code_id []byte,
	params []byte,
	msg []byte,
	gasMeter *GasMeter,
	store *KVStore,
	api *GoAPI,
	querier *Querier,
	gasLimit uint64,
) ([]byte, uint64, error)

func Migrate

func Migrate(
	cache Cache,
	code_id []byte,
	params []byte,
	msg []byte,
	gasMeter *GasMeter,
	store *KVStore,
	api *GoAPI,
	querier *Querier,
	gasLimit uint64,
) ([]byte, uint64, error)

func Query

func Query(
	cache Cache,
	code_id []byte,
	msg []byte,
	gasMeter *GasMeter,
	store *KVStore,
	api *GoAPI,
	querier *Querier,
	gasLimit uint64,
) ([]byte, uint64, error)

func ReleaseCache

func ReleaseCache(cache Cache)

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func InitCache

func InitCache(dataDir string, supportedFeatures string, cacheSize uint64) (Cache, error)

type CanonicalAddress

type CanonicalAddress func(string) ([]byte, error)

type Gas

type Gas = uint64

type GasMeter

type GasMeter interface {
	GasConsumed() Gas
	GasConsumedToLimit() Gas
	Limit() Gas
	ConsumeGas(amount Gas, descriptor string)
	IsPastLimit() bool
	IsOutOfGas() bool
}

GasMeter is a copy of an interface declaration from cosmos-sdk https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34

type GoAPI

type GoAPI struct {
	HumanAddress     HumanAddress
	CanonicalAddress CanonicalAddress
}

type HumanAddress

type HumanAddress func([]byte) (string, error)

type KVStore

type KVStore interface {
	Get(key []byte) []byte
	Set(key, value []byte)
	Delete(key []byte)

	// Iterator over a domain of keys in ascending order. End is exclusive.
	// Start must be less than end, or the Iterator is invalid.
	// Iterator must be closed by caller.
	// To iterate over entire domain, use store.Iterator(nil, nil)
	Iterator(start, end []byte) dbm.Iterator

	// Iterator over a domain of keys in descending order. End is exclusive.
	// Start must be less than end, or the Iterator is invalid.
	// Iterator must be closed by caller.
	ReverseIterator(start, end []byte) dbm.Iterator
}

KVStore copies a subset of types from cosmos-sdk We may wish to make this more generic sometime in the future, but not now https://github.com/cosmos/cosmos-sdk/blob/bef3689245bab591d7d169abd6bea52db97a70c7/store/types/store.go#L170

type Querier

type Querier = types.Querier

Jump to

Keyboard shortcuts

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