-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnat_oracle.tz
64 lines (64 loc) · 2.55 KB
/
nat_oracle.tz
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
parameter (or (pair :get_value (unit %unit)
(contract %callback_contract (pair timestamp
nat)))
(or (pair %update_value (timestamp %value_timestamp)
(nat %value))
(address %update_admin)));
storage (pair (pair timestamp
nat)
address);
code { CAST (pair (or (pair unit (contract (pair timestamp nat))) (or (pair timestamp nat) address)) (pair (pair timestamp nat) address));
DUP;
CAR;
DIP { CDR };
IF_LEFT { DUP;
CAR;
DIP { CDR };
DIP { DIP { DUP };
SWAP };
PAIR;
CDR;
CAR;
DIP { AMOUNT };
TRANSFER_TOKENS;
NIL operation;
SWAP;
CONS;
PAIR }
{ IF_LEFT { DIP { DUP;
CAR;
DIP { CDR } };
DIP { DUP };
DUP;
DIP { SWAP };
CAR;
DIP { CAR };
COMPARE;
GT;
IF { }
{ PUSH string "not newer";
FAILWITH };
DIP { DROP;
DUP;
DIP { SENDER;
COMPARE;
EQ;
IF { }
{ PUSH string "only admin may update";
FAILWITH } } };
PAIR;
NIL operation;
PAIR }
{ DIP { DUP;
CAR;
DIP { CDR };
DIP { SENDER;
COMPARE;
EQ;
IF { }
{ PUSH string "only admin may update";
FAILWITH } } };
SWAP;
PAIR;
NIL operation;
PAIR } } };