anchor.diff:  -export([call/3]).
   
   -include_lib("aebytecode/include/aeb_opcodes.hrl").
  +
  +-record(chain, {api, state}).
   
   -define(BASE_ADDRESS, 32). %% Byte offset for data
   
  
positive.code:     {error, out_of_gas}.
  
  call_chain1(Callback, State) ->
      ChainAPI   = aevm_eeevm_state:chain_api(State),
      ChainState = aevm_eeevm_state:chain_state(State),
      Callback(ChainAPI, ChainState).
  
  query_chain(Callback, State) ->
      case call_chain1(Callback, State) of
          {ok, Res} ->
              Return = {ok, aeso_data:to_binary(Res, 0)},
              {ok, Return, 0, State};
          {error, _} = Err -> Err
      end.
  
  
negative.code:       StateOut :: State,
        State :: aevm_eeevm_state:state(),
        ReturnValue :: {ok, binary()} | {error, any()}.
  call(Value, Data, StateIn) ->
      ChainIn = #chain{api = aevm_eeevm_state:chain_api(StateIn),
                       state = aevm_eeevm_state:chain_state(StateIn)},
      case call_(Value, Data, ChainIn) of
          {ok, ReturnValue, GasSpent, ChainStateOut} ->
              StateOut = aevm_eeevm_state:set_chain_state(ChainStateOut, StateIn),
              {ok, ReturnValue, GasSpent, StateOut};
          {error, _} = Err ->
              ?TEST_LOG("Primop call error ~p~n~p:~p(~p, ~p, State)",
                        [Err, ?MODULE, ?FUNCTION_NAME, Value, Data]),
  