An Ethereum VM in Cartouche, that can only execute pure functions.
Summary
Functions
Executes the Ethereum Virtual Machine (EVM) with the given code and input.
Runs the given EVM, returning the RETURN data or the REVERT data.
Types
@type address() :: <<_::160>>
@type code() :: [opcode()]
@type context_result() :: {:ok, Cartouche.VM.Context.t()} | {:error, vm_error()}
@type opcode() :: Cartouche.Assembly.opcode()
@type signed() :: integer()
@type unsigned() :: non_neg_integer()
@type word() :: <<_::256>>
Functions
@spec exec(code() | binary(), binary(), exec_opts()) :: {:ok, Cartouche.VM.ExecutionResult.t()} | {:error, vm_error()}
Executes the Ethereum Virtual Machine (EVM) with the given code and input.
Parameters
code: The bytecode to be executed, either as abinaryor decoded.calldata: The call data for the execution.opts: Execution options (see below)
Options
:callvalue: value passed as callvalue for the execution.:ffis: A mapping of address to functions to run as natively implemented ffis
Returns the result of the execution.
Runs the given EVM, returning the RETURN data or the REVERT data.
Raises on any other exceptional state.
Parameters
code: The bytecode to be executed, either as abinaryor decoded.calldata: The call data for the execution.opts: Execution options (see below)
Options
:callvalue: value passed as callvalue for the execution.:ffis: A mapping of address to functions to run as natively implemented ffis