evmc

package
v1.7.1999 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: Apache-2.0 Imports: 5 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

This section is empty.

Types

type Address

type Address [addressLength]byte

Address represents the 20 byte address of an Ethereum account.

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 Capability

type Capability uint32
const (
	CapabilityEVM1  Capability = C.EVMC_CAPABILITY_EVM1
	CapabilityEWASM Capability = C.EVMC_CAPABILITY_EWASM
)

type Error

type Error int32

func (Error) Error

func (err Error) Error() string

func (Error) IsInternalError

func (err Error) IsInternalError() bool

type Hash

type Hash [hashLength]byte

Hash represents the 32 byte Keccak256 hash of arbitrary data.

func (Hash) Big

func (h Hash) Big() *big.Int

Big converts a hash to a big integer.

type HostContext

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

type Revision

type Revision int32
const (
	Frontier         Revision = C.EVMC_FRONTIER
	Homestead        Revision = C.EVMC_HOMESTEAD
	TangerineWhistle Revision = C.EVMC_TANGERINE_WHISTLE
	SpuriousDragon   Revision = C.EVMC_SPURIOUS_DRAGON
	Byzantium        Revision = C.EVMC_BYZANTIUM
	Constantinople   Revision = C.EVMC_CONSTANTINOPLE
	Petersburg       Revision = C.EVMC_PETERSBURG
	Istanbul         Revision = C.EVMC_ISTANBUL
)

type StorageStatus

type StorageStatus int

type TxContext

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

TxContext contains information about current transaction and block.

type VM

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

func Load

func Load(filename string) (vm *VM, err error)

func LoadAndConfigure

func LoadAndConfigure(config string) (vm *VM, err error)

func (*VM) Destroy

func (vm *VM) Destroy()

func (*VM) Execute

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

func (*VM) HasCapability

func (vm *VM) HasCapability(capability Capability) bool

func (*VM) Name

func (vm *VM) Name() string

func (*VM) SetOption

func (vm *VM) SetOption(name string, value string) (err error)

func (*VM) Version

func (vm *VM) Version() string

Jump to

Keyboard shortcuts

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