tx · EhLahnhRAZ4g4PS9GUxs3p4vafZ89q8j6Q1rkR5PjEA

3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE:  -0.01600000 Waves

2023.08.31 11:56 [2734645] smart account 3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE > SELF 0.00000000 Waves

{ "type": 13, "id": "EhLahnhRAZ4g4PS9GUxs3p4vafZ89q8j6Q1rkR5PjEA", "fee": 1600000, "feeAssetId": null, "timestamp": 1693472237591, "version": 2, "chainId": 84, "sender": "3Mp5kisFrqESzrXxAMEPk2k69zpeF41czEE", "senderPublicKey": "G349Uq3FTox7dRNLeAfAQeoACvwZ9iEnVSaHcEYn6j8J", "proofs": [ "4tKaMVp6fkJBjJPjgDoRgjt1fJHZjJoWERRc19HVDPTVe5TxZaEMPeMYwdZ61xin71545oPcqdYjpoqEudWWJYEV" ], "script": "base64:BgLZFggCEgQKAgIBEgYKBAEYEQESBAoCCAESABIAEgMKAQgSABIECgIYERIAEgMKAQgSAwoBBCIDU0VQIgVTQ0FMRSIFTVVMVDgiB01VTFQ4QkkiCnplcm9CaWdJbnQiFHByb2Nlc3NpbmdTdGFnZVRvdGFsIhVwcm9jZXNzaW5nU3RhZ2VTaGFyZXMiBk1VTFQxOCIITVVMVDE4QkkiC3dhdmVzU3RyaW5nIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIg5nZXROdW1iZXJCeUtleSIDa2V5Ig9nZXROdW1iZXJPckZhaWwiDmdldFN0cmluZ0J5S2V5Ig9nZXRTdHJpbmdPckZhaWwiDHBhcnNlQXNzZXRJZCIFaW5wdXQiA2FicyIDdmFsIglhYnNCaWdJbnQiC2tleU1heERlcHRoIg9tYXhEZXB0aERlZmF1bHQiCG1heERlcHRoIhFrZXlGYWN0b3J5QWRkcmVzcyIRZmFjdG9yeUFkZHJlc3NTdHIiD2ZhY3RvcnlDb250cmFjdCISa2V5RW1pc3Npb25BZGRyZXNzIhlrZXlWb3RpbmdFbWlzc2lvbkNvbnRyYWN0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aXRzZWxmLgECY2wBAmNtAAQCY24EAmFTCQECYVUAAwkAAQIFAmFTAgpCeXRlVmVjdG9yBAJhWQUCYVMFAmFZAwkAAQIFAmFTAgRVbml0CAUCY2wPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmNsCWJvZHlCeXRlcwkAkQMCCAUCY2wGcHJvb2ZzAAAFAmNuZJQbEQ==", "height": 2734645, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G6fZHDhXeatGFoj34kPv9VhdwkiimeX6CM7cG5843yyL Next: 7NvuJ4KAwoJojGajdTuS9iD8jBXST7tKbdzaxaDqENZV Diff:
OldNewDifferences
144144 }
145145
146146
147+let keySuspension = "%s__suspension"
148+
149+let isSuspended = valueOrElse(getBoolean(this, keySuspension), false)
150+
151+func throwIfSuspended () = if (!(isSuspended))
152+ then true
153+ else throwErr("suspended")
154+
155+
147156 func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight"
148157
149158
284293
285294
286295 func _refreshUserReward (userAddress,userNum) = {
287- let $t01012210210 = _refreshRewardPerGwxIntegral()
288- let rewardPerGwxIntegralActions = $t01012210210._1
289- let rewardPerGwxIntegral = $t01012210210._2
296+ let $t01029210380 = _refreshRewardPerGwxIntegral()
297+ let rewardPerGwxIntegralActions = $t01029210380._1
298+ let rewardPerGwxIntegral = $t01029210380._2
290299 let rewardPerGwxIntegralUserLast = match getString(this, keyRewardPerGwxIntegralUserLast(userAddress)) {
291300 case s: String =>
292301 valueOrErrorMessage(parseBigInt(s), wrapErr("invalid user last integral"))
307316 let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address"))
308317 let cfgArray = readConfigArrayOrFail()
309318 let userNum = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddressStr)
310- let $t01150111565 = _refreshUserReward(userAddress, userNum)
311- let actions = $t01150111565._1
312- let reward = $t01150111565._2
319+ let $t01167111735 = _refreshUserReward(userAddress, userNum)
320+ let actions = $t01167111735._1
321+ let reward = $t01167111735._2
313322 $Tuple2(reward, ([IntegerEntry(keyUserUnclaimed(userNum), 0)] ++ actions))
314323 }
315324
316325
317326 @Callable(i)
318327 func refreshUserReward (userAddressBytes,userNum) = {
319- let checkCaller = if ((i.caller == boostingContractOrFail()))
320- then true
321- else throwErr("permission denied")
322- if ((checkCaller == checkCaller))
328+ let suspensionCheck = throwIfSuspended()
329+ if ((suspensionCheck == suspensionCheck))
323330 then {
324- let $t01184511923 = _refreshUserReward(Address(userAddressBytes), userNum)
325- let actions = $t01184511923._1
326- let reward = $t01184511923._2
327- $Tuple2(([IntegerEntry(keyUserUnclaimed(userNum), reward)] ++ actions), reward)
331+ let checkCaller = if ((i.caller == boostingContractOrFail()))
332+ then true
333+ else throwErr("permission denied")
334+ if ((checkCaller == checkCaller))
335+ then {
336+ let $t01206112139 = _refreshUserReward(Address(userAddressBytes), userNum)
337+ let actions = $t01206112139._1
338+ let reward = $t01206112139._2
339+ $Tuple2(([IntegerEntry(keyUserUnclaimed(userNum), reward)] ++ actions), reward)
340+ }
341+ else throw("Strict value is not equal to itself.")
328342 }
329343 else throw("Strict value is not equal to itself.")
330344 }
332346
333347
334348 @Callable(i)
335-func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = if ((currentIter == size(userAddresses)))
336- then nil
337- else {
338- let checks = [if ((i.caller == this))
339- then true
340- else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
341- then true
342- else throwErr("insufficient payment assetId")]
343- if ((checks == checks))
344- then {
345- let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
346- if ((tradeRewardInternal == tradeRewardInternal))
349+func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = {
350+ let suspensionCheck = throwIfSuspended()
351+ if ((suspensionCheck == suspensionCheck))
352+ then if ((currentIter == size(userAddresses)))
353+ then nil
354+ else {
355+ let checks = [if ((i.caller == this))
356+ then true
357+ else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
358+ then true
359+ else throwErr("insufficient payment assetId")]
360+ if ((checks == checks))
347361 then {
348- let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
349- let userAddress = addressFromStringValue(userAddresses[currentIter])
350- $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), IntegerEntry(keyTradingReward(userAddresses[currentIter]), rewards[currentIter])], tradeRewardInternal)
362+ let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
363+ if ((tradeRewardInternal == tradeRewardInternal))
364+ then {
365+ let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
366+ let userAddress = addressFromStringValue(userAddresses[currentIter])
367+ $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), IntegerEntry(keyTradingReward(userAddresses[currentIter]), rewards[currentIter])], tradeRewardInternal)
368+ }
369+ else throw("Strict value is not equal to itself.")
351370 }
352371 else throw("Strict value is not equal to itself.")
353372 }
354- else throw("Strict value is not equal to itself.")
355- }
373+ else throw("Strict value is not equal to itself.")
374+ }
356375
357376
358377
359378 @Callable(i)
360379 func updateReferralActivity (userAddress,gWxAmountStart) = {
361- let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
362- let activeReferralInv = if ((referrer == unit))
363- then unit
364- else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil)
365- if ((activeReferralInv == activeReferralInv))
366- then $Tuple2(nil, unit)
380+ let suspensionCheck = throwIfSuspended()
381+ if ((suspensionCheck == suspensionCheck))
382+ then {
383+ let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
384+ let activeReferralInv = if ((referrer == unit))
385+ then unit
386+ else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil)
387+ if ((activeReferralInv == activeReferralInv))
388+ then $Tuple2(nil, unit)
389+ else throw("Strict value is not equal to itself.")
390+ }
367391 else throw("Strict value is not equal to itself.")
368392 }
369393
376400
377401 @Callable(i)
378402 func claimReward () = {
379- let cfgArray = readConfigArrayOrFail()
380- let userAddress = i.caller
381- let userAddressStr = toString(userAddress)
382- let $t01365513712 = commonClaimReward(userAddressStr)
383- let amount = $t01365513712._1
384- let actions = $t01365513712._2
385- let checkAmount = if ((amount > 0))
386- then true
387- else throw("nothing to claim")
388- if ((checkAmount == checkAmount))
403+ let suspensionCheck = throwIfSuspended()
404+ if ((suspensionCheck == suspensionCheck))
389405 then {
390- let userGwxAmount = {
391- let @ = invoke(boostingContractOrFail(), "getUserGwxAmount", [userAddressStr], nil)
392- if ($isInstanceOf(@, "Int"))
393- then @
394- else throw(($getType(@) + " couldn't be cast to Int"))
395- }
396- let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddressStr))
397- let activeReferralInv = if ((referrer == unit))
398- then unit
399- else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userGwxAmount >= referralMinGWxAmount)], nil)
400- if ((activeReferralInv == activeReferralInv))
406+ let cfgArray = readConfigArrayOrFail()
407+ let userAddress = i.caller
408+ let userAddressStr = toString(userAddress)
409+ let $t01400914066 = commonClaimReward(userAddressStr)
410+ let amount = $t01400914066._1
411+ let actions = $t01400914066._2
412+ let checkAmount = if ((amount > 0))
413+ then true
414+ else throw("nothing to claim")
415+ if ((checkAmount == checkAmount))
401416 then {
402- let referralInv = if (if ((referrer == unit))
403- then true
404- else (referralMinGWxAmount > userGwxAmount))
417+ let userGwxAmount = {
418+ let @ = invoke(boostingContractOrFail(), "getUserGwxAmount", [userAddressStr], nil)
419+ if ($isInstanceOf(@, "Int"))
420+ then @
421+ else throw(($getType(@) + " couldn't be cast to Int"))
422+ }
423+ let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddressStr))
424+ let activeReferralInv = if ((referrer == unit))
405425 then unit
406- else {
407- let referrerReward = fraction(amount, referrerRewardPermille, SCALE)
408- let referralReward = fraction(amount, referralRewardPermille, SCALE)
409- invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil)
410- }
411- if ((referralInv == referralInv))
426+ else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userGwxAmount >= referralMinGWxAmount)], nil)
427+ if ((activeReferralInv == activeReferralInv))
412428 then {
413- let emit = invoke(emissionContract, "emit", [amount], nil)
414- if ((emit == emit))
429+ let referralInv = if (if ((referrer == unit))
430+ then true
431+ else (referralMinGWxAmount > userGwxAmount))
432+ then unit
433+ else {
434+ let referrerReward = fraction(amount, referrerRewardPermille, SCALE)
435+ let referralReward = fraction(amount, referralRewardPermille, SCALE)
436+ invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil)
437+ }
438+ if ((referralInv == referralInv))
415439 then {
416- let claimedReferral = {
417- let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil)
418- if ($isInstanceOf(@, "Int"))
419- then @
420- else throw(($getType(@) + " couldn't be cast to Int"))
421- }
422- if ((claimedReferral == claimedReferral))
440+ let emit = invoke(emissionContract, "emit", [amount], nil)
441+ if ((emit == emit))
423442 then {
424- let totalAmount = (amount + claimedReferral)
425- $Tuple2(([ScriptTransfer(i.caller, amount, wxAssetId), HistoryEntry("claim", userAddressStr, totalAmount, i)] ++ actions), totalAmount)
443+ let claimedReferral = {
444+ let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil)
445+ if ($isInstanceOf(@, "Int"))
446+ then @
447+ else throw(($getType(@) + " couldn't be cast to Int"))
448+ }
449+ if ((claimedReferral == claimedReferral))
450+ then {
451+ let totalAmount = (amount + claimedReferral)
452+ $Tuple2(([ScriptTransfer(i.caller, amount, wxAssetId), HistoryEntry("claim", userAddressStr, totalAmount, i)] ++ actions), totalAmount)
453+ }
454+ else throw("Strict value is not equal to itself.")
426455 }
427456 else throw("Strict value is not equal to itself.")
428457 }
439468
440469 @Callable(i)
441470 func claimRewardREADONLY (address) = {
442- let $t01506915119 = commonClaimReward(address)
443- let amount = $t01506915119._1
444- let actions = $t01506915119._2
471+ let $t01542315473 = commonClaimReward(address)
472+ let amount = $t01542315473._1
473+ let actions = $t01542315473._2
445474 let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0)
446475 let totalAmount = (amount + referralUnclaimed)
447476 $Tuple2(nil, totalAmount)
450479
451480
452481 @Callable(i)
453-func onEmissionForGwxStart () = if ((i.caller != factoryContract))
454- then throw("permissions denied")
455- else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)]
482+func onEmissionForGwxStart () = {
483+ let suspensionCheck = throwIfSuspended()
484+ if ((suspensionCheck == suspensionCheck))
485+ then if ((i.caller != factoryContract))
486+ then throw("permissions denied")
487+ else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)]
488+ else throw("Strict value is not equal to itself.")
489+ }
456490
457491
458492
459493 @Callable(i)
460494 func tradeReward (userAddresses,rewards) = {
461- let argsComparison = (size(userAddresses) == size(rewards))
462- let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
463- let payment = i.payments[0]
464- let paymentAssetId = payment.assetId
465- let paymentAmount = payment.amount
466- let checks = [if ((maxRecipients >= size(userAddresses)))
467- then true
468- else throwErr("Too many recipients"), if (argsComparison)
469- then true
470- else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
471- then true
472- else throwErr("Wrong asset payment")]
473- if ((checks == checks))
495+ let suspensionCheck = throwIfSuspended()
496+ if ((suspensionCheck == suspensionCheck))
474497 then {
475- let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
476- if ((tradeRewardInternal == tradeRewardInternal))
477- then $Tuple2(nil, tradeRewardInternal)
498+ let argsComparison = (size(userAddresses) == size(rewards))
499+ let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
500+ let payment = i.payments[0]
501+ let paymentAssetId = payment.assetId
502+ let paymentAmount = payment.amount
503+ let checks = [if ((maxRecipients >= size(userAddresses)))
504+ then true
505+ else throwErr("Too many recipients"), if (argsComparison)
506+ then true
507+ else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
508+ then true
509+ else throwErr("Wrong asset payment")]
510+ if ((checks == checks))
511+ then {
512+ let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
513+ if ((tradeRewardInternal == tradeRewardInternal))
514+ then $Tuple2(nil, tradeRewardInternal)
515+ else throw("Strict value is not equal to itself.")
516+ }
478517 else throw("Strict value is not equal to itself.")
479518 }
480519 else throw("Strict value is not equal to itself.")
484523
485524 @Callable(i)
486525 func claimTradingReward () = {
487- let userAddress = i.caller
488- let userAddressString = toString(userAddress)
489- let reward = getTradingReward(userAddressString)
490- if ((reward > 0))
491- then $Tuple2([ScriptTransfer(userAddress, reward, wxAssetId), IntegerEntry(keyTradingReward(userAddressString), 0)], reward)
492- else throwErr("nothing to claim")
526+ let suspensionCheck = throwIfSuspended()
527+ if ((suspensionCheck == suspensionCheck))
528+ then {
529+ let userAddress = i.caller
530+ let userAddressString = toString(userAddress)
531+ let reward = getTradingReward(userAddressString)
532+ if ((reward > 0))
533+ then $Tuple2([ScriptTransfer(userAddress, reward, wxAssetId), IntegerEntry(keyTradingReward(userAddressString), 0)], reward)
534+ else throwErr("nothing to claim")
535+ }
536+ else throw("Strict value is not equal to itself.")
493537 }
494538
495539
496540
497541 @Callable(i)
498542 func claimTradingRewardREADONLY (userAddress) = $Tuple2(nil, getTradingReward(userAddress))
543+
544+
545+
546+@Callable(i)
547+func suspend (v) = {
548+ let checkCaller = mustManager(i)
549+ if ((checkCaller == checkCaller))
550+ then $Tuple2([BooleanEntry(keySuspension, v)], v)
551+ else throw("Strict value is not equal to itself.")
552+ }
499553
500554
501555 @Verifier(tx)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let SCALE = 1000
77
88 let MULT8 = 100000000
99
1010 let MULT8BI = toBigInt(MULT8)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let processingStageTotal = 0
1515
1616 let processingStageShares = 1
1717
1818 let MULT18 = 1000000000000000000
1919
2020 let MULT18BI = toBigInt(MULT18)
2121
2222 let wavesString = "WAVES"
2323
2424 func wrapErr (msg) = makeString(["gwx_reward.ride:", msg], " ")
2525
2626
2727 func throwErr (msg) = throw(wrapErr(msg))
2828
2929
3030 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
3131
3232
3333 func getNumberOrFail (key) = valueOrErrorMessage(getInteger(this, key), wrapErr((("mandatory this." + key) + " is not defined")))
3434
3535
3636 func getStringByKey (key) = valueOrElse(getString(this, key), "")
3737
3838
3939 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), wrapErr((("mandatory this." + key) + " is not defined")))
4040
4141
4242 func parseAssetId (input) = if ((input == wavesString))
4343 then unit
4444 else fromBase58String(input)
4545
4646
4747 func abs (val) = if ((0 > val))
4848 then -(val)
4949 else val
5050
5151
5252 func absBigInt (val) = if ((zeroBigInt > val))
5353 then -(val)
5454 else val
5555
5656
5757 let keyMaxDepth = "%s__maxDepth"
5858
5959 let maxDepthDefault = 30
6060
6161 let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault)
6262
6363 func keyFactoryAddress () = "%s%s__config__factoryAddress"
6464
6565
6666 let factoryAddressStr = getStringOrFail(keyFactoryAddress())
6767
6868 let factoryContract = addressFromStringValue(factoryAddressStr)
6969
7070 func keyEmissionAddress () = "%s%s__config__emissionAddress"
7171
7272
7373 func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP)
7474
7575
7676 let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract()))
7777
7878 func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP)
7979
8080
8181 let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP)
8282
8383 let referralProgramNameDefault = "wxlock"
8484
8585 let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault)
8686
8787 let keyReferralMinGWxAmount = makeString(["%s%s", "referral", "minGWxAmount"], SEP)
8888
8989 let referralMinGWxAmountDefault = (500 * MULT8)
9090
9191 let referralMinGWxAmount = valueOrElse(getInteger(this, keyReferralMinGWxAmount), referralMinGWxAmountDefault)
9292
9393 let keyReferrerRewardPermille = makeString(["%s%s", "referral", "referrerRewardPermille"], SEP)
9494
9595 let referrerRewardPermilleDefault = 50
9696
9797 let referrerRewardPermille = valueOrElse(getInteger(this, keyReferrerRewardPermille), referrerRewardPermilleDefault)
9898
9999 let keyReferralRewardPermille = makeString(["%s%s", "referral", "referralRewardPermille"], SEP)
100100
101101 let referralRewardPermilleDefault = 50
102102
103103 let referralRewardPermille = valueOrElse(getInteger(this, keyReferralRewardPermille), referralRewardPermilleDefault)
104104
105105 func keyReferrer (referralAddress) = makeString(["%s%s%s", "referrer", referralProgramName, referralAddress], SEP)
106106
107107
108108 func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], SEP)
109109
110110
111111 let emissionAddressStr = getStringOrFail(keyEmissionAddress())
112112
113113 let emissionContract = addressFromStringValue(emissionAddressStr)
114114
115115 let IdxCfgAssetId = 1
116116
117117 let IdxCfgPacemakerAddress = 2
118118
119119 let IdxCfgBoostingContract = 3
120120
121121 let IdxCfgMaxDepth = 4
122122
123123 func keyConfig () = "%s__config"
124124
125125
126126 func getEmissionAddress () = addressFromStringValue(valueOrErrorMessage(getString(this, keyEmissionAddress()), (("mandatory this." + keyEmissionAddress()) + " is not defined")))
127127
128128
129129 let emissionAddress = getEmissionAddress()
130130
131131 let wxAssetIdStr = split(value(getString(emissionAddress, keyConfig())), SEP)[1]
132132
133133 let wxAssetId = fromBase58String(wxAssetIdStr)
134134
135135 func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP)
136136
137137
138138 func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP)
139139
140140
141141 func boostingContractOrFail () = {
142142 let cfgArray = readConfigArrayOrFail()
143143 valueOrErrorMessage(addressFromString(cfgArray[IdxCfgBoostingContract]), "boosting contract address is not defined")
144144 }
145145
146146
147+let keySuspension = "%s__suspension"
148+
149+let isSuspended = valueOrElse(getBoolean(this, keySuspension), false)
150+
151+func throwIfSuspended () = if (!(isSuspended))
152+ then true
153+ else throwErr("suspended")
154+
155+
147156 func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight"
148157
149158
150159 func keyUsersCount () = "%s__nextUserNum"
151160
152161
153162 func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", toString(userAddress)], SEP)
154163
155164
156165 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
157166
158167
159168 func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
160169
161170
162171 func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
163172
164173
165174 func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL"
166175
167176
168177 func keyUserUnclaimed (userIndex) = makeString(["%s%d", "userUnclaimed", toString(userIndex)], SEP)
169178
170179
171180 func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP)
172181
173182
174183 let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress()))
175184
176185 func keyTradingRewardHistory (user,i) = makeString(["%s%s%s%s", "tradingReward", "history", user, toBase58String(i.transactionId)], SEP)
177186
178187
179188 func keyTradingReward (userAddress) = makeString(["%s%s", "tradingReward", userAddress], SEP)
180189
181190
182191 func keyMaxRecipients () = makeString(["%s", "maxRecipients"], SEP)
183192
184193
185194 func HistoryEntry (type,user,amount,i) = {
186195 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
187196 let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP)
188197 StringEntry(historyKEY, historyDATA)
189198 }
190199
191200
192201 func keyManagerPublicKey () = "%s__managerPublicKey"
193202
194203
195204 func keyManagerVaultAddress () = "%s__managerVaultAddress"
196205
197206
198207 func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
199208 case s: String =>
200209 addressFromStringValue(s)
201210 case _ =>
202211 this
203212 }
204213
205214
206215 func managerPublicKeyOrUnit () = {
207216 let managerVaultAddress = getManagerVaultAddressOrThis()
208217 match getString(managerVaultAddress, keyManagerPublicKey()) {
209218 case s: String =>
210219 fromBase58String(s)
211220 case _: Unit =>
212221 unit
213222 case _ =>
214223 throw("Match error")
215224 }
216225 }
217226
218227
219228 func mustManager (i) = {
220229 let pd = throw("Permission denied")
221230 match managerPublicKeyOrUnit() {
222231 case pk: ByteVector =>
223232 if ((i.callerPublicKey == pk))
224233 then true
225234 else pd
226235 case _: Unit =>
227236 if ((i.caller == this))
228237 then true
229238 else pd
230239 case _ =>
231240 throw("Match error")
232241 }
233242 }
234243
235244
236245 func getUserIndexByAddress (boostingContractAddressStr,userAddress) = {
237246 let key = makeString(["%s%s%s", "mapping", "user2num", userAddress], SEP)
238247 parseIntValue(valueOrErrorMessage(getString(Address(fromBase58String(boostingContractAddressStr)), key), ((("User address " + userAddress) + " is not found in boosting contract data, key=") + key)))
239248 }
240249
241250
242251 func getTradingReward (userAddress) = valueOrElse(getInteger(this, keyTradingReward(userAddress)), 0)
243252
244253
245254 func keyRewardPerGwxIntegral () = makeString(["%s", "rewardPerGwxIntegral"], SEP)
246255
247256
248257 func getGwxAmountTotalOption () = {
249258 let keyGwxTotal = "%s%s__gwx__total"
250259 getInteger(boostingContractOrFail(), keyGwxTotal)
251260 }
252261
253262
254263 func getUserGwxAmountTotalOption (userAddress) = {
255264 func keyUserGwxAmountTotal (userAddress) = makeString(["%s%s__gwxAmountTotal", toString(userAddress)], SEP)
256265
257266 getInteger(boostingContractOrFail(), keyUserGwxAmountTotal(userAddress))
258267 }
259268
260269
261270 func _refreshRewardPerGwxIntegral () = {
262271 let rewardPerGwxIntegralPrevious = valueOrElse( match getString(this, keyRewardPerGwxIntegral()) {
263272 case s: String =>
264273 parseBigInt(s)
265274 case _: Unit =>
266275 unit
267276 case _ =>
268277 throw("Match error")
269278 }, zeroBigInt)
270279 let rewardPerGwxIntegralLastHeight = valueOrErrorMessage(getInteger(this, keyGwxRewardEmissionStartHeight()), wrapErr(("invalid " + keyGwxRewardEmissionStartHeight())))
271280 let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), wrapErr(("invalid " + keyRatePerBlockCurrent())))
272281 let gwxHoldersRewardCurrent = valueOrElse(getInteger(emissionContract, keyGwxHoldersRewardCurrent()), 0)
273282 let gwxAmountTotal = valueOrElse(getGwxAmountTotalOption(), 0)
274283 let dh = toBigInt((height - rewardPerGwxIntegralLastHeight))
275284 let gwxAmountTotalBI = toBigInt(gwxAmountTotal)
276285 let rewardPerGwxIntegral = (rewardPerGwxIntegralPrevious + (if ((gwxAmountTotalBI == zeroBigInt))
277286 then zeroBigInt
278287 else fraction(dh, ((toBigInt(emissionRate) * toBigInt(gwxHoldersRewardCurrent)) * MULT18BI), (gwxAmountTotalBI * MULT8BI))))
279288 $Tuple2([IntegerEntry(keyGwxRewardEmissionStartHeight(), height), StringEntry(keyRewardPerGwxIntegral(), toString(rewardPerGwxIntegral))], rewardPerGwxIntegral)
280289 }
281290
282291
283292 func keyRewardPerGwxIntegralUserLast (userAddress) = makeString(["%s%s", "rewardPerGwxIntegralUserLast", toString(userAddress)], SEP)
284293
285294
286295 func _refreshUserReward (userAddress,userNum) = {
287- let $t01012210210 = _refreshRewardPerGwxIntegral()
288- let rewardPerGwxIntegralActions = $t01012210210._1
289- let rewardPerGwxIntegral = $t01012210210._2
296+ let $t01029210380 = _refreshRewardPerGwxIntegral()
297+ let rewardPerGwxIntegralActions = $t01029210380._1
298+ let rewardPerGwxIntegral = $t01029210380._2
290299 let rewardPerGwxIntegralUserLast = match getString(this, keyRewardPerGwxIntegralUserLast(userAddress)) {
291300 case s: String =>
292301 valueOrErrorMessage(parseBigInt(s), wrapErr("invalid user last integral"))
293302 case _: Unit =>
294303 rewardPerGwxIntegral
295304 case _ =>
296305 throw("Match error")
297306 }
298307 let userIdxOption = getString(boostingContractOrFail(), keyUser2NumMapping(userAddress))
299308 let userUnclaimed = valueOrElse(getInteger(keyUserUnclaimed(userNum)), 0)
300309 let userGwxAmount = valueOrElse(getUserGwxAmountTotalOption(userAddress), 0)
301310 let userReward = (toInt(fraction(toBigInt(userGwxAmount), (rewardPerGwxIntegral - rewardPerGwxIntegralUserLast), MULT18BI)) + userUnclaimed)
302311 $Tuple2(([StringEntry(keyRewardPerGwxIntegralUserLast(userAddress), toString(rewardPerGwxIntegral))] ++ rewardPerGwxIntegralActions), userReward)
303312 }
304313
305314
306315 func commonClaimReward (userAddressStr) = {
307316 let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address"))
308317 let cfgArray = readConfigArrayOrFail()
309318 let userNum = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddressStr)
310- let $t01150111565 = _refreshUserReward(userAddress, userNum)
311- let actions = $t01150111565._1
312- let reward = $t01150111565._2
319+ let $t01167111735 = _refreshUserReward(userAddress, userNum)
320+ let actions = $t01167111735._1
321+ let reward = $t01167111735._2
313322 $Tuple2(reward, ([IntegerEntry(keyUserUnclaimed(userNum), 0)] ++ actions))
314323 }
315324
316325
317326 @Callable(i)
318327 func refreshUserReward (userAddressBytes,userNum) = {
319- let checkCaller = if ((i.caller == boostingContractOrFail()))
320- then true
321- else throwErr("permission denied")
322- if ((checkCaller == checkCaller))
328+ let suspensionCheck = throwIfSuspended()
329+ if ((suspensionCheck == suspensionCheck))
323330 then {
324- let $t01184511923 = _refreshUserReward(Address(userAddressBytes), userNum)
325- let actions = $t01184511923._1
326- let reward = $t01184511923._2
327- $Tuple2(([IntegerEntry(keyUserUnclaimed(userNum), reward)] ++ actions), reward)
331+ let checkCaller = if ((i.caller == boostingContractOrFail()))
332+ then true
333+ else throwErr("permission denied")
334+ if ((checkCaller == checkCaller))
335+ then {
336+ let $t01206112139 = _refreshUserReward(Address(userAddressBytes), userNum)
337+ let actions = $t01206112139._1
338+ let reward = $t01206112139._2
339+ $Tuple2(([IntegerEntry(keyUserUnclaimed(userNum), reward)] ++ actions), reward)
340+ }
341+ else throw("Strict value is not equal to itself.")
328342 }
329343 else throw("Strict value is not equal to itself.")
330344 }
331345
332346
333347
334348 @Callable(i)
335-func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = if ((currentIter == size(userAddresses)))
336- then nil
337- else {
338- let checks = [if ((i.caller == this))
339- then true
340- else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
341- then true
342- else throwErr("insufficient payment assetId")]
343- if ((checks == checks))
344- then {
345- let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
346- if ((tradeRewardInternal == tradeRewardInternal))
349+func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = {
350+ let suspensionCheck = throwIfSuspended()
351+ if ((suspensionCheck == suspensionCheck))
352+ then if ((currentIter == size(userAddresses)))
353+ then nil
354+ else {
355+ let checks = [if ((i.caller == this))
356+ then true
357+ else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
358+ then true
359+ else throwErr("insufficient payment assetId")]
360+ if ((checks == checks))
347361 then {
348- let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
349- let userAddress = addressFromStringValue(userAddresses[currentIter])
350- $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), IntegerEntry(keyTradingReward(userAddresses[currentIter]), rewards[currentIter])], tradeRewardInternal)
362+ let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
363+ if ((tradeRewardInternal == tradeRewardInternal))
364+ then {
365+ let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
366+ let userAddress = addressFromStringValue(userAddresses[currentIter])
367+ $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), IntegerEntry(keyTradingReward(userAddresses[currentIter]), rewards[currentIter])], tradeRewardInternal)
368+ }
369+ else throw("Strict value is not equal to itself.")
351370 }
352371 else throw("Strict value is not equal to itself.")
353372 }
354- else throw("Strict value is not equal to itself.")
355- }
373+ else throw("Strict value is not equal to itself.")
374+ }
356375
357376
358377
359378 @Callable(i)
360379 func updateReferralActivity (userAddress,gWxAmountStart) = {
361- let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
362- let activeReferralInv = if ((referrer == unit))
363- then unit
364- else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil)
365- if ((activeReferralInv == activeReferralInv))
366- then $Tuple2(nil, unit)
380+ let suspensionCheck = throwIfSuspended()
381+ if ((suspensionCheck == suspensionCheck))
382+ then {
383+ let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
384+ let activeReferralInv = if ((referrer == unit))
385+ then unit
386+ else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil)
387+ if ((activeReferralInv == activeReferralInv))
388+ then $Tuple2(nil, unit)
389+ else throw("Strict value is not equal to itself.")
390+ }
367391 else throw("Strict value is not equal to itself.")
368392 }
369393
370394
371395
372396 @Callable(i)
373397 func processPendingPeriodsAndUsers () = $Tuple2(nil, throwErr("deprecated"))
374398
375399
376400
377401 @Callable(i)
378402 func claimReward () = {
379- let cfgArray = readConfigArrayOrFail()
380- let userAddress = i.caller
381- let userAddressStr = toString(userAddress)
382- let $t01365513712 = commonClaimReward(userAddressStr)
383- let amount = $t01365513712._1
384- let actions = $t01365513712._2
385- let checkAmount = if ((amount > 0))
386- then true
387- else throw("nothing to claim")
388- if ((checkAmount == checkAmount))
403+ let suspensionCheck = throwIfSuspended()
404+ if ((suspensionCheck == suspensionCheck))
389405 then {
390- let userGwxAmount = {
391- let @ = invoke(boostingContractOrFail(), "getUserGwxAmount", [userAddressStr], nil)
392- if ($isInstanceOf(@, "Int"))
393- then @
394- else throw(($getType(@) + " couldn't be cast to Int"))
395- }
396- let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddressStr))
397- let activeReferralInv = if ((referrer == unit))
398- then unit
399- else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userGwxAmount >= referralMinGWxAmount)], nil)
400- if ((activeReferralInv == activeReferralInv))
406+ let cfgArray = readConfigArrayOrFail()
407+ let userAddress = i.caller
408+ let userAddressStr = toString(userAddress)
409+ let $t01400914066 = commonClaimReward(userAddressStr)
410+ let amount = $t01400914066._1
411+ let actions = $t01400914066._2
412+ let checkAmount = if ((amount > 0))
413+ then true
414+ else throw("nothing to claim")
415+ if ((checkAmount == checkAmount))
401416 then {
402- let referralInv = if (if ((referrer == unit))
403- then true
404- else (referralMinGWxAmount > userGwxAmount))
417+ let userGwxAmount = {
418+ let @ = invoke(boostingContractOrFail(), "getUserGwxAmount", [userAddressStr], nil)
419+ if ($isInstanceOf(@, "Int"))
420+ then @
421+ else throw(($getType(@) + " couldn't be cast to Int"))
422+ }
423+ let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddressStr))
424+ let activeReferralInv = if ((referrer == unit))
405425 then unit
406- else {
407- let referrerReward = fraction(amount, referrerRewardPermille, SCALE)
408- let referralReward = fraction(amount, referralRewardPermille, SCALE)
409- invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil)
410- }
411- if ((referralInv == referralInv))
426+ else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userGwxAmount >= referralMinGWxAmount)], nil)
427+ if ((activeReferralInv == activeReferralInv))
412428 then {
413- let emit = invoke(emissionContract, "emit", [amount], nil)
414- if ((emit == emit))
429+ let referralInv = if (if ((referrer == unit))
430+ then true
431+ else (referralMinGWxAmount > userGwxAmount))
432+ then unit
433+ else {
434+ let referrerReward = fraction(amount, referrerRewardPermille, SCALE)
435+ let referralReward = fraction(amount, referralRewardPermille, SCALE)
436+ invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil)
437+ }
438+ if ((referralInv == referralInv))
415439 then {
416- let claimedReferral = {
417- let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil)
418- if ($isInstanceOf(@, "Int"))
419- then @
420- else throw(($getType(@) + " couldn't be cast to Int"))
421- }
422- if ((claimedReferral == claimedReferral))
440+ let emit = invoke(emissionContract, "emit", [amount], nil)
441+ if ((emit == emit))
423442 then {
424- let totalAmount = (amount + claimedReferral)
425- $Tuple2(([ScriptTransfer(i.caller, amount, wxAssetId), HistoryEntry("claim", userAddressStr, totalAmount, i)] ++ actions), totalAmount)
443+ let claimedReferral = {
444+ let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil)
445+ if ($isInstanceOf(@, "Int"))
446+ then @
447+ else throw(($getType(@) + " couldn't be cast to Int"))
448+ }
449+ if ((claimedReferral == claimedReferral))
450+ then {
451+ let totalAmount = (amount + claimedReferral)
452+ $Tuple2(([ScriptTransfer(i.caller, amount, wxAssetId), HistoryEntry("claim", userAddressStr, totalAmount, i)] ++ actions), totalAmount)
453+ }
454+ else throw("Strict value is not equal to itself.")
426455 }
427456 else throw("Strict value is not equal to itself.")
428457 }
429458 else throw("Strict value is not equal to itself.")
430459 }
431460 else throw("Strict value is not equal to itself.")
432461 }
433462 else throw("Strict value is not equal to itself.")
434463 }
435464 else throw("Strict value is not equal to itself.")
436465 }
437466
438467
439468
440469 @Callable(i)
441470 func claimRewardREADONLY (address) = {
442- let $t01506915119 = commonClaimReward(address)
443- let amount = $t01506915119._1
444- let actions = $t01506915119._2
471+ let $t01542315473 = commonClaimReward(address)
472+ let amount = $t01542315473._1
473+ let actions = $t01542315473._2
445474 let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0)
446475 let totalAmount = (amount + referralUnclaimed)
447476 $Tuple2(nil, totalAmount)
448477 }
449478
450479
451480
452481 @Callable(i)
453-func onEmissionForGwxStart () = if ((i.caller != factoryContract))
454- then throw("permissions denied")
455- else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)]
482+func onEmissionForGwxStart () = {
483+ let suspensionCheck = throwIfSuspended()
484+ if ((suspensionCheck == suspensionCheck))
485+ then if ((i.caller != factoryContract))
486+ then throw("permissions denied")
487+ else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)]
488+ else throw("Strict value is not equal to itself.")
489+ }
456490
457491
458492
459493 @Callable(i)
460494 func tradeReward (userAddresses,rewards) = {
461- let argsComparison = (size(userAddresses) == size(rewards))
462- let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
463- let payment = i.payments[0]
464- let paymentAssetId = payment.assetId
465- let paymentAmount = payment.amount
466- let checks = [if ((maxRecipients >= size(userAddresses)))
467- then true
468- else throwErr("Too many recipients"), if (argsComparison)
469- then true
470- else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
471- then true
472- else throwErr("Wrong asset payment")]
473- if ((checks == checks))
495+ let suspensionCheck = throwIfSuspended()
496+ if ((suspensionCheck == suspensionCheck))
474497 then {
475- let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
476- if ((tradeRewardInternal == tradeRewardInternal))
477- then $Tuple2(nil, tradeRewardInternal)
498+ let argsComparison = (size(userAddresses) == size(rewards))
499+ let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
500+ let payment = i.payments[0]
501+ let paymentAssetId = payment.assetId
502+ let paymentAmount = payment.amount
503+ let checks = [if ((maxRecipients >= size(userAddresses)))
504+ then true
505+ else throwErr("Too many recipients"), if (argsComparison)
506+ then true
507+ else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
508+ then true
509+ else throwErr("Wrong asset payment")]
510+ if ((checks == checks))
511+ then {
512+ let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
513+ if ((tradeRewardInternal == tradeRewardInternal))
514+ then $Tuple2(nil, tradeRewardInternal)
515+ else throw("Strict value is not equal to itself.")
516+ }
478517 else throw("Strict value is not equal to itself.")
479518 }
480519 else throw("Strict value is not equal to itself.")
481520 }
482521
483522
484523
485524 @Callable(i)
486525 func claimTradingReward () = {
487- let userAddress = i.caller
488- let userAddressString = toString(userAddress)
489- let reward = getTradingReward(userAddressString)
490- if ((reward > 0))
491- then $Tuple2([ScriptTransfer(userAddress, reward, wxAssetId), IntegerEntry(keyTradingReward(userAddressString), 0)], reward)
492- else throwErr("nothing to claim")
526+ let suspensionCheck = throwIfSuspended()
527+ if ((suspensionCheck == suspensionCheck))
528+ then {
529+ let userAddress = i.caller
530+ let userAddressString = toString(userAddress)
531+ let reward = getTradingReward(userAddressString)
532+ if ((reward > 0))
533+ then $Tuple2([ScriptTransfer(userAddress, reward, wxAssetId), IntegerEntry(keyTradingReward(userAddressString), 0)], reward)
534+ else throwErr("nothing to claim")
535+ }
536+ else throw("Strict value is not equal to itself.")
493537 }
494538
495539
496540
497541 @Callable(i)
498542 func claimTradingRewardREADONLY (userAddress) = $Tuple2(nil, getTradingReward(userAddress))
543+
544+
545+
546+@Callable(i)
547+func suspend (v) = {
548+ let checkCaller = mustManager(i)
549+ if ((checkCaller == checkCaller))
550+ then $Tuple2([BooleanEntry(keySuspension, v)], v)
551+ else throw("Strict value is not equal to itself.")
552+ }
499553
500554
501555 @Verifier(tx)
502556 func verify () = {
503557 let targetPublicKey = match managerPublicKeyOrUnit() {
504558 case pk: ByteVector =>
505559 pk
506560 case _: Unit =>
507561 tx.senderPublicKey
508562 case _ =>
509563 throw("Match error")
510564 }
511565 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
512566 }
513567

github/deemru/w8io/169f3d6 
91.26 ms