wasm

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const GasXVMDeploy = 21000 * 10

Variables

This section is empty.

Functions

func EmptyImports

func EmptyImports() (wasmlib.WasmImport, error)

Types

type Context

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

Context represents the context of wasm

func NewContext

func NewContext(tx pb.Transaction, data *pb.TransactionData, ledger *ledger.Ledger, logger logrus.FieldLogger) *Context

NewContext creates a context of wasm instance

func (*Context) Callee

func (ctx *Context) Callee() string

Callee returns the tx callee address

func (*Context) Caller

func (ctx *Context) Caller() string

Caller returns the tx caller address

func (*Context) Logger

func (ctx *Context) Logger() logrus.FieldLogger

Logger returns the log instance

type Contract

type Contract struct {
	// contract byte
	Code []byte

	// contract hash
	Hash types.Hash
}

Contract represents the smart contract structure used in the wasm vm

type WasmVM

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

Wasm represents the wasm vm in BitXHub

func New

func New(ctx *vm.Context, imports wasmlib.WasmImport, instances map[string]*wasmer.Instance) (*WasmVM, error)

New creates a wasm vm instance

func (*WasmVM) Run

func (w *WasmVM) Run(input []byte, gasLimit uint64) (ret []byte, gasUsed uint64, err error)

Run let the wasm vm excute or deploy the smart contract which depends on whether the callee is empty

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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