1 | | - | {-# STDLIB_VERSION 5 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let a = "__" |
---|
5 | | - | |
---|
6 | | - | let b = 10 |
---|
7 | | - | |
---|
8 | | - | func c (d) = { |
---|
9 | | - | let e = d |
---|
10 | | - | if ($isInstanceOf(e, "Int")) |
---|
11 | | - | then { |
---|
12 | | - | let f = e |
---|
13 | | - | f |
---|
14 | | - | } |
---|
15 | | - | else throw("Failed to cast into Integer") |
---|
16 | | - | } |
---|
17 | | - | |
---|
18 | | - | |
---|
19 | | - | func g (d) = { |
---|
20 | | - | let e = d |
---|
21 | | - | if ($isInstanceOf(e, "Boolean")) |
---|
22 | | - | then { |
---|
23 | | - | let h = e |
---|
24 | | - | h |
---|
25 | | - | } |
---|
26 | | - | else throw("Failed to cast into Boolean") |
---|
27 | | - | } |
---|
28 | | - | |
---|
29 | | - | |
---|
30 | | - | let i = makeString(["%s", "fee"], a) |
---|
31 | | - | |
---|
32 | | - | let j = makeString(["%s", "wxAssetId"], a) |
---|
33 | | - | |
---|
34 | | - | let k = makeString(["%s", "votingThreshold"], a) |
---|
35 | | - | |
---|
36 | | - | let l = makeString(["%s", "epochLength"], a) |
---|
37 | | - | |
---|
38 | | - | let m = makeString(["%s", "voteBeforeElimination"], a) |
---|
39 | | - | |
---|
40 | | - | let n = makeString(["%s", "currentVotingHeightStart"], a) |
---|
41 | | - | |
---|
42 | | - | let o = makeString(["%s", "currentEpoch"], a) |
---|
43 | | - | |
---|
44 | | - | let p = makeString(["%s", "boostingContract"], a) |
---|
45 | | - | |
---|
46 | | - | let q = makeString(["%s", "emissionContract"], a) |
---|
47 | | - | |
---|
48 | | - | let r = makeString(["%s", "assetsStoreContract"], a) |
---|
49 | | - | |
---|
50 | | - | let s = makeString(["%s", "latestProcessedAsset"], a) |
---|
51 | | - | |
---|
52 | | - | let t = makeString(["%s", "latestProcessedUser"], a) |
---|
53 | | - | |
---|
54 | | - | let u = makeString(["%s", "latestProcessedUserRemove"], a) |
---|
55 | | - | |
---|
56 | | - | let v = makeString(["%s", "latestProcessedAssetTransfer"], a) |
---|
57 | | - | |
---|
58 | | - | let w = makeString(["%s", "latestProcessedUserTransfer"], a) |
---|
59 | | - | |
---|
60 | | - | let x = makeString(["%s", "latestProcessedUserRemoveTransfer"], a) |
---|
61 | | - | |
---|
62 | | - | let y = makeString(["%s", "maxDepth"], a) |
---|
63 | | - | |
---|
64 | | - | func z (A) = makeString(["%s", "votesTransferFinished", toString(A)], a) |
---|
65 | | - | |
---|
66 | | - | |
---|
67 | | - | let B = "__assets" |
---|
68 | | - | |
---|
69 | | - | func C (D) = ("%s__votes__" + D) |
---|
70 | | - | |
---|
71 | | - | |
---|
72 | | - | func E (F) = makeString([("%s%s" + F), "head"], a) |
---|
73 | | - | |
---|
74 | | - | |
---|
75 | | - | func G (F) = makeString([("%s%s" + F), "size"], a) |
---|
76 | | - | |
---|
77 | | - | |
---|
78 | | - | func H (F,I) = makeString([("%s%s%s" + F), I, "prev"], a) |
---|
79 | | - | |
---|
80 | | - | |
---|
81 | | - | func J (F,I) = makeString([("%s%s%s" + F), I, "next"], a) |
---|
82 | | - | |
---|
83 | | - | |
---|
84 | | - | func K (D,A) = makeString(["%s%d%s", "verifiedAt", toString(A), D], a) |
---|
85 | | - | |
---|
86 | | - | |
---|
87 | | - | func L (D) = makeString(["%s%s", "verified", D], a) |
---|
88 | | - | |
---|
89 | | - | |
---|
90 | | - | func M (D,A) = makeString(["%s%s%d", "eliminated", D, toString(A)], a) |
---|
91 | | - | |
---|
92 | | - | |
---|
93 | | - | func N (D,A) = makeString(["%s%d%s", "votingResultAtAsset", toString(A), D], a) |
---|
94 | | - | |
---|
95 | | - | |
---|
96 | | - | func O (P,Q,R) = makeString(["%d%d%s", toString(P), toString(Q), toString(R)], a) |
---|
97 | | - | |
---|
98 | | - | |
---|
99 | | - | func S (T) = { |
---|
100 | | - | let U = split(T, a) |
---|
101 | | - | let V = 1 |
---|
102 | | - | let W = 2 |
---|
103 | | - | let X = 3 |
---|
104 | | - | let P = parseIntValue(U[V]) |
---|
105 | | - | let Q = parseIntValue(U[W]) |
---|
106 | | - | let R = if ((size(U) == 4)) |
---|
107 | | - | then (U[X] == "true") |
---|
108 | | - | else false |
---|
109 | | - | $Tuple3(P, Q, R) |
---|
110 | | - | } |
---|
111 | | - | |
---|
112 | | - | |
---|
113 | | - | func Y (Z,D,A) = makeString(["%s%d%s%s", "vru", toString(A), D, Z], a) |
---|
114 | | - | |
---|
115 | | - | |
---|
116 | | - | func aa (ab,ac) = { |
---|
117 | | - | let P = if (ac) |
---|
118 | | - | then ab |
---|
119 | | - | else 0 |
---|
120 | | - | let Q = if (ac) |
---|
121 | | - | then 0 |
---|
122 | | - | else ab |
---|
123 | | - | makeString(["%d%d", toString(P), toString(Q)], a) |
---|
124 | | - | } |
---|
125 | | - | |
---|
126 | | - | |
---|
127 | | - | func ad (T) = { |
---|
128 | | - | let U = split(T, a) |
---|
129 | | - | let V = 1 |
---|
130 | | - | let W = 2 |
---|
131 | | - | let P = parseIntValue(U[V]) |
---|
132 | | - | let Q = parseIntValue(U[W]) |
---|
133 | | - | let ac = if ((P > 0)) |
---|
134 | | - | then (Q == 0) |
---|
135 | | - | else false |
---|
136 | | - | let ae = if ((P == 0)) |
---|
137 | | - | then (Q > 0) |
---|
138 | | - | else false |
---|
139 | | - | let af = if (if (ac) |
---|
140 | | - | then true |
---|
141 | | - | else ae) |
---|
142 | | - | then true |
---|
143 | | - | else throw("Invalid user vote value") |
---|
144 | | - | if ((af == af)) |
---|
145 | | - | then { |
---|
146 | | - | let ab = if (ac) |
---|
147 | | - | then P |
---|
148 | | - | else Q |
---|
149 | | - | $Tuple2(ab, ac) |
---|
150 | | - | } |
---|
151 | | - | else throw("Strict value is not equal to itself.") |
---|
152 | | - | } |
---|
153 | | - | |
---|
154 | | - | |
---|
155 | | - | func ag (ah,Z,D,ai,A) = makeString(["%s%s%s%s%s%d", "history", ah, D, Z, ai, toString(A)], a) |
---|
156 | | - | |
---|
157 | | - | |
---|
158 | | - | func aj (ak) = if ((ak.caller == this)) |
---|
159 | | - | then true |
---|
160 | | - | else throw("Permission denied") |
---|
161 | | - | |
---|
162 | | - | |
---|
163 | | - | func al (am) = valueOrElse(getInteger(this, am), 0) |
---|
164 | | - | |
---|
165 | | - | |
---|
166 | | - | func an (am) = valueOrErrorMessage(getInteger(this, am), (am + " is not defined")) |
---|
167 | | - | |
---|
168 | | - | |
---|
169 | | - | func ao (am) = valueOrElse(getString(this, am), "") |
---|
170 | | - | |
---|
171 | | - | |
---|
172 | | - | func ap (am) = valueOrErrorMessage(getString(this, am), (am + " is not defined")) |
---|
173 | | - | |
---|
174 | | - | |
---|
175 | | - | let aq = an(i) |
---|
176 | | - | |
---|
177 | | - | let ar = fromBase58String(ap(j)) |
---|
178 | | - | |
---|
179 | | - | let as = an(k) |
---|
180 | | - | |
---|
181 | | - | let at = an(l) |
---|
182 | | - | |
---|
183 | | - | let au = an(m) |
---|
184 | | - | |
---|
185 | | - | let av = an(n) |
---|
186 | | - | |
---|
187 | | - | let aw = an(o) |
---|
188 | | - | |
---|
189 | | - | let ax = addressFromStringValue(ap(p)) |
---|
190 | | - | |
---|
191 | | - | let ay = addressFromStringValue(ap(q)) |
---|
192 | | - | |
---|
193 | | - | let az = addressFromStringValue(ap(r)) |
---|
194 | | - | |
---|
195 | | - | let aA = valueOrElse(getInteger(y), b) |
---|
196 | | - | |
---|
197 | | - | let aB = (av + at) |
---|
198 | | - | |
---|
199 | | - | func aC (Z,aD) = { |
---|
200 | | - | let aE = invoke(ax, "getUserGwxAmountAtHeightREADONLY", [Z, aD], nil) |
---|
201 | | - | c(aE) |
---|
202 | | - | } |
---|
203 | | - | |
---|
204 | | - | |
---|
205 | | - | func aF (D,ab,ac,A,R) = { |
---|
206 | | - | let aG = N(D, A) |
---|
207 | | - | let aH = { |
---|
208 | | - | let e = getString(aG) |
---|
209 | | - | if ($isInstanceOf(e, "String")) |
---|
210 | | - | then { |
---|
211 | | - | let aI = e |
---|
212 | | - | S(aI) |
---|
213 | | - | } |
---|
214 | | - | else if ($isInstanceOf(e, "Unit")) |
---|
215 | | - | then { |
---|
216 | | - | let aJ = getString(N(D, (A - 1))) |
---|
217 | | - | if ($isInstanceOf(aJ, "String")) |
---|
218 | | - | then { |
---|
219 | | - | let aI = aJ |
---|
220 | | - | $Tuple3(0, 0, S(aI)._3) |
---|
221 | | - | } |
---|
222 | | - | else if ($isInstanceOf(aJ, "Unit")) |
---|
223 | | - | then $Tuple3(0, 0, false) |
---|
224 | | - | else throw("Match error") |
---|
225 | | - | } |
---|
226 | | - | else throw("Match error") |
---|
227 | | - | } |
---|
228 | | - | let aK = aH._1 |
---|
229 | | - | let aL = aH._2 |
---|
230 | | - | let aM = aH._3 |
---|
231 | | - | StringEntry(aG, O((aK + (if (ac) |
---|
232 | | - | then ab |
---|
233 | | - | else 0)), (aL + (if (ac) |
---|
234 | | - | then 0 |
---|
235 | | - | else ab)), if ((R == unit)) |
---|
236 | | - | then aM |
---|
237 | | - | else value(R))) |
---|
238 | | - | } |
---|
239 | | - | |
---|
240 | | - | |
---|
241 | | - | func aN (F,I) = { |
---|
242 | | - | let aO = getString(this, E(F)) |
---|
243 | | - | let aP = getString(this, H(F, I)) |
---|
244 | | - | let aQ = getString(this, J(F, I)) |
---|
245 | | - | if (if ((I == aO)) |
---|
246 | | - | then true |
---|
247 | | - | else (aP != unit)) |
---|
248 | | - | then true |
---|
249 | | - | else (aQ != unit) |
---|
250 | | - | } |
---|
251 | | - | |
---|
252 | | - | |
---|
253 | | - | func aR (F,I) = { |
---|
254 | | - | let aO = getString(this, E(F)) |
---|
255 | | - | let aS = valueOrElse(getInteger(this, G(F)), 0) |
---|
256 | | - | let aT = if (!(aN(F, I))) |
---|
257 | | - | then true |
---|
258 | | - | else throw("Node exists") |
---|
259 | | - | if ((aT == aT)) |
---|
260 | | - | then (([IntegerEntry(G(F), (aS + 1))] ++ (if (isDefined(aO)) |
---|
261 | | - | then [StringEntry(J(F, I), value(aO)), StringEntry(H(F, value(aO)), I)] |
---|
262 | | - | else nil)) ++ [StringEntry(E(F), I)]) |
---|
263 | | - | else throw("Strict value is not equal to itself.") |
---|
264 | | - | } |
---|
265 | | - | |
---|
266 | | - | |
---|
267 | | - | func aU (F,I) = { |
---|
268 | | - | let aO = getString(this, E(F)) |
---|
269 | | - | let aS = valueOrElse(getInteger(this, G(F)), 0) |
---|
270 | | - | let aP = getString(this, H(F, I)) |
---|
271 | | - | let aQ = getString(this, J(F, I)) |
---|
272 | | - | ([IntegerEntry(G(F), (aS - 1))] ++ (if (if (isDefined(aP)) |
---|
273 | | - | then isDefined(aQ) |
---|
274 | | - | else false) |
---|
275 | | - | then [StringEntry(J(F, value(aP)), value(aQ)), StringEntry(H(F, value(aQ)), value(aP)), DeleteEntry(H(F, I)), DeleteEntry(J(F, I))] |
---|
276 | | - | else if (isDefined(aQ)) |
---|
277 | | - | then [StringEntry(E(F), value(aQ)), DeleteEntry(J(F, I)), DeleteEntry(H(F, value(aQ)))] |
---|
278 | | - | else if (isDefined(aP)) |
---|
279 | | - | then [DeleteEntry(H(F, I)), DeleteEntry(J(F, value(aP)))] |
---|
280 | | - | else if ((I == aO)) |
---|
281 | | - | then [DeleteEntry(E(F))] |
---|
282 | | - | else throw("Invalid node"))) |
---|
283 | | - | } |
---|
284 | | - | |
---|
285 | | - | |
---|
286 | | - | func aV (D,aW,aX,aY,aZ) = { |
---|
287 | | - | let ba = StringEntry(aX, D) |
---|
288 | | - | let bb = DeleteEntry(aY) |
---|
289 | | - | if ((aW == unit)) |
---|
290 | | - | then [ba, bb] |
---|
291 | | - | else { |
---|
292 | | - | let Z = value(aW) |
---|
293 | | - | let bc = StringEntry(aY, Z) |
---|
294 | | - | let bd = Y(Z, D, aw) |
---|
295 | | - | let be = getString(bd) |
---|
296 | | - | let bf = if ((be == unit)) |
---|
297 | | - | then { |
---|
298 | | - | let bg = aC(Z, aB) |
---|
299 | | - | if ((bg == 0)) |
---|
300 | | - | then [BooleanEntry(aZ, true)] |
---|
301 | | - | else { |
---|
302 | | - | let bh = (aw - 1) |
---|
303 | | - | let bi = valueOrElse(getBoolean(M(D, bh)), false) |
---|
304 | | - | let bj = if (bi) |
---|
305 | | - | then unit |
---|
306 | | - | else getString(Y(Z, D, bh)) |
---|
307 | | - | if ((bj == unit)) |
---|
308 | | - | then nil |
---|
309 | | - | else { |
---|
310 | | - | let bk = ad(value(bj)) |
---|
311 | | - | let bl = bk._1 |
---|
312 | | - | let ac = bk._2 |
---|
313 | | - | let ab = min([bl, bg]) |
---|
314 | | - | [StringEntry(bd, aa(ab, ac)), aF(D, ab, ac, aw, unit)] |
---|
315 | | - | } |
---|
316 | | - | } |
---|
317 | | - | } |
---|
318 | | - | else nil |
---|
319 | | - | ((bf :+ ba) :+ bc) |
---|
320 | | - | } |
---|
321 | | - | } |
---|
322 | | - | |
---|
323 | | - | |
---|
324 | | - | func bm (D,A) = !(valueOrElse(getBoolean(K(D, A)), true)) |
---|
325 | | - | |
---|
326 | | - | |
---|
327 | | - | func bn (D) = if (if (bm(D, (aw - 1))) |
---|
328 | | - | then bm(D, (aw - 2)) |
---|
329 | | - | else false) |
---|
330 | | - | then bm(D, (aw - 3)) |
---|
331 | | - | else false |
---|
332 | | - | |
---|
333 | | - | |
---|
334 | | - | @Callable(ak) |
---|
335 | | - | func constructor (bo,bp,bq,br,bs,bt,bu,bv,bw,bx) = { |
---|
336 | | - | let by = [aj(ak), if (isDefined(addressFromString(bo))) |
---|
337 | | - | then true |
---|
338 | | - | else throw("Invalid boosting contract address"), if (isDefined(addressFromString(bp))) |
---|
339 | | - | then true |
---|
340 | | - | else throw("Invalid emission contract address"), if (isDefined(addressFromString(bq))) |
---|
341 | | - | then true |
---|
342 | | - | else throw("Invalid asset_store contract address"), if ((br >= 0)) |
---|
343 | | - | then true |
---|
344 | | - | else throw("Invalid fee amount"), if (isDefined(assetInfo(fromBase58String(bs)))) |
---|
345 | | - | then true |
---|
346 | | - | else throw("Invalid WX asset ID"), if ((bt >= 0)) |
---|
347 | | - | then true |
---|
348 | | - | else throw("Invalid voting threshold"), if ((bu > 0)) |
---|
349 | | - | then true |
---|
350 | | - | else throw("Invalid voting duration"), if (((bw + bu) > height)) |
---|
351 | | - | then true |
---|
352 | | - | else throw("Invalid start height")] |
---|
353 | | - | if ((by == by)) |
---|
354 | | - | then $Tuple2([StringEntry(p, bo), StringEntry(q, bp), StringEntry(r, bq), IntegerEntry(i, br), StringEntry(j, bs), IntegerEntry(k, bt), IntegerEntry(l, bu), IntegerEntry(m, bv), IntegerEntry(n, bw), IntegerEntry(o, 0), IntegerEntry(y, bx)], unit) |
---|
355 | | - | else throw("Strict value is not equal to itself.") |
---|
356 | | - | } |
---|
357 | | - | |
---|
358 | | - | |
---|
359 | | - | |
---|
360 | | - | @Callable(ak) |
---|
361 | | - | func suggest (D,bz) = { |
---|
362 | | - | let bA = valueOrErrorMessage(assetInfo(fromBase58String(D)), "Invalid asset ID") |
---|
363 | | - | let bB = value(ak.payments[0]) |
---|
364 | | - | let by = [if ((bA.issuer == ak.caller)) |
---|
365 | | - | then true |
---|
366 | | - | else throw("Asset can only be suggested by its issuer"), if ((value(bB.assetId) == ar)) |
---|
367 | | - | then true |
---|
368 | | - | else throw("Invalid fee asset"), if ((bB.amount == aq)) |
---|
369 | | - | then true |
---|
370 | | - | else throw("Invalid fee amount")] |
---|
371 | | - | if ((by == by)) |
---|
372 | | - | then { |
---|
373 | | - | let bC = invoke(az, "createOrUpdate", [D, bz, false], nil) |
---|
374 | | - | if ((bC == bC)) |
---|
375 | | - | then { |
---|
376 | | - | let bD = invoke(ay, "burn", nil, [AttachedPayment(bB.assetId, bB.amount)]) |
---|
377 | | - | if ((bD == bD)) |
---|
378 | | - | then { |
---|
379 | | - | let bE = aR(B, D) |
---|
380 | | - | let bF = (aw + 1) |
---|
381 | | - | let bG = if ((aB > height)) |
---|
382 | | - | then aw |
---|
383 | | - | else bF |
---|
384 | | - | $Tuple2((bE :+ aF(D, 0, true, bG, false)), unit) |
---|
385 | | - | } |
---|
386 | | - | else throw("Strict value is not equal to itself.") |
---|
387 | | - | } |
---|
388 | | - | else throw("Strict value is not equal to itself.") |
---|
389 | | - | } |
---|
390 | | - | else throw("Strict value is not equal to itself.") |
---|
391 | | - | } |
---|
392 | | - | |
---|
393 | | - | |
---|
394 | | - | |
---|
395 | | - | @Callable(ak) |
---|
396 | | - | func vote (D,ac) = { |
---|
397 | | - | let bH = if (aN(B, D)) |
---|
398 | | - | then true |
---|
399 | | - | else throw("Invalid asset") |
---|
400 | | - | if ((bH == bH)) |
---|
401 | | - | then { |
---|
402 | | - | let bI = if ((aB > height)) |
---|
403 | | - | then true |
---|
404 | | - | else throw("Current voting is over but results are not finalized") |
---|
405 | | - | if ((bI == bI)) |
---|
406 | | - | then { |
---|
407 | | - | let Z = toString(ak.caller) |
---|
408 | | - | let bJ = aC(Z, aB) |
---|
409 | | - | let bK = if ((bJ > 0)) |
---|
410 | | - | then true |
---|
411 | | - | else throw("You'll not have gWX at the end of voting") |
---|
412 | | - | if ((bK == bK)) |
---|
413 | | - | then { |
---|
414 | | - | let bL = C(D) |
---|
415 | | - | let bd = Y(Z, D, aw) |
---|
416 | | - | let be = getString(bd) |
---|
417 | | - | let bM = if ((be == unit)) |
---|
418 | | - | then unit |
---|
419 | | - | else invoke(this, "cancelVote", [D], nil) |
---|
420 | | - | if ((bM == bM)) |
---|
421 | | - | then { |
---|
422 | | - | let bN = [StringEntry(bd, aa(bJ, ac)), StringEntry(ag("vote", Z, D, toBase58String(ak.transactionId), aw), aa(bJ, ac)), aF(D, bJ, ac, aw, unit)] |
---|
423 | | - | let bO = if (aN(bL, Z)) |
---|
424 | | - | then nil |
---|
425 | | - | else aR(bL, Z) |
---|
426 | | - | $Tuple2((bO ++ bN), unit) |
---|
427 | | - | } |
---|
428 | | - | else throw("Strict value is not equal to itself.") |
---|
429 | | - | } |
---|
430 | | - | else throw("Strict value is not equal to itself.") |
---|
431 | | - | } |
---|
432 | | - | else throw("Strict value is not equal to itself.") |
---|
433 | | - | } |
---|
434 | | - | else throw("Strict value is not equal to itself.") |
---|
435 | | - | } |
---|
436 | | - | |
---|
437 | | - | |
---|
438 | | - | |
---|
439 | | - | @Callable(ak) |
---|
440 | | - | func cancelVote (D) = { |
---|
441 | | - | let Z = if ((ak.caller == this)) |
---|
442 | | - | then toString(ak.originCaller) |
---|
443 | | - | else toString(ak.caller) |
---|
444 | | - | let bL = C(D) |
---|
445 | | - | let bd = Y(Z, D, aw) |
---|
446 | | - | let be = getString(bd) |
---|
447 | | - | let bP = ad(valueOrErrorMessage(be, "Nothing to cancel")) |
---|
448 | | - | let ab = bP._1 |
---|
449 | | - | let ac = bP._2 |
---|
450 | | - | let bO = aU(bL, Z) |
---|
451 | | - | let bN = [DeleteEntry(bd), StringEntry(ag("cancelVote", Z, D, toBase58String(ak.transactionId), aw), aa(0, true)), aF(D, -(ab), ac, aw, unit)] |
---|
452 | | - | $Tuple2((bO ++ bN), unit) |
---|
453 | | - | } |
---|
454 | | - | |
---|
455 | | - | |
---|
456 | | - | |
---|
457 | | - | @Callable(ak) |
---|
458 | | - | func finalizeAssetINTERNAL (D,A) = { |
---|
459 | | - | let bQ = aj(ak) |
---|
460 | | - | if ((bQ == bQ)) |
---|
461 | | - | then { |
---|
462 | | - | let aG = N(D, A) |
---|
463 | | - | let bR = { |
---|
464 | | - | let e = getString(aG) |
---|
465 | | - | if ($isInstanceOf(e, "String")) |
---|
466 | | - | then { |
---|
467 | | - | let aI = e |
---|
468 | | - | let bS = S(aI) |
---|
469 | | - | $Tuple2(bS._1, bS._2) |
---|
470 | | - | } |
---|
471 | | - | else if ($isInstanceOf(e, "Unit")) |
---|
472 | | - | then $Tuple2(0, 0) |
---|
473 | | - | else throw("Match error") |
---|
474 | | - | } |
---|
475 | | - | let P = bR._1 |
---|
476 | | - | let Q = bR._2 |
---|
477 | | - | let ab = (P + Q) |
---|
478 | | - | let R = if ((ab >= as)) |
---|
479 | | - | then (P > Q) |
---|
480 | | - | else false |
---|
481 | | - | let bT = [BooleanEntry(K(D, A), R), if (R) |
---|
482 | | - | then BooleanEntry(L(D), true) |
---|
483 | | - | else DeleteEntry(L(D))] |
---|
484 | | - | let bU = invoke(az, "setVerified", [D, R], nil) |
---|
485 | | - | if ((bU == bU)) |
---|
486 | | - | then { |
---|
487 | | - | let bV = if (R) |
---|
488 | | - | then false |
---|
489 | | - | else bn(D) |
---|
490 | | - | let bW = if (bV) |
---|
491 | | - | then [BooleanEntry(M(D, aw), true)] |
---|
492 | | - | else nil |
---|
493 | | - | let bX = if (bV) |
---|
494 | | - | then nil |
---|
495 | | - | else [aF(D, 0, true, (aw + 1), R)] |
---|
496 | | - | let bO = if (bV) |
---|
497 | | - | then aU(B, D) |
---|
498 | | - | else nil |
---|
499 | | - | let bY = if (bV) |
---|
500 | | - | then invoke(az, "onEliminate", [D], nil) |
---|
501 | | - | else unit |
---|
502 | | - | if ((bY == bY)) |
---|
503 | | - | then $Tuple2(((bO ++ bX) ++ bT), unit) |
---|
504 | | - | else throw("Strict value is not equal to itself.") |
---|
505 | | - | } |
---|
506 | | - | else throw("Strict value is not equal to itself.") |
---|
507 | | - | } |
---|
508 | | - | else throw("Strict value is not equal to itself.") |
---|
509 | | - | } |
---|
510 | | - | |
---|
511 | | - | |
---|
512 | | - | |
---|
513 | | - | @Callable(ak) |
---|
514 | | - | func deleteUserNodeINTERNAL (D,Z,aZ) = { |
---|
515 | | - | let bQ = aj(ak) |
---|
516 | | - | if ((bQ == bQ)) |
---|
517 | | - | then $Tuple2((aU(C(D), Z) :+ DeleteEntry(aZ)), unit) |
---|
518 | | - | else throw("Strict value is not equal to itself.") |
---|
519 | | - | } |
---|
520 | | - | |
---|
521 | | - | |
---|
522 | | - | |
---|
523 | | - | @Callable(ak) |
---|
524 | | - | func finalizeVotingHelper () = if ((aB > height)) |
---|
525 | | - | then $Tuple2(nil, false) |
---|
526 | | - | else { |
---|
527 | | - | let bZ = getString(s) |
---|
528 | | - | let ca = getString(t) |
---|
529 | | - | let cb = 0 |
---|
530 | | - | let cc = $Tuple2([IntegerEntry(n, (height + cb)), IntegerEntry(o, (aw + 1)), DeleteEntry(s), DeleteEntry(t), DeleteEntry(v), DeleteEntry(w)], true) |
---|
531 | | - | if ((bZ == unit)) |
---|
532 | | - | then { |
---|
533 | | - | let cd = getString(E(B)) |
---|
534 | | - | if ((cd == unit)) |
---|
535 | | - | then cc |
---|
536 | | - | else { |
---|
537 | | - | let ce = value(cd) |
---|
538 | | - | let aW = getString(E(C(ce))) |
---|
539 | | - | let cf = aV(ce, aW, s, t, u) |
---|
540 | | - | $Tuple2(cf, true) |
---|
541 | | - | } |
---|
542 | | - | } |
---|
543 | | - | else { |
---|
544 | | - | let cg = value(bZ) |
---|
545 | | - | if ((ca == unit)) |
---|
546 | | - | then { |
---|
547 | | - | let ch = getString(J(B, cg)) |
---|
548 | | - | if ((ch == ch)) |
---|
549 | | - | then { |
---|
550 | | - | let ci = invoke(this, "finalizeAssetINTERNAL", [cg, aw], nil) |
---|
551 | | - | if ((ci == ci)) |
---|
552 | | - | then if ((ch == unit)) |
---|
553 | | - | then cc |
---|
554 | | - | else { |
---|
555 | | - | let ce = value(ch) |
---|
556 | | - | let aW = getString(E(C(ce))) |
---|
557 | | - | let cf = aV(ce, aW, s, t, u) |
---|
558 | | - | $Tuple2(cf, true) |
---|
559 | | - | } |
---|
560 | | - | else throw("Strict value is not equal to itself.") |
---|
561 | | - | } |
---|
562 | | - | else throw("Strict value is not equal to itself.") |
---|
563 | | - | } |
---|
564 | | - | else { |
---|
565 | | - | let cj = value(ca) |
---|
566 | | - | let aW = getString(J(C(cg), cj)) |
---|
567 | | - | if ((aW == aW)) |
---|
568 | | - | then { |
---|
569 | | - | let ck = valueOrElse(getBoolean(u), false) |
---|
570 | | - | let cl = if (ck) |
---|
571 | | - | then invoke(this, "deleteUserNodeINTERNAL", [cg, cj, u], nil) |
---|
572 | | - | else unit |
---|
573 | | - | if ((cl == cl)) |
---|
574 | | - | then { |
---|
575 | | - | let cf = aV(cg, aW, s, t, u) |
---|
576 | | - | $Tuple2(cf, true) |
---|
577 | | - | } |
---|
578 | | - | else throw("Strict value is not equal to itself.") |
---|
579 | | - | } |
---|
580 | | - | else throw("Strict value is not equal to itself.") |
---|
581 | | - | } |
---|
582 | | - | } |
---|
583 | | - | } |
---|
584 | | - | |
---|
585 | | - | |
---|
586 | | - | |
---|
587 | | - | @Callable(ak) |
---|
588 | | - | func finalizeVotingWrapper (cm) = { |
---|
589 | | - | let cn = g(invoke(this, "finalizeVotingHelper", nil, nil)) |
---|
590 | | - | if ((cn == cn)) |
---|
591 | | - | then if (!(cn)) |
---|
592 | | - | then if ((cm == 0)) |
---|
593 | | - | then throw("Current voting is not over yet") |
---|
594 | | - | else $Tuple2(nil, unit) |
---|
595 | | - | else if ((aA > cm)) |
---|
596 | | - | then { |
---|
597 | | - | let co = invoke(this, "finalizeVotingWrapper", [(cm + 1)], nil) |
---|
598 | | - | if ((co == co)) |
---|
599 | | - | then $Tuple2(nil, unit) |
---|
600 | | - | else throw("Strict value is not equal to itself.") |
---|
601 | | - | } |
---|
602 | | - | else $Tuple2(nil, unit) |
---|
603 | | - | else throw("Strict value is not equal to itself.") |
---|
604 | | - | } |
---|
605 | | - | |
---|
606 | | - | |
---|
607 | | - | |
---|
608 | | - | @Callable(ak) |
---|
609 | | - | func finalizeVoting () = { |
---|
610 | | - | let co = invoke(this, "finalizeVotingWrapper", [0], nil) |
---|
611 | | - | if ((co == co)) |
---|
612 | | - | then $Tuple2(nil, unit) |
---|
613 | | - | else throw("Strict value is not equal to itself.") |
---|
614 | | - | } |
---|
615 | | - | |
---|
616 | | - | |
---|
617 | | - | |
---|
618 | | - | @Callable(ak) |
---|
619 | | - | func transferVotesHelper () = { |
---|
620 | | - | let cp = z(aw) |
---|
621 | | - | let cq = valueOrElse(getBoolean(cp), false) |
---|
622 | | - | if (if (if ((av > height)) |
---|
623 | | - | then true |
---|
624 | | - | else (height >= aB)) |
---|
625 | | - | then true |
---|
626 | | - | else cq) |
---|
627 | | - | then $Tuple2(nil, false) |
---|
628 | | - | else { |
---|
629 | | - | let bZ = getString(v) |
---|
630 | | - | let ca = getString(w) |
---|
631 | | - | let cc = $Tuple2([BooleanEntry(cp, true), DeleteEntry(v), DeleteEntry(w)], true) |
---|
632 | | - | if ((bZ == unit)) |
---|
633 | | - | then { |
---|
634 | | - | let cd = getString(E(B)) |
---|
635 | | - | if ((cd == unit)) |
---|
636 | | - | then cc |
---|
637 | | - | else { |
---|
638 | | - | let ce = value(cd) |
---|
639 | | - | let aW = getString(E(C(ce))) |
---|
640 | | - | let cf = aV(ce, aW, v, w, x) |
---|
641 | | - | $Tuple2(cf, true) |
---|
642 | | - | } |
---|
643 | | - | } |
---|
644 | | - | else { |
---|
645 | | - | let cg = value(bZ) |
---|
646 | | - | if ((ca == unit)) |
---|
647 | | - | then { |
---|
648 | | - | let ch = getString(J(B, cg)) |
---|
649 | | - | if ((ch == unit)) |
---|
650 | | - | then cc |
---|
651 | | - | else { |
---|
652 | | - | let ce = value(ch) |
---|
653 | | - | let aW = getString(E(C(ce))) |
---|
654 | | - | let cf = aV(ce, aW, v, w, x) |
---|
655 | | - | $Tuple2(cf, true) |
---|
656 | | - | } |
---|
657 | | - | } |
---|
658 | | - | else { |
---|
659 | | - | let cj = value(ca) |
---|
660 | | - | let aW = getString(J(C(cg), cj)) |
---|
661 | | - | if ((aW == aW)) |
---|
662 | | - | then { |
---|
663 | | - | let ck = valueOrElse(getBoolean(x), false) |
---|
664 | | - | let cl = if (ck) |
---|
665 | | - | then invoke(this, "deleteUserNodeINTERNAL", [cg, cj, x], nil) |
---|
666 | | - | else unit |
---|
667 | | - | if ((cl == cl)) |
---|
668 | | - | then { |
---|
669 | | - | let cf = aV(cg, aW, v, w, x) |
---|
670 | | - | $Tuple2(cf, true) |
---|
671 | | - | } |
---|
672 | | - | else throw("Strict value is not equal to itself.") |
---|
673 | | - | } |
---|
674 | | - | else throw("Strict value is not equal to itself.") |
---|
675 | | - | } |
---|
676 | | - | } |
---|
677 | | - | } |
---|
678 | | - | } |
---|
679 | | - | |
---|
680 | | - | |
---|
681 | | - | |
---|
682 | | - | @Callable(ak) |
---|
683 | | - | func transferVotesWrapper (cm) = { |
---|
684 | | - | let cn = g(invoke(this, "transferVotesHelper", nil, nil)) |
---|
685 | | - | if ((cn == cn)) |
---|
686 | | - | then if (!(cn)) |
---|
687 | | - | then if ((cm == 0)) |
---|
688 | | - | then throw("Voting is not started yet") |
---|
689 | | - | else $Tuple2(nil, unit) |
---|
690 | | - | else if ((aA > cm)) |
---|
691 | | - | then { |
---|
692 | | - | let co = invoke(this, "transferVotesWrapper", [(cm + 1)], nil) |
---|
693 | | - | if ((co == co)) |
---|
694 | | - | then $Tuple2(nil, unit) |
---|
695 | | - | else throw("Strict value is not equal to itself.") |
---|
696 | | - | } |
---|
697 | | - | else $Tuple2(nil, unit) |
---|
698 | | - | else throw("Strict value is not equal to itself.") |
---|
699 | | - | } |
---|
700 | | - | |
---|
701 | | - | |
---|
702 | | - | |
---|
703 | | - | @Callable(ak) |
---|
704 | | - | func transferVotes () = { |
---|
705 | | - | let co = invoke(this, "transferVotesWrapper", [0], nil) |
---|
706 | | - | if ((co == co)) |
---|
707 | | - | then $Tuple2(nil, unit) |
---|
708 | | - | else throw("Strict value is not equal to itself.") |
---|
709 | | - | } |
---|
710 | | - | |
---|
711 | | - | |
---|
712 | | - | |
---|
713 | | - | @Callable(ak) |
---|
714 | | - | func setVotingThreshold (cr) = { |
---|
715 | | - | let bQ = aj(ak) |
---|
716 | | - | if ((bQ == bQ)) |
---|
717 | | - | then $Tuple2([IntegerEntry(k, cr)], unit) |
---|
718 | | - | else throw("Strict value is not equal to itself.") |
---|
719 | | - | } |
---|
720 | | - | |
---|
721 | | - | |
---|
722 | | - | |
---|
723 | | - | @Callable(ak) |
---|
724 | | - | func setFee (cs) = { |
---|
725 | | - | let bQ = aj(ak) |
---|
726 | | - | if ((bQ == bQ)) |
---|
727 | | - | then $Tuple2([IntegerEntry(i, cs)], unit) |
---|
728 | | - | else throw("Strict value is not equal to itself.") |
---|
729 | | - | } |
---|
730 | | - | |
---|
731 | | - | |
---|
732 | | - | |
---|
733 | | - | @Callable(ak) |
---|
734 | | - | func gwxAvailableForVoteREADONLY (Z) = { |
---|
735 | | - | let bJ = aC(Z, aB) |
---|
736 | | - | $Tuple2(nil, bJ) |
---|
737 | | - | } |
---|
738 | | - | |
---|
739 | | - | |
---|
| 1 | + | # no script |
---|