stdlib

package
v0.37.5-pr6271 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: AGPL-3.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ContractName = "EVM"
)
View Source
const InternalEVMContractName = "InternalEVM"

Variables

View Source
var (
	EVMTransactionBytesCadenceType = cadence.NewVariableSizedArrayType(cadence.UInt8Type)

	EVMAddressBytesCadenceType = cadence.NewConstantSizedArrayType(types.AddressLength, cadence.UInt8Type)
)
View Source
var ContractMinimalCode string
View Source
var InternalEVMContractType = func() *sema.CompositeType {
	ty := &sema.CompositeType{
		Identifier: InternalEVMContractName,
		Kind:       common.CompositeKindContract,
	}

	ty.Members = sema.MembersAsMap([]*sema.Member{
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeRunFunctionName,
			internalEVMTypeRunFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeDryRunFunctionName,
			internalEVMTypeDryRunFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeBatchRunFunctionName,
			internalEVMTypeBatchRunFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeCreateCadenceOwnedAccountFunctionName,
			internalEVMTypeCreateCadenceOwnedAccountFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeCallFunctionName,
			internalEVMTypeCallFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeDepositFunctionName,
			internalEVMTypeDepositFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeWithdrawFunctionName,
			internalEVMTypeWithdrawFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeDeployFunctionName,
			internalEVMTypeDeployFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeCastToAttoFLOWFunctionName,
			internalEVMTypeCastToAttoFLOWFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeCastToFLOWFunctionName,
			internalEVMTypeCastToFLOWFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeBalanceFunctionName,
			internalEVMTypeBalanceFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeNonceFunctionName,
			internalEVMTypeNonceFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeCodeFunctionName,
			internalEVMTypeCodeFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeCodeHashFunctionName,
			internalEVMTypeCodeHashFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeEncodeABIFunctionName,
			internalEVMTypeEncodeABIFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeDecodeABIFunctionName,
			internalEVMTypeDecodeABIFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeGetLatestBlockFunctionName,
			internalEVMTypeGetLatestBlockFunctionType,
			"",
		),
		sema.NewUnmeteredPublicFunctionMember(
			ty,
			internalEVMTypeCommitBlockProposalFunctionName,
			internalEVMTypeCommitBlockProposalFunctionType,
			"",
		),
	})
	return ty
}()

Functions

func AddressBytesArrayValueToEVMAddress

func AddressBytesArrayValueToEVMAddress(
	inter *interpreter.Interpreter,
	locationRange interpreter.LocationRange,
	addressBytesValue *interpreter.ArrayValue,
) (
	result types.Address,
	err error,
)

func ContractCode

func ContractCode(nonFungibleTokenAddress, fungibleTokenAddress, flowTokenAddress flow.Address) []byte

func ContractTypeForChain added in v0.36.3

func ContractTypeForChain(chainID flow.ChainID) *sema.CompositeType

func EVMAddressToAddressBytesArrayValue

func EVMAddressToAddressBytesArrayValue(
	inter *interpreter.Interpreter,
	address types.Address,
) *interpreter.ArrayValue

func NewBalanceCadenceType

func NewBalanceCadenceType(address common.Address) *cadence.StructType

func NewEVMAddress

func NewEVMAddress(
	inter *interpreter.Interpreter,
	locationRange interpreter.LocationRange,
	location common.AddressLocation,
	address types.Address,
) *interpreter.CompositeValue

func NewEVMAddressCadenceType

func NewEVMAddressCadenceType(address common.Address) *cadence.StructType

func NewEVMBlockCadenceType added in v0.33.30

func NewEVMBlockCadenceType(address common.Address) *cadence.StructType

func NewEVMBlockValue added in v0.33.30

func NewEVMBlockValue(
	handler types.ContractHandler,
	gauge common.MemoryGauge,
	inter *interpreter.Interpreter,
	locationRange interpreter.LocationRange,
	block *types.Block,
) *interpreter.CompositeValue

func NewInternalEVMContractValue

func NewInternalEVMContractValue(
	gauge common.MemoryGauge,
	handler types.ContractHandler,
	location common.AddressLocation,
) *interpreter.SimpleCompositeValue

func NewResultValue added in v0.33.30

func NewResultValue(
	handler types.ContractHandler,
	gauge common.MemoryGauge,
	inter *interpreter.Interpreter,
	locationRange interpreter.LocationRange,
	result *types.ResultSummary,
) *interpreter.CompositeValue

func ResultSummaryFromEVMResultValue added in v0.33.30

func ResultSummaryFromEVMResultValue(val cadence.Value) (*types.ResultSummary, error)

func SetupEnvironment

func SetupEnvironment(
	env runtime.Environment,
	handler types.ContractHandler,
	contractAddress flow.Address,
)

Types

type CadenceTypes added in v0.36.3

type CadenceTypes struct {
	TransactionExecuted *cadence.EventType
	BlockExecuted       *cadence.EventType
}

func CadenceTypesForChain added in v0.36.3

func CadenceTypesForChain(chainID flow.ChainID) CadenceTypes

Jump to

Keyboard shortcuts

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