-
Notifications
You must be signed in to change notification settings - Fork 22
/
OracleDelegation.aes
31 lines (25 loc) · 1.47 KB
/
OracleDelegation.aes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@compiler >= 6
contract OracleDelegation =
stateful payable entrypoint register_oracle(acct : address,
sign : signature,
qfee : int,
ttl : Chain.ttl) : oracle(string, string) =
Oracle.register(acct, qfee, ttl, signature = sign)
stateful payable entrypoint extend_oracle(o : oracle(string, string),
sign : signature,
ttl : Chain.ttl) =
Oracle.extend(o, signature = sign, ttl)
payable stateful entrypoint create_query(o : oracle(string, string),
q : string,
qttl : Chain.ttl,
rttl : Chain.ttl) : oracle_query(string, string) =
require(Oracle.check(o), "oracle not valid")
require(Call.value =< Oracle.query_fee(o), "insufficient value for qfee")
Oracle.query(o, q, Oracle.query_fee(o), qttl, rttl)
stateful entrypoint respond(o : oracle(string, string),
q : oracle_query(string, string),
sign : signature,
r : string) =
Oracle.respond(o, q, signature = sign, r)
entrypoint query_fee(o : oracle(string, string)) : int =
Oracle.query_fee(o)