Add AENS.lookup

Also move Pointee-constructors inside AENS namespace.
This commit is contained in:
Hans Svensson
2020-02-03 12:52:00 +01:00
parent db01e237c1
commit c3426f0e65
5 changed files with 46 additions and 16 deletions
+2 -1
View File
@@ -154,6 +154,7 @@ compilable_contracts() ->
"bytes_to_x",
"bytes_concat",
"aens",
"aens_update",
"tuple_match",
"cyclic_include",
"stdlib_include",
@@ -170,7 +171,7 @@ compilable_contracts() ->
].
not_yet_compilable(fate) -> [];
not_yet_compilable(aevm) -> ["pairing_crypto"].
not_yet_compilable(aevm) -> ["pairing_crypto", "aens_update"].
%% Contracts that should produce type errors
+17
View File
@@ -0,0 +1,17 @@
contract AENSUpdate =
stateful entrypoint update_name(owner : address, name : string) =
let p1 : AENS.pointee = AENS.AccountPt(Call.caller)
let p2 : AENS.pointee = AENS.OraclePt(Call.caller)
let p3 : AENS.pointee = AENS.ContractPt(Call.caller)
let p4 : AENS.pointee = AENS.ChannelPt(Call.caller)
AENS.update(owner, name, None, None,
Some({ ["account_pubkey"] = p1, ["oracle_pubkey"] = p2,
["contract_pubkey"] = p3, ["misc"] = p4 }))
entrypoint get_ttl(name : string) =
switch(AENS.lookup(name))
Some(AENS.Name(_, FixedTTL(ttl), _)) => ttl
entrypoint expiry(o : oracle(int, int)) : int =
Oracle.expiry(o)