2024.04.05 17:52 [3049596] smart account 3N9evuqxGecMq9hBmpdJu2VkMzdR5VNVrvK > SELF 0.00000000 Waves

{ "type": 13, "id": "EDU3M2uBP4x1W5dAGZHs8KbGEujpoEB6fSGoTJffyj4L", "fee": 1000000, "feeAssetId": null, "timestamp": 1712328731218, "version": 2, "chainId": 84, "sender": "3N9evuqxGecMq9hBmpdJu2VkMzdR5VNVrvK", "senderPublicKey": "AHY8zupoYc6HPJ5fh1gQiGE9bNZSeifFbcQQ89okxVug", "proofs": [ "5UYjWHVisTntXM4JkUDCHnHrx5QjWZiPLqc75v2b4Kgu5J3AjQxUzZxHTHvBQxPBA4VSyEJCRVz46NBq1SG5Dmh2" ], "script": "base64:BgIECAISAAABAWkBC0NlcnRpZnlVc2VyAAkAzAgCCQELU3RyaW5nRW50cnkCAg1DZXJ0aWZpZWRVc2VyCQDYBAEICAUBaQZjYWxsZXIFYnl0ZXMJAMwIAgkBDEludGVnZXJFbnRyeQICEUNlcnRpZmllZFVzZXJCb3JuBQZoZWlnaHQFA25pbADdiA2c", "height": 3049596, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EivmKMNW77KNjnXFmVvugLjkvXtsjo8uyTjZ4Fmhk8oy Next: CnodQWZ1x28Nf3MjcKjNiqCKFaNGD8hDvCm9ZzSFyLKy Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let StakedToken = base58'Hoej8L1ezqQY4Miex4Z4J7uJ33LCdcubV3DsubGHEqWP'
5-
6-let GovernToken = base58'6ZPMzZseuYoMP4ByozJpVxbugXBobwJYF22zVjW5JjN'
7-
8-let dAppAdmin = "3Mu3nwxzGzeQBGxCKLyJcSDKmRiCea9FQSJ"
9-
10-@Callable(i)
11-func DevWithdraw () = {
12- let currentKey = toBase58String(i.caller.bytes)
13- if ((currentKey == dAppAdmin))
14- then {
15- let DevBoxAmount = match getInteger(this, "DevBox") {
16- case a: Int =>
17- a
18- case _ =>
19- 0
20- }
21- if ((0 > DevBoxAmount))
22- then throw("Not enough balance")
23- else [IntegerEntry("DevBox", 0), ScriptTransfer(i.caller, DevBoxAmount, GovernToken)]
24- }
25- else throw("You cannot withdraw as your are not the Dev.")
26- }
27-
284
295
306 @Callable(i)
31-func WithdrawWeeklyEarning () = {
32- let ContractWalletStakeBalance = assetBalance(this, StakedToken)
33- let MaxDepositer = match getString(this, "MaxDepositer") {
34- case a: String =>
35- a
36- case _ =>
37- ""
38- }
39- let UserWeeklyEarnings = (toBase58String(i.caller.bytes) + "_WeekEarning")
40- let StakeBalance = match getInteger(this, "StakeBalance") {
41- case a: Int =>
42- a
43- case _ =>
44- 0
45- }
46- let PrizeAmount = match getInteger(this, "FundBox") {
47- case a: Int =>
48- a
49- case _ =>
50- 0
51- }
52- let HeightTransactFundBox = match getInteger(this, "PrizeHeight") {
53- case a: Int =>
54- a
55- case _ =>
56- 0
57- }
58- let PrizeHeightValue = if (if ((HeightTransactFundBox == 0))
59- then (PrizeAmount == 0)
60- else false)
61- then 0
62- else if (if ((HeightTransactFundBox == 0))
63- then (PrizeAmount != 0)
64- else false)
65- then height
66- else if (if ((HeightTransactFundBox != 0))
67- then (PrizeAmount != 0)
68- else false)
69- then HeightTransactFundBox
70- else 0
71- let currentKey = toBase58String(i.caller.bytes)
72- let newAmount = match getInteger(this, UserWeeklyEarnings) {
73- case a: Int =>
74- a
75- case _ =>
76- 0
77- }
78- if ((0 > newAmount))
79- then throw("Can't withdraw negative amount")
80- else if ((0 > newAmount))
81- then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((newAmount / 100000000))))
82- else [IntegerEntry(UserWeeklyEarnings, 0), IntegerEntry("PrizeHeight", PrizeHeightValue), IntegerEntry("MaxDeposit", 0), ScriptTransfer(i.caller, newAmount, StakedToken)]
83- }
84-
85-
86-
87-@Callable(i)
88-func PushReward () = {
89- let minPushBlock = 10
90- let minStakeBlock = (7 * 1440)
91- let DelayAfterPush = 60
92- let WaitTime = (1440 * 1)
93- let minref = 3
94- let FirstPushTimer = (7 * 1440)
95- let userWalletGovernBalance = assetBalance(Address(i.caller.bytes), GovernToken)
96- let pmt = if ((size(i.payments) == 1))
97- then i.payments[0]
98- else throw("Attached payment is required")
99- let UserPush = (toBase58String(i.caller.bytes) + "_Push")
100- let UserLastPushOldValue = match getInteger(this, UserPush) {
101- case a: Int =>
102- a
103- case _ =>
104- 0
105- }
106- let UserRefsNum = (toBase58String(i.caller.bytes) + "_refs")
107- let UserRefsNumValue = match getInteger(this, UserRefsNum) {
108- case a: Int =>
109- a
110- case _ =>
111- 0
112- }
113- let HighestPushValue = match getInteger(this, "HighestPush") {
114- case a: Int =>
115- a
116- case _ =>
117- 0
118- }
119- if ((userWalletGovernBalance > pmt.amount))
120- then if (if (((pmt.amount + UserLastPushOldValue) > HighestPushValue))
121- then (pmt.assetId == GovernToken)
122- else false)
123- then {
124- let UserLastPushBlock = (toBase58String(i.caller.bytes) + "_UserLastPushBlock")
125- let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock")
126- let UserStake = (toBase58String(i.caller.bytes) + "_Staking")
127- let ContractWalletStakeBalance = assetBalance(this, StakedToken)
128- let StakeBalance = match getInteger(this, "StakeBalance") {
129- case a: Int =>
130- a
131- case _ =>
132- 0
133- }
134- let PrizeAmount = match getInteger(this, "FundBox") {
135- case a: Int =>
136- a
137- case _ =>
138- 0
139- }
140- let HeightTransactFundBox = match getInteger(this, "PrizeHeight") {
141- case a: Int =>
142- a
143- case _ =>
144- 0
145- }
146- let PrizeHeightValue = if (if ((HeightTransactFundBox == 0))
147- then (PrizeAmount == 0)
148- else false)
149- then 0
150- else if (if ((HeightTransactFundBox == 0))
151- then (PrizeAmount != 0)
152- else false)
153- then height
154- else if (if ((HeightTransactFundBox != 0))
155- then (PrizeAmount != 0)
156- else false)
157- then HeightTransactFundBox
158- else 0
159- let ActualDelay = match getInteger(this, "Delay") {
160- case a: Int =>
161- a
162- case _ =>
163- 0
164- }
165- let HighestPushAddress = match getInteger(this, "HighestPushAddress") {
166- case a: Int =>
167- a
168- case _ =>
169- 0
170- }
171- let UserLastPushBlockValue = match getInteger(this, UserLastPushBlock) {
172- case a: Int =>
173- a
174- case _ =>
175- 0
176- }
177- let UserLastStakeBlockValue = match getInteger(this, UserLastStakeBlock) {
178- case a: Int =>
179- a
180- case _ =>
181- 0
182- }
183- let UserStakeValue = match getInteger(this, UserStake) {
184- case a: Int =>
185- a
186- case _ =>
187- 0
188- }
189- let DevBoxBalance = match getInteger(this, "DevBox") {
190- case a: Int =>
191- a
192- case _ =>
193- 0
194- }
195- let DevBoxAmount = (DevBoxBalance + ((pmt.amount * 5) / 1000))
196- let UserPushvalue = (pmt.amount + UserLastPushOldValue)
197- let NewDelay = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
198- then (HighestPushValue > 0)
199- else false)
200- then FirstPushTimer
201- else (ActualDelay + DelayAfterPush)
202- let HighestPushAddressValue = if (if ((height > ((PrizeHeightValue + NewDelay) + WaitTime)))
203- then (HighestPushValue > 0)
204- else false)
205- then ""
206- else HighestPushAddress
207- let PrizeHeightValueNew = if (if ((height > ((PrizeHeightValue + NewDelay) + WaitTime)))
208- then (HighestPushValue > 0)
209- else false)
210- then height
211- else PrizeHeightValue
212- if (if ((UserPushvalue > 0))
213- then ((height - UserLastStakeBlockValue) > minStakeBlock)
214- else false)
215- then if (((height - UserLastPushBlockValue) > minPushBlock))
216- then if ((UserStakeValue > 0))
217- then if ((UserPushvalue > HighestPushValue))
218- then if ((PrizeAmount > 0))
219- then if (if (if (if (((PrizeHeightValueNew + NewDelay) >= height))
220- then true
221- else (height >= ((PrizeHeightValueNew + NewDelay) + WaitTime)))
222- then (HighestPushValue > 0)
223- else false)
224- then true
225- else (HighestPushValue == 0))
226- then if ((UserRefsNumValue >= minref))
227- then [IntegerEntry(UserPush, UserPushvalue), StringEntry("HighestPushAddress", toBase58String(i.caller.bytes)), IntegerEntry("HighestPush", UserPushvalue), IntegerEntry(UserLastPushBlock, height), IntegerEntry("PrizeHeight", PrizeHeightValueNew), IntegerEntry("Delay", NewDelay), IntegerEntry("DevBox", DevBoxAmount)]
228- else throw((("You have to have " + toString(minref)) + " referrals already staking for a minimum of 10 days, to push"))
229- else {
230- let txt = if ((HighestPushValue > 0))
231- then "You cannot Push after rewarding Prize and before One day has passed after award"
232- else "Unexpected error"
233- throw(txt)
234- }
235- else throw("You cannot push before the reward is unlocked, no reward has been detected yet")
236- else throw("Your push in troikan token, should be Higher than last Highest Push")
237- else throw("To be able to participate in Pushing for the reward you need to Stake ASIMIs in the dApp")
238- else throw("You have to wait 10min before you can make a new Push")
239- else throw(("Your Push dot not comply one of the following conditions: " + "1. Positive Value for Push in Troikan Toke
240- 2. Must Staked ASIMI Token for a minimum of week "))
241- }
242- else throw((("Can deposit only positive amounts of Troikan Token, or Check your Wallet balance in Troika, you should have more than " + toString(HighestPushValue)) + " to push"))
243- 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 !")
244- }
245-
246-
247-
248-@Callable(i)
249-func Stake () = {
250- let WaitTime = (1440 * 1)
251- let pmt = if ((size(i.payments) == 1))
252- then i.payments[0]
253- else throw("Attached payment is required")
254- if (if ((pmt.amount > 0))
255- then (pmt.assetId == StakedToken)
256- else false)
257- then {
258- let GovernTokenSmartContractBalance = assetBalance(this, GovernToken)
259- let UserAPY = (toBase58String(i.caller.bytes) + "_APY")
260- let UserPush = (toBase58String(i.caller.bytes) + "_Push")
261- let UserStakedTokenKey = (toBase58String(i.caller.bytes) + "_Staking")
262- let UserGovernTokenKey = (toBase58String(i.caller.bytes) + "_Earnings")
263- let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock")
264- let UserStakeTransactionsKey = (toBase58String(i.caller.bytes) + "_StakedTransactions")
265- let AddressHeight = (toBase58String(i.caller.bytes) + "_PrizeHeight")
266- let UserWeekEarnings = (toBase58String(i.caller.bytes) + "_WeekEarning")
267- let UserStakeTransactions = match getInteger(this, UserStakeTransactionsKey) {
268- case a: Int =>
269- a
270- case _ =>
271- 0
272- }
273- let MaxDepositer = match getString(this, "MaxDepositer") {
274- case a: String =>
275- a
276- case _ =>
277- ""
278- }
279- let MaxDepositBlock = match getInteger(this, "MaxDepositBlock") {
280- case a: Int =>
281- a
282- case _ =>
283- 0
284- }
285- let MaxDeposit = match getInteger(this, "MaxDeposit") {
286- case a: Int =>
287- a
288- case _ =>
289- 0
290- }
291- let MaxDepositerValue = if ((pmt.amount > MaxDeposit))
292- then toBase58String(i.caller.bytes)
293- else MaxDepositer
294- let MaxDepositValue = if ((pmt.amount > MaxDeposit))
295- then pmt.amount
296- else MaxDeposit
297- let MaxDepositBlockValue = if ((pmt.amount > MaxDeposit))
298- then height
299- else MaxDepositBlock
300- let UserPushValue = match getInteger(this, UserPush) {
301- case a: Int =>
302- a
303- case _ =>
304- 0
305- }
306- let UserLastStakeBlockValue = match getInteger(this, UserLastStakeBlock) {
307- case a: Int =>
308- a
309- case _ =>
310- 0
311- }
312- let UserLastStakeBlockNewValue = if ((UserLastStakeBlockValue == 0))
313- then height
314- else UserLastStakeBlockValue
315- let NewUserStakeTransactions = (UserStakeTransactions + 1)
316- let currentAmountStakedToken = match getInteger(this, UserStakedTokenKey) {
317- case a: Int =>
318- a
319- case _ =>
320- 0
321- }
322- let newAmountStakedToken = (currentAmountStakedToken + pmt.amount)
323- let ContractWalletStakeBalance = assetBalance(this, StakedToken)
324- let StakeBalance = match getInteger(this, "StakeBalance") {
325- case a: Int =>
326- a
327- case _ =>
328- 0
329- }
330- let StakeBalanceAmount = (StakeBalance + pmt.amount)
331- let PrizeAmount = match getInteger(this, "FundBox") {
332- case a: Int =>
333- a
334- case _ =>
335- 0
336- }
337- let UserWeekEarningsValue = match getInteger(this, UserWeekEarnings) {
338- case a: Int =>
339- a
340- case _ =>
341- 0
342- }
343- let currentAmountGovernToken = match getInteger(this, UserGovernTokenKey) {
344- case a: Int =>
345- a
346- case _ =>
347- 0
348- }
349- let HeightTransactFundBox = match getInteger(this, "PrizeHeight") {
350- case a: Int =>
351- a
352- case _ =>
353- 0
354- }
355- let PrizeHeightValue = if (if ((HeightTransactFundBox == 0))
356- then (PrizeAmount == 0)
357- else false)
358- then 0
359- else if (if ((HeightTransactFundBox == 0))
360- then (PrizeAmount != 0)
361- else false)
362- then height
363- else if (if ((HeightTransactFundBox != 0))
364- then (PrizeAmount != 0)
365- else false)
366- then HeightTransactFundBox
367- else 0
368- let ActualDelay = match getInteger(this, "Delay") {
369- case a: Int =>
370- a
371- case _ =>
372- 0
373- }
374- let HighestPushValue = match getInteger(this, "HighestPush") {
375- case a: Int =>
376- a
377- case _ =>
378- 0
379- }
380- let HighestPushAddress = match getString(this, "HighestPushAddress") {
381- case a: String =>
382- a
383- case _ =>
384- ""
385- }
386- let HighestPushAddressValue = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
387- then (HighestPushValue > 0)
388- else false)
389- then ""
390- else HighestPushAddress
391- let PrizeHeightValueNew = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
392- then (HighestPushValue > 0)
393- else false)
394- then height
395- else PrizeHeightValue
396- if ((100000000 > GovernTokenSmartContractBalance))
397- then throw("No enough GovernToken In Contract, Please deposit GovernTokens")
398- else {
399- let Reward = if ((StakeBalance == 0))
400- then 10000
401- else if ((NewUserStakeTransactions > 10))
402- then ((10000 * NewUserStakeTransactions) * (1 + (newAmountStakedToken / StakeBalance)))
403- else (10000 * (1 + (newAmountStakedToken / StakeBalance)))
404- let UserAPYValue = if ((currentAmountGovernToken > 0))
405- then ((100 * Reward) / currentAmountGovernToken)
406- else 0
407- let newAmountGovernToken = (currentAmountGovernToken + Reward)
408-[IntegerEntry(UserGovernTokenKey, newAmountGovernToken), IntegerEntry(UserStakedTokenKey, newAmountStakedToken), IntegerEntry(UserStakeTransactionsKey, NewUserStakeTransactions), IntegerEntry("StakeBalance", StakeBalanceAmount), IntegerEntry("PrizeHeight", PrizeHeightValueNew), IntegerEntry(UserAPY, UserAPYValue), IntegerEntry(UserLastStakeBlock, UserLastStakeBlockNewValue), IntegerEntry(UserPush, UserPushValue), StringEntry("MaxDepositer", MaxDepositerValue), IntegerEntry("MaxDeposit", MaxDepositValue), IntegerEntry("MaxDepositBlock", MaxDepositBlockValue), StringEntry("HighestPushAddress", HighestPushAddressValue), IntegerEntry(UserWeekEarnings, UserWeekEarningsValue), ScriptTransfer(i.caller, Reward, GovernToken)]
409- }
410- }
411- else throw("Can deposit only StakeToken")
412- }
413-
414-
415-
416-@Callable(i)
417-func WithdrawStakedFunds (amount) = {
418- let WaitTime = (1440 * 1)
419- let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock")
420- let UserStakedTokenKey = (toBase58String(i.caller.bytes) + "_Staking")
421- let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
422- let ContractWalletStakeBalance = assetBalance(this, StakedToken)
423- let UserLastStakeBlockValue = match getInteger(this, UserLastStakeBlock) {
424- case a: Int =>
425- a
426- case _ =>
427- 0
428- }
429- let StakeBalance = match getInteger(this, "StakeBalance") {
430- case a: Int =>
431- a
432- case _ =>
433- 0
434- }
435- let PrizeAmount = match getInteger(this, "FundBox") {
436- case a: Int =>
437- a
438- case _ =>
439- 0
440- }
441- let HeightTransactFundBox = match getInteger(this, "PrizeHeight") {
442- case a: Int =>
443- a
444- case _ =>
445- 0
446- }
447- let ActualDelay = match getInteger(this, "Delay") {
448- case a: Int =>
449- a
450- case _ =>
451- 0
452- }
453- let HighestPushValue = match getInteger(this, "HighestPush") {
454- case a: Int =>
455- a
456- case _ =>
457- 0
458- }
459- let PrizeHeightValue = if (if ((HeightTransactFundBox == 0))
460- then (PrizeAmount == 0)
461- else false)
462- then 0
463- else if (if ((HeightTransactFundBox == 0))
464- then (PrizeAmount != 0)
465- else false)
466- then height
467- else if (if ((HeightTransactFundBox != 0))
468- then (PrizeAmount != 0)
469- else false)
470- then HeightTransactFundBox
471- else 0
472- let HighestPushAddress = match getString(this, "HighestPushAddress") {
473- case a: String =>
474- a
475- case _ =>
476- ""
477- }
478- let HighestPushAddressValue = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
479- then (HighestPushValue > 0)
480- else false)
481- then ""
482- else HighestPushAddress
483- let PrizeHeightValueNew = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
484- then (HighestPushValue > 0)
485- else false)
486- then height
487- else PrizeHeightValue
488- let currentKey = toBase58String(i.caller.bytes)
489- let currentAmount = match getInteger(this, UserStakedTokenKey) {
490- case a: Int =>
491- a
492- case _ =>
493- 0
494- }
495- let newAmount = (currentAmount - amount)
496- let StakeBalanceAmount = (StakeBalance - amount)
497- let UserLastStakeBlockNewValue = if ((StakeBalanceAmount == 0))
498- then 0
499- else UserLastStakeBlockValue
500- if ((0 > amount))
501- then throw("Can't withdraw negative amount")
502- else if ((0 > newAmount))
503- then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((currentAmount / 100000000))))
504- else if ((100000000 > assetBalance(this, GovernToken)))
505- then throw(("Not enough Troika In Contract: " + toString((assetBalance(this, GovernToken) / 100000000))))
506- else [IntegerEntry(UserGovernTokenKey, 100000000), IntegerEntry(UserStakedTokenKey, newAmount), IntegerEntry("StakeBalance", StakeBalanceAmount), IntegerEntry("PrizeHeight", PrizeHeightValueNew), IntegerEntry(UserLastStakeBlock, UserLastStakeBlockNewValue), StringEntry("HighestPushAddress", HighestPushAddressValue), ScriptTransfer(i.caller, 100000000, GovernToken), ScriptTransfer(i.caller, amount, StakedToken)]
507- }
508-
509-
510-
511-@Callable(i)
512-func WithdrawBigStakeReward () = {
513- let WaitTime = (1440 * 1)
514- let LastBigStakerRewardBlock = (toBase58String(i.caller.bytes) + "_LastBigStakerRewardBlock")
515- let BigStakerReward = (toBase58String(i.caller.bytes) + "_BigStaker")
516- let UserGovernTokenKey = (toBase58String(i.caller.bytes) + "_Earnings")
517- let LimiWithdrawReward = 10
518- let UserGovernTokenAmount = match getInteger(this, UserGovernTokenKey) {
519- case a: Int =>
520- a
521- case _ =>
522- 0
523- }
524- let LastBigStakerRewardBlockValue = match getInteger(this, LastBigStakerRewardBlock) {
525- case a: Int =>
526- a
527- case _ =>
528- 0
529- }
530- let BigStakerRewardTotalValue = match getInteger(this, "BigStakerRewardTotal") {
531- case a: Int =>
532- a
533- case _ =>
534- 0
535- }
536- let PrizeAmount = match getInteger(this, "FundBox") {
537- case a: Int =>
538- a
539- case _ =>
540- 0
541- }
542- let HeightTransactFundBox = match getInteger(this, "PrizeHeight") {
543- case a: Int =>
544- a
545- case _ =>
546- 0
547- }
548- let PrizeHeightValue = if (if ((HeightTransactFundBox == 0))
549- then (PrizeAmount == 0)
550- else false)
551- then 0
552- else if (if ((HeightTransactFundBox == 0))
553- then (PrizeAmount != 0)
554- else false)
555- then height
556- else if (if ((HeightTransactFundBox != 0))
557- then (PrizeAmount != 0)
558- else false)
559- then HeightTransactFundBox
560- else 0
561- let ActualDelay = match getInteger(this, "Delay") {
562- case a: Int =>
563- a
564- case _ =>
565- 0
566- }
567- let HighestPushValue = match getInteger(this, "HighestPush") {
568- case a: Int =>
569- a
570- case _ =>
571- 0
572- }
573- let HighestPushAddress = match getString(this, "HighestPushAddress") {
574- case a: String =>
575- a
576- case _ =>
577- ""
578- }
579- let HighestPushAddressValue = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
580- then (HighestPushValue > 0)
581- else false)
582- then ""
583- else HighestPushAddress
584- let PrizeHeightValueNew = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
585- then (HighestPushValue > 0)
586- else false)
587- then height
588- else PrizeHeightValue
589- let currentKey = toBase58String(i.caller.bytes)
590- let amount = match getInteger(this, BigStakerReward) {
591- case a: Int =>
592- a
593- case _ =>
594- 0
595- }
596- let StakeBalanceAmount = (BigStakerRewardTotalValue - amount)
597- let BigStakerRewardTax = if ((0 > ((UserGovernTokenAmount / 1000) * (1000 - ((1000 * (height - LastBigStakerRewardBlockValue)) / (LimiWithdrawReward * 1440))))))
598- then (1000 * 100000000)
599- else ((UserGovernTokenAmount / 1000) * (1000 - ((1000 * (height - LastBigStakerRewardBlockValue)) / (LimiWithdrawReward * 1440))))
600- if ((0 > amount))
601- then throw(((("Can't withdraw negative amount " + toString((UserGovernTokenAmount - (1000 * 100000000)))) + " ... ") + toString(amount)))
602- else if (if (if (((1000 * 100000000) > UserGovernTokenAmount))
603- then true
604- else (1 > amount))
605- then true
606- else (0 > (UserGovernTokenAmount - BigStakerRewardTax)))
607- then throw(("No ASIMI reward available, or Not enough Earned Troikan Tokens to do transaction, you have: " + toString((UserGovernTokenAmount / 100000000))))
608- else if ((StakeBalanceAmount > 0))
609- then [IntegerEntry(BigStakerReward, 0), IntegerEntry("BigStakerRewardTotal", StakeBalanceAmount), IntegerEntry(UserGovernTokenKey, (UserGovernTokenAmount - BigStakerRewardTax)), IntegerEntry("PrizeHeight", PrizeHeightValue), IntegerEntry(LastBigStakerRewardBlock, height), StringEntry("HighestPushAddress", HighestPushAddressValue), ScriptTransfer(i.caller, amount, StakedToken)]
610- else throw("Balance Error, Total Big Stakers cannot be negative, Operation won't be authorized")
611- }
612-
613-
614-
615-@Callable(i)
616-func HarvestGovernToiken (amount) = {
617- let ContractWalletStakeBalance = assetBalance(this, StakedToken)
618- let UserGovernTokenKey = (toBase58String(i.caller.bytes) + "_Earnings")
619- let StakeBalance = match getInteger(this, "StakeBalance") {
620- case a: Int =>
621- a
622- case _ =>
623- 0
624- }
625- let PrizeAmount = match getInteger(this, "FundBox") {
626- case a: Int =>
627- a
628- case _ =>
629- 0
630- }
631- let HeightTransactFundBox = match getInteger(this, "PrizeHeight") {
632- case a: Int =>
633- a
634- case _ =>
635- 0
636- }
637- let PrizeHeightValue = if (if ((HeightTransactFundBox == 0))
638- then (PrizeAmount == 0)
639- else false)
640- then 0
641- else if (if ((HeightTransactFundBox == 0))
642- then (PrizeAmount != 0)
643- else false)
644- then height
645- else if (if ((HeightTransactFundBox != 0))
646- then (PrizeAmount != 0)
647- else false)
648- then HeightTransactFundBox
649- else 0
650- let currentKey = toBase58String(i.caller.bytes)
651- let currentAmount = match getInteger(this, UserGovernTokenKey) {
652- case a: Int =>
653- a
654- case _ =>
655- 0
656- }
657- let newAmount = (currentAmount - amount)
658- if ((0 > amount))
659- then throw("Can't withdraw negative amount")
660- else if ((0 > newAmount))
661- then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((currentAmount / 100000000))))
662- else [IntegerEntry(UserGovernTokenKey, newAmount), IntegerEntry("PrizeHeight", PrizeHeightValue), ScriptTransfer(i.caller, amount, GovernToken)]
663- }
664-
665-
666-
667-@Callable(i)
668-func delayprize () = {
669- let DelayDays = (1440 * 1)
670- let WaitTime = (1440 * 1)
671- let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
672- let UserWalletSGovernBalance = assetBalance(Address(i.caller.bytes), GovernToken)
673- let ContractWalletStakeBalance = assetBalance(this, StakedToken)
674- let StakeBalance = match getInteger(this, "StakeBalance") {
675- case a: Int =>
676- a
677- case _ =>
678- 0
679- }
680- let PrizeAmount = match getInteger(this, "FundBox") {
681- case a: Int =>
682- a
683- case _ =>
684- 0
685- }
686- let HeightTransactFundBox = match getInteger(this, "PrizeHeight") {
687- case a: Int =>
688- a
689- case _ =>
690- 0
691- }
692- let ActualDelay = match getInteger(this, "Delay") {
693- case a: Int =>
694- a
695- case _ =>
696- 0
697- }
698- let PrizeHeightValue = if (if ((HeightTransactFundBox == 0))
699- then (PrizeAmount == 0)
700- else false)
701- then 0
702- else if (if ((HeightTransactFundBox == 0))
703- then (PrizeAmount != 0)
704- else false)
705- then height
706- else if (if ((HeightTransactFundBox != 0))
707- then (PrizeAmount != 0)
708- else false)
709- then HeightTransactFundBox
710- else 0
711- let HighestPushValue = match getInteger(this, "HighestPush") {
712- case a: Int =>
713- a
714- case _ =>
715- 0
716- }
717- let HighestPushAddress = match getString(this, "HighestPushAddress") {
718- case a: String =>
719- a
720- case _ =>
721- ""
722- }
723- let HighestPushAddressValue = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
724- then (HighestPushValue > 0)
725- else false)
726- then ""
727- else HighestPushAddress
728- let PrizeHeightValueNew = if (if ((height > ((PrizeHeightValue + ActualDelay) + WaitTime)))
729- then (HighestPushValue > 0)
730- else false)
731- then height
732- else PrizeHeightValue
733- let ActualDelayCost = match getInteger(this, "DelayCost") {
734- case a: Int =>
735- a
736- case _ =>
737- 10
738- }
739- let pmt = if ((size(i.payments) == 1))
740- then i.payments[0]
741- else throw("Attached payment is required")
742- let DevBoxBalance = match getInteger(this, "DevBox") {
743- case a: Int =>
744- a
745- case _ =>
746- 0
747- }
748- if (if (isDefined(pmt.assetId))
749- then (pmt.assetId == GovernToken)
750- else false)
751- then if ((PrizeAmount > 0))
752- then {
753- let UserGovernTokenAmount = pmt.amount
754- let DevBoxAmount = (DevBoxBalance + ((pmt.amount * 5) / 1000))
755- let NewDelayCost = if ((ActualDelayCost == 0))
756- then 1000000000
757- else (2 * ActualDelayCost)
758- if ((UserGovernTokenAmount >= NewDelayCost))
759- then {
760- let NewDelay = (ActualDelay + DelayDays)
761-[IntegerEntry("Delay", NewDelay), IntegerEntry("DelayCost", NewDelayCost), IntegerEntry("PrizeHeight", PrizeHeightValueNew), IntegerEntry("DevBox", DevBoxAmount), StringEntry("HighestPushAddress", HighestPushAddressValue)]
762- }
763- else throw((("To delay the release of the reward ONE DAY later than expected, you need " + toString(NewDelayCost)) + "TROIKAs"))
764- }
765- else throw("You cannot delay the reward before reward is received! Please wait until a reward is available")
766- else throw("Can Use only Troika Token to Delay Reward")
767- }
768-
769-
770-
771-@Callable(i)
772-func ClaimPrize () = {
773- let UserStakedTokenKey = (toBase58String(i.caller.bytes) + "_Staking")
774- let UserPush = (toBase58String(i.caller.bytes) + "_Push")
775- let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock")
776- let minStakeBlock = (1440 * 7)
777- let minref = 3
778- let ContractGovTokenBalance = assetBalance(this, GovernToken)
779- let ContractWalletStakeBalance = assetBalance(this, StakedToken)
780- let StakeBalance = match getInteger(this, "StakeBalance") {
781- case a: Int =>
782- a
783- case _ =>
784- 0
785- }
786- let PrizeAmount = match getInteger(this, "FundBox") {
787- case a: Int =>
788- a
789- case _ =>
790- 0
791- }
792- let UserPushValue = match getInteger(this, UserPush) {
793- case a: Int =>
794- a
795- case _ =>
796- 0
797- }
798- let UserLastStakeBlockValue = match getInteger(this, UserLastStakeBlock) {
799- case a: Int =>
800- a
801- case _ =>
802- 0
803- }
804- let UserStakedTokenAmount = match getInteger(this, UserStakedTokenKey) {
805- case a: Int =>
806- a
807- case _ =>
808- 0
809- }
810- let ActualDelay = match getInteger(this, "Delay") {
811- case a: Int =>
812- a
813- case _ =>
814- 0
815- }
816- let PrizeWinner = match getString(this, "HighestPushAddress") {
817- case a: String =>
818- a
819- case _ =>
820- ""
821- }
822- let PrizeHeight = match getInteger(this, "PrizeHeight") {
823- case a: Int =>
824- a
825- case _ =>
826- 0
827- }
828- let HighestPushValue = match getInteger(this, "HighestPush") {
829- case a: Int =>
830- a
831- case _ =>
832- 0
833- }
834- let UserRefsNum = (toBase58String(i.caller.bytes) + "_refs")
835- let UserRefsNumValue = match getInteger(this, UserRefsNum) {
836- case a: Int =>
837- a
838- case _ =>
839- 0
840- }
841- if (if ((PrizeAmount == 0))
842- then true
843- else (10000000000 > ContractGovTokenBalance))
844- then throw("No prize to Claim or Not enough Govern Token en Contract (Min 100 Troika)")
845- else if ((toBase58String(i.caller.bytes) != PrizeWinner))
846- then throw("You are not the winner hence cannot claim the reward ")
847- else if (if ((100000000 > UserStakedTokenAmount))
848- then (minStakeBlock > UserLastStakeBlockValue)
849- else false)
850- then throw("You have to Stake ASIMI Token to claim reward ")
851- else if (if ((height > (PrizeHeight + ActualDelay)))
852- then (UserPushValue >= HighestPushValue)
853- else false)
854- then if ((UserRefsNumValue >= minref))
855- then [IntegerEntry(PrizeWinner, PrizeAmount), IntegerEntry("FundBox", 0), IntegerEntry("HighestPush", 0), IntegerEntry(UserPush, 0), StringEntry("HighestPushAddress", ""), IntegerEntry("PrizeHeight", 0), IntegerEntry("Delay", 0), IntegerEntry("DelayCost", 0), StringEntry("LastWinner", PrizeWinner), IntegerEntry("LastPrize", PrizeAmount), ScriptTransfer(i.caller, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 1000000000, GovernToken)]
856- else throw((("You have to have " + toString(minref)) + " referrals already staking for a minimum of 10 days to Claim the prize"))
857- else throw("You have to be the user with the highest Push and wait till countown is finished, to claim Reward")
858- }
859-
860-
861-
862-@Callable(i)
863-func Addmentor (Mentor) = {
864- let UserMentorAddress = (toBase58String(i.caller.bytes) + "_Mentor")
865- if ((Mentor != ""))
866- then [StringEntry(UserMentorAddress, Mentor)]
867- else throw("Mentor's Address cannot be empty")
868- }
869-
870-
871-
872-@Callable(i)
873-func UpdateTwittsCost (LikePackageASIMICost,LikePackageTROIKANCost) = if ((toBase58String(i.caller.bytes) == dAppAdmin))
874- then [IntegerEntry("LikePackageASIMICost", (LikePackageASIMICost * 100000000)), IntegerEntry("LikePackageTROIKANCost", (LikePackageTROIKANCost * 100000000))]
875- else throw("Only available for Admin")
876-
877-
878-
879-@Callable(i)
880-func GetLikesPackage (TwitterUserId,TwittId) = {
881- let Influencer = ((toString(TwitterUserId) + "_Twitt2Like_") + toString(TwittId))
882- let LikePackageTROIKANCostValue = match getInteger(this, "LikePackageTROIKANCost") {
883- case a: Int =>
884- a
885- case _ =>
886- 0
887- }
888- let LikePackageASIMICostValue = match getInteger(this, "LikePackageASIMICost") {
889- case a: Int =>
890- a
891- case _ =>
892- 0
893- }
894- let pmt = if ((size(i.payments) == 2))
895- then i.payments[0]
896- else throw("Attached payment is required")
897- if (if ((i.payments[0].assetId == StakedToken))
898- then (i.payments[1].assetId == GovernToken)
899- else false)
900- then if ((i.payments[0].amount >= LikePackageASIMICostValue))
901- then if ((i.payments[1].amount >= LikePackageTROIKANCostValue))
902- then {
903- let InfluencerBalance = match getInteger(this, Influencer) {
904- case a: Int =>
905- a
906- case _ =>
907- 0
908- }
909- if ((InfluencerBalance == 0))
910- then [IntegerEntry(((toString(TwitterUserId) + "_Twitt2Like_") + toString(TwittId)), ((95 * LikePackageASIMICostValue) / 100)), IntegerEntry("LikeTwittsDevBox", ((5 * LikePackageASIMICostValue) / 100))]
911- 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")
912- }
913- else throw(("TROIKAN Amount should be :" + toString((LikePackageASIMICostValue / 100000000))))
914- else throw(("ASIMI Amount should be :" + toString((LikePackageTROIKANCostValue / 100000000))))
915- else throw("Payments should be both ASIMI and TROIKAN tokens")
916- }
917-
918-
919-
920-@Callable(i)
921-func GetMyLikedTwittsRewards (UserId) = {
922- let UserEarnedLikeTwittASIMI = match getInteger(this, (UserId + "_Like_Amount")) {
923- case a: Int =>
924- a
925- case _ =>
926- 0
927- }
928- let UserEarneddAppRTTwittTROIKAN = match getInteger(this, (UserId + "_TroikandApp_RT_Amount")) {
929- case a: Int =>
930- a
931- case _ =>
932- 0
933- }
934- if (if ((UserEarnedLikeTwittASIMI >= (1 * 100000000)))
935- then (UserEarneddAppRTTwittTROIKAN >= (1 * 100000000))
936- else false)
937- then [IntegerEntry((UserId + "_TroikandApp_RT_Amount"), 0), IntegerEntry((UserId + "_Like_Amount"), 0), ScriptTransfer(i.caller, UserEarnedLikeTwittASIMI, StakedToken), ScriptTransfer(i.caller, UserEarneddAppRTTwittTROIKAN, GovernToken)]
938- else throw("Minimum earnings to withdraw are: 100 ASIMI and 50 Troikans")
939- }
940-
941-
942-
943-@Callable(i)
944-func LinkTwitterAcc2Wallet (TwitterUserId) = {
945- let TwitterLinkedWallet = match getString(this, (TwitterUserId + "_Wallet")) {
946- case a: String =>
947- a
948- case _ =>
949- "None"
950- }
951- if ((toBase58String(i.caller.bytes) == TwitterLinkedWallet))
952- then throw("You already have your wallet linked to the Twitter account")
953- else if (if ((toBase58String(i.caller.bytes) != TwitterLinkedWallet))
954- then (TwitterLinkedWallet != "None")
955- else false)
956- then throw("The wallet you are using is not the linked Wallet to this Twitter account")
957- else [StringEntry((TwitterUserId + "_Wallet"), toBase58String(i.caller.bytes))]
958- }
7+func CertifyUser () = [StringEntry("CertifiedUser", toBase58String(i.caller.bytes)), IntegerEntry("CertifiedUserBorn", height)]
9598
9609

github/deemru/w8io/786bc32 
64.89 ms