runtime

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2023 The AmazeChain Authors This file is part of the AmazeChain library.

The AmazeChain library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The AmazeChain library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the AmazeChain library. If not, see <http://www.gnu.org/licenses/>. Package runtime provides a basic execution model for executing EVM code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(address types.Address, input []byte, cfg *Config) ([]byte, uint64, error)

Call executes the code given by the contract's address. It will return the EVM's return value or an error if it failed.

Call, unlike Execute, requires a config and also requires the State field to be set.

func Create

func Create(input []byte, cfg *Config, blockNr uint64) ([]byte, types.Address, uint64, error)

Create executes the code using the EVM create method

func Execute

func Execute(code, input []byte, cfg *Config, bn uint64) ([]byte, *state.IntraBlockState, error)

Execute executes the code using the input as call data during the execution. It returns the EVM's return value, the new state and an error if it failed.

Execute sets up an in-memory, temporary, environment for the execution of the given code. It makes sure that it's restored to its original state afterwards.

func NewEnv

func NewEnv(cfg *Config) *vm.EVM

Types

type Config

type Config struct {
	ChainConfig *params.ChainConfig
	Difficulty  *big.Int
	Origin      types.Address
	Coinbase    types.Address
	BlockNumber *big.Int
	Time        *big.Int
	GasLimit    uint64
	GasPrice    *uint256.Int
	Value       *uint256.Int
	Debug       bool
	EVMConfig   vm2.Config
	BaseFee     *uint256.Int

	State *state.IntraBlockState

	GetHashFn func(n uint64) types.Hash
	// contains filtered or unexported fields
}

Config is a basic type specifying certain configuration flags for running the EVM.

Jump to

Keyboard shortcuts

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