anchor.diff:  sophia_typed_calls(_Cfg) ->
       state(aect_test_utils:new_state()),
       Acc    = ?call(new_account, 20000000),
  -    Server = ?call(create_contract, Acc, multiplication_server, {}),
  +    Server = ?call(create_contract, Acc, multiplication_server, {}, #{amount => 0}),
       Client = ?call(create_contract, Acc, contract_types, Server, #{amount => 1000}),
       2      = ?call(call_contract, Acc, Client, get_n, word, {}),
       {}     = ?call(call_contract, Acc, Client, square, {tuple, []}, {}),
  
positive.code:     <<_:1, Large:255>>   = list_to_binary(lists:duplicate(32, $o)),
  
      %% Does an arbitrary precision number fit in a signed 256 bit integer?
      IsSafe = fun(X) -> <<Y:256/signed-integer>> = <<X:256/signed-integer>>, X == Y end,
  
      %% Reference implementation of ^
      ErrorVal = 1 bsl 260,
  
negative.code:         Z   = Op(X, Y),
          Res = ?call(call_contract, Acc, C, Fun, signed_word, {X, Y}),
          Exp = case IsSafe(Z) of
                  true  -> Fix(Z);                         %% If safe we should get back the right answer
                  false -> {error, <<"arithmetic_error">>}  %% otherwise out of gas (no wrap-arounds!)
                end,
          ?assertMatch({_, _, _, {A, A}}, {Fun, X, Y, {Exp, Res}})
        end || {Fun, Op} <- Ops, X <- Values, Y <- Values ],
  
      ok.
  
  sophia_safe_math_old() ->
      state(aect_test_utils:new_state()),
      Acc = ?call(new_account, 1000000000000),
      C   = ?call(create_contract, Acc, safe_math, {}),
  
      <<Medium:17/unit:8>> = list_to_binary(lists:duplicate(17, $x)),
      <<_:1, Large:255>>   = list_to_binary(lists:duplicate(32, $o)),
  
      Signed = fun(Z) -> <<Y:256/signed-integer>> = <<Z:256/unsigned-integer>>, Y end,
  
      %% Reference implementation of ^
      Mask = fun(X) -> X rem (1 bsl 512 - 1 bsl 263 - 17) end,
      Pow = fun Pow(1, _, _) -> 1;
                Pow(_, B, _) when B < 0 -> 0;
                Pow(_, 0, R) -> R;                %% mask to not blow up
                Pow(A, B, R) when B rem 2 == 0 -> Pow(Mask(A * A), B bsr 1, R);
                Pow(A, B, R)                   -> Pow(Mask(A * A), B bsr 1, R * A)
            end,
  
      %% Test vectors
      Values = [ Z || X <- [1, 2, 5, 173, 255, 256, 1 bsl 128 - 1, 1 bsl 128, Medium, 1 bsl 255 - 2,
                            1 bsl 255 - 1, 1 bsl 255, Large],
                      Z <- [X, -X], Z < 1 bsl 255 ],
      Ops    = [{add, fun erlang:'+'/2}, {sub,   fun erlang:'-'/2},
                {mul, fun erlang:'*'/2}, {'div', fun erlang:'div'/2},
                {pow, fun(X, Y) -> Pow(X, Y, 1) end}],
  
      [ begin
          Exp = Signed(Op(X, Y)),
          Res = ?call(call_contract, Acc, C, Fun, signed_word, {X, Y}),
          ?assertMatch({_, _, _, {A, A}}, {Fun, X, Y, {Exp, Res}})
        end || {Fun, Op} <- Ops, X <- Values, Y <- Values ],
  
  