From 98fe2fda5e1bfcc3739d03d0488a4b9c2b0518a7 Mon Sep 17 00:00:00 2001 From: Tobias Lindahl Date: Thu, 20 Jun 2019 14:13:51 +0200 Subject: [PATCH] Introduce AENS instructions in FATE --- src/aeb_fate_generate_ops.erl | 14 +++++++------- test/aeb_fate_asm_test.erl | 1 + test/asm_code/names.fate | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 test/asm_code/names.fate diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 9423bbb..21364c9 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -149,13 +149,13 @@ ops_defs() -> , { 'ORACLE_GET_ANSWER', 16#65, false, false, 3, [a,a,a,a,a], oracle_get_answer, {oracle, oracle_query, typerep, typerep}, any, "Arg0 := option variant with answer (if any) from oracle query in Arg1 given by oracle Arg0. Typereps for checking oracle type is in Arg3 and Arg4."} , { 'ORACLE_GET_QUESTION', 16#66, false, false, 3, [a,a,a,a,a], oracle_get_question, {oracle, oracle_query, typerep, typerep}, any, "Arg0 := question in oracle query Arg2 given to oracle Arg1. Typereps for checking oracle type is in Arg3 and Arg4."} , { 'ORACLE_QUERY_FEE', 16#67, false, false, 3, [a,a], oracle_query_fee, {oracle}, integer, "Arg0 := query fee for oracle Arg1"} - , { 'AENS_RESOLVE', 16#68, false, false, 3, [], aens_resolve, {}, none, "NYI"} - , { 'AENS_PRECLAIM', 16#69, false, false, 3, [], aens_preclaim, {}, none, "NYI"} - , { 'AENS_CLAIM', 16#6a, false, false, 3, [], aens_claim, {}, none, "NYI"} - , { 'AENS_UPDATE', 16#6b, false, false, 3, [], aend_update, {}, none, "NYI"} - , { 'AENS_TRANSFER', 16#6c, false, false, 3, [], aens_transfer, {}, none, "NYI"} - , { 'AENS_REVOKE', 16#6d, false, false, 3, [], aens_revoke, {}, none, "NYI"} - , { 'BALANCE_OTHER', 16#6e, false, true, 3, [a,a], balance_other, {address}, integer, "Arg0 := The balance of address Arg1."} + , { 'AENS_RESOLVE', 16#68, false, false, 3, [a,a,a,a], aens_resolve, {string, string, typerep}, variant, "Resolve name in Arg0 with tag Arg1. Arg2 describes the type parameter of the resolved name."} + , { 'AENS_PRECLAIM', 16#69, false, false, 3, [a,a,a], aens_preclaim, {signature, address, hash}, none, "Preclaim the hash in Arg2 for address in Arg1. Arg0 contains delegation signature."} + , { 'AENS_CLAIM', 16#6a, false, false, 3, [a,a,a,a], aens_claim, {signature, address, string, integer}, none, "Claim the name in Arg2 for address in Arg1. Arg3 contains the salt used to hash the preclaim. Arg0 contains delegation signature."} + , { 'AENS_UPDATE', 16#6b, false, false, 3, [], aens_update, {}, none, "NYI"} + , { 'AENS_TRANSFER', 16#6c, false, false, 3, [a,a,a,a], aens_transfer, {signature, address, address, name}, none, "Transfer ownership of name Arg3 from account Arg1 to Arg2. Arg0 contains delegation signature."} + , { 'AENS_REVOKE', 16#6d, false, false, 3, [a,a,a], aens_revoke, {signature, address, name}, none, "Revoke the name in Arg2 from owner Arg1. Arg0 contains delegation signature."} + , { 'BALANCE_OTHER', 16#6e, false, true, 3, [a,a], balance_other, {address}, integer, "Arg0 := The balance of address Arg1."} %% TODO: Reorder these before documenting the specification , { 'MAP_SIZE', 16#6f, false, true, 3, [a,a], map_size_, {map}, integer, "Arg0 := The size of the map Arg1."} , { 'MAP_TO_LIST', 16#70, false, true, 3, [a,a], map_to_list, {map}, list, "Arg0 := The tuple list representation of the map Arg1."} diff --git a/test/aeb_fate_asm_test.erl b/test/aeb_fate_asm_test.erl index 42df184..9e9cb95 100644 --- a/test/aeb_fate_asm_test.erl +++ b/test/aeb_fate_asm_test.erl @@ -47,6 +47,7 @@ sources() -> , "tuple" , "mapofmap" , "immediates" + , "names" , "oracles" %% , "all_instructions" ]. diff --git a/test/asm_code/names.fate b/test/asm_code/names.fate new file mode 100644 index 0000000..12475dd --- /dev/null +++ b/test/asm_code/names.fate @@ -0,0 +1,23 @@ +;; CONTRACT names + +FUNCTION preclaim(address, hash) : {tuple, []} + AENS_PRECLAIM $sg_11111111111111111111111111111111111111111111111111111111111111116oUsJe arg0 arg1 + RETURNR {} + +FUNCTION claim(address, string, integer) : {tuple, []} + AENS_CLAIM $sg_11111111111111111111111111111111111111111111111111111111111111116oUsJe arg0 arg1 arg2 + RETURNR {} + +FUNCTION transfer(address, address, name) : {tuple, []} + AENS_TRANSFER $sg_11111111111111111111111111111111111111111111111111111111111111116oUsJe arg0 arg1 arg2 + RETURNR {} + +FUNCTION revoke(address, name) : {tuple, []} + AENS_PRECLAIM $sg_11111111111111111111111111111111111111111111111111111111111111116oUsJe arg0 arg1 + RETURNR {} + +FUNCTION resolve(string, string) : {variant, [{tuple, []}, {tuple, [address]}]} + AENS_RESOLVE a arg0 arg1 'address + RETURN + +