neovm

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology 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 ontology 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 ontology. If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology 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 ontology 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 ontology. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	//Gas Limit
	MIN_TRANSACTION_GAS           uint64 = 20000 // Per transaction base cost.
	BLOCKCHAIN_GETHEADER_GAS      uint64 = 100
	BLOCKCHAIN_GETBLOCK_GAS       uint64 = 200
	BLOCKCHAIN_GETTRANSACTION_GAS uint64 = 100
	BLOCKCHAIN_GETCONTRACT_GAS    uint64 = 100
	CONTRACT_CREATE_GAS           uint64 = 20000000
	CONTRACT_MIGRATE_GAS          uint64 = 20000000
	UINT_DEPLOY_CODE_LEN_GAS      uint64 = 200000
	UINT_INVOKE_CODE_LEN_GAS      uint64 = 20000
	NATIVE_INVOKE_GAS             uint64 = 1000
	STORAGE_GET_GAS               uint64 = 200
	STORAGE_PUT_GAS               uint64 = 4000
	STORAGE_DELETE_GAS            uint64 = 100
	RUNTIME_CHECKWITNESS_GAS      uint64 = 200
	RUNTIME_VERIFYMUTISIG_GAS     uint64 = 400
	RUNTIME_ADDRESSTOBASE58_GAS   uint64 = 40
	RUNTIME_BASE58TOADDRESS_GAS   uint64 = 30
	APPCALL_GAS                   uint64 = 10
	TAILCALL_GAS                  uint64 = 10
	SHA1_GAS                      uint64 = 10
	SHA256_GAS                    uint64 = 10
	HASH160_GAS                   uint64 = 20
	HASH256_GAS                   uint64 = 20
	OPCODE_GAS                    uint64 = 1

	PER_UNIT_CODE_LEN    int = 1024
	METHOD_LENGTH_LIMIT  int = 1024
	DUPLICATE_STACK_SIZE int = 1024 * 2
	VM_STEP_LIMIT        int = 400000

	// API Name
	ATTRIBUTE_GETUSAGE_NAME = "Ontology.Attribute.GetUsage"
	ATTRIBUTE_GETDATA_NAME  = "Ontology.Attribute.GetData"

	BLOCK_GETTRANSACTIONCOUNT_NAME       = "System.Block.GetTransactionCount"
	BLOCK_GETTRANSACTIONS_NAME           = "System.Block.GetTransactions"
	BLOCK_GETTRANSACTION_NAME            = "System.Block.GetTransaction"
	BLOCKCHAIN_GETHEIGHT_NAME            = "System.Blockchain.GetHeight"
	BLOCKCHAIN_GETHEADER_NAME            = "System.Blockchain.GetHeader"
	BLOCKCHAIN_GETBLOCK_NAME             = "System.Blockchain.GetBlock"
	BLOCKCHAIN_GETTRANSACTION_NAME       = "System.Blockchain.GetTransaction"
	BLOCKCHAIN_GETCONTRACT_NAME          = "System.Blockchain.GetContract"
	BLOCKCHAIN_GETTRANSACTIONHEIGHT_NAME = "System.Blockchain.GetTransactionHeight"

	HEADER_GETINDEX_NAME         = "System.Header.GetIndex"
	HEADER_GETHASH_NAME          = "System.Header.GetHash"
	HEADER_GETVERSION_NAME       = "Ontology.Header.GetVersion"
	HEADER_GETPREVHASH_NAME      = "System.Header.GetPrevHash"
	HEADER_GETTIMESTAMP_NAME     = "System.Header.GetTimestamp"
	HEADER_GETCONSENSUSDATA_NAME = "Ontology.Header.GetConsensusData"
	HEADER_GETNEXTCONSENSUS_NAME = "Ontology.Header.GetNextConsensus"
	HEADER_GETMERKLEROOT_NAME    = "Ontology.Header.GetMerkleRoot"

	TRANSACTION_GETHASH_NAME       = "System.Transaction.GetHash"
	TRANSACTION_GETTYPE_NAME       = "Ontology.Transaction.GetType"
	TRANSACTION_GETATTRIBUTES_NAME = "Ontology.Transaction.GetAttributes"

	CONTRACT_CREATE_NAME            = "Ontology.Contract.Create"
	CONTRACT_MIGRATE_NAME           = "Ontology.Contract.Migrate"
	CONTRACT_GETSTORAGECONTEXT_NAME = "System.Contract.GetStorageContext"
	CONTRACT_DESTROY_NAME           = "System.Contract.Destroy"
	CONTRACT_GETSCRIPT_NAME         = "Ontology.Contract.GetScript"

	STORAGE_GET_NAME                = "System.Storage.Get"
	STORAGE_PUT_NAME                = "System.Storage.Put"
	STORAGE_DELETE_NAME             = "System.Storage.Delete"
	STORAGE_GETCONTEXT_NAME         = "System.Storage.GetContext"
	STORAGE_GETREADONLYCONTEXT_NAME = "System.Storage.GetReadOnlyContext"

	STORAGECONTEXT_ASREADONLY_NAME = "System.StorageContext.AsReadOnly"

	RUNTIME_GETTIME_NAME             = "System.Runtime.GetTime"
	RUNTIME_CHECKWITNESS_NAME        = "System.Runtime.CheckWitness"
	RUNTIME_NOTIFY_NAME              = "System.Runtime.Notify"
	RUNTIME_LOG_NAME                 = "System.Runtime.Log"
	RUNTIME_GETTRIGGER_NAME          = "System.Runtime.GetTrigger"
	RUNTIME_SERIALIZE_NAME           = "System.Runtime.Serialize"
	RUNTIME_DESERIALIZE_NAME         = "System.Runtime.Deserialize"
	RUNTIME_BASE58TOADDRESS_NAME     = "Ontology.Runtime.Base58ToAddress"
	RUNTIME_ADDRESSTOBASE58_NAME     = "Ontology.Runtime.AddressToBase58"
	RUNTIME_GETCURRENTBLOCKHASH_NAME = "Ontology.Runtime.GetCurrentBlockHash"
	RUNTIME_VERIFYMUTISIG_NAME       = "Ontology.Runtime.VerifyMutiSig"

	NATIVE_INVOKE_NAME = "Ontology.Native.Invoke"
	WASM_INVOKE_NAME   = "Ontology.Wasm.InvokeWasm"

	GETSCRIPTCONTAINER_NAME     = "System.ExecutionEngine.GetScriptContainer"
	GETEXECUTINGSCRIPTHASH_NAME = "System.ExecutionEngine.GetExecutingScriptHash"
	GETCALLINGSCRIPTHASH_NAME   = "System.ExecutionEngine.GetCallingScriptHash"
	GETENTRYSCRIPTHASH_NAME     = "System.ExecutionEngine.GetEntryScriptHash"

	APPCALL_NAME              = "APPCALL"
	TAILCALL_NAME             = "TAILCALL"
	SHA1_NAME                 = "SHA1"
	SHA256_NAME               = "SHA256"
	HASH160_NAME              = "HASH160"
	HASH256_NAME              = "HASH256"
	UINT_DEPLOY_CODE_LEN_NAME = "Deploy.Code.Gas"
	UINT_INVOKE_CODE_LEN_NAME = "Invoke.Code.Gas"

	GAS_TABLE = initGAS_TABLE()

	GAS_TABLE_KEYS = []string{
		BLOCKCHAIN_GETHEADER_NAME,
		BLOCKCHAIN_GETBLOCK_NAME,
		BLOCKCHAIN_GETTRANSACTION_NAME,
		BLOCKCHAIN_GETCONTRACT_NAME,
		CONTRACT_CREATE_NAME,
		CONTRACT_MIGRATE_NAME,
		STORAGE_GET_NAME,
		STORAGE_PUT_NAME,
		STORAGE_DELETE_NAME,
		RUNTIME_CHECKWITNESS_NAME,
		NATIVE_INVOKE_NAME,
		APPCALL_NAME,
		TAILCALL_NAME,
		SHA1_NAME,
		SHA256_NAME,
		HASH160_NAME,
		HASH256_NAME,
		UINT_DEPLOY_CODE_LEN_NAME,
		UINT_INVOKE_CODE_LEN_NAME,
		config.WASM_GAS_FACTOR,
	}

	INIT_GAS_TABLE = map[string]uint64{
		BLOCKCHAIN_GETHEADER_NAME:      BLOCKCHAIN_GETHEADER_GAS,
		BLOCKCHAIN_GETBLOCK_NAME:       BLOCKCHAIN_GETBLOCK_GAS,
		BLOCKCHAIN_GETTRANSACTION_NAME: BLOCKCHAIN_GETTRANSACTION_GAS,
		BLOCKCHAIN_GETCONTRACT_NAME:    BLOCKCHAIN_GETCONTRACT_GAS,
		CONTRACT_CREATE_NAME:           CONTRACT_CREATE_GAS,
		CONTRACT_MIGRATE_NAME:          CONTRACT_MIGRATE_GAS,
		STORAGE_GET_NAME:               STORAGE_GET_GAS,
		STORAGE_PUT_NAME:               STORAGE_PUT_GAS,
		STORAGE_DELETE_NAME:            STORAGE_DELETE_GAS,
		RUNTIME_CHECKWITNESS_NAME:      RUNTIME_CHECKWITNESS_GAS,
		NATIVE_INVOKE_NAME:             NATIVE_INVOKE_GAS,
		APPCALL_NAME:                   APPCALL_GAS,
		TAILCALL_NAME:                  TAILCALL_GAS,
		SHA1_NAME:                      SHA1_GAS,
		SHA256_NAME:                    SHA256_GAS,
		HASH160_NAME:                   HASH160_GAS,
		HASH256_NAME:                   HASH256_GAS,
		UINT_DEPLOY_CODE_LEN_NAME:      UINT_DEPLOY_CODE_LEN_GAS,
		UINT_INVOKE_CODE_LEN_NAME:      UINT_INVOKE_CODE_LEN_GAS,
	}
)
View Source
var (
	ERR_CHECK_STACK_SIZE  = errors.NewErr("[NeoVmService] vm execution exceeded the max stack size!")
	ERR_EXECUTE_CODE      = errors.NewErr("[NeoVmService] vm execution code was invalid!")
	ERR_GAS_INSUFFICIENT  = errors.NewErr("[NeoVmService] insufficient gas for transaction!")
	VM_EXEC_STEP_EXCEED   = errors.NewErr("[NeoVmService] vm execution exceeded the step limit!")
	CONTRACT_NOT_EXIST    = errors.NewErr("[NeoVmService] the given contract does not exist!")
	DEPLOYCODE_TYPE_ERROR = errors.NewErr("[NeoVmService] deploy code type error!")
	VM_EXEC_FAULT         = errors.NewErr("[NeoVmService] vm execution encountered a state fault!")
)
View Source
var (
	// Register all service for smart contract execute
	ServiceMap = map[string]Service{
		ATTRIBUTE_GETUSAGE_NAME:              {Execute: AttributeGetUsage},
		ATTRIBUTE_GETDATA_NAME:               {Execute: AttributeGetData},
		BLOCK_GETTRANSACTIONCOUNT_NAME:       {Execute: BlockGetTransactionCount},
		BLOCK_GETTRANSACTIONS_NAME:           {Execute: BlockGetTransactions},
		BLOCK_GETTRANSACTION_NAME:            {Execute: BlockGetTransaction},
		BLOCKCHAIN_GETHEIGHT_NAME:            {Execute: BlockChainGetHeight},
		BLOCKCHAIN_GETHEADER_NAME:            {Execute: BlockChainGetHeader},
		BLOCKCHAIN_GETBLOCK_NAME:             {Execute: BlockChainGetBlock},
		BLOCKCHAIN_GETTRANSACTION_NAME:       {Execute: BlockChainGetTransaction},
		BLOCKCHAIN_GETCONTRACT_NAME:          {Execute: BlockChainGetContract},
		BLOCKCHAIN_GETTRANSACTIONHEIGHT_NAME: {Execute: BlockChainGetTransactionHeight},
		HEADER_GETINDEX_NAME:                 {Execute: HeaderGetIndex},
		HEADER_GETHASH_NAME:                  {Execute: HeaderGetHash},
		HEADER_GETVERSION_NAME:               {Execute: HeaderGetVersion},
		HEADER_GETPREVHASH_NAME:              {Execute: HeaderGetPrevHash},
		HEADER_GETTIMESTAMP_NAME:             {Execute: HeaderGetTimestamp},
		HEADER_GETCONSENSUSDATA_NAME:         {Execute: HeaderGetConsensusData},
		HEADER_GETNEXTCONSENSUS_NAME:         {Execute: HeaderGetNextConsensus},
		HEADER_GETMERKLEROOT_NAME:            {Execute: HeaderGetMerkleRoot},
		TRANSACTION_GETHASH_NAME:             {Execute: TransactionGetHash},
		TRANSACTION_GETTYPE_NAME:             {Execute: TransactionGetType},
		TRANSACTION_GETATTRIBUTES_NAME:       {Execute: TransactionGetAttributes},
		CONTRACT_CREATE_NAME:                 {Execute: ContractCreate},
		CONTRACT_MIGRATE_NAME:                {Execute: ContractMigrate},
		CONTRACT_GETSTORAGECONTEXT_NAME:      {Execute: ContractGetStorageContext},
		CONTRACT_DESTROY_NAME:                {Execute: ContractDestory},
		CONTRACT_GETSCRIPT_NAME:              {Execute: ContractGetCode},
		RUNTIME_GETTIME_NAME:                 {Execute: RuntimeGetTime},
		RUNTIME_CHECKWITNESS_NAME:            {Execute: RuntimeCheckWitness},
		RUNTIME_NOTIFY_NAME:                  {Execute: RuntimeNotify},
		RUNTIME_LOG_NAME:                     {Execute: RuntimeLog},
		RUNTIME_GETTRIGGER_NAME:              {Execute: RuntimeGetTrigger},
		RUNTIME_SERIALIZE_NAME:               {Execute: RuntimeSerialize},
		RUNTIME_DESERIALIZE_NAME:             {Execute: RuntimeDeserialize},
		RUNTIME_VERIFYMUTISIG_NAME:           {Execute: RuntimeVerifyMutiSig},
		NATIVE_INVOKE_NAME:                   {Execute: NativeInvoke},
		WASM_INVOKE_NAME:                     {Execute: WASMInvoke},
		STORAGE_GET_NAME:                     {Execute: StorageGet},
		STORAGE_PUT_NAME:                     {Execute: StoragePut},
		STORAGE_DELETE_NAME:                  {Execute: StorageDelete},
		STORAGE_GETCONTEXT_NAME:              {Execute: StorageGetContext},
		STORAGE_GETREADONLYCONTEXT_NAME:      {Execute: StorageGetReadOnlyContext},
		STORAGECONTEXT_ASREADONLY_NAME:       {Execute: StorageContextAsReadOnly},
		GETSCRIPTCONTAINER_NAME:              {Execute: GetCodeContainer},
		GETEXECUTINGSCRIPTHASH_NAME:          {Execute: GetExecutingAddress},
		GETCALLINGSCRIPTHASH_NAME:            {Execute: GetCallingAddress},
		GETENTRYSCRIPTHASH_NAME:              {Execute: GetEntryAddress},

		RUNTIME_BASE58TOADDRESS_NAME:     {Execute: RuntimeBase58ToAddress},
		RUNTIME_ADDRESSTOBASE58_NAME:     {Execute: RuntimeAddressToBase58},
		RUNTIME_GETCURRENTBLOCKHASH_NAME: {Execute: RuntimeGetCurrentBlockHash},
	}
)

Functions

func AttributeGetData

func AttributeGetData(service *NeoVmService, engine *vm.Executor) error

AttributeGetData put attribute's data to vm stack

func AttributeGetUsage

func AttributeGetUsage(service *NeoVmService, engine *vm.Executor) error

AttributeGetUsage put attribute's usage to vm stack

func BlockChainGetBlock

func BlockChainGetBlock(service *NeoVmService, engine *vm.Executor) error

BlockChainGetBlock put blockchain's block to vm stack

func BlockChainGetContract

func BlockChainGetContract(service *NeoVmService, engine *vm.Executor) error

BlockChainGetContract put blockchain's contract to vm stack

func BlockChainGetHeader

func BlockChainGetHeader(service *NeoVmService, engine *vm.Executor) error

BlockChainGetHeader put blockchain's header to vm stack

func BlockChainGetHeight

func BlockChainGetHeight(service *NeoVmService, engine *vm.Executor) error

BlockChainGetHeight put blockchain's height to vm stack

func BlockChainGetTransaction

func BlockChainGetTransaction(service *NeoVmService, engine *vm.Executor) error

BlockChainGetTransaction put blockchain's transaction to vm stack

func BlockChainGetTransactionHeight

func BlockChainGetTransactionHeight(service *NeoVmService, engine *vm.Executor) error

BlockChainGetTransactionHeight put transaction in block height to vm stack

func BlockGetTransaction

func BlockGetTransaction(service *NeoVmService, engine *vm.Executor) error

BlockGetTransaction put block's transaction to vm stack

func BlockGetTransactionCount

func BlockGetTransactionCount(service *NeoVmService, engine *vm.Executor) error

BlockGetTransactionCount put block's transactions count to vm stack

func BlockGetTransactions

func BlockGetTransactions(service *NeoVmService, engine *vm.Executor) error

BlockGetTransactions put block's transactions to vm stack

func ContractCreate

func ContractCreate(service *NeoVmService, engine *vm.Executor) error

ContractCreate create a new smart contract on blockchain, and put it to vm stack

func ContractDestory

func ContractDestory(service *NeoVmService, engine *vm.Executor) error

ContractDestory destroy a contract

func ContractGetCode

func ContractGetCode(service *NeoVmService, engine *vm.Executor) error

ContractGetCode put contract to vm stack

func ContractGetStorageContext

func ContractGetStorageContext(service *NeoVmService, engine *vm.Executor) error

ContractGetStorageContext put contract storage context to vm stack

func ContractMigrate

func ContractMigrate(service *NeoVmService, engine *vm.Executor) error

ContractMigrate migrate old smart contract to a new contract, and destroy old contract

func GasPrice

func GasPrice(gasTable map[string]uint64, engine *vm.Executor, name string) (uint64, error)

func GetCallingAddress

func GetCallingAddress(service *NeoVmService, engine *vm.Executor) error

GetExecutingAddress push previous context to vm stack

func GetCodeContainer

func GetCodeContainer(service *NeoVmService, engine *vm.Executor) error

GetCodeContainer push current transaction to vm stack

func GetEntryAddress

func GetEntryAddress(service *NeoVmService, engine *vm.Executor) error

GetExecutingAddress push entry call context to vm stack

func GetExecutingAddress

func GetExecutingAddress(service *NeoVmService, engine *vm.Executor) error

GetExecutingAddress push current context to vm stack

func HeaderGetConsensusData

func HeaderGetConsensusData(service *NeoVmService, engine *vm.Executor) error

HeaderGetConsensusData put header's consensus data to vm stack

func HeaderGetHash

func HeaderGetHash(service *NeoVmService, engine *vm.Executor) error

HeaderGetHash put header's hash to vm stack

func HeaderGetIndex

func HeaderGetIndex(service *NeoVmService, engine *vm.Executor) error

HeaderGetIndex put header's height to vm stack

func HeaderGetMerkleRoot

func HeaderGetMerkleRoot(service *NeoVmService, engine *vm.Executor) error

HeaderGetMerkleRoot put header's merkleroot to vm stack

func HeaderGetNextConsensus

func HeaderGetNextConsensus(service *NeoVmService, engine *vm.Executor) error

HeaderGetNextConsensus put header's consensus to vm stack

func HeaderGetPrevHash

func HeaderGetPrevHash(service *NeoVmService, engine *vm.Executor) error

HeaderGetPrevHash put header's prevblockhash to vm stack

func HeaderGetTimestamp

func HeaderGetTimestamp(service *NeoVmService, engine *vm.Executor) error

HeaderGetTimestamp put header's timestamp to vm stack

func HeaderGetVersion

func HeaderGetVersion(service *NeoVmService, engine *vm.Executor) error

HeaderGetVersion put header's version to vm stack

func NativeInvoke

func NativeInvoke(service *NeoVmService, engine *vm.Executor) error

func RuntimeAddressToBase58 added in v1.5.1

func RuntimeAddressToBase58(service *NeoVmService, engine *vm.Executor) error

func RuntimeBase58ToAddress added in v1.5.1

func RuntimeBase58ToAddress(service *NeoVmService, engine *vm.Executor) error

func RuntimeCheckWitness

func RuntimeCheckWitness(service *NeoVmService, engine *vm.Executor) error

RuntimeCheckWitness provide check permissions service If param address isn't exist in authorization list, check fail

func RuntimeDeserialize

func RuntimeDeserialize(service *NeoVmService, engine *vm.Executor) error

TODO check consistency with original implementation

func RuntimeGetCurrentBlockHash added in v1.5.2

func RuntimeGetCurrentBlockHash(service *NeoVmService, engine *vm.Executor) error

func RuntimeGetTime

func RuntimeGetTime(service *NeoVmService, engine *vm.Executor) error

HeaderGetNextConsensus put current block time to vm stack

func RuntimeGetTrigger

func RuntimeGetTrigger(service *NeoVmService, engine *vm.Executor) error

func RuntimeLog

func RuntimeLog(service *NeoVmService, engine *vm.Executor) error

RuntimeLog push smart contract execute event log to client

func RuntimeNotify

func RuntimeNotify(service *NeoVmService, engine *vm.Executor) error

RuntimeNotify put smart contract execute event notify to notifications

func RuntimeSerialize

func RuntimeSerialize(service *NeoVmService, engine *vm.Executor) error

func RuntimeVerifyMutiSig added in v1.7.0

func RuntimeVerifyMutiSig(service *NeoVmService, engine *vm.Executor) error

func StorageContextAsReadOnly added in v0.9.2

func StorageContextAsReadOnly(service *NeoVmService, engine *vm.Executor) error

func StorageDelete

func StorageDelete(service *NeoVmService, engine *vm.Executor) error

StorageDelete delete smart contract storage item from cache

func StorageGet

func StorageGet(service *NeoVmService, engine *vm.Executor) error

StorageGet push smart contract storage item from cache to vm stack

func StorageGetContext

func StorageGetContext(service *NeoVmService, engine *vm.Executor) error

StorageGetContext push smart contract storage context to vm stack

func StorageGetReadOnlyContext added in v0.9.2

func StorageGetReadOnlyContext(service *NeoVmService, engine *vm.Executor) error

func StoragePut

func StoragePut(service *NeoVmService, engine *vm.Executor) error

StoragePut put smart contract storage item to cache

func StoreGasCost

func StoreGasCost(gasTable map[string]uint64, engine *vm.Executor) (uint64, error)

func TransactionGetAttributes

func TransactionGetAttributes(service *NeoVmService, engine *vm.Executor) error

TransactionGetAttributes push transaction's attributes to vm stack

func TransactionGetHash

func TransactionGetHash(service *NeoVmService, engine *vm.Executor) error

GetExecutingAddress push transaction's hash to vm stack

func TransactionGetType

func TransactionGetType(service *NeoVmService, engine *vm.Executor) error

TransactionGetType push transaction's type to vm stack

func WASMInvoke added in v1.8.0

func WASMInvoke(service *NeoVmService, engine *vm.Executor) error

neovm contract call wasmvm contract

Types

type Execute

type Execute func(service *NeoVmService, engine *vm.Executor) error

type NeoVmService

type NeoVmService struct {
	Store         store.LedgerStore
	CacheDB       *storage.CacheDB
	ContextRef    context.ContextRef
	Notifications []*event.NotifyEventInfo
	Code          []byte
	GasTable      map[string]uint64
	Tx            *types.Transaction
	Time          uint32
	Height        uint32
	BlockHash     scommon.Uint256
	Engine        *vm.Executor
	PreExec       bool
}

NeoVmService is a struct for smart contract provide interop service

func (*NeoVmService) Invoke

func (this *NeoVmService) Invoke() (interface{}, error)

Invoke a smart contract

func (*NeoVmService) SystemCall

func (this *NeoVmService) SystemCall(engine *vm.Executor) error

SystemCall provide register service for smart contract to interaction with blockchain

type Service

type Service struct {
	Execute Execute
}

type StorageContext

type StorageContext struct {
	Address    common.Address
	IsReadOnly bool
}

StorageContext store smart contract address

func NewStorageContext

func NewStorageContext(address common.Address) *StorageContext

NewStorageContext return a new smart contract storage context

func (*StorageContext) ToArray

func (this *StorageContext) ToArray() []byte

ToArray return address byte array

Jump to

Keyboard shortcuts

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