-
Notifications
You must be signed in to change notification settings - Fork 14
/
vote_approval.teal
138 lines (138 loc) · 1.52 KB
/
vote_approval.teal
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
137
138
#pragma version 2
txn ApplicationID
int 0
==
bnz main_l18
txn OnCompletion
int DeleteApplication
==
bnz main_l17
txn OnCompletion
int UpdateApplication
==
bnz main_l16
txn OnCompletion
int CloseOut
==
bnz main_l13
txn OnCompletion
int OptIn
==
bnz main_l12
txna ApplicationArgs 0
byte "vote"
==
bnz main_l7
err
main_l7:
global Round
byte "VoteBegin"
app_global_get
>=
global Round
byte "VoteEnd"
app_global_get
<=
&&
bnz main_l9
err
main_l9:
int 0
global CurrentApplicationID
byte "voted"
app_local_get_ex
store 1
store 0
load 1
bnz main_l11
txna ApplicationArgs 1
txna ApplicationArgs 1
app_global_get
int 1
+
app_global_put
int 0
byte "voted"
txna ApplicationArgs 1
app_local_put
int 1
return
main_l11:
int 0
return
main_l12:
global Round
byte "RegBegin"
app_global_get
>=
global Round
byte "RegEnd"
app_global_get
<=
&&
return
main_l13:
int 0
global CurrentApplicationID
byte "voted"
app_local_get_ex
store 1
store 0
global Round
byte "VoteEnd"
app_global_get
<=
load 1
&&
bnz main_l15
main_l14:
int 1
return
main_l15:
load 0
load 0
app_global_get
int 1
-
app_global_put
b main_l14
main_l16:
txn Sender
byte "Creator"
app_global_get
==
return
main_l17:
txn Sender
byte "Creator"
app_global_get
==
return
main_l18:
byte "Creator"
txn Sender
app_global_put
txn NumAppArgs
int 4
==
bnz main_l20
err
main_l20:
byte "RegBegin"
txna ApplicationArgs 0
btoi
app_global_put
byte "RegEnd"
txna ApplicationArgs 1
btoi
app_global_put
byte "VoteBegin"
txna ApplicationArgs 2
btoi
app_global_put
byte "VoteEnd"
txna ApplicationArgs 3
btoi
app_global_put
int 1
return