Documentation ¶
Index ¶
- Constants
- func COAOwnershipProofValidator(contractAddress flow.Address, backend types.Backend) func(proof *types.COAOwnershipProofInContext) (bool, error)
- func ExecutionErrorCode(err error) types.ErrorCode
- func MakeCOAAddress(index uint64) types.Address
- func MakePrecompileAddress(index uint64) types.Address
- func ValidationErrorCode(err error) types.ErrorCode
- type Account
- func (a *Account) Address() types.Address
- func (a *Account) Balance() types.Balance
- func (a *Account) Call(to types.Address, data types.Data, gaslimit types.GasLimit, ...) types.Data
- func (a *Account) Code() types.Code
- func (a *Account) CodeHash() []byte
- func (a *Account) Deploy(code types.Code, gaslimit types.GasLimit, balance types.Balance) types.Address
- func (a *Account) Deposit(v *types.FLOWTokenVault)
- func (a *Account) Transfer(to types.Address, balance types.Balance)
- func (a *Account) Withdraw(b types.Balance) *types.FLOWTokenVault
- type AddressAllocator
- type BlockStore
- type ContractHandler
- func (h *ContractHandler) AccountByAddress(addr types.Address, isAuthorized bool) types.Account
- func (h *ContractHandler) DeployCOA(uuid uint64) types.Address
- func (h *ContractHandler) FlowTokenAddress() common.Address
- func (h *ContractHandler) LastExecutedBlock() *types.Block
- func (h *ContractHandler) Run(rlpEncodedTx []byte, coinbase types.Address)
- func (h *ContractHandler) TryRun(rlpEncodedTx []byte, coinbase types.Address) *types.ResultSummary
Constants ¶
const ( BlockHashListCapacity = 16 BlockStoreLatestBlockKey = "LatestBlock" BlockStoreBlockHashesKey = "LatestBlockHashes" )
const InvalidTransactionComputationCost = 1_000
Variables ¶
This section is empty.
Functions ¶
func ExecutionErrorCode ¶
func MakeCOAAddress ¶ added in v0.33.30
func MakePrecompileAddress ¶ added in v0.33.30
func ValidationErrorCode ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func (*Account) Balance ¶
Balance returns the balance of this account
TODO: we might need to meter computation for read only operations as well currently the storage limits is enforced
func (*Account) Call ¶
func (a *Account) Call(to types.Address, data types.Data, gaslimit types.GasLimit, balance types.Balance) types.Data
Call calls a smart contract function with the given data it would limit the gas used according to the limit provided given it doesn't goes beyond what Flow transaction allows. the balance would be deducted from the OFA account and would be transferred to the target address
func (*Account) Deploy ¶
func (a *Account) Deploy(code types.Code, gaslimit types.GasLimit, balance types.Balance) types.Address
Deploy deploys a contract to the EVM environment the new deployed contract would be at the returned address and the contract data is not controlled by the caller accounts
func (*Account) Deposit ¶
func (a *Account) Deposit(v *types.FLOWTokenVault)
Deposit deposits the token from the given vault into the flow evm main vault and update the account balance with the new amount
type AddressAllocator ¶
type AddressAllocator struct { }
func NewAddressAllocator ¶
func NewAddressAllocator() *AddressAllocator
NewAddressAllocator constructs a new statefull address allocator
func (*AddressAllocator) AllocateCOAAddress ¶ added in v0.33.30
func (aa *AddressAllocator) AllocateCOAAddress(uuid uint64) types.Address
AllocateCOAAddress allocates an address for COA
func (*AddressAllocator) AllocatePrecompileAddress ¶ added in v0.33.30
func (aa *AddressAllocator) AllocatePrecompileAddress(index uint64) types.Address
func (*AddressAllocator) COAFactoryAddress ¶ added in v0.33.30
func (aa *AddressAllocator) COAFactoryAddress() types.Address
type BlockStore ¶
type BlockStore struct {
// contains filtered or unexported fields
}
func NewBlockStore ¶
func NewBlockStore(backend types.Backend, rootAddress flow.Address) *BlockStore
NewBlockStore constructs a new block store
func (*BlockStore) BlockHash ¶
func (bs *BlockStore) BlockHash(height uint64) (gethCommon.Hash, error)
BlockHash returns the block hash for the last x blocks
func (*BlockStore) BlockProposal ¶
func (bs *BlockStore) BlockProposal() (*types.Block, error)
BlockProposal returns the block proposal to be updated by the handler
func (*BlockStore) CommitBlockProposal ¶
func (bs *BlockStore) CommitBlockProposal() error
CommitBlockProposal commits the block proposal to the chain
func (*BlockStore) LatestBlock ¶
func (bs *BlockStore) LatestBlock() (*types.Block, error)
LatestBlock returns the latest executed block
func (*BlockStore) ResetBlockProposal ¶
func (bs *BlockStore) ResetBlockProposal() error
ResetBlockProposal resets the block proposal
type ContractHandler ¶
type ContractHandler struct {
// contains filtered or unexported fields
}
ContractHandler is responsible for triggering calls to emulator, metering, event emission and updating the block
func NewContractHandler ¶
func NewContractHandler( evmContractAddress flow.Address, flowTokenAddress common.Address, blockStore types.BlockStore, addressAllocator types.AddressAllocator, backend types.Backend, emulator types.Emulator, ) *ContractHandler
func (*ContractHandler) AccountByAddress ¶
AccountByAddress returns the account for the given address, if isAuthorized is set, account is controlled by the FVM (COAs)
func (*ContractHandler) DeployCOA ¶ added in v0.33.30
func (h *ContractHandler) DeployCOA(uuid uint64) types.Address
DeployCOA deploys a cadence-owned-account and returns the address
func (*ContractHandler) FlowTokenAddress ¶
func (h *ContractHandler) FlowTokenAddress() common.Address
func (*ContractHandler) LastExecutedBlock ¶
func (h *ContractHandler) LastExecutedBlock() *types.Block
LastExecutedBlock returns the last executed block
func (*ContractHandler) Run ¶
func (h *ContractHandler) Run(rlpEncodedTx []byte, coinbase types.Address)
Run runs an rlpencoded evm transaction and collects the gas fees and pay it to the coinbase address provided.
func (*ContractHandler) TryRun ¶
func (h *ContractHandler) TryRun(rlpEncodedTx []byte, coinbase types.Address) *types.ResultSummary
TryRun tries to run an rlpencoded evm transaction and collects the gas fees and pay it to the coinbase address provided.