# Functions
AddBalance balance 2 to balance 1 and returns the result as a new balance.
AggregatedPrecompileCallsFromEncoded constructs an AggregatedPrecompileCalls from encoded data.
BalanceConversionToUFix64ProneToRoundingError returns true if casting to UFix64 could result in rounding error.
BalancesAreEqual returns true if balances are equal.
BalanceToBigInt convert balance into big int.
No description provided by the author
No description provided by the author
No description provided by the author
ConvertBalanceToUFix64 casts the balance into a UFix64,
Warning! The smallest unit of Flow token that a FlowVault (Cadence) could store is 1e10^-8, so transferring smaller values (or values with smalls fractions) could result in loss in conversion.
CopyBalance creates a copy of the balance.
DirectCallFromEncoded constructs a DirectCall from encoded data.
No description provided by the author
No description provided by the author
No description provided by the author
GenesisBlock returns the genesis block in the EVM environment.
GenesisBlockHash returns the genesis block hash in the EVM environment.
GenesisTimestamp returns the block time stamp for EVM genesis block.
IsABackendError returns true if the error or any underlying errors is a backend error.
IsACOAAddress returns true if the address is a COA address
This test insures `addr` has been generated as a COA address with high probability.
IsAFatalError returns true if the error or underlying error is of fatal type.
IsAInsufficientTotalSupplyError returns true if the error type is InsufficientTotalSupplyError.
IsAnExtendedPrecompileAddress returns true if the address is a extended precompile address.
IsAStateError returns true if the error or any underlying errors is a state error.
IsAUnauthorizedMethodCallError returns true if the error type is UnauthorizedMethodCallError.
IsWithdrawBalanceRoundingError returns true if the error type is ErrWithdrawBalanceRounding.
MakeABalanceInFlow makes a balance object that has `amount` Flow Token in it.
MakeBigIntInFlow makes big int containing `amount` of Flow.
NewAddress constructs a new Address.
NewAddressFromBytes constructs a new address from bytes.
NewAddressFromString constructs a new address from an string.
NewBackendError returns a new BackendError.
NewBalance constructs a new balance from an atto-flow value.
NewBalanceFromUFix64 constructs a new balance from flow value (how its stored in Cadence Flow).
NewBlock constructs a new block.
NewBlockFromBytes constructs a new block from encoded data.
No description provided by the author
NewBlockProposalFromBytes constructs a new block proposal from encoded data.
No description provided by the author
NewContractCall constructs a new contract call.
NewDefaultBlockContext returns a new default block context.
NewDeployCall constructs a new deploy direct call.
NewDeployCallWithTargetAddress constructs a new deployment call for the given target address
Warning! This subtype should only be used internally for deploying contracts at given addresses (e.g.
NewDepositCall constructs a new deposit direct call.
NewFatalError returns a new FatalError.
No description provided by the author
NewInvalidResult creates a new result that hold transaction validation error as well as the defined gas cost for validation.
NewStateError returns a new StateError.
No description provided by the author
NewDepositCall constructs a new withdraw direct call.
OneFlow creates a big int including one flow.
OneFlowBalance creates a new balance including one flow.
Subtract balance 2 from balance 1 and returns the result as a new balance.
UnsafeCastOfBalanceToFloat64 tries to cast the balance into a float64,
Warning! this method is only provided for logging and metric reporting purposes, using float64 for any actual computation result in non-determinism.
No description provided by the author
# Constants
AddressLength holds the number of bytes used for each EVM address.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
21_000 is the minimum for a transaction + max gas allowed for receive/fallback methods.
No description provided by the author
the value is set to the gas limit for transfer to facilitate transfers to smart contract addresses.
No description provided by the author
tx type 255 is used for direct calls from COAs.
internal error codes.
contract creation code storage out of gas.
contract address collision".
max call depth exceeded.
execution reverted.
gas uint64 overflow.
insufficient balance for transfer.
invalid code: must not begin with 0xef.
invalid jump destination.
max code size exceeded.
max initcode size exceeded.
general execution error returned for cases that don't have an specific code.
nonce uint64 overflow.
execution ran out of gas.
return data out of bounds.
write protection.
FlowEVMSpecialAddressPrefixLen captures the number of prefix bytes with constant values for special accounts (extended precompiles and COAs).
Note that these gas values might need to change if we change the transaction (e.g.
InvalidTransactionGasCost is a gas cost we charge when a transaction or call fails at validation step.
No description provided by the author
No description provided by the author
the transaction fee cap is less than the blob gas fee of the block.
the transaction fee cap is less than the base fee of the block.
an extremely big numbers is set for the fee cap field.
not enough gas is available on the block to include this transaction.
overflow detected when calculating the gas usage.
the total cost of executing a transaction is higher than the balance of the user's account.
the transaction sender doesn't have enough funds for transfer(topmost call only).
the transaction is specified to use less gas than required to start the invocation.
creation transaction provides the init code bigger than init code size limit.
covers all other validation codes that doesn't have an specific code.
tx sender account has reached to the maximum nonce.
the nonce of the tx is higher than the expected.
the nonce of the tx is lower than the expected.
the sender of a transaction is a contract.
tip was set to higher than the total fee cap.
an extremely big numbers is set for the tip field.
the transaction is not supported in the current network configuration.
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
anything block number above 0 works here.
Coinbase address.
DefaultBaseFee is the default base fee value for the block is set to zero but can be updated by the config.
DefaultBlockLevelGasLimit is the default value for the block gas limit currently set to maximum and we don't consider any limit given number of included EVM transactions are naturally limited by the Flow block production limits.
DefaultDirectCallBaseGasUsage holds the minimum gas charge for direct calls.
DefaultDirectCallGasPrice captures the default gas price for the direct call.
EmptyAddress is an empty evm address.
No description provided by the author
ErrInsufficientComputation is returned when not enough computation is left in the context of flow transaction to execute the evm operation.
ErrInsufficientTotalSupply is returned when flow token withdraw request is received but not enough balance is on EVM native token vault this should never happen but its a safety measure to protect Flow against EVM issues.
ErrInvalidBalance is returned when an invalid amount is provided for transfer or balance change (e.g.
ErrNotImplemented is a fatal error when something is called that is not implemented.
ErrUnauthorizedMethodCall method call, usually emitted when calls are called on EOA accounts.
ErrUnexpectedEmptyResult is returned when a result is expected to be returned by the emulator but nil has been returned.
ErrWithdrawBalanceRounding is returned when withdraw call has a balance that could result in rounding error, i.e.
No description provided by the author
No description provided by the author
Prefix for the COA addresses.
Prefix for the extended precompiles.
No description provided by the author
Using leading zeros for prefix helps with the storage compactness.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
StatusFailed shows that the transaction has been executed, but the output of the execution was an error for this case a block is formed and receipts are available.
StatusInvalid shows that the transaction was not a valid transaction and rejected to be executed and included in any block.
StatusSuccessful shows that the transaction has been executed and the execution has returned success for this case a block is formed and receipts are available.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
BackendError is a non-fatal error wraps errors returned from the backend.
Block represents a evm block.
BlockContext holds the context needed for the emulator operations.
BlockProposal is a EVM block proposal holding all the interim data of block before commitment.
No description provided by the author
before adding PrevRandao to the block.
COAOwnershipProof is a proof that a flow account controls a COA resource.
COAOwnershipProofInContext contains all the data needed to verify a COAOwnership proof.
DirectCall captures all the data related to a direct call to evm direct calls are similar to transactions but they don't have signatures and don't need sequence number checks Note that while we don't check the nonce, it impacts hash calculation and also impacts the address of resulting contract when deployed through direct calls.
FatalError is used for any error that is not user related and something unusual has happened.
FLOWTokenVault holds a balance of flow token.
LightLog captures only consensus fields of an EVM log used by the LightReceipt.
LightReceipt captures only the consensus fields of a receipt, making storage of receipts for the purpose of trie building more storage efficient.
PrecompiledCalls captures all the calls to a precompiled contract.
RunCall captures a call to the RequiredGas method of a precompiled contract.
Result captures the result of an interaction to the emulator it could be the output of a direct call or output of running an evm transaction.
ResultSummary summarizes the outcome of a EVM call or tx run.
RunCall captures a call to the Run method of a precompiled contract.
SlotAddress captures an address to a storage slot.
StateError is a non-fatal error, returned when a state operation has failed (e.g.
# Interfaces
Account is an EVM account, currently three types of accounts are supported on Flow EVM, externally owned accounts (EOAs), smart contract accounts and cadence owned accounts Cadence-owned-account (COA) is a new type of account in the environment, that instead of being managed by public key, it is managed by a resource owned by a Flow account.
AddressAllocator allocates addresses, used by the handler.
Backend provides a subset of the FVM environment functionality Any error returned by a Backend is expected to be a `FatalError` or a `BackendError`.
BaseView is a low-level mutable view of the state baseview is usually updated at the commit calls to the higher level view.
BlockStore stores the chain of blocks.
BlockView facilitates execution of a transaction or a direct evm call in the context of a block Any error returned by any of the methods (e.g.
ContractHandler handles operations on the evm environment.
Emulator emulates an evm-compatible chain.
HotView captures a high-level mutable view of the state.
PrecompiledContract wraps gethVM precompiles with functionality to return where the contract is deployed.
ReadOnlyBlockView provides a read only view of a block.
ReadOnlyView provides a readonly view of the state.
StateDB acts as the main interface to the EVM runtime.
# Type aliases
Address is an EVM-compatible address.
AggregatedPrecompiledCalls aggregates a list of precompiled calls the list should be sorted by the address.
Code holds an smart contract code.
Data holds the data passed as part of a call.
No description provided by the author
No description provided by the author
GasLimit sets the limit for the total gas used by a transaction.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Status captures the status of an interaction to the emulator.
No description provided by the author