stdlib

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: AGPL-3.0 Imports: 13 Imported by: 4 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ContractName = "EVM"

	EVMAddressTypeBytesFieldName = "bytes"

	EVMBytesTypeValueFieldName = "value"

	EVMAddressTypeQualifiedIdentifier = "EVM.EVMAddress"

	EVMBalanceTypeQualifiedIdentifier = "EVM.Balance"

	EVMBytesTypeQualifiedIdentifier = "EVM.EVMBytes"

	EVMBytes4TypeQualifiedIdentifier = "EVM.EVMBytes4"

	EVMBytes32TypeQualifiedIdentifier = "EVM.EVMBytes32"

	EVMResultTypeQualifiedIdentifier       = "EVM.Result"
	EVMResultTypeStatusFieldName           = "status"
	EVMResultTypeErrorCodeFieldName        = "errorCode"
	EVMResultTypeErrorMessageFieldName     = "errorMessage"
	EVMResultTypeGasUsedFieldName          = "gasUsed"
	EVMResultTypeDataFieldName             = "data"
	EVMResultTypeDeployedContractFieldName = "deployedContract"

	EVMStatusTypeQualifiedIdentifier = "EVM.Status"

	EVMBlockTypeQualifiedIdentifier = "EVM.EVMBlock"
)
View Source
const (
	EVMAddressLength = 20
	EVMBytes4Length  = 4
	EVMBytes32Length = 32
)
View Source
const InternalEVMContractName = "InternalEVM"
View Source
const InternalEVMTypeBalanceFunctionName = "balance"
View Source
const InternalEVMTypeBatchRunFunctionName = "batchRun"
View Source
const InternalEVMTypeCallFunctionName = "call"
View Source
const InternalEVMTypeCastToAttoFLOWFunctionName = "castToAttoFLOW"
View Source
const InternalEVMTypeCastToFLOWFunctionName = "castToFLOW"
View Source
const InternalEVMTypeCodeFunctionName = "code"
View Source
const InternalEVMTypeCodeHashFunctionName = "codeHash"
View Source
const InternalEVMTypeCommitBlockProposalFunctionName = "commitBlockProposal"
View Source
const InternalEVMTypeCreateCadenceOwnedAccountFunctionName = "createCadenceOwnedAccount"
View Source
const InternalEVMTypeDecodeABIFunctionName = "decodeABI"
View Source
const InternalEVMTypeDeployFunctionName = "deploy"
View Source
const InternalEVMTypeDepositFunctionName = "deposit"
View Source
const InternalEVMTypeDryCallFunctionName = "dryCall"
View Source
const InternalEVMTypeDryRunFunctionName = "dryRun"
View Source
const InternalEVMTypeEncodeABIFunctionName = "encodeABI"
View Source
const InternalEVMTypeGetLatestBlockFunctionName = "getLatestBlock"
View Source
const InternalEVMTypeNonceFunctionName = "nonce"
View Source
const InternalEVMTypeRunFunctionName = "run"
View Source
const InternalEVMTypeWithdrawFunctionName = "withdraw"

Variables

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,
			InternalEVMTypeDryCallFunctionName,
			InternalEVMTypeDryCallFunctionType,
			"",
		),
		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
}()
View Source
var InternalEVMTypeBalanceFunctionType = &sema.FunctionType{
	Purity: sema.FunctionPurityView,
	Parameters: []sema.Parameter{
		{
			Label:          "address",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.UIntType),
}
View Source
var InternalEVMTypeBatchRunFunctionType *sema.FunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "txs",
			TypeAnnotation: sema.NewTypeAnnotation(EVMTransactionsBatchBytesType),
		},
		{
			Label:          "coinbase",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
	},

	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.NewVariableSizedType(nil, sema.AnyStructType)),
}
View Source
var InternalEVMTypeCallFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "from",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
		{
			Label:          "to",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
		{
			Label:          "data",
			TypeAnnotation: sema.NewTypeAnnotation(sema.ByteArrayType),
		},
		{
			Label:          "gasLimit",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UInt64Type),
		},
		{
			Label:          "value",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UIntType),
		},
	},

	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.AnyStructType),
}
View Source
var InternalEVMTypeCastToAttoFLOWFunctionType = &sema.FunctionType{
	Purity: sema.FunctionPurityView,
	Parameters: []sema.Parameter{
		{
			Label:          "balance",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UFix64Type),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.UIntType),
}
View Source
var InternalEVMTypeCastToFLOWFunctionType = &sema.FunctionType{
	Purity: sema.FunctionPurityView,
	Parameters: []sema.Parameter{
		{
			Label:          "balance",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UIntType),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.UFix64Type),
}
View Source
var InternalEVMTypeCodeFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "address",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.ByteArrayType),
}
View Source
var InternalEVMTypeCodeHashFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "address",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.ByteArrayType),
}
View Source
var InternalEVMTypeCommitBlockProposalFunctionType = &sema.FunctionType{
	Parameters:           []sema.Parameter{},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.VoidType),
}
View Source
var InternalEVMTypeCreateCadenceOwnedAccountFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "uuid",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UInt64Type),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
}
View Source
var InternalEVMTypeDecodeABIFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Identifier: "types",
			TypeAnnotation: sema.NewTypeAnnotation(
				sema.NewVariableSizedType(nil, sema.MetaType),
			),
		},
		{
			Label:          "data",
			TypeAnnotation: sema.NewTypeAnnotation(sema.ByteArrayType),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(
		sema.NewVariableSizedType(nil, sema.AnyStructType),
	),
}
View Source
var InternalEVMTypeDeployFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "from",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
		{
			Label:          "code",
			TypeAnnotation: sema.NewTypeAnnotation(sema.ByteArrayType),
		},
		{
			Label:          "gasLimit",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UInt64Type),
		},
		{
			Label:          "value",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UIntType),
		},
	},

	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.AnyStructType),
}
View Source
var InternalEVMTypeDepositFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "from",
			TypeAnnotation: sema.NewTypeAnnotation(sema.AnyResourceType),
		},
		{
			Label:          "to",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.VoidType),
}
View Source
var InternalEVMTypeDryCallFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "from",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
		{
			Label:          "to",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
		{
			Label:          "data",
			TypeAnnotation: sema.NewTypeAnnotation(sema.ByteArrayType),
		},
		{
			Label:          "gasLimit",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UInt64Type),
		},
		{
			Label:          "value",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UIntType),
		},
	},

	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.AnyStructType),
}
View Source
var InternalEVMTypeDryRunFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "tx",
			TypeAnnotation: sema.NewTypeAnnotation(EVMTransactionBytesType),
		},
		{
			Label:          "from",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
	},

	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.AnyStructType),
}
View Source
var InternalEVMTypeEncodeABIFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:      sema.ArgumentLabelNotRequired,
			Identifier: "values",
			TypeAnnotation: sema.NewTypeAnnotation(
				sema.NewVariableSizedType(nil, sema.AnyStructType),
			),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.ByteArrayType),
}
View Source
var InternalEVMTypeGetLatestBlockFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{},

	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.AnyStructType),
}
View Source
var InternalEVMTypeNonceFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "address",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.UInt64Type),
}
View Source
var InternalEVMTypeRunFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "tx",
			TypeAnnotation: sema.NewTypeAnnotation(EVMTransactionBytesType),
		},
		{
			Label:          "coinbase",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
	},

	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.AnyStructType),
}
View Source
var InternalEVMTypeWithdrawFunctionType = &sema.FunctionType{
	Parameters: []sema.Parameter{
		{
			Label:          "from",
			TypeAnnotation: sema.NewTypeAnnotation(EVMAddressBytesType),
		},
		{
			Label:          "amount",
			TypeAnnotation: sema.NewTypeAnnotation(sema.UIntType),
		},
	},
	ReturnTypeAnnotation: sema.NewTypeAnnotation(sema.AnyResourceType),
}

Functions

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 NewBalanceCadenceType

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

func NewEVMAddressCadenceType

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

func NewEVMBlockCadenceType added in v0.33.30

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

func SetupEnvironment

func SetupEnvironment(
	env runtime.Environment,
	internalEVMValue interpreter.Value,
	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