evm

package
v0.0.0-...-a173fca Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEvmConfig = &vm.VMConfig{
		LogConfig: &vm.LogConfig{
			DisableMemory:  false,
			DisableStack:   false,
			DisableStorage: false,
			Debug:          false,
			Limit:          0,
		},
	}
)

Functions

func CanTransfer

func CanTransfer(db vm.VMState, addr crypto.CommonAddress, 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 GetHashFn

func GetHashFn(ref *types.BlockHeader, chain ChainContext) func(n uint64) crypto.Hash

GetHashFn returns a GetHashFunc which retrieves header hashes by number

func NewEVMContext

func NewEVMContext(msg *types.Transaction, header *types.BlockHeader, sender *crypto.CommonAddress) vm.Context

NewEVMContext creates a new context for use in the EVM.

func Transfer

func Transfer(db vm.VMState, sender, to crypto.CommonAddress, amount *big.Int)

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

Types

type ChainContext

type ChainContext interface {
	// GetHeader returns the hash corresponding to their hash.
	GetHeader(crypto.Hash, uint64) *types.BlockHeader
}

ChainContext supports retrieving headers and consensus parameters from the current blockchain to be used during transaction processing.

type EvmService

type EvmService struct {
	Config *vm.VMConfig
	//Chain           chain.ChainServiceInterface `service:"chain"`
	DatabaseService *database.DatabaseService `service:"database"`
}

func (*EvmService) Api

func (evmService *EvmService) Api() []app.API

func (*EvmService) Call

func (evmService *EvmService) Call(database store.StoreInterface, tx *types.Transaction, header *types.BlockHeader) (ret []byte, err error)

func (*EvmService) CommandFlags

func (evmService *EvmService) CommandFlags() ([]cli.Command, []cli.Flag)

func (*EvmService) DefaultConfig

func (evmService *EvmService) DefaultConfig(netType params.NetType) *vm.VMConfig

func (*EvmService) Eval

func (evmService *EvmService) Eval(state vm.VMState, tx *types.Transaction, header *types.BlockHeader, gas uint64, value *big.Int) (ret []byte, gasUsed uint64, contractAddr crypto.CommonAddress, failed bool, err error)

func (*EvmService) Init

func (evmService *EvmService) Init(executeContext *app.ExecuteContext) error

func (*EvmService) Name

func (evmService *EvmService) Name() string

func (*EvmService) P2pMessages

func (evmService *EvmService) P2pMessages() map[int]interface{}

func (*EvmService) Receive

func (evmService *EvmService) Receive(context actor.Context)

func (*EvmService) Start

func (evmService *EvmService) Start(executeContext *app.ExecuteContext) error

func (*EvmService) Stop

func (evmService *EvmService) Stop(executeContext *app.ExecuteContext) error

type Vm

type Vm interface {
	app.Service
	Eval(vm.VMState, *types.Transaction, *types.BlockHeader, ChainContext, uint64, *big.Int) (ret []byte, gasUsed uint64, failed bool, err error)
}

Directories

Path Synopsis
Package event deals with subscriptions to real-time events.
Package event deals with subscriptions to real-time events.

Jump to

Keyboard shortcuts

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