vm

package
v0.0.0-...-caec882 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: GPL-3.0 Imports: 22 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 GetHashFunc

func GetHashFunc(blockDB block.Interface) func(height uint64) common.Hash

GetHashFunc returns the hash corresponding to n

func NewVMContext

func NewVMContext(header *pb.BlockHeader, msg *Message, blockDB block.Interface) vm.Context

func SetupGenesis

func SetupGenesis(factory database.Factory, genesis *Genesis, execContract bool) error

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 Executor

type Executor interface {
	Call(ctx context.Context, header *pb.BlockHeader, signedTxs []*pb.SignedTransaction) ([]*pb.Receipt, []byte, error)
	StaticCall(ctx context.Context, height uint64, from, to, data []byte) ([]byte, bool, error)
}

func NewExecutor

func NewExecutor(factory database.Factory) Executor

type Genesis

type Genesis struct {
	Timestamp uint64 `json:"timestamp`
	Prevhash  string `json:"prevhash"`

	Alloc GenesisAlloc `json:"alloc"`
}

type GenesisAccount

type GenesisAccount struct {
	Code    string            `json:"code,omitempty"`
	Storage map[string]string `json:"storage,omitempty"`
	Nonce   string            `json:"nonce,omitempty"`
}

type GenesisAlloc

type GenesisAlloc map[string]GenesisAccount

type Message

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

func NewMessage

func NewMessage(
	from common.Address, to *common.Address,
	data []byte, quota uint64, value *big.Int,
	txHash []byte,
) *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) Nonce

func (m Message) Nonce() uint64

func (Message) Quota

func (m Message) Quota() uint64

func (Message) QuotaPrice

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

func (Message) To

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

func (Message) TxHash

func (m Message) TxHash() []byte

func (Message) Value

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

type Server

type Server interface {
	Run()
}

func NewServer

func NewServer(factory database.Factory) Server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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