Fix calldata creation for contracts involving oracles #525

Merged
zxq9 merged 7 commits from fix_create_calldata_again_again into master 2019-03-01 23:03:52 +09:00
2 changed files with 2 additions and 0 deletions
Showing only changes of commit 3efde2a2a1 - Show all commits

View File

@ -1655,6 +1655,7 @@ unify1(_Env, A, B, When) ->
Kind = fun({qcon, _, _}) -> con;
({con, _, _}) -> con;
({id, _, "address"}) -> addr;
({id, _, "hash"}) -> hash;
({app_t, _, {id, _, "oracle"}, _}) -> oracle;
({app_t, _, {id, _, "oracle_query"}, _}) -> query;
(_) -> other end,

View File

@ -97,6 +97,7 @@ calldata_test() ->
Map = #{ <<"a">> => 4 },
[{variant, 1, [Map]}, {{<<"b">>, 5}, {variant, 0, []}}] =
encode_decode_calldata("foo", ["variant", "r"], ["Blue({[\"a\"] = 4})", "{x = (\"b\", 5), y = Red}"]),
[16#123, 16#456] = encode_decode_calldata("foo", ["hash", "address"], ["#123", "#456"]),
ok.
calldata_init_test() ->