Check stateful annotations #560
@ -1,99 +0,0 @@
|
||||
contract Oracles =
|
||||
|
||||
function registerOracle :
|
||||
(address,
|
||||
int,
|
||||
Chain.ttl) => oracle(string, int)
|
||||
|
||||
function createQuery :
|
||||
(oracle(string, int),
|
||||
string,
|
||||
int,
|
||||
Chain.ttl,
|
||||
Chain.ttl) => oracle_query(string, int)
|
||||
|
||||
function unsafeCreateQuery :
|
||||
(oracle(string, int),
|
||||
string,
|
||||
int,
|
||||
Chain.ttl,
|
||||
Chain.ttl) => oracle_query(string, int)
|
||||
|
||||
function respond :
|
||||
(oracle(string, int),
|
||||
oracle_query(string, int),
|
||||
int) => ()
|
||||
|
||||
contract OraclesErr =
|
||||
|
||||
function unsafeCreateQueryThenErr :
|
||||
(oracle(string, int),
|
||||
string,
|
||||
int,
|
||||
Chain.ttl,
|
||||
Chain.ttl) => oracle_query(string, int)
|
||||
|
||||
contract RemoteOracles =
|
||||
|
||||
public function callRegisterOracle(
|
||||
r : Oracles,
|
||||
acct : address,
|
||||
qfee : int,
|
||||
ttl : Chain.ttl) : oracle(string, int) =
|
||||
r.registerOracle(acct, qfee, ttl)
|
||||
|
||||
public function callCreateQuery(
|
||||
r : Oracles,
|
||||
value : int,
|
||||
o : oracle(string, int),
|
||||
q : string,
|
||||
qfee : int,
|
||||
qttl : Chain.ttl,
|
||||
rttl : Chain.ttl) : oracle_query(string, int) =
|
||||
require(value =< Call.value, "insufficient value")
|
||||
r.createQuery(value = value, o, q, qfee, qttl, rttl)
|
||||
|
||||
// Do not use in production!
|
||||
public function callUnsafeCreateQuery(
|
||||
r : Oracles,
|
||||
value : int,
|
||||
o : oracle(string, int),
|
||||
q : string,
|
||||
qfee : int,
|
||||
qttl : Chain.ttl,
|
||||
rttl : Chain.ttl) : oracle_query(string, int) =
|
||||
r.unsafeCreateQuery(value = value, o, q, qfee, qttl, rttl)
|
||||
|
||||
// Do not use in production!
|
||||
public function callUnsafeCreateQueryThenErr(
|
||||
r : OraclesErr,
|
||||
value : int,
|
||||
o : oracle(string, int),
|
||||
q : string,
|
||||
qfee : int,
|
||||
qttl : Chain.ttl,
|
||||
rttl : Chain.ttl) : oracle_query(string, int) =
|
||||
r.unsafeCreateQueryThenErr(value = value, o, q, qfee, qttl, rttl)
|
||||
|
||||
// Do not use in production!
|
||||
public function callUnsafeCreateQueryAndThenErr(
|
||||
r : Oracles,
|
||||
value : int,
|
||||
o : oracle(string, int),
|
||||
q : string,
|
||||
qfee : int,
|
||||
qttl : Chain.ttl,
|
||||
rttl : Chain.ttl) : oracle_query(string, int) =
|
||||
let x = r.unsafeCreateQuery(value = value, o, q, qfee, qttl, rttl)
|
||||
switch(0) 1 => ()
|
||||
x // Never reached.
|
||||
|
||||
public function callRespond(
|
||||
r : Oracles,
|
||||
o : oracle(string, int),
|
||||
q : oracle_query(string, int),
|
||||
qr : int) =
|
||||
r.respond(o, q, qr)
|
||||
|
||||
private function require(b : bool, err : string) =
|
||||
if(!b) abort(err)
|
Loading…
x
Reference in New Issue
Block a user