diff --git a/rebar.config b/rebar.config index 043dc58..ac0d491 100644 --- a/rebar.config +++ b/rebar.config @@ -2,7 +2,7 @@ {erl_opts, [debug_info]}. -{deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", {ref,"e7f2be7"}}} +{deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", {ref,"72b2a58"}}} , {getopt, "1.0.1"} , {eblake2, "1.0.0"} , {jsx, {git, "https://github.com/talentdeficit/jsx.git", diff --git a/rebar.lock b/rebar.lock index 924dffc..4e9247b 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,17 +1,21 @@ {"1.1.0", [{<<"aebytecode">>, {git,"https://github.com/aeternity/aebytecode.git", - {ref,"e7f2be7ce878b1e22bad287f3342f32579e98599"}}, + {ref,"72b2a581d5a6d488a208331da88de1a488ac2da1"}}, 0}, {<<"aeserialization">>, {git,"https://github.com/aeternity/aeserialization.git", - {ref,"816bf994ffb5cee218c3f22dc5fea296c9e0882e"}}, + {ref,"47aaa8f5434b365c50a35bfd1490340b19241991"}}, 1}, {<<"base58">>, {git,"https://github.com/aeternity/erl-base58.git", {ref,"60a335668a60328a29f9731b67c4a0e9e3d50ab6"}}, 2}, {<<"eblake2">>,{pkg,<<"eblake2">>,<<"1.0.0">>},0}, + {<<"enacl">>, + {git,"https://github.com/aeternity/enacl.git", + {ref,"26180f42c0b3a450905d2efd8bc7fd5fd9cece75"}}, + 2}, {<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0}, {<<"jsx">>, {git,"https://github.com/talentdeficit/jsx.git", diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index 5e58a45..ea9c1ae 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -443,7 +443,7 @@ global_env() -> { funs = MkDefs( [{"resolve", Fun([String, String], option_t(Ann, A))}, {"preclaim", SignFun([Address, Hash], Unit)}, - {"claim", SignFun([Address, String, Int], Unit)}, + {"claim", SignFun([Address, String, Int, Int], Unit)}, {"transfer", SignFun([Address, Address, String], Unit)}, {"revoke", SignFun([Address, String], Unit)}]) }, diff --git a/src/aeso_ast_to_fcode.erl b/src/aeso_ast_to_fcode.erl index 3f0c960..29473e7 100644 --- a/src/aeso_ast_to_fcode.erl +++ b/src/aeso_ast_to_fcode.erl @@ -185,7 +185,7 @@ builtins() -> {["Oracle"], [{"register", 4}, {"query_fee", 1}, {"query", 5}, {"get_question", 2}, {"respond", 4}, {"extend", 3}, {"get_answer", 2}, {"check", 1}, {"check_query", 2}]}, - {["AENS"], [{"resolve", 2}, {"preclaim", 3}, {"claim", 4}, {"transfer", 4}, + {["AENS"], [{"resolve", 2}, {"preclaim", 3}, {"claim", 5}, {"transfer", 4}, {"revoke", 3}]}, {["Map"], [{"from_list", 1}, {"to_list", 1}, {"lookup", 2}, {"lookup_default", 3}, {"delete", 2}, {"member", 2}, {"size", 1}]}, @@ -1600,4 +1600,3 @@ pp_pat(Pat) -> pp_fexpr(Pat). is_infix(Op) -> C = hd(atom_to_list(Op)), C < $a orelse C > $z. - diff --git a/src/aeso_ast_to_icode.erl b/src/aeso_ast_to_icode.erl index c245e29..38bba87 100644 --- a/src/aeso_ast_to_icode.erl +++ b/src/aeso_ast_to_icode.erl @@ -270,10 +270,10 @@ ast_body(?qid_app(["AENS", "preclaim"], Args, _, _), Icode) -> [word, word, sign_t()], {tuple, []}); ast_body(?qid_app(["AENS", "claim"], Args, _, _), Icode) -> - {Sign, [Addr, Name, Salt]} = get_signature_arg(Args), + {Sign, [Addr, Name, Salt, NameFee]} = get_signature_arg(Args), prim_call(?PRIM_CALL_AENS_CLAIM, #integer{value = 0}, - [ast_body(Addr, Icode), ast_body(Name, Icode), ast_body(Salt, Icode), ast_body(Sign, Icode)], - [word, string, word, sign_t()], {tuple, []}); + [ast_body(Addr, Icode), ast_body(Name, Icode), ast_body(Salt, Icode), ast_body(NameFee, Icode), ast_body(Sign, Icode)], + [word, string, word, word, sign_t()], {tuple, []}); ast_body(?qid_app(["AENS", "transfer"], Args, _, _), Icode) -> {Sign, [FromAddr, ToAddr, Name]} = get_signature_arg(Args), diff --git a/src/aeso_fcode_to_fate.erl b/src/aeso_fcode_to_fate.erl index eadd9dd..304ffdb 100644 --- a/src/aeso_fcode_to_fate.erl +++ b/src/aeso_fcode_to_fate.erl @@ -557,8 +557,8 @@ builtin_to_scode(Env, aens_resolve, [_Name, _Key, _Type] = Args) -> builtin_to_scode(Env, aens_preclaim, [_Sign, _Account, _Hash] = Args) -> call_to_scode(Env, [aeb_fate_ops:aens_preclaim(?a, ?a, ?a), tuple(0)], Args); -builtin_to_scode(Env, aens_claim, [_Sign, _Account, _NameString, _Salt] = Args) -> - call_to_scode(Env, [aeb_fate_ops:aens_claim(?a, ?a, ?a, ?a), +builtin_to_scode(Env, aens_claim, [_Sign, _Account, _NameString, _Salt, _NameFee] = Args) -> + call_to_scode(Env, [aeb_fate_ops:aens_claim(?a, ?a, ?a, ?a, ?a), tuple(0)], Args); builtin_to_scode(Env, aens_transfer, [_Sign, _From, _To, _Name] = Args) -> call_to_scode(Env, [aeb_fate_ops:aens_transfer(?a, ?a, ?a, ?a), @@ -883,7 +883,7 @@ attributes(I) -> {'ORACLE_QUERY_FEE', A, B} -> Impure(A, [B]); {'AENS_RESOLVE', A, B, C, D} -> Impure(A, [B, C, D]); {'AENS_PRECLAIM', A, B, C} -> Impure(none, [A, B, C]); - {'AENS_CLAIM', A, B, C, D} -> Impure(none, [A, B, C, D]); + {'AENS_CLAIM', A, B, C, D, E} -> Impure(none, [A, B, C, D, E]); 'AENS_UPDATE' -> Impure(none, []);%% TODO {'AENS_TRANSFER', A, B, C, D} -> Impure(none, [A, B, C, D]); {'AENS_REVOKE', A, B, C} -> Impure(none, [A, B, C]); @@ -1571,4 +1571,3 @@ drop_common_suffix_r([X | Xs], [X | Ys]) -> drop_common_suffix_r(Xs, Ys); drop_common_suffix_r(Xs, Ys) -> {lists:reverse(Xs), lists:reverse(Ys)}. - diff --git a/test/contracts/aens.aes b/test/contracts/aens.aes index 9d5e063..ee1ba27 100644 --- a/test/contracts/aens.aes +++ b/test/contracts/aens.aes @@ -22,14 +22,16 @@ contract AENSTest = stateful entrypoint claim(addr : address, name : string, - salt : int) : unit = - AENS.claim(addr, name, salt) + salt : int, + name_fee : int) : unit = + AENS.claim(addr, name, salt, name_fee) stateful entrypoint signedClaim(addr : address, name : string, salt : int, + name_fee : int, sign : signature) : unit = - AENS.claim(addr, name, salt, signature = sign) + AENS.claim(addr, name, salt, name_fee, signature = sign) // TODO: update() -- how to handle pointers? @@ -52,4 +54,3 @@ contract AENSTest = name : string, sign : signature) : unit = AENS.revoke(owner, name, signature = sign) -