tx · 56mR8Qtk2XdCtCjpsmo36moCPyVivyMoZySHa4BoeJSd 3MteeMicpvRbmpGtb55Ym7qajPGJqju6DfD: -0.01400000 Waves 2019.07.13 15:23 [583960] smart account 3MteeMicpvRbmpGtb55Ym7qajPGJqju6DfD > SELF 0.00000000 Waves
{ "type": 13, "id": "56mR8Qtk2XdCtCjpsmo36moCPyVivyMoZySHa4BoeJSd", "fee": 1400000, "feeAssetId": null, "timestamp": 1563020612579, "version": 1, "sender": "3MteeMicpvRbmpGtb55Ym7qajPGJqju6DfD", "senderPublicKey": "Ag9VhLi94fq2sVuC1mHGQFUv1ioh2E2RqXkjYpTWakT5", "proofs": [ "5fV9fGBxKJrM4QCoZR5QJ57k7wqYtEnmDnfEELE8cHwLRLPuta41z1DRx3iS48hhw7QiDKtTVTMcGXkNdi1jv5NK" ], "script": "base64:AAIDAAAAAAAAAAAAAAAeAAAAAAROT05FAgAAAARub25lAAAAAAdCQUxBTkNFAgAAAAlfQkFMQU5DRV8AAAAABlZPVEVSUwAAAAAAAAAAAwAAAAAGUVVPUlVNAAAAAAAAAAACAAAAAAZWT1RJTkcCAAAABnZvdGluZwAAAAAGUkVWRUFMAgAAAAZyZXZlYWwAAAAACEZFQVRVUkVEAgAAAAhmZWF0dXJlZAAAAAAIREVMSVNURUQCAAAACGRlbGlzdGVkAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQ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XRlbQMJAABnAAAAAgUAAAAMbmV3Vm90ZUNvdW50BQAAAAZRVU9SVU0FAAAABHZvdGUFAAAABlJFVkVBTAUAAAADbmlsAAAAAMsl2JM=", "chainId": 84, "height": 583960, "spentComplexity": 0 } View: original | compacted Prev: 9qzs2HCnVD7xXDh7qxmibE5kkfCk2Tb9zFncCxf526Nh Next: none Diff:
Old | New | Differences | |
---|---|---|---|
203 | 203 | } | |
204 | 204 | ||
205 | 205 | ||
206 | + | ||
207 | + | @Callable(P) | |
208 | + | func voteReveal (q,A,ad) = { | |
209 | + | let r = toBase58String(P.caller.bytes) | |
210 | + | let ac = y(q) | |
211 | + | let ae = (B(q, A) + 1) | |
212 | + | if ((toBase58String(sha256(toBytes((A + ad)))) != s(q, r))) | |
213 | + | then throw("reveal data is not valid") | |
214 | + | else if ((c > u(q))) | |
215 | + | then throw("max num of voters hasn't reached yet") | |
216 | + | else if ((w(q, r) != a)) | |
217 | + | then throw("user has already participated") | |
218 | + | else if (if ((ac != e)) | |
219 | + | then (ac != f) | |
220 | + | else false) | |
221 | + | then throw("wrong status") | |
222 | + | else if (if ((A != g)) | |
223 | + | then (A != h) | |
224 | + | else false) | |
225 | + | then throw("wrong vote") | |
226 | + | else if (if ((ac == g)) | |
227 | + | then true | |
228 | + | else (ac == h)) | |
229 | + | then throw("vote has finished") | |
230 | + | else WriteSet([DataEntry(v(q, r), A), DataEntry(z(q, A), ae), DataEntry(x(q), if ((ae >= d)) | |
231 | + | then A | |
232 | + | else f)]) | |
233 | + | } | |
234 | + | ||
235 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "none" | |
5 | 5 | ||
6 | 6 | let b = "_BALANCE_" | |
7 | 7 | ||
8 | 8 | let c = 3 | |
9 | 9 | ||
10 | 10 | let d = 2 | |
11 | 11 | ||
12 | 12 | let e = "voting" | |
13 | 13 | ||
14 | 14 | let f = "reveal" | |
15 | 15 | ||
16 | 16 | let g = "featured" | |
17 | 17 | ||
18 | 18 | let h = "delisted" | |
19 | 19 | ||
20 | 20 | func i (j) = { | |
21 | 21 | let k = { | |
22 | 22 | let l = getInteger(this, j) | |
23 | 23 | if ($isInstanceOf(l, "Int")) | |
24 | 24 | then { | |
25 | 25 | let m = l | |
26 | 26 | m | |
27 | 27 | } | |
28 | 28 | else 0 | |
29 | 29 | } | |
30 | 30 | k | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func n (j) = { | |
35 | 35 | let o = { | |
36 | 36 | let l = getString(this, j) | |
37 | 37 | if ($isInstanceOf(l, "String")) | |
38 | 38 | then { | |
39 | 39 | let m = l | |
40 | 40 | m | |
41 | 41 | } | |
42 | 42 | else a | |
43 | 43 | } | |
44 | 44 | o | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func p (q,r) = (((q + "_") + r) + "_commit") | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func s (q,r) = n(p(q, r)) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func t (q) = (q + "_comcnt") | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func u (q) = i(t(q)) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func v (q,r) = (((q + "_") + r) + "_reveal") | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func w (q,r) = n(v(q, r)) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func x (q) = (q + "_status") | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func y (q) = n(x(q)) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func z (q,A) = ((q + "_res:") + A) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func B (q,A) = i(z(q, A)) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func C (q) = (q + "_price") | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func D (q) = i(C(q)) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func E (r,q) = (((q + "_") + r) + "_cnt") | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func F (r,q) = i(E(r, q)) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func G (H,I) = ("item_" + toBase58String(sha256(toBytes((H + I))))) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func J (q) = (q + "_data") | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func K (q) = (q + "_owner") | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func L (q) = n(K(q)) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func M (N) = (N + "_balance") | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func O (N) = i(M(N)) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | @Callable(P) | |
109 | 109 | func deposit () = { | |
110 | 110 | let Q = extract(P.payment) | |
111 | 111 | if (isDefined(Q.assetId)) | |
112 | 112 | then throw("can hold waves only at the moment") | |
113 | 113 | else { | |
114 | 114 | let R = toBase58String(P.caller.bytes) | |
115 | 115 | let S = { | |
116 | 116 | let l = getInteger(this, R) | |
117 | 117 | if ($isInstanceOf(l, "Int")) | |
118 | 118 | then { | |
119 | 119 | let m = l | |
120 | 120 | m | |
121 | 121 | } | |
122 | 122 | else 0 | |
123 | 123 | } | |
124 | 124 | let T = { | |
125 | 125 | let l = getString(this, ("wl_sts_" + R)) | |
126 | 126 | if ($isInstanceOf(l, "String")) | |
127 | 127 | then { | |
128 | 128 | let m = l | |
129 | 129 | m | |
130 | 130 | } | |
131 | 131 | else throw("user has been not waitlisted") | |
132 | 132 | } | |
133 | 133 | let U = (S + Q.amount) | |
134 | 134 | WriteSet([DataEntry((b + R), U)]) | |
135 | 135 | } | |
136 | 136 | } | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | ||
140 | 140 | @Callable(P) | |
141 | 141 | func addItem (I,V,W) = { | |
142 | 142 | let X = toBase58String(P.caller.bytes) | |
143 | 143 | let q = G(X, I) | |
144 | 144 | if ((0 >= V)) | |
145 | 145 | then throw("purchase amount cannot be less then item price") | |
146 | 146 | else if ((L(q) != a)) | |
147 | 147 | then throw("an item is already exist") | |
148 | 148 | else WriteSet([DataEntry(K(q), X), DataEntry(C(q), V), DataEntry(J(q), W)]) | |
149 | 149 | } | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | ||
153 | 153 | @Callable(P) | |
154 | 154 | func purchase (q) = { | |
155 | 155 | let Q = extract(P.payment) | |
156 | 156 | if (isDefined(Q.assetId)) | |
157 | 157 | then throw("WAVES tokens only at the moment") | |
158 | 158 | else { | |
159 | 159 | let Y = toBase58String(P.caller.bytes) | |
160 | 160 | let V = D(q) | |
161 | 161 | let X = L(q) | |
162 | 162 | if ((V > Q.amount)) | |
163 | 163 | then throw("purchase amount cannot be less then item price") | |
164 | 164 | else if ((Q.amount > V)) | |
165 | 165 | then throw("purchase amount cannot be higher then item price") | |
166 | 166 | else if ((X == a)) | |
167 | 167 | then throw("supplier does not exist") | |
168 | 168 | else WriteSet([DataEntry(E(Y, q), (F(Y, q) + 1)), DataEntry(M(X), (O(X) + Q.amount))]) | |
169 | 169 | } | |
170 | 170 | } | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | 174 | @Callable(P) | |
175 | 175 | func withdraw () = { | |
176 | 176 | let X = toBase58String(P.caller.bytes) | |
177 | 177 | let Z = O(X) | |
178 | 178 | if ((0 >= Z)) | |
179 | 179 | then throw("insufficient balance") | |
180 | 180 | else ScriptResult(WriteSet([DataEntry(M(X), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(X), Z, unit)])) | |
181 | 181 | } | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | 185 | @Callable(P) | |
186 | 186 | func voteCommit (q,aa) = { | |
187 | 187 | let r = toBase58String(P.caller.bytes) | |
188 | 188 | let ab = u(q) | |
189 | 189 | let ac = y(q) | |
190 | 190 | if ((ab >= c)) | |
191 | 191 | then throw("reached max num of voters") | |
192 | 192 | else if ((s(q, r) != a)) | |
193 | 193 | then throw("user has already participated") | |
194 | 194 | else if ((K(q) == a)) | |
195 | 195 | then throw("item does not exist") | |
196 | 196 | else if (if ((ac != a)) | |
197 | 197 | then (ac != e) | |
198 | 198 | else false) | |
199 | 199 | then throw("voting is not possible") | |
200 | 200 | else WriteSet([DataEntry(p(q, r), aa), DataEntry(t(q), (ab + 1)), DataEntry(x(q), if ((ab == c)) | |
201 | 201 | then f | |
202 | 202 | else e)]) | |
203 | 203 | } | |
204 | 204 | ||
205 | 205 | ||
206 | + | ||
207 | + | @Callable(P) | |
208 | + | func voteReveal (q,A,ad) = { | |
209 | + | let r = toBase58String(P.caller.bytes) | |
210 | + | let ac = y(q) | |
211 | + | let ae = (B(q, A) + 1) | |
212 | + | if ((toBase58String(sha256(toBytes((A + ad)))) != s(q, r))) | |
213 | + | then throw("reveal data is not valid") | |
214 | + | else if ((c > u(q))) | |
215 | + | then throw("max num of voters hasn't reached yet") | |
216 | + | else if ((w(q, r) != a)) | |
217 | + | then throw("user has already participated") | |
218 | + | else if (if ((ac != e)) | |
219 | + | then (ac != f) | |
220 | + | else false) | |
221 | + | then throw("wrong status") | |
222 | + | else if (if ((A != g)) | |
223 | + | then (A != h) | |
224 | + | else false) | |
225 | + | then throw("wrong vote") | |
226 | + | else if (if ((ac == g)) | |
227 | + | then true | |
228 | + | else (ac == h)) | |
229 | + | then throw("vote has finished") | |
230 | + | else WriteSet([DataEntry(v(q, r), A), DataEntry(z(q, A), ae), DataEntry(x(q), if ((ae >= d)) | |
231 | + | then A | |
232 | + | else f)]) | |
233 | + | } | |
234 | + | ||
235 | + |
github/deemru/w8io/026f985 45.52 ms ◑