vm

package
v1.999.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 3 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallType

type CallType int

CallType specifies the type of SC invocation (in terms of asynchronicity)

const (
	// DirectCall means that the call is an explicit SC invocation originating from a user Transaction
	DirectCall CallType = iota

	// AsynchronousCall means that the invocation was performed from within
	// another SmartContract from another Shard, using asyncCall
	AsynchronousCall

	// AsynchronousCallBack means that an AsynchronousCall was performed
	// previously, and now the control returns to the caller SmartContract's callBack method
	AsynchronousCallBack

	// ESDTTransferAndExecute means that there is a smart contract execution after the ESDT transfer
	// this is needed in order to skip the check whether a contract is payable or not
	ESDTTransferAndExecute

	// ExecOnDestByCaller means that the call is an invocation of a built in function / smart contract from
	// another smart contract but the caller is from the previous caller
	ExecOnDestByCaller
)

type LogEntryApi

type LogEntryApi struct {
	Identifier []byte   `json:"identifier"`
	Address    string   `json:"address"`
	Topics     [][]byte `json:"topics"`
	Data       []byte   `json:"data"`
}

LogEntryApi is a wrapper over vmcommon's LogEntry

type OutputAccountApi

type OutputAccountApi struct {
	Address         string                       `json:"address"`
	Nonce           uint64                       `json:"nonce"`
	Balance         *big.Int                     `json:"balance"`
	BalanceDelta    *big.Int                     `json:"balanceDelta"`
	StorageUpdates  map[string]*StorageUpdateApi `json:"storageUpdates"`
	Code            []byte                       `json:"code"`
	CodeMetadata    []byte                       `json:"codeMetaData"`
	OutputTransfers []OutputTransferApi          `json:"outputTransfers"`
	CallType        CallType                     `json:"callType"`
}

OutputAccountApi is a wrapper over vmcommon's OutputAccount

type OutputTransferApi

type OutputTransferApi struct {
	Value         *big.Int `json:"value"`
	GasLimit      uint64   `json:"gasLimit"`
	Data          []byte   `json:"data"`
	CallType      CallType `json:"callType"`
	SenderAddress string   `json:"senderAddress"`
}

OutputTransferApi is a wrapper over vmcommon's OutputTransfer

type ReturnDataKind

type ReturnDataKind int

ReturnDataKind specifies how to interpret VMOutputs's return data. More specifically, how to interpret returned data's first item.

const (
	// AsBigInt to interpret as big int
	AsBigInt ReturnDataKind = 1 << iota
	// AsBigIntString to interpret as big int string
	AsBigIntString
	// AsString to interpret as string
	AsString
	// AsHex to interpret as hex
	AsHex
)

type StorageUpdateApi

type StorageUpdateApi struct {
	Offset []byte `json:"offset"`
	Data   []byte `json:"data"`
}

StorageUpdateApi is a wrapper over vmcommon's StorageUpdate

type VMOutputApi

type VMOutputApi struct {
	ReturnData      [][]byte                     `json:"returnData"`
	ReturnCode      string                       `json:"returnCode"`
	ReturnMessage   string                       `json:"returnMessage"`
	GasRemaining    uint64                       `json:"gasRemaining"`
	GasRefund       *big.Int                     `json:"gasRefund"`
	OutputAccounts  map[string]*OutputAccountApi `json:"outputAccounts"`
	DeletedAccounts [][]byte                     `json:"deletedAccounts"`
	TouchedAccounts [][]byte                     `json:"touchedAccounts"`
	Logs            []*LogEntryApi               `json:"logs"`
}

VMOutputApi is a wrapper over the vmcommon's VMOutput

func (*VMOutputApi) GetFirstReturnData

func (vmOutput *VMOutputApi) GetFirstReturnData(asType ReturnDataKind) (interface{}, error)

GetFirstReturnData is a helper function that returns the first ReturnData of VMOutput, interpreted as specified.

Jump to

Keyboard shortcuts

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