32 | | - | |
---|
33 | | - | @Callable(d) |
---|
34 | | - | func WithdrawWeeklyEarning () = { |
---|
35 | | - | let i = assetBalance(this, a) |
---|
36 | | - | let j = { |
---|
37 | | - | let g = getString(this, "MaxDepositer") |
---|
38 | | - | if ($isInstanceOf(g, "String")) |
---|
39 | | - | then { |
---|
40 | | - | let h = g |
---|
41 | | - | h |
---|
42 | | - | } |
---|
43 | | - | else "" |
---|
44 | | - | } |
---|
45 | | - | let k = (toBase58String(d.caller.bytes) + "_WeekEarning") |
---|
46 | | - | let l = { |
---|
47 | | - | let g = getInteger(this, "StakeBalance") |
---|
48 | | - | if ($isInstanceOf(g, "Int")) |
---|
49 | | - | then { |
---|
50 | | - | let h = g |
---|
51 | | - | h |
---|
52 | | - | } |
---|
53 | | - | else 0 |
---|
54 | | - | } |
---|
55 | | - | let m = { |
---|
56 | | - | let g = getInteger(this, "FundBox") |
---|
57 | | - | if ($isInstanceOf(g, "Int")) |
---|
58 | | - | then { |
---|
59 | | - | let h = g |
---|
60 | | - | h |
---|
61 | | - | } |
---|
62 | | - | else 0 |
---|
63 | | - | } |
---|
64 | | - | let n = { |
---|
65 | | - | let g = getInteger(this, "PrizeHeight") |
---|
66 | | - | if ($isInstanceOf(g, "Int")) |
---|
67 | | - | then { |
---|
68 | | - | let h = g |
---|
69 | | - | h |
---|
70 | | - | } |
---|
71 | | - | else 0 |
---|
72 | | - | } |
---|
73 | | - | let o = if (if ((n == 0)) |
---|
74 | | - | then (m == 0) |
---|
75 | | - | else false) |
---|
76 | | - | then 0 |
---|
77 | | - | else if (if ((n == 0)) |
---|
78 | | - | then (m != 0) |
---|
79 | | - | else false) |
---|
80 | | - | then height |
---|
81 | | - | else if (if ((n != 0)) |
---|
82 | | - | then (m != 0) |
---|
83 | | - | else false) |
---|
84 | | - | then n |
---|
85 | | - | else 0 |
---|
86 | | - | let e = toBase58String(d.caller.bytes) |
---|
87 | | - | let p = { |
---|
88 | | - | let g = getInteger(this, k) |
---|
89 | | - | if ($isInstanceOf(g, "Int")) |
---|
90 | | - | then { |
---|
91 | | - | let h = g |
---|
92 | | - | h |
---|
93 | | - | } |
---|
94 | | - | else 0 |
---|
95 | | - | } |
---|
96 | | - | if ((0 > p)) |
---|
97 | | - | then throw("Can't withdraw negative amount") |
---|
98 | | - | else if ((0 > p)) |
---|
99 | | - | then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((p / 100000000)))) |
---|
100 | | - | else [IntegerEntry(k, 0), IntegerEntry("PrizeHeight", o), IntegerEntry("MaxDeposit", 0), ScriptTransfer(d.caller, p, a)] |
---|
101 | | - | } |
---|
102 | | - | |
---|
103 | | - | |
---|
104 | | - | |
---|
105 | | - | @Callable(d) |
---|
106 | | - | func PushReward () = { |
---|
107 | | - | let q = 10 |
---|
108 | | - | let r = (7 * 1440) |
---|
109 | | - | let s = 60 |
---|
110 | | - | let t = (1440 * 1) |
---|
111 | | - | let u = 3 |
---|
112 | | - | let v = (7 * 1440) |
---|
113 | | - | let w = assetBalance(Address(d.caller.bytes), b) |
---|
114 | | - | let x = if ((size(d.payments) == 1)) |
---|
115 | | - | then d.payments[0] |
---|
116 | | - | else throw("Attached payment is required") |
---|
117 | | - | let y = (toBase58String(d.caller.bytes) + "_Push") |
---|
118 | | - | let z = { |
---|
119 | | - | let g = getInteger(this, y) |
---|
120 | | - | if ($isInstanceOf(g, "Int")) |
---|
121 | | - | then { |
---|
122 | | - | let h = g |
---|
123 | | - | h |
---|
124 | | - | } |
---|
125 | | - | else 0 |
---|
126 | | - | } |
---|
127 | | - | let A = (toBase58String(d.caller.bytes) + "_refs") |
---|
128 | | - | let B = { |
---|
129 | | - | let g = getInteger(this, A) |
---|
130 | | - | if ($isInstanceOf(g, "Int")) |
---|
131 | | - | then { |
---|
132 | | - | let h = g |
---|
133 | | - | h |
---|
134 | | - | } |
---|
135 | | - | else 0 |
---|
136 | | - | } |
---|
137 | | - | let C = { |
---|
138 | | - | let g = getInteger(this, "HighestPush") |
---|
139 | | - | if ($isInstanceOf(g, "Int")) |
---|
140 | | - | then { |
---|
141 | | - | let h = g |
---|
142 | | - | h |
---|
143 | | - | } |
---|
144 | | - | else 0 |
---|
145 | | - | } |
---|
146 | | - | if ((w > x.amount)) |
---|
147 | | - | then if (if (((x.amount + z) > C)) |
---|
148 | | - | then (x.assetId == b) |
---|
149 | | - | else false) |
---|
150 | | - | then { |
---|
151 | | - | let D = (toBase58String(d.caller.bytes) + "_UserLastPushBlock") |
---|
152 | | - | let E = (toBase58String(d.caller.bytes) + "_UserLastStakeBlock") |
---|
153 | | - | let F = (toBase58String(d.caller.bytes) + "_Staking") |
---|
154 | | - | let i = assetBalance(this, a) |
---|
155 | | - | let l = { |
---|
156 | | - | let g = getInteger(this, "StakeBalance") |
---|
157 | | - | if ($isInstanceOf(g, "Int")) |
---|
158 | | - | then { |
---|
159 | | - | let h = g |
---|
160 | | - | h |
---|
161 | | - | } |
---|
162 | | - | else 0 |
---|
163 | | - | } |
---|
164 | | - | let m = { |
---|
165 | | - | let g = getInteger(this, "FundBox") |
---|
166 | | - | if ($isInstanceOf(g, "Int")) |
---|
167 | | - | then { |
---|
168 | | - | let h = g |
---|
169 | | - | h |
---|
170 | | - | } |
---|
171 | | - | else 0 |
---|
172 | | - | } |
---|
173 | | - | let n = { |
---|
174 | | - | let g = getInteger(this, "PrizeHeight") |
---|
175 | | - | if ($isInstanceOf(g, "Int")) |
---|
176 | | - | then { |
---|
177 | | - | let h = g |
---|
178 | | - | h |
---|
179 | | - | } |
---|
180 | | - | else 0 |
---|
181 | | - | } |
---|
182 | | - | let o = if (if ((n == 0)) |
---|
183 | | - | then (m == 0) |
---|
184 | | - | else false) |
---|
185 | | - | then 0 |
---|
186 | | - | else if (if ((n == 0)) |
---|
187 | | - | then (m != 0) |
---|
188 | | - | else false) |
---|
189 | | - | then height |
---|
190 | | - | else if (if ((n != 0)) |
---|
191 | | - | then (m != 0) |
---|
192 | | - | else false) |
---|
193 | | - | then n |
---|
194 | | - | else 0 |
---|
195 | | - | let G = { |
---|
196 | | - | let g = getInteger(this, "Delay") |
---|
197 | | - | if ($isInstanceOf(g, "Int")) |
---|
198 | | - | then { |
---|
199 | | - | let h = g |
---|
200 | | - | h |
---|
201 | | - | } |
---|
202 | | - | else 0 |
---|
203 | | - | } |
---|
204 | | - | let H = { |
---|
205 | | - | let g = getInteger(this, "HighestPushAddress") |
---|
206 | | - | if ($isInstanceOf(g, "Int")) |
---|
207 | | - | then { |
---|
208 | | - | let h = g |
---|
209 | | - | h |
---|
210 | | - | } |
---|
211 | | - | else 0 |
---|
212 | | - | } |
---|
213 | | - | let I = { |
---|
214 | | - | let g = getInteger(this, D) |
---|
215 | | - | if ($isInstanceOf(g, "Int")) |
---|
216 | | - | then { |
---|
217 | | - | let h = g |
---|
218 | | - | h |
---|
219 | | - | } |
---|
220 | | - | else 0 |
---|
221 | | - | } |
---|
222 | | - | let J = { |
---|
223 | | - | let g = getInteger(this, E) |
---|
224 | | - | if ($isInstanceOf(g, "Int")) |
---|
225 | | - | then { |
---|
226 | | - | let h = g |
---|
227 | | - | h |
---|
228 | | - | } |
---|
229 | | - | else 0 |
---|
230 | | - | } |
---|
231 | | - | let K = { |
---|
232 | | - | let g = getInteger(this, F) |
---|
233 | | - | if ($isInstanceOf(g, "Int")) |
---|
234 | | - | then { |
---|
235 | | - | let h = g |
---|
236 | | - | h |
---|
237 | | - | } |
---|
238 | | - | else 0 |
---|
239 | | - | } |
---|
240 | | - | let L = { |
---|
241 | | - | let g = getInteger(this, "DevBox") |
---|
242 | | - | if ($isInstanceOf(g, "Int")) |
---|
243 | | - | then { |
---|
244 | | - | let h = g |
---|
245 | | - | h |
---|
246 | | - | } |
---|
247 | | - | else 0 |
---|
248 | | - | } |
---|
249 | | - | let f = (L + ((x.amount * 5) / 1000)) |
---|
250 | | - | let M = (x.amount + z) |
---|
251 | | - | let N = if (if ((height > ((o + G) + t))) |
---|
252 | | - | then (C > 0) |
---|
253 | | - | else false) |
---|
254 | | - | then v |
---|
255 | | - | else (G + s) |
---|
256 | | - | let O = if (if ((height > ((o + N) + t))) |
---|
257 | | - | then (C > 0) |
---|
258 | | - | else false) |
---|
259 | | - | then "" |
---|
260 | | - | else H |
---|
261 | | - | let P = if (if ((height > ((o + N) + t))) |
---|
262 | | - | then (C > 0) |
---|
263 | | - | else false) |
---|
264 | | - | then height |
---|
265 | | - | else o |
---|
266 | | - | if (if ((M > 0)) |
---|
267 | | - | then ((height - J) > r) |
---|
268 | | - | else false) |
---|
269 | | - | then if (((height - I) > q)) |
---|
270 | | - | then if ((K > 0)) |
---|
271 | | - | then if ((M > C)) |
---|
272 | | - | then if ((m > 0)) |
---|
273 | | - | then if (if (if (if (((P + N) >= height)) |
---|
274 | | - | then true |
---|
275 | | - | else (height >= ((P + N) + t))) |
---|
276 | | - | then (C > 0) |
---|
277 | | - | else false) |
---|
278 | | - | then true |
---|
279 | | - | else (C == 0)) |
---|
280 | | - | then if ((B >= u)) |
---|
281 | | - | then [IntegerEntry(y, M), StringEntry("HighestPushAddress", toBase58String(d.caller.bytes)), IntegerEntry("HighestPush", M), IntegerEntry(D, height), IntegerEntry("PrizeHeight", P), IntegerEntry("Delay", N), IntegerEntry("DevBox", f)] |
---|
282 | | - | else throw((("You have to have " + toString(u)) + " referrals already staking for a minimum of 10 days, to push")) |
---|
283 | | - | else { |
---|
284 | | - | let Q = if ((C > 0)) |
---|
285 | | - | then "You cannot Push after rewarding Prize and before One day has passed after award" |
---|
286 | | - | else "Unexpected error" |
---|
287 | | - | throw(Q) |
---|
288 | | - | } |
---|
289 | | - | else throw("You cannot push before the reward is unlocked, no reward has been detected yet") |
---|
290 | | - | else throw("Your push in troikan token, should be Higher than last Highest Push") |
---|
291 | | - | else throw("To be able to participate in Pushing for the reward you need to Stake ASIMIs in the dApp") |
---|
292 | | - | else throw("You have to wait 10min before you can make a new Push") |
---|
293 | | - | else throw(("Your Push dot not comply one of the following conditions: " + "1. Positive Value for Push in Troikan Toke |
---|
294 | | - | 2. Must Staked ASIMI Token for a minimum of week ")) |
---|
295 | | - | } |
---|
296 | | - | else throw((("Can deposit only positive amounts of Troikan Token, or Check your Wallet balance in Troika, you should have more than " + toString(C)) + " to push")) |
---|
297 | | - | else throw("You do not have enough Troikan Tokens in your Wallet Balance, Please Harvest if you have earned Troikan wallet or transfer to your wallet necessary Troikan amount !") |
---|
298 | | - | } |
---|
299 | | - | |
---|
300 | | - | |
---|
301 | | - | |
---|
302 | | - | @Callable(d) |
---|
303 | | - | func Stake () = { |
---|
304 | | - | let t = (1440 * 1) |
---|
305 | | - | let x = if ((size(d.payments) == 1)) |
---|
306 | | - | then d.payments[0] |
---|
307 | | - | else throw("Attached payment is required") |
---|
308 | | - | if (if ((x.amount > 0)) |
---|
309 | | - | then (x.assetId == a) |
---|
310 | | - | else false) |
---|
311 | | - | then { |
---|
312 | | - | let R = assetBalance(this, b) |
---|
313 | | - | let S = (toBase58String(d.caller.bytes) + "_APY") |
---|
314 | | - | let y = (toBase58String(d.caller.bytes) + "_Push") |
---|
315 | | - | let T = (toBase58String(d.caller.bytes) + "_Staking") |
---|
316 | | - | let U = (toBase58String(d.caller.bytes) + "_Earnings") |
---|
317 | | - | let E = (toBase58String(d.caller.bytes) + "_UserLastStakeBlock") |
---|
318 | | - | let V = (toBase58String(d.caller.bytes) + "_StakedTransactions") |
---|
319 | | - | let W = (toBase58String(d.caller.bytes) + "_PrizeHeight") |
---|
320 | | - | let X = (toBase58String(d.caller.bytes) + "_WeekEarning") |
---|
321 | | - | let Y = { |
---|
322 | | - | let g = getInteger(this, V) |
---|
323 | | - | if ($isInstanceOf(g, "Int")) |
---|
324 | | - | then { |
---|
325 | | - | let h = g |
---|
326 | | - | h |
---|
327 | | - | } |
---|
328 | | - | else 0 |
---|
329 | | - | } |
---|
330 | | - | let j = { |
---|
331 | | - | let g = getString(this, "MaxDepositer") |
---|
332 | | - | if ($isInstanceOf(g, "String")) |
---|
333 | | - | then { |
---|
334 | | - | let h = g |
---|
335 | | - | h |
---|
336 | | - | } |
---|
337 | | - | else "" |
---|
338 | | - | } |
---|
339 | | - | let Z = { |
---|
340 | | - | let g = getInteger(this, "MaxDepositBlock") |
---|
341 | | - | if ($isInstanceOf(g, "Int")) |
---|
342 | | - | then { |
---|
343 | | - | let h = g |
---|
344 | | - | h |
---|
345 | | - | } |
---|
346 | | - | else 0 |
---|
347 | | - | } |
---|
348 | | - | let aa = { |
---|
349 | | - | let g = getInteger(this, "MaxDeposit") |
---|
350 | | - | if ($isInstanceOf(g, "Int")) |
---|
351 | | - | then { |
---|
352 | | - | let h = g |
---|
353 | | - | h |
---|
354 | | - | } |
---|
355 | | - | else 0 |
---|
356 | | - | } |
---|
357 | | - | let ab = if ((x.amount > aa)) |
---|
358 | | - | then toBase58String(d.caller.bytes) |
---|
359 | | - | else j |
---|
360 | | - | let ac = if ((x.amount > aa)) |
---|
361 | | - | then x.amount |
---|
362 | | - | else aa |
---|
363 | | - | let ad = if ((x.amount > aa)) |
---|
364 | | - | then height |
---|
365 | | - | else Z |
---|
366 | | - | let ae = { |
---|
367 | | - | let g = getInteger(this, y) |
---|
368 | | - | if ($isInstanceOf(g, "Int")) |
---|
369 | | - | then { |
---|
370 | | - | let h = g |
---|
371 | | - | h |
---|
372 | | - | } |
---|
373 | | - | else 0 |
---|
374 | | - | } |
---|
375 | | - | let J = { |
---|
376 | | - | let g = getInteger(this, E) |
---|
377 | | - | if ($isInstanceOf(g, "Int")) |
---|
378 | | - | then { |
---|
379 | | - | let h = g |
---|
380 | | - | h |
---|
381 | | - | } |
---|
382 | | - | else 0 |
---|
383 | | - | } |
---|
384 | | - | let af = if ((J == 0)) |
---|
385 | | - | then height |
---|
386 | | - | else J |
---|
387 | | - | let ag = (Y + 1) |
---|
388 | | - | let ah = { |
---|
389 | | - | let g = getInteger(this, T) |
---|
390 | | - | if ($isInstanceOf(g, "Int")) |
---|
391 | | - | then { |
---|
392 | | - | let h = g |
---|
393 | | - | h |
---|
394 | | - | } |
---|
395 | | - | else 0 |
---|
396 | | - | } |
---|
397 | | - | let ai = (ah + x.amount) |
---|
398 | | - | let i = assetBalance(this, a) |
---|
399 | | - | let l = { |
---|
400 | | - | let g = getInteger(this, "StakeBalance") |
---|
401 | | - | if ($isInstanceOf(g, "Int")) |
---|
402 | | - | then { |
---|
403 | | - | let h = g |
---|
404 | | - | h |
---|
405 | | - | } |
---|
406 | | - | else 0 |
---|
407 | | - | } |
---|
408 | | - | let aj = (l + x.amount) |
---|
409 | | - | let m = { |
---|
410 | | - | let g = getInteger(this, "FundBox") |
---|
411 | | - | if ($isInstanceOf(g, "Int")) |
---|
412 | | - | then { |
---|
413 | | - | let h = g |
---|
414 | | - | h |
---|
415 | | - | } |
---|
416 | | - | else 0 |
---|
417 | | - | } |
---|
418 | | - | let ak = { |
---|
419 | | - | let g = getInteger(this, X) |
---|
420 | | - | if ($isInstanceOf(g, "Int")) |
---|
421 | | - | then { |
---|
422 | | - | let h = g |
---|
423 | | - | h |
---|
424 | | - | } |
---|
425 | | - | else 0 |
---|
426 | | - | } |
---|
427 | | - | let al = { |
---|
428 | | - | let g = getInteger(this, U) |
---|
429 | | - | if ($isInstanceOf(g, "Int")) |
---|
430 | | - | then { |
---|
431 | | - | let h = g |
---|
432 | | - | h |
---|
433 | | - | } |
---|
434 | | - | else 0 |
---|
435 | | - | } |
---|
436 | | - | let n = { |
---|
437 | | - | let g = getInteger(this, "PrizeHeight") |
---|
438 | | - | if ($isInstanceOf(g, "Int")) |
---|
439 | | - | then { |
---|
440 | | - | let h = g |
---|
441 | | - | h |
---|
442 | | - | } |
---|
443 | | - | else 0 |
---|
444 | | - | } |
---|
445 | | - | let o = if (if ((n == 0)) |
---|
446 | | - | then (m == 0) |
---|
447 | | - | else false) |
---|
448 | | - | then 0 |
---|
449 | | - | else if (if ((n == 0)) |
---|
450 | | - | then (m != 0) |
---|
451 | | - | else false) |
---|
452 | | - | then height |
---|
453 | | - | else if (if ((n != 0)) |
---|
454 | | - | then (m != 0) |
---|
455 | | - | else false) |
---|
456 | | - | then n |
---|
457 | | - | else 0 |
---|
458 | | - | let G = { |
---|
459 | | - | let g = getInteger(this, "Delay") |
---|
460 | | - | if ($isInstanceOf(g, "Int")) |
---|
461 | | - | then { |
---|
462 | | - | let h = g |
---|
463 | | - | h |
---|
464 | | - | } |
---|
465 | | - | else 0 |
---|
466 | | - | } |
---|
467 | | - | let C = { |
---|
468 | | - | let g = getInteger(this, "HighestPush") |
---|
469 | | - | if ($isInstanceOf(g, "Int")) |
---|
470 | | - | then { |
---|
471 | | - | let h = g |
---|
472 | | - | h |
---|
473 | | - | } |
---|
474 | | - | else 0 |
---|
475 | | - | } |
---|
476 | | - | let H = { |
---|
477 | | - | let g = getString(this, "HighestPushAddress") |
---|
478 | | - | if ($isInstanceOf(g, "String")) |
---|
479 | | - | then { |
---|
480 | | - | let h = g |
---|
481 | | - | h |
---|
482 | | - | } |
---|
483 | | - | else "" |
---|
484 | | - | } |
---|
485 | | - | let O = if (if ((height > ((o + G) + t))) |
---|
486 | | - | then (C > 0) |
---|
487 | | - | else false) |
---|
488 | | - | then "" |
---|
489 | | - | else H |
---|
490 | | - | let P = if (if ((height > ((o + G) + t))) |
---|
491 | | - | then (C > 0) |
---|
492 | | - | else false) |
---|
493 | | - | then height |
---|
494 | | - | else o |
---|
495 | | - | if ((100000000 > R)) |
---|
496 | | - | then throw("No enough GovernToken In Contract, Please deposit GovernTokens") |
---|
497 | | - | else { |
---|
498 | | - | let am = if ((l == 0)) |
---|
499 | | - | then 10000 |
---|
500 | | - | else if ((ag > 10)) |
---|
501 | | - | then ((10000 * ag) * (1 + (ai / l))) |
---|
502 | | - | else (10000 * (1 + (ai / l))) |
---|
503 | | - | let an = if ((al > 0)) |
---|
504 | | - | then ((100 * am) / al) |
---|
505 | | - | else 0 |
---|
506 | | - | let ao = (al + am) |
---|
507 | | - | [IntegerEntry(U, ao), IntegerEntry(T, ai), IntegerEntry(V, ag), IntegerEntry("StakeBalance", aj), IntegerEntry("PrizeHeight", P), IntegerEntry(S, an), IntegerEntry(E, af), IntegerEntry(y, ae), StringEntry("MaxDepositer", ab), IntegerEntry("MaxDeposit", ac), IntegerEntry("MaxDepositBlock", ad), StringEntry("HighestPushAddress", O), IntegerEntry(X, ak), ScriptTransfer(d.caller, am, b)] |
---|
508 | | - | } |
---|
509 | | - | } |
---|
510 | | - | else throw("Can deposit only StakeToken") |
---|
511 | | - | } |
---|
512 | | - | |
---|
513 | | - | |
---|
514 | | - | |
---|
515 | | - | @Callable(d) |
---|
516 | | - | func WithdrawStakedFunds (ap) = { |
---|
517 | | - | let t = (1440 * 1) |
---|
518 | | - | let E = (toBase58String(d.caller.bytes) + "_UserLastStakeBlock") |
---|
519 | | - | let T = (toBase58String(d.caller.bytes) + "_Staking") |
---|
520 | | - | let U = ((toBase58String(d.caller.bytes) + "_") + toBase58String(b)) |
---|
521 | | - | let i = assetBalance(this, a) |
---|
522 | | - | let J = { |
---|
523 | | - | let g = getInteger(this, E) |
---|
524 | | - | if ($isInstanceOf(g, "Int")) |
---|
525 | | - | then { |
---|
526 | | - | let h = g |
---|
527 | | - | h |
---|
528 | | - | } |
---|
529 | | - | else 0 |
---|
530 | | - | } |
---|
531 | | - | let l = { |
---|
532 | | - | let g = getInteger(this, "StakeBalance") |
---|
533 | | - | if ($isInstanceOf(g, "Int")) |
---|
534 | | - | then { |
---|
535 | | - | let h = g |
---|
536 | | - | h |
---|
537 | | - | } |
---|
538 | | - | else 0 |
---|
539 | | - | } |
---|
540 | | - | let m = { |
---|
541 | | - | let g = getInteger(this, "FundBox") |
---|
542 | | - | if ($isInstanceOf(g, "Int")) |
---|
543 | | - | then { |
---|
544 | | - | let h = g |
---|
545 | | - | h |
---|
546 | | - | } |
---|
547 | | - | else 0 |
---|
548 | | - | } |
---|
549 | | - | let n = { |
---|
550 | | - | let g = getInteger(this, "PrizeHeight") |
---|
551 | | - | if ($isInstanceOf(g, "Int")) |
---|
552 | | - | then { |
---|
553 | | - | let h = g |
---|
554 | | - | h |
---|
555 | | - | } |
---|
556 | | - | else 0 |
---|
557 | | - | } |
---|
558 | | - | let G = { |
---|
559 | | - | let g = getInteger(this, "Delay") |
---|
560 | | - | if ($isInstanceOf(g, "Int")) |
---|
561 | | - | then { |
---|
562 | | - | let h = g |
---|
563 | | - | h |
---|
564 | | - | } |
---|
565 | | - | else 0 |
---|
566 | | - | } |
---|
567 | | - | let C = { |
---|
568 | | - | let g = getInteger(this, "HighestPush") |
---|
569 | | - | if ($isInstanceOf(g, "Int")) |
---|
570 | | - | then { |
---|
571 | | - | let h = g |
---|
572 | | - | h |
---|
573 | | - | } |
---|
574 | | - | else 0 |
---|
575 | | - | } |
---|
576 | | - | let o = if (if ((n == 0)) |
---|
577 | | - | then (m == 0) |
---|
578 | | - | else false) |
---|
579 | | - | then 0 |
---|
580 | | - | else if (if ((n == 0)) |
---|
581 | | - | then (m != 0) |
---|
582 | | - | else false) |
---|
583 | | - | then height |
---|
584 | | - | else if (if ((n != 0)) |
---|
585 | | - | then (m != 0) |
---|
586 | | - | else false) |
---|
587 | | - | then n |
---|
588 | | - | else 0 |
---|
589 | | - | let H = { |
---|
590 | | - | let g = getString(this, "HighestPushAddress") |
---|
591 | | - | if ($isInstanceOf(g, "String")) |
---|
592 | | - | then { |
---|
593 | | - | let h = g |
---|
594 | | - | h |
---|
595 | | - | } |
---|
596 | | - | else "" |
---|
597 | | - | } |
---|
598 | | - | let O = if (if ((height > ((o + G) + t))) |
---|
599 | | - | then (C > 0) |
---|
600 | | - | else false) |
---|
601 | | - | then "" |
---|
602 | | - | else H |
---|
603 | | - | let P = if (if ((height > ((o + G) + t))) |
---|
604 | | - | then (C > 0) |
---|
605 | | - | else false) |
---|
606 | | - | then height |
---|
607 | | - | else o |
---|
608 | | - | let e = toBase58String(d.caller.bytes) |
---|
609 | | - | let aq = { |
---|
610 | | - | let g = getInteger(this, T) |
---|
611 | | - | if ($isInstanceOf(g, "Int")) |
---|
612 | | - | then { |
---|
613 | | - | let h = g |
---|
614 | | - | h |
---|
615 | | - | } |
---|
616 | | - | else 0 |
---|
617 | | - | } |
---|
618 | | - | let p = (aq - ap) |
---|
619 | | - | let aj = (l - ap) |
---|
620 | | - | let af = if ((aj == 0)) |
---|
621 | | - | then 0 |
---|
622 | | - | else J |
---|
623 | | - | if ((0 > ap)) |
---|
624 | | - | then throw("Can't withdraw negative amount") |
---|
625 | | - | else if ((0 > p)) |
---|
626 | | - | then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((aq / 100000000)))) |
---|
627 | | - | else if ((100000000 > assetBalance(this, b))) |
---|
628 | | - | then throw(("Not enough Troika In Contract: " + toString((assetBalance(this, b) / 100000000)))) |
---|
629 | | - | else [IntegerEntry(U, 100000000), IntegerEntry(T, p), IntegerEntry("StakeBalance", aj), IntegerEntry("PrizeHeight", P), IntegerEntry(E, af), StringEntry("HighestPushAddress", O), ScriptTransfer(d.caller, 100000000, b), ScriptTransfer(d.caller, ap, a)] |
---|
630 | | - | } |
---|
631 | | - | |
---|
632 | | - | |
---|
633 | | - | |
---|
634 | | - | @Callable(d) |
---|
635 | | - | func WithdrawBigStakeReward () = { |
---|
636 | | - | let t = (1440 * 1) |
---|
637 | | - | let ar = (toBase58String(d.caller.bytes) + "_LastBigStakerRewardBlock") |
---|
638 | | - | let as = (toBase58String(d.caller.bytes) + "_BigStaker") |
---|
639 | | - | let U = (toBase58String(d.caller.bytes) + "_Earnings") |
---|
640 | | - | let at = 10 |
---|
641 | | - | let au = { |
---|
642 | | - | let g = getInteger(this, U) |
---|
643 | | - | if ($isInstanceOf(g, "Int")) |
---|
644 | | - | then { |
---|
645 | | - | let h = g |
---|
646 | | - | h |
---|
647 | | - | } |
---|
648 | | - | else 0 |
---|
649 | | - | } |
---|
650 | | - | let av = { |
---|
651 | | - | let g = getInteger(this, ar) |
---|
652 | | - | if ($isInstanceOf(g, "Int")) |
---|
653 | | - | then { |
---|
654 | | - | let h = g |
---|
655 | | - | h |
---|
656 | | - | } |
---|
657 | | - | else 0 |
---|
658 | | - | } |
---|
659 | | - | let aw = { |
---|
660 | | - | let g = getInteger(this, "BigStakerRewardTotal") |
---|
661 | | - | if ($isInstanceOf(g, "Int")) |
---|
662 | | - | then { |
---|
663 | | - | let h = g |
---|
664 | | - | h |
---|
665 | | - | } |
---|
666 | | - | else 0 |
---|
667 | | - | } |
---|
668 | | - | let m = { |
---|
669 | | - | let g = getInteger(this, "FundBox") |
---|
670 | | - | if ($isInstanceOf(g, "Int")) |
---|
671 | | - | then { |
---|
672 | | - | let h = g |
---|
673 | | - | h |
---|
674 | | - | } |
---|
675 | | - | else 0 |
---|
676 | | - | } |
---|
677 | | - | let n = { |
---|
678 | | - | let g = getInteger(this, "PrizeHeight") |
---|
679 | | - | if ($isInstanceOf(g, "Int")) |
---|
680 | | - | then { |
---|
681 | | - | let h = g |
---|
682 | | - | h |
---|
683 | | - | } |
---|
684 | | - | else 0 |
---|
685 | | - | } |
---|
686 | | - | let o = if (if ((n == 0)) |
---|
687 | | - | then (m == 0) |
---|
688 | | - | else false) |
---|
689 | | - | then 0 |
---|
690 | | - | else if (if ((n == 0)) |
---|
691 | | - | then (m != 0) |
---|
692 | | - | else false) |
---|
693 | | - | then height |
---|
694 | | - | else if (if ((n != 0)) |
---|
695 | | - | then (m != 0) |
---|
696 | | - | else false) |
---|
697 | | - | then n |
---|
698 | | - | else 0 |
---|
699 | | - | let G = { |
---|
700 | | - | let g = getInteger(this, "Delay") |
---|
701 | | - | if ($isInstanceOf(g, "Int")) |
---|
702 | | - | then { |
---|
703 | | - | let h = g |
---|
704 | | - | h |
---|
705 | | - | } |
---|
706 | | - | else 0 |
---|
707 | | - | } |
---|
708 | | - | let C = { |
---|
709 | | - | let g = getInteger(this, "HighestPush") |
---|
710 | | - | if ($isInstanceOf(g, "Int")) |
---|
711 | | - | then { |
---|
712 | | - | let h = g |
---|
713 | | - | h |
---|
714 | | - | } |
---|
715 | | - | else 0 |
---|
716 | | - | } |
---|
717 | | - | let H = { |
---|
718 | | - | let g = getString(this, "HighestPushAddress") |
---|
719 | | - | if ($isInstanceOf(g, "String")) |
---|
720 | | - | then { |
---|
721 | | - | let h = g |
---|
722 | | - | h |
---|
723 | | - | } |
---|
724 | | - | else "" |
---|
725 | | - | } |
---|
726 | | - | let O = if (if ((height > ((o + G) + t))) |
---|
727 | | - | then (C > 0) |
---|
728 | | - | else false) |
---|
729 | | - | then "" |
---|
730 | | - | else H |
---|
731 | | - | let P = if (if ((height > ((o + G) + t))) |
---|
732 | | - | then (C > 0) |
---|
733 | | - | else false) |
---|
734 | | - | then height |
---|
735 | | - | else o |
---|
736 | | - | let e = toBase58String(d.caller.bytes) |
---|
737 | | - | let ap = { |
---|
738 | | - | let g = getInteger(this, as) |
---|
739 | | - | if ($isInstanceOf(g, "Int")) |
---|
740 | | - | then { |
---|
741 | | - | let h = g |
---|
742 | | - | h |
---|
743 | | - | } |
---|
744 | | - | else 0 |
---|
745 | | - | } |
---|
746 | | - | let aj = (aw - ap) |
---|
747 | | - | let ax = if ((0 > ((au / 1000) * (1000 - ((1000 * (height - av)) / (at * 1440)))))) |
---|
748 | | - | then (1000 * 100000000) |
---|
749 | | - | else ((au / 1000) * (1000 - ((1000 * (height - av)) / (at * 1440)))) |
---|
750 | | - | if ((0 > ap)) |
---|
751 | | - | then throw(((("Can't withdraw negative amount " + toString((au - (1000 * 100000000)))) + " ... ") + toString(ap))) |
---|
752 | | - | else if (if (if (((1000 * 100000000) > au)) |
---|
753 | | - | then true |
---|
754 | | - | else (1 > ap)) |
---|
755 | | - | then true |
---|
756 | | - | else (0 > (au - ax))) |
---|
757 | | - | then throw(("No ASIMI reward available, or Not enough Earned Troikan Tokens to do transaction, you have: " + toString((au / 100000000)))) |
---|
758 | | - | else if ((aj > 0)) |
---|
759 | | - | then [IntegerEntry(as, 0), IntegerEntry("BigStakerRewardTotal", aj), IntegerEntry(U, (au - ax)), IntegerEntry("PrizeHeight", o), IntegerEntry(ar, height), StringEntry("HighestPushAddress", O), ScriptTransfer(d.caller, ap, a)] |
---|
760 | | - | else throw("Balance Error, Total Big Stakers cannot be negative, Operation won't be authorized") |
---|
761 | | - | } |
---|
762 | | - | |
---|
763 | | - | |
---|
764 | | - | |
---|
765 | | - | @Callable(d) |
---|
766 | | - | func HarvestGovernToiken (ap) = { |
---|
767 | | - | let i = assetBalance(this, a) |
---|
768 | | - | let U = (toBase58String(d.caller.bytes) + "_Earnings") |
---|
769 | | - | let l = { |
---|
770 | | - | let g = getInteger(this, "StakeBalance") |
---|
771 | | - | if ($isInstanceOf(g, "Int")) |
---|
772 | | - | then { |
---|
773 | | - | let h = g |
---|
774 | | - | h |
---|
775 | | - | } |
---|
776 | | - | else 0 |
---|
777 | | - | } |
---|
778 | | - | let m = { |
---|
779 | | - | let g = getInteger(this, "FundBox") |
---|
780 | | - | if ($isInstanceOf(g, "Int")) |
---|
781 | | - | then { |
---|
782 | | - | let h = g |
---|
783 | | - | h |
---|
784 | | - | } |
---|
785 | | - | else 0 |
---|
786 | | - | } |
---|
787 | | - | let n = { |
---|
788 | | - | let g = getInteger(this, "PrizeHeight") |
---|
789 | | - | if ($isInstanceOf(g, "Int")) |
---|
790 | | - | then { |
---|
791 | | - | let h = g |
---|
792 | | - | h |
---|
793 | | - | } |
---|
794 | | - | else 0 |
---|
795 | | - | } |
---|
796 | | - | let o = if (if ((n == 0)) |
---|
797 | | - | then (m == 0) |
---|
798 | | - | else false) |
---|
799 | | - | then 0 |
---|
800 | | - | else if (if ((n == 0)) |
---|
801 | | - | then (m != 0) |
---|
802 | | - | else false) |
---|
803 | | - | then height |
---|
804 | | - | else if (if ((n != 0)) |
---|
805 | | - | then (m != 0) |
---|
806 | | - | else false) |
---|
807 | | - | then n |
---|
808 | | - | else 0 |
---|
809 | | - | let e = toBase58String(d.caller.bytes) |
---|
810 | | - | let aq = { |
---|
811 | | - | let g = getInteger(this, U) |
---|
812 | | - | if ($isInstanceOf(g, "Int")) |
---|
813 | | - | then { |
---|
814 | | - | let h = g |
---|
815 | | - | h |
---|
816 | | - | } |
---|
817 | | - | else 0 |
---|
818 | | - | } |
---|
819 | | - | let p = (aq - ap) |
---|
820 | | - | if ((0 > ap)) |
---|
821 | | - | then throw("Can't withdraw negative amount") |
---|
822 | | - | else if ((0 > p)) |
---|
823 | | - | then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((aq / 100000000)))) |
---|
824 | | - | else [IntegerEntry(U, p), IntegerEntry("PrizeHeight", o), ScriptTransfer(d.caller, ap, b)] |
---|
825 | | - | } |
---|
826 | | - | |
---|
827 | | - | |
---|
828 | | - | |
---|
829 | | - | @Callable(d) |
---|
830 | | - | func delayprize () = { |
---|
831 | | - | let ay = (1440 * 1) |
---|
832 | | - | let t = (1440 * 1) |
---|
833 | | - | let U = ((toBase58String(d.caller.bytes) + "_") + toBase58String(b)) |
---|
834 | | - | let az = assetBalance(Address(d.caller.bytes), b) |
---|
835 | | - | let i = assetBalance(this, a) |
---|
836 | | - | let l = { |
---|
837 | | - | let g = getInteger(this, "StakeBalance") |
---|
838 | | - | if ($isInstanceOf(g, "Int")) |
---|
839 | | - | then { |
---|
840 | | - | let h = g |
---|
841 | | - | h |
---|
842 | | - | } |
---|
843 | | - | else 0 |
---|
844 | | - | } |
---|
845 | | - | let m = { |
---|
846 | | - | let g = getInteger(this, "FundBox") |
---|
847 | | - | if ($isInstanceOf(g, "Int")) |
---|
848 | | - | then { |
---|
849 | | - | let h = g |
---|
850 | | - | h |
---|
851 | | - | } |
---|
852 | | - | else 0 |
---|
853 | | - | } |
---|
854 | | - | let n = { |
---|
855 | | - | let g = getInteger(this, "PrizeHeight") |
---|
856 | | - | if ($isInstanceOf(g, "Int")) |
---|
857 | | - | then { |
---|
858 | | - | let h = g |
---|
859 | | - | h |
---|
860 | | - | } |
---|
861 | | - | else 0 |
---|
862 | | - | } |
---|
863 | | - | let G = { |
---|
864 | | - | let g = getInteger(this, "Delay") |
---|
865 | | - | if ($isInstanceOf(g, "Int")) |
---|
866 | | - | then { |
---|
867 | | - | let h = g |
---|
868 | | - | h |
---|
869 | | - | } |
---|
870 | | - | else 0 |
---|
871 | | - | } |
---|
872 | | - | let o = if (if ((n == 0)) |
---|
873 | | - | then (m == 0) |
---|
874 | | - | else false) |
---|
875 | | - | then 0 |
---|
876 | | - | else if (if ((n == 0)) |
---|
877 | | - | then (m != 0) |
---|
878 | | - | else false) |
---|
879 | | - | then height |
---|
880 | | - | else if (if ((n != 0)) |
---|
881 | | - | then (m != 0) |
---|
882 | | - | else false) |
---|
883 | | - | then n |
---|
884 | | - | else 0 |
---|
885 | | - | let C = { |
---|
886 | | - | let g = getInteger(this, "HighestPush") |
---|
887 | | - | if ($isInstanceOf(g, "Int")) |
---|
888 | | - | then { |
---|
889 | | - | let h = g |
---|
890 | | - | h |
---|
891 | | - | } |
---|
892 | | - | else 0 |
---|
893 | | - | } |
---|
894 | | - | let H = { |
---|
895 | | - | let g = getString(this, "HighestPushAddress") |
---|
896 | | - | if ($isInstanceOf(g, "String")) |
---|
897 | | - | then { |
---|
898 | | - | let h = g |
---|
899 | | - | h |
---|
900 | | - | } |
---|
901 | | - | else "" |
---|
902 | | - | } |
---|
903 | | - | let O = if (if ((height > ((o + G) + t))) |
---|
904 | | - | then (C > 0) |
---|
905 | | - | else false) |
---|
906 | | - | then "" |
---|
907 | | - | else H |
---|
908 | | - | let P = if (if ((height > ((o + G) + t))) |
---|
909 | | - | then (C > 0) |
---|
910 | | - | else false) |
---|
911 | | - | then height |
---|
912 | | - | else o |
---|
913 | | - | let aA = { |
---|
914 | | - | let g = getInteger(this, "DelayCost") |
---|
915 | | - | if ($isInstanceOf(g, "Int")) |
---|
916 | | - | then { |
---|
917 | | - | let h = g |
---|
918 | | - | h |
---|
919 | | - | } |
---|
920 | | - | else 10 |
---|
921 | | - | } |
---|
922 | | - | let x = if ((size(d.payments) == 1)) |
---|
923 | | - | then d.payments[0] |
---|
924 | | - | else throw("Attached payment is required") |
---|
925 | | - | let L = { |
---|
926 | | - | let g = getInteger(this, "DevBox") |
---|
927 | | - | if ($isInstanceOf(g, "Int")) |
---|
928 | | - | then { |
---|
929 | | - | let h = g |
---|
930 | | - | h |
---|
931 | | - | } |
---|
932 | | - | else 0 |
---|
933 | | - | } |
---|
934 | | - | if (if (isDefined(x.assetId)) |
---|
935 | | - | then (x.assetId == b) |
---|
936 | | - | else false) |
---|
937 | | - | then if ((m > 0)) |
---|
938 | | - | then { |
---|
939 | | - | let au = x.amount |
---|
940 | | - | let f = (L + ((x.amount * 5) / 1000)) |
---|
941 | | - | let aB = if ((aA == 0)) |
---|
942 | | - | then 1000000000 |
---|
943 | | - | else (2 * aA) |
---|
944 | | - | if ((au >= aB)) |
---|
945 | | - | then { |
---|
946 | | - | let N = (G + ay) |
---|
947 | | - | [IntegerEntry("Delay", N), IntegerEntry("DelayCost", aB), IntegerEntry("PrizeHeight", P), IntegerEntry("DevBox", f), StringEntry("HighestPushAddress", O)] |
---|
948 | | - | } |
---|
949 | | - | else throw((("To delay the release of the reward ONE DAY later than expected, you need " + toString(aB)) + "TROIKAs")) |
---|
950 | | - | } |
---|
951 | | - | else throw("You cannot delay the reward before reward is received! Please wait until a reward is available") |
---|
952 | | - | else throw("Can Use only Troika Token to Delay Reward") |
---|
953 | | - | } |
---|
954 | | - | |
---|
955 | | - | |
---|
956 | | - | |
---|
957 | | - | @Callable(d) |
---|
958 | | - | func ClaimPrize () = { |
---|
959 | | - | let T = (toBase58String(d.caller.bytes) + "_Staking") |
---|
960 | | - | let y = (toBase58String(d.caller.bytes) + "_Push") |
---|
961 | | - | let E = (toBase58String(d.caller.bytes) + "_UserLastStakeBlock") |
---|
962 | | - | let r = (1440 * 7) |
---|
963 | | - | let u = 3 |
---|
964 | | - | let aC = assetBalance(this, b) |
---|
965 | | - | let i = assetBalance(this, a) |
---|
966 | | - | let l = { |
---|
967 | | - | let g = getInteger(this, "StakeBalance") |
---|
968 | | - | if ($isInstanceOf(g, "Int")) |
---|
969 | | - | then { |
---|
970 | | - | let h = g |
---|
971 | | - | h |
---|
972 | | - | } |
---|
973 | | - | else 0 |
---|
974 | | - | } |
---|
975 | | - | let m = { |
---|
976 | | - | let g = getInteger(this, "FundBox") |
---|
977 | | - | if ($isInstanceOf(g, "Int")) |
---|
978 | | - | then { |
---|
979 | | - | let h = g |
---|
980 | | - | h |
---|
981 | | - | } |
---|
982 | | - | else 0 |
---|
983 | | - | } |
---|
984 | | - | let ae = { |
---|
985 | | - | let g = getInteger(this, y) |
---|
986 | | - | if ($isInstanceOf(g, "Int")) |
---|
987 | | - | then { |
---|
988 | | - | let h = g |
---|
989 | | - | h |
---|
990 | | - | } |
---|
991 | | - | else 0 |
---|
992 | | - | } |
---|
993 | | - | let J = { |
---|
994 | | - | let g = getInteger(this, E) |
---|
995 | | - | if ($isInstanceOf(g, "Int")) |
---|
996 | | - | then { |
---|
997 | | - | let h = g |
---|
998 | | - | h |
---|
999 | | - | } |
---|
1000 | | - | else 0 |
---|
1001 | | - | } |
---|
1002 | | - | let aD = { |
---|
1003 | | - | let g = getInteger(this, T) |
---|
1004 | | - | if ($isInstanceOf(g, "Int")) |
---|
1005 | | - | then { |
---|
1006 | | - | let h = g |
---|
1007 | | - | h |
---|
1008 | | - | } |
---|
1009 | | - | else 0 |
---|
1010 | | - | } |
---|
1011 | | - | let G = { |
---|
1012 | | - | let g = getInteger(this, "Delay") |
---|
1013 | | - | if ($isInstanceOf(g, "Int")) |
---|
1014 | | - | then { |
---|
1015 | | - | let h = g |
---|
1016 | | - | h |
---|
1017 | | - | } |
---|
1018 | | - | else 0 |
---|
1019 | | - | } |
---|
1020 | | - | let aE = { |
---|
1021 | | - | let g = getString(this, "HighestPushAddress") |
---|
1022 | | - | if ($isInstanceOf(g, "String")) |
---|
1023 | | - | then { |
---|
1024 | | - | let h = g |
---|
1025 | | - | h |
---|
1026 | | - | } |
---|
1027 | | - | else "" |
---|
1028 | | - | } |
---|
1029 | | - | let aF = { |
---|
1030 | | - | let g = getInteger(this, "PrizeHeight") |
---|
1031 | | - | if ($isInstanceOf(g, "Int")) |
---|
1032 | | - | then { |
---|
1033 | | - | let h = g |
---|
1034 | | - | h |
---|
1035 | | - | } |
---|
1036 | | - | else 0 |
---|
1037 | | - | } |
---|
1038 | | - | let C = { |
---|
1039 | | - | let g = getInteger(this, "HighestPush") |
---|
1040 | | - | if ($isInstanceOf(g, "Int")) |
---|
1041 | | - | then { |
---|
1042 | | - | let h = g |
---|
1043 | | - | h |
---|
1044 | | - | } |
---|
1045 | | - | else 0 |
---|
1046 | | - | } |
---|
1047 | | - | let A = (toBase58String(d.caller.bytes) + "_refs") |
---|
1048 | | - | let B = { |
---|
1049 | | - | let g = getInteger(this, A) |
---|
1050 | | - | if ($isInstanceOf(g, "Int")) |
---|
1051 | | - | then { |
---|
1052 | | - | let h = g |
---|
1053 | | - | h |
---|
1054 | | - | } |
---|
1055 | | - | else 0 |
---|
1056 | | - | } |
---|
1057 | | - | if (if ((m == 0)) |
---|
1058 | | - | then true |
---|
1059 | | - | else (10000000000 > aC)) |
---|
1060 | | - | then throw("No prize to Claim or Not enough Govern Token en Contract (Min 100 Troika)") |
---|
1061 | | - | else if ((toBase58String(d.caller.bytes) != aE)) |
---|
1062 | | - | then throw("You are not the winner hence cannot claim the reward ") |
---|
1063 | | - | else if (if ((100000000 > aD)) |
---|
1064 | | - | then (r > J) |
---|
1065 | | - | else false) |
---|
1066 | | - | then throw("You have to Stake ASIMI Token to claim reward ") |
---|
1067 | | - | else if (if ((height > (aF + G))) |
---|
1068 | | - | then (ae >= C) |
---|
1069 | | - | else false) |
---|
1070 | | - | then if ((B >= u)) |
---|
1071 | | - | then [IntegerEntry(aE, m), IntegerEntry("FundBox", 0), IntegerEntry("HighestPush", 0), IntegerEntry(y, 0), StringEntry("HighestPushAddress", ""), IntegerEntry("PrizeHeight", 0), IntegerEntry("Delay", 0), IntegerEntry("DelayCost", 0), StringEntry("LastWinner", aE), IntegerEntry("LastPrize", m), ScriptTransfer(d.caller, m, a), ScriptTransfer(d.caller, 1000000000, b)] |
---|
1072 | | - | else throw((("You have to have " + toString(u)) + " referrals already staking for a minimum of 10 days to Claim the prize")) |
---|
1073 | | - | else throw("You have to be the user with the highest Push and wait till countown is finished, to claim Reward") |
---|
1074 | | - | } |
---|
1075 | | - | |
---|
1076 | | - | |
---|
1077 | | - | |
---|
1078 | | - | @Callable(d) |
---|
1079 | | - | func Addmentor (aG) = { |
---|
1080 | | - | let aH = (toBase58String(d.caller.bytes) + "_Mentor") |
---|
1081 | | - | if ((aG != "")) |
---|
1082 | | - | then [StringEntry(aH, aG)] |
---|
1083 | | - | else throw("Mentor's Address cannot be empty") |
---|
1084 | | - | } |
---|
1085 | | - | |
---|
1086 | | - | |
---|
1087 | | - | |
---|
1088 | | - | @Callable(d) |
---|
1089 | | - | func UpdateTwittsCost (aI,aJ) = if ((toBase58String(d.caller.bytes) == c)) |
---|
1090 | | - | then [IntegerEntry("LikePackageASIMICost", (aI * 100000000)), IntegerEntry("LikePackageTROIKANCost", (aJ * 100000000))] |
---|
1091 | | - | else throw("Only available for Admin") |
---|
1092 | | - | |
---|
1093 | | - | |
---|
1094 | | - | |
---|
1095 | | - | @Callable(d) |
---|
1096 | | - | func GetLikesPackage (aK,aL) = { |
---|
1097 | | - | let aM = ((toString(aK) + "_Twitt2Like_") + toString(aL)) |
---|
1098 | | - | let aN = { |
---|
1099 | | - | let g = getInteger(this, "LikePackageTROIKANCost") |
---|
1100 | | - | if ($isInstanceOf(g, "Int")) |
---|
1101 | | - | then { |
---|
1102 | | - | let h = g |
---|
1103 | | - | h |
---|
1104 | | - | } |
---|
1105 | | - | else 0 |
---|
1106 | | - | } |
---|
1107 | | - | let aO = { |
---|
1108 | | - | let g = getInteger(this, "LikePackageASIMICost") |
---|
1109 | | - | if ($isInstanceOf(g, "Int")) |
---|
1110 | | - | then { |
---|
1111 | | - | let h = g |
---|
1112 | | - | h |
---|
1113 | | - | } |
---|
1114 | | - | else 0 |
---|
1115 | | - | } |
---|
1116 | | - | let x = if ((size(d.payments) == 2)) |
---|
1117 | | - | then d.payments[0] |
---|
1118 | | - | else throw("Attached payment is required") |
---|
1119 | | - | if (if ((d.payments[0].assetId == a)) |
---|
1120 | | - | then (d.payments[1].assetId == b) |
---|
1121 | | - | else false) |
---|
1122 | | - | then if ((d.payments[0].amount >= aO)) |
---|
1123 | | - | then if ((d.payments[1].amount >= aN)) |
---|
1124 | | - | then { |
---|
1125 | | - | let aP = { |
---|
1126 | | - | let g = getInteger(this, aM) |
---|
1127 | | - | if ($isInstanceOf(g, "Int")) |
---|
1128 | | - | then { |
---|
1129 | | - | let h = g |
---|
1130 | | - | h |
---|
1131 | | - | } |
---|
1132 | | - | else 0 |
---|
1133 | | - | } |
---|
1134 | | - | if ((aP == 0)) |
---|
1135 | | - | then [IntegerEntry(((toString(aK) + "_Twitt2Like_") + toString(aL)), ((95 * aO) / 100)), IntegerEntry("LikeTwittsDevBox", ((5 * aO) / 100))] |
---|
1136 | | - | else throw("Cannot acquire a new package, the prior like package for this twitt has to be drained to be able to acquire a new one") |
---|
1137 | | - | } |
---|
1138 | | - | else throw(("TROIKAN Amount should be :" + toString((aO / 100000000)))) |
---|
1139 | | - | else throw(("ASIMI Amount should be :" + toString((aN / 100000000)))) |
---|
1140 | | - | else throw("Payments should be both ASIMI and TROIKAN tokens") |
---|
1141 | | - | } |
---|
1142 | | - | |
---|
1143 | | - | |
---|
1144 | | - | |
---|
1145 | | - | @Callable(d) |
---|
1146 | | - | func GetMyLikedTwittsRewards (aQ) = { |
---|
1147 | | - | let aR = { |
---|
1148 | | - | let g = getInteger(this, (aQ + "_Like_Amount")) |
---|
1149 | | - | if ($isInstanceOf(g, "Int")) |
---|
1150 | | - | then { |
---|
1151 | | - | let h = g |
---|
1152 | | - | h |
---|
1153 | | - | } |
---|
1154 | | - | else 0 |
---|
1155 | | - | } |
---|
1156 | | - | let aS = { |
---|
1157 | | - | let g = getInteger(this, (aQ + "_TroikandApp_RT_Amount")) |
---|
1158 | | - | if ($isInstanceOf(g, "Int")) |
---|
1159 | | - | then { |
---|
1160 | | - | let h = g |
---|
1161 | | - | h |
---|
1162 | | - | } |
---|
1163 | | - | else 0 |
---|
1164 | | - | } |
---|
1165 | | - | if (if ((aR >= (1 * 100000000))) |
---|
1166 | | - | then (aS >= (1 * 100000000)) |
---|
1167 | | - | else false) |
---|
1168 | | - | then [IntegerEntry((aQ + "_TroikandApp_RT_Amount"), 0), IntegerEntry((aQ + "_Like_Amount"), 0), ScriptTransfer(d.caller, aR, a), ScriptTransfer(d.caller, aS, b)] |
---|
1169 | | - | else throw("Minimum earnings to withdraw are: 100 ASIMI and 50 Troikans") |
---|
1170 | | - | } |
---|
1171 | | - | |
---|
1172 | | - | |
---|
1173 | | - | |
---|
1174 | | - | @Callable(d) |
---|
1175 | | - | func LinkTwitterAcc2Wallet (aK) = { |
---|
1176 | | - | let aT = { |
---|
1177 | | - | let g = getString(this, (aK + "_Wallet")) |
---|
1178 | | - | if ($isInstanceOf(g, "String")) |
---|
1179 | | - | then { |
---|
1180 | | - | let h = g |
---|
1181 | | - | h |
---|
1182 | | - | } |
---|
1183 | | - | else "None" |
---|
1184 | | - | } |
---|
1185 | | - | if ((toBase58String(d.caller.bytes) == aT)) |
---|
1186 | | - | then throw("You already have your wallet linked to the Twitter account") |
---|
1187 | | - | else if (if ((toBase58String(d.caller.bytes) != aT)) |
---|
1188 | | - | then (aT != "None") |
---|
1189 | | - | else false) |
---|
1190 | | - | then throw("The wallet you are using is not the linked Wallet to this Twitter account") |
---|
1191 | | - | else [StringEntry((aK + "_Wallet"), toBase58String(d.caller.bytes))] |
---|
1192 | | - | } |
---|
| 6 | + | @Callable(a) |
---|
| 7 | + | func CertifyUser () = [StringEntry("CertifiedUser", toBase58String(a.caller.bytes)), IntegerEntry("CertifiedUserBorn", height)] |
---|