evmc

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Failure = Error(C.EVMC_FAILURE)
	Revert  = Error(C.EVMC_REVERT)
)

Variables

This section is empty.

Functions

func NewWASMInstance

func NewWASMInstance(
	config string,
	blockChainHook vmcommon.BlockchainHook,
	cryptoHook vmcommon.CryptoHook,
	vmType []byte,
) (*vmContext, error)

Types

type CallKind

type CallKind int
const (
	Call         CallKind = C.EVMC_CALL
	DelegateCall CallKind = C.EVMC_DELEGATECALL
	CallCode     CallKind = C.EVMC_CALLCODE
	Create       CallKind = C.EVMC_CREATE
	Create2      CallKind = C.EVMC_CREATE2
)

type Error

type Error int32

func (Error) Error

func (err Error) Error() string

func (Error) IsInternalError

func (err Error) IsInternalError() bool

func (Error) ToReturnCode

func (err Error) ToReturnCode() vmcommon.ReturnCode

type HostContext

type HostContext interface {
	AccountExists(addr common.Address) bool
	GetStorage(addr common.Address, key common.Hash) common.Hash
	SetStorage(addr common.Address, key common.Hash, value common.Hash) StorageStatus
	GetBalance(addr common.Address) common.Hash
	GetCodeSize(addr common.Address) int
	GetCodeHash(addr common.Address) common.Hash
	GetCode(addr common.Address) []byte
	Selfdestruct(addr common.Address, beneficiary common.Address)
	GetTxContext() TxContext
	GetBlockHash(number int64) common.Hash
	EmitLog(addr common.Address, topics []common.Hash, data []byte)
	Call(kind CallKind,
		destination common.Address, sender common.Address, value *big.Int, input []byte, gas int64, depth int,
		static bool, salt *big.Int) (output []byte, gasLeft int64, createAddr common.Address, err error)
}

type Instance

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

func Load

func Load(filename string) (instance *Instance, err error)

func (*Instance) Destroy

func (instance *Instance) Destroy()

func (*Instance) Execute

func (instance *Instance) Execute(
	ctx HostContext,
	rev Revision,
	kind CallKind,
	static bool,
	depth int,
	gas int64,
	destination common.Address,
	sender common.Address,
	input []byte,
	value common.Hash,
	code []byte,
	create2Salt common.Hash,
) (output []byte, gasLeft int64, err error)

func (*Instance) Name

func (instance *Instance) Name() string

func (*Instance) SetOption

func (instance *Instance) SetOption(name string, value string) (err error)

func (*Instance) Version

func (instance *Instance) Version() string

type Revision

type Revision int32
const (
	Byzantium Revision = C.EVMC_BYZANTIUM
	MaxDepth           = 10
)

type StorageStatus

type StorageStatus int

type TxContext

type TxContext struct {
	GasPrice   common.Hash
	Origin     common.Address
	Coinbase   common.Address
	Number     int64
	Timestamp  int64
	GasLimit   int64
	Difficulty common.Hash
}

TxContext contains information about current transaction and block.

Jump to

Keyboard shortcuts

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