-
Notifications
You must be signed in to change notification settings - Fork 1
/
michelson-buffer.tz
136 lines (136 loc) · 2.43 KB
/
michelson-buffer.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
parameter (or (pair %inject_randomness (string %randomness) (nat %request_id)) (unit %request_randomness));
storage (pair (big_map %buffer nat (pair (address %requester) (timestamp %timestamp))) (pair (address %oracle) (nat %request_id)));
code
{
DUP;
CDR;
SWAP;
CAR;
IF_LEFT
{
DUP;
CAR;
SIZE;
PUSH nat 0;
SWAP;
PUSH nat 0;
DUP;
DIG 2;
DUP;
DUG 3;
COMPARE;
GT;
LOOP
{
PUSH (map string nat) {Elt 0 0; Elt 1 1; Elt 2 2; Elt 3 3; Elt 4 4; Elt 5 5; Elt 6 6; Elt 7 7; Elt 8 8; Elt 9 9};
DIG 4;
DUP;
DUG 5;
CAR;
PUSH nat 1;
DIG 3;
DUP;
DUG 4;
SLICE;
IF_SOME
{}
{
PUSH int 47;
FAILWITH;
};
GET;
IF_SOME
{}
{
PUSH int 47;
FAILWITH;
};
DIG 3;
PUSH nat 10;
MUL;
ADD;
DUG 2;
PUSH nat 1;
ADD;
DUP;
DIG 2;
DUP;
DUG 3;
COMPARE;
GT;
};
DROP 2;
NIL operation;
DIG 3;
DUP;
DUG 4;
CAR;
DIG 3;
DUP;
DUG 4;
CDR;
GET;
IF_SOME
{}
{
PUSH int 38;
FAILWITH;
};
CAR;
CONTRACT nat;
IF_SOME
{}
{
PUSH int 38;
FAILWITH;
};
PUSH mutez 0;
DIG 3;
TRANSFER_TOKENS;
CONS;
DIG 2;
DUP;
CDR;
SWAP;
CAR;
NONE (pair (address %requester) (timestamp %timestamp));
DIG 4;
CDR;
UPDATE;
PAIR;
SWAP;
}
{
DROP;
DUP;
CAR;
SWAP;
CDR;
DUP;
CAR;
SWAP;
CDR;
PUSH nat 1;
ADD;
SWAP;
PAIR;
SWAP;
PAIR;
DUP;
DUP;
CDR;
SWAP;
CAR;
DIG 2;
CDDR;
NOW;
SENDER;
PAIR;
SOME;
SWAP;
UPDATE;
PAIR;
NIL operation;
};
PAIR;
};