Version: v1.65.3 Latest Latest

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

Go to latest
Published: Oct 19, 2021 License: BSD-3-Clause Imports: 22 Imported by: 3




This section is empty.


View Source
var (

	// EvmAddress 本合约地址
	EvmAddress = ""


func CanTransfer

func CanTransfer(db state.EVMStateDB, sender common.Address, amount uint64) bool

CanTransfer 检查合约调用账户是否有充足的金额进行转账交易操作

func GetHashFn

func GetHashFn(api client.QueueProtocolAPI) func(blockHeight uint64) common.Hash

GetHashFn 获取制定高度区块的哈希

func GetName

func GetName() string

GetName 返回本合约名称

func Init

func Init(name string, cfg *types.Chain33Config, sub []byte)

Init 初始化本合约对象

func InitExecType

func InitExecType()

InitExecType Init Exec Type

func Transfer

func Transfer(db state.EVMStateDB, sender, recipient common.Address, amount uint64) bool

Transfer 在内存数据库中执行转账操作(只修改内存中的金额) 从外部账户地址到合约账户地址


type EVMExecutor

type EVMExecutor struct {
	// contains filtered or unexported fields

EVMExecutor EVM执行器结构

func NewEVMExecutor

func NewEVMExecutor() *EVMExecutor

NewEVMExecutor 新创建执行器对象

func (*EVMExecutor) Allow

func (evm *EVMExecutor) Allow(tx *types.Transaction, index int) error

Allow 允许哪些交易在本命执行器执行

func (*EVMExecutor) CheckInit

func (evm *EVMExecutor) CheckInit()

CheckInit 检查是否初始化数据库

func (*EVMExecutor) CheckReceiptExecOk

func (evm *EVMExecutor) CheckReceiptExecOk() bool

CheckReceiptExecOk return true to check if receipt ty is ok

func (*EVMExecutor) CheckTx

func (evm *EVMExecutor) CheckTx(tx *types.Transaction, index int) error

CheckTx 校验交易

func (*EVMExecutor) Exec

func (evm *EVMExecutor) Exec(tx *types.Transaction, index int) (*types.Receipt, error)

Exec 本合约执行逻辑

func (*EVMExecutor) ExecDelLocal

func (evm *EVMExecutor) ExecDelLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal 处理区块回滚

func (*EVMExecutor) ExecLocal

func (evm *EVMExecutor) ExecLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal 处理本地区块新增逻辑

func (*EVMExecutor) ExecutorOrder

func (evm *EVMExecutor) ExecutorOrder() int64

ExecutorOrder 设置localdb的EnableRead

func (*EVMExecutor) GetActionName

func (evm *EVMExecutor) GetActionName(tx *types.Transaction) string

GetActionName 获取运行状态名

func (*EVMExecutor) GetDriverName

func (evm *EVMExecutor) GetDriverName() string

GetDriverName 获取本合约驱动名称

func (*EVMExecutor) GetFuncMap

func (evm *EVMExecutor) GetFuncMap() map[string]reflect.Method

GetFuncMap 获取方法列表

func (*EVMExecutor) GetMStateDB

func (evm *EVMExecutor) GetMStateDB() *state.MemoryStateDB

GetMStateDB 获取内部状态数据库

func (*EVMExecutor) GetMessage

func (evm *EVMExecutor) GetMessage(tx *types.Transaction, index int, fromPtr *common.Address) (msg *common.Message, err error)

GetMessage 目前的交易中,如果是coins交易,金额是放在payload的,但是合约不行,需要修改Transaction结构

func (*EVMExecutor) GetTxFee added in v1.65.2

func (evm *EVMExecutor) GetTxFee(tx *types.Transaction, index int) int64

GetTxFee 获取交易手续费,支持交易组

func (*EVMExecutor) GetVMConfig

func (evm *EVMExecutor) GetVMConfig() *runtime.Config

GetVMConfig 获取VM配置

func (*EVMExecutor) IsFriend

func (evm *EVMExecutor) IsFriend(myexec, writekey []byte, othertx *types.Transaction) bool

IsFriend 是否允许对应的KEY

func (*EVMExecutor) NewEVMContext

func (evm *EVMExecutor) NewEVMContext(msg *common.Message, txHash []byte) runtime.Context

NewEVMContext 构造一个新的EVM上下文对象

func (*EVMExecutor) Query_CheckAddrExists

func (evm *EVMExecutor) Query_CheckAddrExists(in *evmtypes.CheckEVMAddrReq) (types.Message, error)

Query_CheckAddrExists 检查合约地址是否存在,此操作不会改变任何状态,所以可以直接从statedb查询

func (*EVMExecutor) Query_EstimateGas

func (evm *EVMExecutor) Query_EstimateGas(req *evmtypes.EstimateEVMGasReq) (types.Message, error)

Query_EstimateGas 此方法用来估算合约消耗的Gas,不能修改原有执行器的状态数据

func (*EVMExecutor) Query_EvmDebug

func (evm *EVMExecutor) Query_EvmDebug(in *evmtypes.EvmDebugReq) (types.Message, error)

Query_EvmDebug 此方法用来控制evm调试打印开关

func (*EVMExecutor) Query_GetNonce added in v1.65.3

func (evm *EVMExecutor) Query_GetNonce(in *evmtypes.EvmGetNonceReq) (types.Message, error)

func (*EVMExecutor) Query_GetPackData added in v1.65.3

func (evm *EVMExecutor) Query_GetPackData(in *evmtypes.EvmGetPackDataReq) (types.Message, error)

func (*EVMExecutor) Query_GetUnpackData added in v1.65.3

func (evm *EVMExecutor) Query_GetUnpackData(in *evmtypes.EvmGetUnpackDataReq) (types.Message, error)

func (*EVMExecutor) Query_Query

func (evm *EVMExecutor) Query_Query(in *evmtypes.EvmQueryReq) (types.Message, error)

Query_Query 此方法用来调用合约的只读接口,不修改原有执行器的状态数据


Path Synopsis
Package math provides integer math utilities.
Package math provides integer math utilities.

Jump to

Keyboard shortcuts

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