vm

package
v1.9.6 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Built-in functions that are common to all the types.

View Source
var IndexedCommonBuiltinTypeBoundFunctions = map[string]*NativeFunctionValue{}

Functions

func AttachmentBaseAndSelfValues added in v1.8.0

func AttachmentBaseAndSelfValues(
	c *Context,
	v *interpreter.CompositeValue,
	method FunctionValue,
) (base *interpreter.EphemeralReferenceValue, self *interpreter.EphemeralReferenceValue)

func DefaultBuiltinGlobals

func DefaultBuiltinGlobals() *activations.Activation[Variable]

func NewArgumentTypesIterator added in v1.9.5

func NewArgumentTypesIterator(context *Context, arguments []bbq.StaticType) interpreter.ArgumentTypesIterator

func NewTypeArgumentsIterator added in v1.8.0

func NewTypeArgumentsIterator(context *Context, arguments []bbq.StaticType) interpreter.TypeArgumentsIterator

func UnwrapOptionalType

func UnwrapOptionalType(ty bbq.StaticType) bbq.StaticType

UnwrapOptionalType returns the type if it is not an optional type, or the inner-most type if it is (optional types are repeatedly unwrapped)

Types

type BoundFunctionValue

type BoundFunctionValue struct {
	ReceiverReference interpreter.ReferenceValue

	Method FunctionValue

	Base *interpreter.EphemeralReferenceValue
	// contains filtered or unexported fields
}

BoundFunctionValue is a function-wrapper which captures the receivers of an object-method.

func (*BoundFunctionValue) Accept

func (*BoundFunctionValue) Clone

func (*BoundFunctionValue) DeepRemove

func (*BoundFunctionValue) DereferencedReceiver

func (v *BoundFunctionValue) DereferencedReceiver(context interpreter.ValueStaticTypeContext) Value

func (*BoundFunctionValue) FunctionType

func (*BoundFunctionValue) HasGenericType

func (v *BoundFunctionValue) HasGenericType() bool

func (*BoundFunctionValue) Invoke

func (*BoundFunctionValue) IsFunctionValue

func (v *BoundFunctionValue) IsFunctionValue()

func (*BoundFunctionValue) IsImportable

func (*BoundFunctionValue) IsNative

func (v *BoundFunctionValue) IsNative() bool

func (*BoundFunctionValue) IsResourceKinded

func (*BoundFunctionValue) IsValue

func (*BoundFunctionValue) IsValue()

func (*BoundFunctionValue) MeteredString

func (*BoundFunctionValue) NeedsStoreTo

func (v *BoundFunctionValue) NeedsStoreTo(_ atree.Address) bool

func (*BoundFunctionValue) Receiver

func (*BoundFunctionValue) RecursiveString

func (v *BoundFunctionValue) RecursiveString(_ interpreter.SeenReferences) string

func (*BoundFunctionValue) ResolvedFunctionType

func (v *BoundFunctionValue) ResolvedFunctionType(_ Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType

func (*BoundFunctionValue) StaticType

func (*BoundFunctionValue) Storable

func (*BoundFunctionValue) String

func (v *BoundFunctionValue) String() string

func (*BoundFunctionValue) Transfer

func (*BoundFunctionValue) Walk

type BuiltinGlobalsProvider

type BuiltinGlobalsProvider func(location common.Location) *activations.Activation[Variable]

type CompiledFunctionValue

type CompiledFunctionValue struct {
	Function   *bbq.Function[opcode.Instruction]
	Executable *ExecutableProgram
	Type       interpreter.FunctionStaticType
	Upvalues   []*Upvalue
}

func (*CompiledFunctionValue) Accept

func (*CompiledFunctionValue) Clone

func (*CompiledFunctionValue) DeepRemove

func (*CompiledFunctionValue) FunctionType

func (*CompiledFunctionValue) HasGenericType

func (*CompiledFunctionValue) HasGenericType() bool

func (*CompiledFunctionValue) Invoke

func (*CompiledFunctionValue) IsFunctionValue

func (*CompiledFunctionValue) IsFunctionValue()

func (*CompiledFunctionValue) IsImportable

func (*CompiledFunctionValue) IsNative

func (v *CompiledFunctionValue) IsNative() bool

func (*CompiledFunctionValue) IsResourceKinded

func (*CompiledFunctionValue) IsValue

func (*CompiledFunctionValue) IsValue()

func (*CompiledFunctionValue) MeteredString

func (*CompiledFunctionValue) NeedsStoreTo

func (*CompiledFunctionValue) NeedsStoreTo(_ atree.Address) bool

func (*CompiledFunctionValue) RecursiveString

func (*CompiledFunctionValue) ResolvedFunctionType

func (v *CompiledFunctionValue) ResolvedFunctionType(_ Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType

func (*CompiledFunctionValue) StaticType

func (*CompiledFunctionValue) Storable

func (*CompiledFunctionValue) String

func (v *CompiledFunctionValue) String() string

func (*CompiledFunctionValue) Transfer

func (v *CompiledFunctionValue) Transfer(
	context interpreter.ValueTransferContext,
	_ atree.Address,
	remove bool,
	storable atree.Storable,
	_ map[atree.ValueID]struct{},
	_ bool,
) interpreter.Value

func (*CompiledFunctionValue) Walk

type Config

type Config struct {
	interpreter.Tracer

	ImportHandler        commons.ImportHandler
	ElaborationResolver  ElaborationResolver
	ContractValueHandler ContractValueHandler
	// BuiltinGlobalsProvider provides the built-in globals for a given location.
	// NOTE: all global must be defined for location nil!
	BuiltinGlobalsProvider BuiltinGlobalsProvider
	// CompositeTypeHandler is used to load composite types
	CompositeTypeHandler interpreter.CompositeTypeHandlerFunc
	// InterfaceTypeHandler is used to load interface types
	InterfaceTypeHandler interpreter.InterfaceTypeHandlerFunc
	// EntitlementTypeHandler is used to load entitlement types
	EntitlementTypeHandler EntitlementTypeHandlerFunc
	// EntitlementMapTypeHandler is used to load entitlement map types
	EntitlementMapTypeHandler EntitlementMapTypeHandlerFunc

	MemoryGauge      common.MemoryGauge
	ComputationGauge common.ComputationGauge
	// CapabilityCheckHandler is used to check ID capabilities
	CapabilityCheckHandler interpreter.CapabilityCheckHandlerFunc
	// CapabilityBorrowHandler is used to borrow ID capabilities
	CapabilityBorrowHandler interpreter.CapabilityBorrowHandlerFunc
	// ValidateAccountCapabilitiesGetHandler is used to handle when a capability of an account is got.
	ValidateAccountCapabilitiesGetHandler interpreter.ValidateAccountCapabilitiesGetHandlerFunc
	// ValidateAccountCapabilitiesPublishHandler is used to handle when a capability of an account is got.
	ValidateAccountCapabilitiesPublishHandler interpreter.ValidateAccountCapabilitiesPublishHandlerFunc
	// OnEventEmitted is triggered when an event is emitted by the program
	OnEventEmitted interpreter.OnEventEmittedFunc
	// AccountHandlerFunc is used to handle accounts
	AccountHandlerFunc interpreter.AccountHandlerFunc
	// InjectedCompositeFieldsHandler is used to initialize new composite values' fields
	InjectedCompositeFieldsHandler interpreter.InjectedCompositeFieldsHandlerFunc
	// UUIDHandler is used to handle the generation of UUIDs
	UUIDHandler interpreter.UUIDHandlerFunc
	// AtreeStorageValidationEnabled determines if the validation of atree storage is enabled
	AtreeStorageValidationEnabled bool
	// AtreeValueValidationEnabled determines if the validation of atree values is enabled
	AtreeValueValidationEnabled bool
	// StackDepthLimit is the maximum depth of the call stack
	StackDepthLimit uint64
	// contains filtered or unexported fields
}

Config contains the VM configurations that is safe to be re-used across VMs/executions. It does not hold data specific to a single execution. i.e: No state is maintained.

func NewConfig

func NewConfig(storage interpreter.Storage) *Config

func (*Config) EmitEvent

func (c *Config) EmitEvent(
	context interpreter.ValueExportContext,
	eventType *sema.CompositeType,
	eventFields []interpreter.Value,
)

func (*Config) GetAccountHandlerFunc

func (c *Config) GetAccountHandlerFunc() interpreter.AccountHandlerFunc

func (*Config) GetCapabilityBorrowHandler

func (c *Config) GetCapabilityBorrowHandler() interpreter.CapabilityBorrowHandlerFunc

func (*Config) GetCapabilityCheckHandler

func (c *Config) GetCapabilityCheckHandler() interpreter.CapabilityCheckHandlerFunc

func (*Config) GetCompositeType

func (c *Config) GetCompositeType(
	location common.Location,
	qualifiedIdentifier string,
	typeID interpreter.TypeID,
) (*sema.CompositeType, error)

func (*Config) GetEntitlementMapType

func (c *Config) GetEntitlementMapType(
	typeID interpreter.TypeID,
	ensureProgramInitialized func(location common.Location),
) (*sema.EntitlementMapType, error)

func (*Config) GetEntitlementType

func (c *Config) GetEntitlementType(
	typeID interpreter.TypeID,
	ensureProgramInitialized func(location common.Location),
) (*sema.EntitlementType, error)

func (*Config) GetInjectedCompositeFieldsHandler

func (c *Config) GetInjectedCompositeFieldsHandler() interpreter.InjectedCompositeFieldsHandlerFunc

func (*Config) GetInterfaceType

func (c *Config) GetInterfaceType(
	location common.Location,
	qualifiedIdentifier string,
	typeID interpreter.TypeID,
) (*sema.InterfaceType, error)

func (*Config) GetValidateAccountCapabilitiesGetHandler

func (c *Config) GetValidateAccountCapabilitiesGetHandler() interpreter.ValidateAccountCapabilitiesGetHandlerFunc

func (*Config) GetValidateAccountCapabilitiesPublishHandler

func (c *Config) GetValidateAccountCapabilitiesPublishHandler() interpreter.ValidateAccountCapabilitiesPublishHandlerFunc

func (*Config) MeterComputation

func (c *Config) MeterComputation(usage common.ComputationUsage) error

func (*Config) MeterMemory

func (c *Config) MeterMemory(usage common.MemoryUsage) error

func (*Config) OnResourceOwnerChange

func (c *Config) OnResourceOwnerChange(
	resource *interpreter.CompositeValue,
	oldOwner common.Address,
	newOwner common.Address,
)

func (*Config) SetStorage

func (c *Config) SetStorage(storage interpreter.Storage)

func (*Config) Storage

func (c *Config) Storage() interpreter.Storage

func (*Config) WithDebugEnabled

func (c *Config) WithDebugEnabled() *Config

type Context

type Context struct {
	*Config

	CapabilityControllerIterations map[interpreter.AddressPath]int
	// contains filtered or unexported fields
}

Context holds the information about the current execution at any given point of time. It consists of:

  • Re-usable configurations (Config).
  • State maintained for the current execution.

Should not be re-used across executions.

func NewContext

func NewContext(config *Config) *Context

func (*Context) ClearReferencedResourceKindedValues

func (c *Context) ClearReferencedResourceKindedValues(valueID atree.ValueID)

func (*Context) DefaultDestroyEvents

func (c *Context) DefaultDestroyEvents(resourceValue *interpreter.CompositeValue) []*interpreter.CompositeValue

func (*Context) EnforceNotResourceDestruction

func (c *Context) EnforceNotResourceDestruction(valueID atree.ValueID)

func (*Context) GetCapabilityControllerIterations

func (c *Context) GetCapabilityControllerIterations() map[interpreter.AddressPath]int

func (*Context) GetCompositeType added in v1.8.0

func (c *Context) GetCompositeType(
	location common.Location,
	qualifiedIdentifier string,
	typeID common.TypeID,
) (*sema.CompositeType, error)

func (*Context) GetCompositeValueFunctions

func (c *Context) GetCompositeValueFunctions(v *interpreter.CompositeValue) *interpreter.FunctionOrderedMap

func (*Context) GetContractValue

func (c *Context) GetContractValue(contractLocation common.AddressLocation) *interpreter.CompositeValue

func (*Context) GetEntitlementMapType added in v1.8.0

func (c *Context) GetEntitlementMapType(
	typeID common.TypeID,
) (*sema.EntitlementMapType, error)

func (*Context) GetEntitlementType added in v1.8.0

func (c *Context) GetEntitlementType(
	typeID common.TypeID,
) (*sema.EntitlementType, error)

func (*Context) GetFunction

func (c *Context) GetFunction(
	location common.Location,
	name string,
) FunctionValue

func (*Context) GetInterfaceType added in v1.8.0

func (c *Context) GetInterfaceType(
	location common.Location,
	qualifiedIdentifier string,
	typeID common.TypeID,
) (*sema.InterfaceType, error)

func (*Context) GetLocation

func (c *Context) GetLocation() common.Location

func (*Context) GetMemberAccessContextForLocation

func (c *Context) GetMemberAccessContextForLocation(location common.Location) interpreter.MemberAccessibleContext

func (*Context) GetMethod

func (*Context) GetResourceDestructionContextForLocation

func (c *Context) GetResourceDestructionContextForLocation(location common.Location) interpreter.ResourceDestructionContext

func (*Context) GetValueOfVariable

func (c *Context) GetValueOfVariable(name string) interpreter.Value

func (*Context) InStorageIteration

func (c *Context) InStorageIteration() bool

func (*Context) InvokeFunction

func (c *Context) InvokeFunction(
	fn interpreter.FunctionValue,
	arguments []interpreter.Value,
) interpreter.Value

InvokeFunction function invokes a given function value with the given arguments.

func (*Context) IsSubType

func (c *Context) IsSubType(subType interpreter.StaticType, superType interpreter.StaticType) bool

func (*Context) IsTypeInfoRecovered

func (c *Context) IsTypeInfoRecovered(location common.Location) bool

func (*Context) LocationRange added in v1.8.0

func (c *Context) LocationRange() interpreter.LocationRange

func (*Context) MaybeTrackReferencedResourceKindedValue

func (c *Context) MaybeTrackReferencedResourceKindedValue(referenceValue *interpreter.EphemeralReferenceValue)

func (*Context) MaybeUpdateStorageReferenceMemberReceiver

func (c *Context) MaybeUpdateStorageReferenceMemberReceiver(
	storageReference *interpreter.StorageReferenceValue,
	referencedValue Value,
	member Value,
) Value

func (*Context) MaybeValidateAtreeStorage

func (c *Context) MaybeValidateAtreeStorage()

func (*Context) MaybeValidateAtreeValue

func (c *Context) MaybeValidateAtreeValue(v atree.Value)

func (*Context) MutationDuringCapabilityControllerIteration

func (c *Context) MutationDuringCapabilityControllerIteration() bool

func (*Context) ReadStored

func (c *Context) ReadStored(
	storageAddress common.Address,
	domain common.StorageDomain,
	identifier interpreter.StorageMapKey,
) interpreter.Value

func (*Context) RecordStorageMutation

func (c *Context) RecordStorageMutation()

func (*Context) RecoverErrors

func (c *Context) RecoverErrors(onError func(error))

func (*Context) ReferencedResourceKindedValues

func (c *Context) ReferencedResourceKindedValues(valueID atree.ValueID) ReferenceSet

func (*Context) SemaAccessFromStaticAuthorization added in v1.8.4

func (c *Context) SemaAccessFromStaticAuthorization(auth interpreter.Authorization) (sema.Access, error)

func (*Context) SemaTypeFromStaticType

func (c *Context) SemaTypeFromStaticType(staticType interpreter.StaticType) sema.Type

func (*Context) SetAttachmentIteration

func (c *Context) SetAttachmentIteration(composite *interpreter.CompositeValue, state bool) bool

func (*Context) SetInStorageIteration

func (c *Context) SetInStorageIteration(inStorageIteration bool)

func (*Context) SetMutationDuringCapabilityControllerIteration

func (c *Context) SetMutationDuringCapabilityControllerIteration()

func (*Context) StorageMutatedDuringIteration

func (c *Context) StorageMutatedDuringIteration() bool

func (*Context) ValidateContainerMutation

func (c *Context) ValidateContainerMutation(valueID atree.ValueID)

func (*Context) WithContainerMutationPrevention

func (c *Context) WithContainerMutationPrevention(valueID atree.ValueID, f func())

func (*Context) WithResourceDestruction

func (c *Context) WithResourceDestruction(valueID atree.ValueID, f func())

func (*Context) WriteStored

func (c *Context) WriteStored(
	storageAddress common.Address,
	domain common.StorageDomain,
	key interpreter.StorageMapKey,
	value interpreter.Value,
) (existed bool)

type ContractValueHandler

type ContractValueHandler func(
	context *Context,
	location common.Location,
) *interpreter.CompositeValue

type ElaborationResolver

type ElaborationResolver func(location common.Location) (*sema.Elaboration, error)

type EntitlementMapTypeHandlerFunc

type EntitlementMapTypeHandlerFunc func(location common.Location, typeID interpreter.TypeID) *sema.EntitlementMapType

type EntitlementTypeHandlerFunc

type EntitlementTypeHandlerFunc func(location common.Location, typeID interpreter.TypeID) *sema.EntitlementType

type ExecutableProgram

type ExecutableProgram struct {
	Location    common.Location
	Program     *bbq.InstructionProgram
	Globals     []Variable
	Constants   []Value
	StaticTypes []bbq.StaticType
}

ExecutableProgram is the 'executable' version of a `bbq.Program`. It holds information that are accessible to a given program, such as constants, static-types, and global variables. These info are accessed by the opcodes of the program. i.e: indexes used in opcodes refer to the indexes of its ExecutableProgram.

func NewExecutableProgram

func NewExecutableProgram(
	location common.Location,
	program *bbq.InstructionProgram,
	globals []Variable,
) *ExecutableProgram

type FunctionValue

type FunctionValue interface {
	interpreter.FunctionValue

	// HasGenericType returns whether this function has a derived-type.
	// A function is said to have a derived-typed if the type of the function
	// is dependent on the receiver.
	// for e.g: `Integer.toBigEndianBytes()` functions type is always `fun(): [UInt8]`.
	// Hence it does not have a derived type.
	// On the other hand, `[T].append()` function's type is `fun(T): Void`,
	// where the parameter type `T` always depends on the receiver's type.
	// Hence, the array-append function is said to have a derived type.
	HasGenericType() bool

	// ResolvedFunctionType returns the resolved type of the function using the provided receiver value,
	// if the function has a generic type. This would panic if the function is not a generic function.
	// Use `HasGenericType` to determine whether this method should be called or not.
	ResolvedFunctionType(receiver Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType

	IsNative() bool
}

type ImplicitReferenceValue

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

func (ImplicitReferenceValue) Accept

func (ImplicitReferenceValue) Clone

func (ImplicitReferenceValue) DeepRemove

func (ImplicitReferenceValue) GetAuthorization

func (v ImplicitReferenceValue) GetAuthorization() interpreter.Authorization

func (ImplicitReferenceValue) IsImportable

func (ImplicitReferenceValue) IsResourceKinded

func (ImplicitReferenceValue) IsValue

func (v ImplicitReferenceValue) IsValue()

func (ImplicitReferenceValue) MeteredString

func (ImplicitReferenceValue) NeedsStoreTo

func (v ImplicitReferenceValue) NeedsStoreTo(_ atree.Address) bool

func (ImplicitReferenceValue) RecursiveString

func (ImplicitReferenceValue) ReferencedValue

func (ImplicitReferenceValue) StaticType

func (ImplicitReferenceValue) Storable

func (ImplicitReferenceValue) String

func (v ImplicitReferenceValue) String() string

func (ImplicitReferenceValue) Transfer

func (ImplicitReferenceValue) Walk

type IteratorWrapperValue

type IteratorWrapperValue struct {
	interpreter.ValueIterator
}

func NewIteratorWrapperValue

func NewIteratorWrapperValue(iterator interpreter.ValueIterator) *IteratorWrapperValue

func (IteratorWrapperValue) Accept

func (IteratorWrapperValue) Clone

func (IteratorWrapperValue) DeepRemove

func (IteratorWrapperValue) IsImportable

func (IteratorWrapperValue) IsResourceKinded

func (IteratorWrapperValue) IsValue

func (v IteratorWrapperValue) IsValue()

func (IteratorWrapperValue) MeteredString

func (IteratorWrapperValue) NeedsStoreTo

func (v IteratorWrapperValue) NeedsStoreTo(_ atree.Address) bool

func (IteratorWrapperValue) RecursiveString

func (IteratorWrapperValue) StaticType

func (IteratorWrapperValue) Storable

func (IteratorWrapperValue) String

func (v IteratorWrapperValue) String() string

func (IteratorWrapperValue) Transfer

func (IteratorWrapperValue) Walk

type LinkedGlobals

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

func LinkGlobals

func LinkGlobals(
	memoryGauge common.MemoryGauge,
	location common.Location,
	program *bbq.InstructionProgram,
	context *Context,
	linkedGlobalsCache map[common.Location]LinkedGlobals,
) LinkedGlobals

LinkGlobals performs the linking of global functions and variables for a given program.

type LinkerError

type LinkerError struct {
	Message string
}

func (LinkerError) Error

func (l LinkerError) Error() string

func (LinkerError) IsInternalError

func (l LinkerError) IsInternalError()

type NativeFunctionValue

type NativeFunctionValue struct {
	Name     string
	Function interpreter.NativeFunction
	// contains filtered or unexported fields
}

func NewNativeFunctionValue

func NewNativeFunctionValue(
	name string,
	funcType *sema.FunctionType,
	fn interpreter.NativeFunction,
) *NativeFunctionValue

func NewNativeFunctionValueWithDerivedType

func NewNativeFunctionValueWithDerivedType(
	name string,
	typeGetter func(receiver Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType,
	fn interpreter.NativeFunction,
) *NativeFunctionValue

func (*NativeFunctionValue) Accept

func (*NativeFunctionValue) Clone

func (*NativeFunctionValue) DeepRemove

func (*NativeFunctionValue) FunctionType

func (*NativeFunctionValue) GetMember

func (*NativeFunctionValue) GetMethod

func (*NativeFunctionValue) HasGenericType

func (v *NativeFunctionValue) HasGenericType() bool

func (*NativeFunctionValue) Invoke

func (*NativeFunctionValue) IsFunctionValue

func (v *NativeFunctionValue) IsFunctionValue()

func (*NativeFunctionValue) IsImportable

func (*NativeFunctionValue) IsNative

func (v *NativeFunctionValue) IsNative() bool

func (*NativeFunctionValue) IsResourceKinded

func (*NativeFunctionValue) IsValue

func (*NativeFunctionValue) IsValue()

func (*NativeFunctionValue) MeteredString

func (*NativeFunctionValue) NeedsStoreTo

func (v *NativeFunctionValue) NeedsStoreTo(_ atree.Address) bool

func (*NativeFunctionValue) RecursiveString

func (v *NativeFunctionValue) RecursiveString(_ interpreter.SeenReferences) string

func (*NativeFunctionValue) RemoveMember

func (*NativeFunctionValue) ResolvedFunctionType

func (v *NativeFunctionValue) ResolvedFunctionType(receiver Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType

func (*NativeFunctionValue) SetMember

func (*NativeFunctionValue) StaticType

func (*NativeFunctionValue) Storable

func (*NativeFunctionValue) String

func (v *NativeFunctionValue) String() string

func (*NativeFunctionValue) Transfer

func (*NativeFunctionValue) Walk

type ReferenceSet added in v1.8.4

type ReferenceSet = map[*interpreter.EphemeralReferenceValue]struct{}

type ReferencedResourceKindedValues

type ReferencedResourceKindedValues map[atree.ValueID]ReferenceSet

type UnknownFunctionError

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

UnknownFunctionError

func (UnknownFunctionError) Error

func (e UnknownFunctionError) Error() string

func (UnknownFunctionError) IsUserError

func (UnknownFunctionError) IsUserError()

type Upvalue

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

type VM

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

func NewVM

func NewVM(
	location common.Location,
	program *bbq.InstructionProgram,
	config *Config,
) *VM

func (*VM) Context

func (vm *VM) Context() *Context

func (*VM) Global

func (vm *VM) Global(name string) Value

func (*VM) InitializeContract

func (vm *VM) InitializeContract(contractName string, arguments ...Value) (*interpreter.CompositeValue, error)

func (*VM) InvokeExternally

func (vm *VM) InvokeExternally(name string, arguments ...Value) (v Value, err error)

func (*VM) InvokeMethodExternally

func (vm *VM) InvokeMethodExternally(
	name string,
	receiver interpreter.MemberAccessibleValue,
	arguments ...Value,
) (
	v Value,
	err error,
)

func (*VM) InvokeTransaction

func (vm *VM) InvokeTransaction(arguments []Value, signers ...Value) (err error)

func (*VM) InvokeTransactionExecute

func (vm *VM) InvokeTransactionExecute(transaction *interpreter.SimpleCompositeValue) error

func (*VM) InvokeTransactionInit

func (vm *VM) InvokeTransactionInit(transactionArgs []Value) error

func (*VM) InvokeTransactionPrepare

func (vm *VM) InvokeTransactionPrepare(transaction *interpreter.SimpleCompositeValue, signers []Value) error

func (*VM) InvokeTransactionWrapper

func (vm *VM) InvokeTransactionWrapper() (*interpreter.SimpleCompositeValue, error)

func (*VM) LocationRange

func (vm *VM) LocationRange() interpreter.LocationRange

LocationRange returns the location of the currently executing instruction. This is an expensive operation and must be only used on-demand.

func (*VM) RecoverErrors

func (vm *VM) RecoverErrors(onError func(error))

func (*VM) Reset

func (vm *VM) Reset()

func (*VM) StackSize

func (vm *VM) StackSize() int

type VMArgumentTypesIterator added in v1.9.5

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

func NewVMArgumentTypesIterator added in v1.9.5

func NewVMArgumentTypesIterator(context *Context, argumentTypes []bbq.StaticType) *VMArgumentTypesIterator

func (*VMArgumentTypesIterator) NextSema added in v1.9.5

func (g *VMArgumentTypesIterator) NextSema() sema.Type

func (*VMArgumentTypesIterator) NextStatic added in v1.9.5

type VMTypeArgumentsIterator added in v1.8.0

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

func NewVMTypeArgumentsIterator added in v1.8.0

func NewVMTypeArgumentsIterator(context *Context, typeArguments []bbq.StaticType) *VMTypeArgumentsIterator

func (*VMTypeArgumentsIterator) NextSema added in v1.8.0

func (g *VMTypeArgumentsIterator) NextSema() sema.Type

func (*VMTypeArgumentsIterator) NextStatic added in v1.8.0

type Value

type Value = interpreter.Value

func ConvertAndBox

func ConvertAndBox(
	context *Context,
	value Value,
	valueType, targetType bbq.StaticType,
) Value

ConvertAndBox converts a value to a target type, and boxes in optionals and any value, if necessary

type Variable

type Variable = interpreter.Variable

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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