Documentation
¶
Index ¶
- Constants
- func MakeCOAAddress(index uint64) types.Address
- func MakePrecompileAddress(index uint64) types.Address
- 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.ResultSummary
- 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.ResultSummary
- func (a *Account) Deposit(v *types.FLOWTokenVault)
- func (a *Account) Nonce() uint64
- func (a *Account) Transfer(to types.Address, balance types.Balance)
- func (a *Account) Withdraw(b types.Balance) *types.FLOWTokenVault
- type AddressAllocator
- type ContractHandler
- func (h *ContractHandler) AccountByAddress(addr types.Address, isAuthorized bool) types.Account
- func (h *ContractHandler) BatchRun(rlpEncodedTxs [][]byte, gasFeeCollector types.Address) []*types.ResultSummary
- func (h *ContractHandler) CommitBlockProposal()
- func (h *ContractHandler) DeployCOA(uuid uint64) types.Address
- func (h *ContractHandler) DryRun(rlpEncodedTx []byte, from types.Address) *types.ResultSummary
- func (h *ContractHandler) DryRunWithTxData(txData gethTypes.TxData, from types.Address) *types.ResultSummary
- func (h *ContractHandler) EVMContractAddress() common.Address
- func (h *ContractHandler) FlowTokenAddress() common.Address
- func (h *ContractHandler) GenerateResourceUUID() uint64
- func (h *ContractHandler) GetState(address types.Address, slot gethCommon.Hash) gethCommon.Hash
- func (h *ContractHandler) LastExecutedBlock() *types.Block
- func (h *ContractHandler) ResetCaches()
- func (h *ContractHandler) Run(rlpEncodedTx []byte, gasFeeCollector types.Address) *types.ResultSummary
- func (h *ContractHandler) RunOrPanic(rlpEncodedTx []byte, gasFeeCollector types.Address)
- func (h *ContractHandler) RunTxAs(from types.Address, to types.Address, txData types.Data, ...) *types.ResultSummary
- func (h *ContractHandler) SetState(address types.Address, slot gethCommon.Hash, value gethCommon.Hash) gethCommon.Hash
Constants ¶
const RandomSourceTypeValueFieldName = "value"
const ValidationResultTypeIsValidFieldName = "isValid"
Variables ¶
This section is empty.
Functions ¶
func MakeCOAAddress ¶ added in v0.33.30
func MakePrecompileAddress ¶ added in v0.33.30
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func (*Account) Balance ¶
Balance returns the balance of this account
Note: we don't meter any extra computation given reading data from the storage already translates into computation
func (*Account) Call ¶
func (a *Account) Call(to types.Address, data types.Data, gaslimit types.GasLimit, balance types.Balance) *types.ResultSummary
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) Code ¶ added in v0.33.30
Code returns the code of this account
Note: we don't meter any extra computation given reading data from the storage already translates into computation
func (*Account) CodeHash ¶ added in v0.33.30
CodeHash returns the code hash of this account
Note: we don't meter any extra computation given reading data from the storage already translates into computation
func (*Account) Deploy ¶
func (a *Account) Deploy(code types.Code, gaslimit types.GasLimit, balance types.Balance) *types.ResultSummary
Deploy deploys a contract to the EVM environment the new deployed contract would be at the returned address contained in the result summary as data 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
func (*Account) Nonce ¶ added in v0.33.30
Nonce returns the nonce of this account
Note: we don't meter any extra computation given reading data from the storage already translates into computation
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
func (*AddressAllocator) NativeTokenBridgeAddress ¶ added in v0.33.30
func (aa *AddressAllocator) NativeTokenBridgeAddress() types.Address
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( flowChainID flow.ChainID, evmContractAddress flow.Address, flowTokenAddress common.Address, randomBeaconAddress flow.Address, addressAllocator types.AddressAllocator, backend backends.Backend, emulator types.Emulator, ) *ContractHandler
NewContractHandler constructs a new 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) BatchRun ¶ added in v0.33.30
func (h *ContractHandler) BatchRun(rlpEncodedTxs [][]byte, gasFeeCollector types.Address) []*types.ResultSummary
BatchRun tries to run batch of rlp-encoded transactions collects the gas fees and pay it to the coinbase address provided. All transactions provided in the batch are included in a single block, except for invalid transactions
func (*ContractHandler) CommitBlockProposal ¶ added in v0.36.2
func (h *ContractHandler) CommitBlockProposal()
CommitBlockProposal commits the block proposal and add a new block to the EVM blockchain
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) DryRun ¶ added in v0.33.30
func (h *ContractHandler) DryRun( rlpEncodedTx []byte, from types.Address, ) *types.ResultSummary
DryRun simulates execution of the provided RLP-encoded and unsigned transaction.
func (*ContractHandler) DryRunWithTxData ¶ added in v0.47.0
func (h *ContractHandler) DryRunWithTxData( txData gethTypes.TxData, from types.Address, ) *types.ResultSummary
DryRunWithTxData simulates execution of the provided transaction data. The from address is required since the transaction is unsigned. The function should not have any persisted changes made to the state.
func (*ContractHandler) EVMContractAddress ¶ added in v0.33.30
func (h *ContractHandler) EVMContractAddress() common.Address
EVMContractAddress returns the address where EVM contract is deployed
func (*ContractHandler) FlowTokenAddress ¶
func (h *ContractHandler) FlowTokenAddress() common.Address
FlowTokenAddress returns the address where the FlowToken contract is deployed
func (*ContractHandler) GenerateResourceUUID ¶ added in v0.33.30
func (h *ContractHandler) GenerateResourceUUID() uint64
func (*ContractHandler) GetState ¶ added in v0.48.0
func (h *ContractHandler) GetState( address types.Address, slot gethCommon.Hash, ) gethCommon.Hash
GetState returns the value for the given storage slot. The operation is only allowed for testing purposes.
func (*ContractHandler) LastExecutedBlock ¶
func (h *ContractHandler) LastExecutedBlock() *types.Block
LastExecutedBlock returns the last executed block
func (*ContractHandler) ResetCaches ¶
func (h *ContractHandler) ResetCaches()
ResetCaches resets caches. It is called by the runtime pool via SwappableEnvironment.onSwap when the runtime is borrowed or returned.
func (*ContractHandler) Run ¶
func (h *ContractHandler) Run(rlpEncodedTx []byte, gasFeeCollector types.Address) *types.ResultSummary
Run tries to run an rlp-encoded evm transaction collects the gas fees and pay it to the gasFeeCollector address provided.
func (*ContractHandler) RunOrPanic ¶ added in v0.33.30
func (h *ContractHandler) RunOrPanic(rlpEncodedTx []byte, gasFeeCollector types.Address)
RunOrPanic runs an rlp-encoded evm transaction and
func (*ContractHandler) RunTxAs ¶ added in v0.48.0
func (h *ContractHandler) RunTxAs( from types.Address, to types.Address, txData types.Data, gasLimit types.GasLimit, balance types.Balance, ) *types.ResultSummary
RunTxAs runs a transaction by setting the call's `msg.sender` to be the `from` address. The operation is only allowed for testing purposes.
func (*ContractHandler) SetState ¶ added in v0.48.0
func (h *ContractHandler) SetState( address types.Address, slot gethCommon.Hash, value gethCommon.Hash, ) gethCommon.Hash
SetState sets a value for the given storage slot. It returns the previous value in any case. The operation is only allowed for testing purposes.