Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Evmc

Hierarchy

  • Evmc

Index

Constructors

constructor

  • new Evmc(path: string): Evmc

Properties

_evm

_evm: EvmcHandle

released

released: boolean = false

Methods

Abstract call

Abstract copyCode

  • copyCode(account: bigint, offset: number, length: number): Promise<Buffer> | Buffer
  • Copy code callback function.

    This callback function is used by an EVM to request a copy of the code of the given account to the memory buffer provided by the EVM. The Client MUST copy the requested code, starting with the given offset, to the returned memory buffer up to length or the size of the code, whichever is smaller.

    @param address The address of the account. @param offset The offset of the code to copy. @param length The length of the code to copy. A buffer returned larger than length will be truncated. @param buffer A buffer containing the code, up to size length. Client.

    Parameters

    • account: bigint
    • offset: number
    • length: number

    Returns Promise<Buffer> | Buffer

Abstract emitLog

  • emitLog(address: bigint, data: Buffer, topics: Array<bigint>): Promise<void> | void
  • Log callback function.

    This callback function is used by an EVM to inform about a LOG that happened during an EVM bytecode execution. @param address The address of the contract that generated the log. @param data The buffer to unindexed data attached to the log. @param topics An array of topics attached to the log.

    Parameters

    • address: bigint
    • data: Buffer
    • topics: Array<bigint>

    Returns Promise<void> | void

execute

  • Executes the given EVM bytecode using the input in the message

    Parameters

    • message: EvmcMessage
    • code: Buffer

      Reference to the bytecode to be executed.

    • Default value revision: EvmcRevision = EvmcRevision.EVMC_MAX_REVISION

    Returns EvmcResult

Abstract getAccountExists

  • getAccountExists(address: bigint): Promise<boolean> | boolean
  • Check account existence callback function.

    This callback function is used by the VM to check if there exists an account at given address.

    Parameters

    • address: bigint

      The address of the account the query is about.

    Returns Promise<boolean> | boolean

    true if exists, false otherwise.

Abstract getBalance

  • getBalance(account: bigint): Promise<bigint> | bigint
  • Get balance callback function.

    This callback function is used by a VM to query the balance of the given account.

    Parameters

    • account: bigint

    Returns Promise<bigint> | bigint

    The balance of the given account or 0 if the account does not exist.

Abstract getBlockHash

  • getBlockHash(num: bigint): Promise<bigint> | bigint
  • Get block hash callback function.

    This callback function is used by a VM to query the hash of the header of the given block. If the information about the requested block is not available, then this is signalled by returning null bytes.

    Parameters

    • num: bigint

      The block number.

    Returns Promise<bigint> | bigint

    The block hash or null bytes if the information about the block is not available.

Abstract getCodeHash

  • getCodeHash(address: bigint): Promise<bigint> | bigint
  • Get code hash callback function.

    This callback function is used by a VM to get the keccak256 hash of the code stored in the account at the given address. For existing accounts not having a code, this function returns keccak256 hash of empty data.

    Parameters

    • address: bigint

      The address of the account.

    Returns Promise<bigint> | bigint

    The hash of the code in the account or null bytes if the account does not exist.

Abstract getCodeSize

  • getCodeSize(address: bigint): Promise<bigint> | bigint
  • Get code size callback function.

    This callback function is used by a VM to get the size of the code stored in the account at the given address.

    Parameters

    • address: bigint

      The address of the account.

    Returns Promise<bigint> | bigint

    The size of the code in the account or 0 if the account does not exist.

Abstract getStorage

  • getStorage(account: bigint, key: bigint): Promise<bigint> | bigint
  • Get storage callback function.

    This callback function is used by a VM to query the given account storage entry.

    Parameters

    • account: bigint
    • key: bigint

      The index of the account's storage entry.

    Returns Promise<bigint> | bigint

    The storage value at the given storage key or null bytes if the account does not exist.

Abstract getTxContext

  • Get transaction context callback function.

    This callback function is used by an EVM to retrieve the transaction and block context.

    @return The transaction context.

    Returns Promise<EvmcTxContext> | EvmcTxContext

release

  • release(): void
  • Releases all resources from this EVM. Once released, you may no longer call execute.

    Returns void

Abstract selfDestruct

  • selfDestruct(address: bigint, beneficiary: bigint): Promise<void> | void
  • Selfdestruct callback function.

    This callback function is used by an EVM to SELFDESTRUCT given contract. The execution of the contract will not be stopped, that is up to the EVM.

    @param address The address of the contract to be selfdestructed. @param beneficiary The address where the remaining ETH is going to be transferred.

    Parameters

    • address: bigint
    • beneficiary: bigint

    Returns Promise<void> | void

Abstract setStorage

  • Set storage callback function.

    This callback function is used by a VM to update the given account storage entry. The VM MUST make sure that the account exists. This requirement is only a formality because VM implementations only modify storage of the account of the current execution context (i.e. referenced by evmc_message::destination).

    Parameters

    • account: bigint
    • key: bigint

      The index of the storage entry.

    • value: bigint

      The value to be stored.

    Returns Promise<EvmcStorageStatus> | EvmcStorageStatus

    The effect on the storage item.

Generated using TypeDoc