evm v0.1.14 EVM.ExecEnv

Stores information about the execution environment which led to this EVM being called. This is, for instance, the sender of a payment or message to a contract, or a sub-contract call.

We’ve added our interfaces for interacting with contracts and accounts to this struct as well.

This generally relates to I in the Yellow Paper, defined in Section 9.3.

Link to this section Summary

Link to this section Types

Link to this type t()
t() :: %EVM.ExecEnv{account_interface: EVM.Interface.AccountInterface.t, address: EVM.address, block_interface: EVM.Interface.BlockInterface.t, data: binary, gas_price: EVM.Gas.gas_price, machine_code: EVM.MachineCode.t, originator: EVM.address, sender: EVM.address, stack_depth: integer, value_in_wei: EVM.Wei.t}

Link to this section Functions

Link to this function exec_env_for_message_call(recipient, originator, gas_price, data, sender, value_in_wei, stack_depth, machine_code, block_interface, account_interface)

Returns the base execution environment for a message call. This is generally defined as equations 107-114 in the Yellow Paper.

TODO: Machine code may be passed in as a hash TODO: How is block header passed in?

TODO: Examples

Link to this function get_storage(exec_env, key)
get_storage(ExecEnv.t, integer) ::
  {:ok, integer} |
  :account_not_found |
  :key_not_found
Link to this function put_storage(exec_env, key, value)
put_storage(ExecEnv.t, integer, integer) :: ExecEnv.t
Link to this function suicide_account(exec_env)
suicide_account(ExecEnv.t) :: ExecEnv.t
Link to this function tranfer_wei_to(exec_env, to, value)