vminterface

package
v0.0.0-...-591ae30 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanTransfer

func CanTransfer(db vm.StateDB, addr common.Address, amount *big.Int) bool

CanTransfer checks whether there are enough funds in the address' account to make a transfer. This does not take the necessary gas in to account to make the transfer valid.

func NewHeader

func NewHeader(cc ChainContext) *types.Header

NewHeader calls GetHeader() on the passed chain context with arbitrary arguments

func NewStateDB

func NewStateDB(root common.Hash, dbPath string) (*state.StateDB, ethdb.Database)

NewStateDB - Create a new StateDB using levelDB instead of RAM

func NewVMContext

func NewVMContext(origin common.Address, coinbase common.Address, blockNum *big.Int, chainContext ChainContext) vm.Context

NewVMContext will construct a new EVM Context with default values. TODO: include gas price variable in params

func Transfer

func Transfer(db vm.StateDB, sender, recipient common.Address, amount *big.Int)

Transfer subtracts amount from sender and adds amount to recipient using the given Db

Types

type ChainContext

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

ChainContext needed by the evm

func NewChainContext

func NewChainContext(coinbase common.Address) ChainContext

NewChainContext constructs a new context needed by EVMContext

func (ChainContext) Engine

func (cc ChainContext) Engine() consensus.Engine

Engine is only here to satisfy the chaincontext interface

func (ChainContext) GetHeader

func (cc ChainContext) GetHeader(hash common.Hash, number uint64) *types.Header

GetHeader returns a header needed by the EVMContext, it also satisfies the ChainContext Interface. TODO: increase gaslimit ?

type Message

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

func NewMessage

func NewMessage(from common.Address, to *common.Address, nonce uint64, amount, gasLimit, price *big.Int, data []byte, checkNonce bool) Message

func (Message) CheckNonce

func (m Message) CheckNonce() bool

func (Message) Data

func (m Message) Data() []byte

func (Message) From

func (m Message) From() common.Address

func (Message) Gas

func (m Message) Gas() *big.Int

func (Message) GasPrice

func (m Message) GasPrice() *big.Int

func (Message) Nonce

func (m Message) Nonce() uint64

func (Message) To

func (m Message) To() *common.Address

func (Message) Value

func (m Message) Value() *big.Int

Jump to

Keyboard shortcuts

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