tx · 31cRiUPvKvxNrm2sue7oMW65qgJU2faqckfGtP9iuhds

3N4h539BJDUdjmkr3cHoeLbq3anwdAEuzkU:  -0.02500000 Waves

2023.07.19 14:41 [2672691] smart account 3N4h539BJDUdjmkr3cHoeLbq3anwdAEuzkU > SELF 0.00000000 Waves

{ "type": 13, "id": "31cRiUPvKvxNrm2sue7oMW65qgJU2faqckfGtP9iuhds", "fee": 2500000, "feeAssetId": null, "timestamp": 1689766967932, "version": 2, "chainId": 84, "sender": "3N4h539BJDUdjmkr3cHoeLbq3anwdAEuzkU", "senderPublicKey": "8nfBMmCv7Vh37pHA6kGxydMKTLd6A2Vv1APwb1bgXHwo", "proofs": [ "64jm68WfD42dMk4kkvcXNFDX7fJL6piGARAPuBsC5QYJpWnxuYhzhsMix6za4GhpTM6jFTSCYEf73gbPHYzUU3qX" ], "script": "base64:BgJXCAISBgoEARgRARIECgIIARIAEgMKAQESABIAEgASAwoBCBIDCgEIEgMKAQgSBQoDAQEBEgUKAwEBARIAEgMKAQgSBwoFCAgICAgSBAoCGBESABIDCgEIXwADU0VQAgJfXwAFU0NBTEUA6AcABU1VTFQ4AIDC1y8ACnplcm9CaWdJbnQJALYCAQAAABRwcm9jZXNzaW5nU3RhZ2VUb3RhbAAAABVwcm9jZXNzaW5nU3RhZ2VTaGFyZXMAAQALd2F2ZXNTdHJpbmcCBVdBVkVTAQ5nZXROdW1iZXJCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFA2tleQAAAQ9nZXROdW1iZXJPckZhaWwBA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCaCAIFBHRoaXMFA2tleQkArAICCQCsAgICD21hbmRhdG9yeSB0aGlzLgUDa2V5Ag8gaXMgbm90IGRlZmluZWQBDmdldFN0cmluZ0J5S2V5AQNrZXkJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUEdGhpcwUDa2V5AgABD2dldFN0cmluZ09yRmFpbAEDa2V5CQETdmFsdWV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lZ2VyRW50cnkCCQEQa2V5VHJhZGluZ1Jld2FyZAEFEXVzZXJBZGRyZXNzU3RyaW5nAAAFA25pbAUGcmV3YXJkCQEIdGhyb3dFcnIBAhBub3RoaW5nIHRvIGNsYWltAWkBGmNsYWltVHJhZGluZ1Jld2FyZFJFQURPTkxZAQt1c2VyQWRkcmVzcwkAlAoCBQNuaWwJARBnZXRUcmFkaW5nUmV3YXJkAQULdXNlckFkZHJlc3MBAnR4AQZ2ZXJpZnkABA90YXJnZXRQdWJsaWNLZXkEByRtYXRjaDAJARZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJwawUHJG1hdGNoMAUCcGsDCQABAgUHJG1hdGNoMAIEVW5pdAgFAnR4D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXnmAhdQ", "height": 2672691, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3L9ZDgbF9Fvpxpnh1bovMzs1kfyBS3NndWTqKZRYFShR Next: none Diff:
OldNewDifferences
1313
1414 let processingStageShares = 1
1515
16+let wavesString = "WAVES"
17+
1618 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
1719
1820
2325
2426
2527 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("mandatory this." + key) + " is not defined"))
28+
29+
30+func parseAssetId (input) = if ((input == wavesString))
31+ then unit
32+ else fromBase58String(input)
33+
34+
35+func wrapErr (msg) = makeString(["gwx_reward.ride:", msg], " ")
36+
37+
38+func throwErr (msg) = throw(wrapErr(msg))
2639
2740
2841 func abs (val) = if ((0 > val))
5063
5164 func keyEmissionAddress () = "%s%s__config__emissionAddress"
5265
66+
67+func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP)
68+
69+
70+let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract()))
5371
5472 func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP)
5573
99117 func keyConfig () = "%s__config"
100118
101119
120+func getEmissionAddress () = addressFromStringValue(valueOrErrorMessage(getString(this, keyEmissionAddress()), (("mandatory this." + keyEmissionAddress()) + " is not defined")))
121+
122+
123+let emissionAddress = getEmissionAddress()
124+
125+let wxAssetIdStr = split(value(getString(emissionAddress, keyConfig())), SEP)[1]
126+
127+let wxAssetId = fromBase58String(wxAssetIdStr)
128+
102129 func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP)
103130
104131
118145
119146
120147 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
148+
149+
150+func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
151+
152+
153+func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
121154
122155
123156 func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL"
182215
183216 let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress()))
184217
218+func keyTradingRewardHistory (user,i) = makeString(["%s%s%s%s", "tradingReward", "history", user, toBase58String(i.transactionId)], SEP)
219+
220+
221+func keyTradingReward (userAddress) = makeString(["%s%s", "tradingReward", userAddress], SEP)
222+
223+
224+func keyMaxRecipients () = makeString(["%s", "maxRecipients"], SEP)
225+
226+
185227 func HistoryEntry (type,user,amount,i) = {
186228 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
187229 let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP)
192234 func keyManagerPublicKey () = "%s__managerPublicKey"
193235
194236
195-func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
237+func keyManagerVaultAddress () = "%s__managerVaultAddress"
196238
197239
198-func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
240+func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
199241 case s: String =>
200- fromBase58String(s)
201- case _: Unit =>
202- unit
242+ addressFromStringValue(s)
203243 case _ =>
204- throw("Match error")
244+ this
205245 }
206246
207247
208-func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
209- case s: String =>
210- fromBase58String(s)
211- case _: Unit =>
212- unit
213- case _ =>
214- throw("Match error")
215-}
248+func managerPublicKeyOrUnit () = {
249+ let managerVaultAddress = getManagerVaultAddressOrThis()
250+ match getString(managerVaultAddress, keyManagerPublicKey()) {
251+ case s: String =>
252+ fromBase58String(s)
253+ case _: Unit =>
254+ unit
255+ case _ =>
256+ throw("Match error")
257+ }
258+ }
216259
217260
218261 func mustManager (i) = {
303346 }
304347
305348
349+func getTradingReward (userAddress) = valueOrElse(getInteger(this, keyTradingReward(userAddress)), 0)
350+
351+
352+@Callable(i)
353+func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = if ((currentIter == size(userAddresses)))
354+ then nil
355+ else {
356+ let checks = [if ((i.caller == this))
357+ then true
358+ else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
359+ then true
360+ else throwErr("insufficient payment assetId")]
361+ if ((checks == checks))
362+ then {
363+ let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
364+ if ((tradeRewardInternal == tradeRewardInternal))
365+ then {
366+ let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
367+ let userAddress = addressFromStringValue(userAddresses[currentIter])
368+ $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), IntegerEntry(keyTradingReward(userAddresses[currentIter]), rewards[currentIter])], tradeRewardInternal)
369+ }
370+ else throw("Strict value is not equal to itself.")
371+ }
372+ else throw("Strict value is not equal to itself.")
373+ }
374+
375+
376+
306377 @Callable(i)
307378 func updateReferralActivity (userAddress,gWxAmountStart) = {
308379 let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
330401 then $Tuple2(nil, false)
331402 else if ((processingStage == processingStageTotal))
332403 then {
333- let $t01208212198 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
334- let userWeight = $t01208212198._1
335- let userActions = $t01208212198._2
404+ let $t01451014626 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
405+ let userWeight = $t01451014626._1
406+ let userActions = $t01451014626._2
336407 let totalWeightNew = (totalWeight + userWeight)
337408 let processingActions = if (((usersCount - 1) > currentUser))
338409 then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))]
407478
408479 @Callable(i)
409480 func deposit () = {
410- let cfgArray = readConfigArrayOrFail()
411- if ((i.caller != Address(fromBase58String(cfgArray[IdxCfgPacemakerAddress]))))
412- then throw("Wrong caller address")
413- else {
414- let assetId = value(value(i.payments[0]).assetId)
415- if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId])))
416- then throw("Wrong payment asset")
417- else {
418- let period = nextPeriod()
419- let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight()))
420- let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined"))
421- let weight = valueOrErrorMessage(getInteger(factoryContract, keyPoolWeightVirtual()), (("mandatory factory_contract." + keyPoolWeightVirtual()) + " is not defined"))
422- let auxAmount = fraction((deltaH * weight), emissionRate, MULT8)
423- let em = invoke(emissionContract, "emit", [auxAmount], nil)
481+ let checkCaller = if ((i.caller == votingEmissionContract))
482+ then true
483+ else mustManager(i)
484+ if ((checkCaller == checkCaller))
485+ then {
486+ let period = nextPeriod()
487+ let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight()))
488+ let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined"))
489+ let gwxHoldersRewardCurrent = valueOrElse(getInteger(emissionContract, keyGwxHoldersRewardCurrent()), 0)
490+ if ((gwxHoldersRewardCurrent == gwxHoldersRewardCurrent))
491+ then {
492+ let auxAmount = fraction((deltaH * gwxHoldersRewardCurrent), emissionRate, MULT8)
493+ let em = if ((auxAmount > 0))
494+ then invoke(emissionContract, "emit", [auxAmount], nil)
495+ else unit
424496 if ((em == em))
425497 then {
426- let matcherPart = value(i.payments[0]).amount
498+ let matcherPart = 0
427499 let payoutInfo = PeriodPayoutInfo(period, matcherPart, auxAmount)
428-[IntegerEntry(keyLatestPeriod(), period), IntegerEntry(keyHeightForPeriod(period), height), IntegerEntry(keyAuxEmissionRewardForPeriod(period), auxAmount), IntegerEntry(keyGwxRewardEmissionStartHeight(), height), IntegerEntry(keyTotalAmountForPeriod(period), matcherPart), IntegerEntry(keyNextPeriod(), (period + 1)), StringEntry(keyLastPayoutInfo(), payoutInfo), StringEntry(keyPayoutHistoryInfo(period), payoutInfo)]
500+ let gwxHoldersRewardUpdated = {
501+ let @ = invoke(emissionContract, "gwxHoldersRewardUpdate", nil, nil)
502+ if ($isInstanceOf(@, "Boolean"))
503+ then @
504+ else throw(($getType(@) + " couldn't be cast to Boolean"))
505+ }
506+ if ((gwxHoldersRewardUpdated == gwxHoldersRewardUpdated))
507+ then {
508+ let totalReward = (matcherPart + auxAmount)
509+ let actions = if (if ((totalReward == 0))
510+ then !(gwxHoldersRewardUpdated)
511+ else false)
512+ then nil
513+ else [IntegerEntry(keyLatestPeriod(), period), IntegerEntry(keyHeightForPeriod(period), height), IntegerEntry(keyAuxEmissionRewardForPeriod(period), auxAmount), IntegerEntry(keyGwxRewardEmissionStartHeight(), height), IntegerEntry(keyTotalAmountForPeriod(period), matcherPart), IntegerEntry(keyNextPeriod(), (period + 1)), StringEntry(keyLastPayoutInfo(), payoutInfo), StringEntry(keyPayoutHistoryInfo(period), payoutInfo)]
514+ $Tuple2(actions, unit)
515+ }
516+ else throw("Strict value is not equal to itself.")
429517 }
430518 else throw("Strict value is not equal to itself.")
431519 }
520+ else throw("Strict value is not equal to itself.")
432521 }
522+ else throw("Strict value is not equal to itself.")
433523 }
434524
435525
438528 func claimReward () = {
439529 let cfgArray = readConfigArrayOrFail()
440530 let address = toString(i.caller)
441- let $t01754017590 = commonClaimReward(address)
442- let amount = $t01754017590._1
443- let actions = $t01754017590._2
531+ let $t01981519865 = commonClaimReward(address)
532+ let amount = $t01981519865._1
533+ let actions = $t01981519865._2
444534 let checkAmount = if ((amount > 0))
445535 then true
446536 else throw("Nothing to claim")
463553
464554 @Callable(i)
465555 func claimRewardREADONLY (address) = {
466- let $t01816318213 = commonClaimReward(address)
467- let amount = $t01816318213._1
468- let actions = $t01816318213._2
556+ let $t02043820488 = commonClaimReward(address)
557+ let amount = $t02043820488._1
558+ let actions = $t02043820488._2
469559 let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0)
470560 let totalAmount = (amount + referralUnclaimed)
471561 $Tuple2(nil, totalAmount)
532622 let ann = (amp * nCoins)
533623 let arr = [0, 1, 2, 3, 4, 5, 6]
534624 func calc (acc,cur) = {
535- let $t02084620873 = acc
536- let d = $t02084620873._1
537- let dPrev = $t02084620873._2
538- let found = $t02084620873._3
625+ let $t02312123148 = acc
626+ let d = $t02312123148._1
627+ let dPrev = $t02312123148._2
628+ let found = $t02312123148._3
539629 if ((found != unit))
540630 then acc
541631 else {
548638 }
549639 }
550640
551- let $t02147121534 = {
641+ let $t02374623809 = {
552642 let $l = arr
553643 let $s = size($l)
554644 let $acc0 = $Tuple3(s, unit, unit)
562652
563653 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7)
564654 }
565- let dNext = $t02147121534._1
566- let dPrev = $t02147121534._2
567- let found = $t02147121534._3
655+ let dNext = $t02374623809._1
656+ let dPrev = $t02374623809._2
657+ let found = $t02374623809._3
568658 if ((found != unit))
569659 then $Tuple2(nil, toString(dNext))
570660 else {
577667
578668
579669 @Callable(i)
580-func setManager (pendingManagerPublicKey) = {
581- let checkCaller = mustManager(i)
582- if ((checkCaller == checkCaller))
670+func tradeReward (userAddresses,rewards) = {
671+ let argsComparison = (size(userAddresses) == size(rewards))
672+ let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
673+ let payment = i.payments[0]
674+ let paymentAssetId = payment.assetId
675+ let paymentAmount = payment.amount
676+ let checks = [if ((maxRecipients >= size(userAddresses)))
677+ then true
678+ else throwErr("Too many recipients"), if (argsComparison)
679+ then true
680+ else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
681+ then true
682+ else throwErr("Wrong asset payment")]
683+ if ((checks == checks))
583684 then {
584- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
585- if ((checkManagerPublicKey == checkManagerPublicKey))
586- then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
685+ let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
686+ if ((tradeRewardInternal == tradeRewardInternal))
687+ then $Tuple2(nil, tradeRewardInternal)
587688 else throw("Strict value is not equal to itself.")
588689 }
589690 else throw("Strict value is not equal to itself.")
592693
593694
594695 @Callable(i)
595-func confirmManager () = {
596- let pm = pendingManagerPublicKeyOrUnit()
597- let hasPM = if (isDefined(pm))
598- then true
599- else throw("No pending manager")
600- if ((hasPM == hasPM))
601- then {
602- let checkPM = if ((i.callerPublicKey == value(pm)))
603- then true
604- else throw("You are not pending manager")
605- if ((checkPM == checkPM))
606- then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
607- else throw("Strict value is not equal to itself.")
608- }
609- else throw("Strict value is not equal to itself.")
696+func claimTradingReward () = {
697+ let userAddress = i.caller
698+ let userAddressString = toString(userAddress)
699+ let reward = getTradingReward(userAddressString)
700+ if ((reward > 0))
701+ then $Tuple2([ScriptTransfer(userAddress, reward, wxAssetId), IntegerEntry(keyTradingReward(userAddressString), 0)], reward)
702+ else throwErr("nothing to claim")
610703 }
704+
705+
706+
707+@Callable(i)
708+func claimTradingRewardREADONLY (userAddress) = $Tuple2(nil, getTradingReward(userAddress))
611709
612710
613711 @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 zeroBigInt = toBigInt(0)
1111
1212 let processingStageTotal = 0
1313
1414 let processingStageShares = 1
1515
16+let wavesString = "WAVES"
17+
1618 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
1719
1820
1921 func getNumberOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("mandatory this." + key) + " is not defined"))
2022
2123
2224 func getStringByKey (key) = valueOrElse(getString(this, key), "")
2325
2426
2527 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("mandatory this." + key) + " is not defined"))
28+
29+
30+func parseAssetId (input) = if ((input == wavesString))
31+ then unit
32+ else fromBase58String(input)
33+
34+
35+func wrapErr (msg) = makeString(["gwx_reward.ride:", msg], " ")
36+
37+
38+func throwErr (msg) = throw(wrapErr(msg))
2639
2740
2841 func abs (val) = if ((0 > val))
2942 then -(val)
3043 else val
3144
3245
3346 func absBigInt (val) = if ((zeroBigInt > val))
3447 then -(val)
3548 else val
3649
3750
3851 let keyMaxDepth = "%s__maxDepth"
3952
4053 let maxDepthDefault = 30
4154
4255 let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault)
4356
4457 func keyFactoryAddress () = "%s%s__config__factoryAddress"
4558
4659
4760 let factoryAddressStr = getStringOrFail(keyFactoryAddress())
4861
4962 let factoryContract = addressFromStringValue(factoryAddressStr)
5063
5164 func keyEmissionAddress () = "%s%s__config__emissionAddress"
5265
66+
67+func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP)
68+
69+
70+let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract()))
5371
5472 func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP)
5573
5674
5775 let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP)
5876
5977 let referralProgramNameDefault = "wxlock"
6078
6179 let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault)
6280
6381 let keyReferralMinGWxAmount = makeString(["%s%s", "referral", "minGWxAmount"], SEP)
6482
6583 let referralMinGWxAmountDefault = (500 * MULT8)
6684
6785 let referralMinGWxAmount = valueOrElse(getInteger(this, keyReferralMinGWxAmount), referralMinGWxAmountDefault)
6886
6987 let keyReferrerRewardPermille = makeString(["%s%s", "referral", "referrerRewardPermille"], SEP)
7088
7189 let referrerRewardPermilleDefault = 50
7290
7391 let referrerRewardPermille = valueOrElse(getInteger(this, keyReferrerRewardPermille), referrerRewardPermilleDefault)
7492
7593 let keyReferralRewardPermille = makeString(["%s%s", "referral", "referralRewardPermille"], SEP)
7694
7795 let referralRewardPermilleDefault = 50
7896
7997 let referralRewardPermille = valueOrElse(getInteger(this, keyReferralRewardPermille), referralRewardPermilleDefault)
8098
8199 func keyReferrer (referralAddress) = makeString(["%s%s%s", "referrer", referralProgramName, referralAddress], SEP)
82100
83101
84102 func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], SEP)
85103
86104
87105 let emissionAddressStr = getStringOrFail(keyEmissionAddress())
88106
89107 let emissionContract = addressFromStringValue(emissionAddressStr)
90108
91109 let IdxCfgAssetId = 1
92110
93111 let IdxCfgPacemakerAddress = 2
94112
95113 let IdxCfgBoostingContract = 3
96114
97115 let IdxCfgMaxDepth = 4
98116
99117 func keyConfig () = "%s__config"
100118
101119
120+func getEmissionAddress () = addressFromStringValue(valueOrErrorMessage(getString(this, keyEmissionAddress()), (("mandatory this." + keyEmissionAddress()) + " is not defined")))
121+
122+
123+let emissionAddress = getEmissionAddress()
124+
125+let wxAssetIdStr = split(value(getString(emissionAddress, keyConfig())), SEP)[1]
126+
127+let wxAssetId = fromBase58String(wxAssetIdStr)
128+
102129 func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP)
103130
104131
105132 func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP)
106133
107134
108135 func boostingContractOrFail () = {
109136 let cfgArray = readConfigArrayOrFail()
110137 valueOrErrorMessage(addressFromString(cfgArray[IdxCfgBoostingContract]), "boosting contract address is not defined")
111138 }
112139
113140
114141 func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight"
115142
116143
117144 func keyUsersCount () = "%s__nextUserNum"
118145
119146
120147 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
148+
149+
150+func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
151+
152+
153+func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
121154
122155
123156 func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL"
124157
125158
126159 func keyNextProcessedUser () = "%s__nextProcessedUser"
127160
128161
129162 func keyLatestPeriod () = "%s__latestPeriod"
130163
131164
132165 func keyNextPeriod () = "%s__nextPeriod"
133166
134167
135168 func keyProcessingStage () = "%s__processingStage"
136169
137170
138171 func keyNextProcessedPeriod () = "%s__nextProcessedPeriod"
139172
140173
141174 func keyUserUnclaimed (userIndex) = makeString(["%s%d", "userUnclaimed", toString(userIndex)], SEP)
142175
143176
144177 func keyNextUnlaimedPeriodOfUser (userIndex) = makeString(["%s%d__nextClaimedPeriod", toString(userIndex)], SEP)
145178
146179
147180 func keyLastProcessedPeriodOfUser (userIndex) = makeString(["%s%d__lastProcessedPeriod", toString(userIndex)], SEP)
148181
149182
150183 func keyHeightForPeriod (period) = makeString(["%s%d__startHeightForPeriod", toString(period)], SEP)
151184
152185
153186 func keyAuxEmissionRewardForPeriod (period) = makeString(["%s%d__auxEmissionReward", toString(period)], SEP)
154187
155188
156189 func keyTotalAmountForPeriod (period) = makeString(["%s%d__totalAmountForPeriod", toString(period)], SEP)
157190
158191
159192 func keyLastPayoutInfo () = "%s__lastPayoutInfo"
160193
161194
162195 func PeriodPayoutInfo (period,matcherReward,emissionReward) = makeString(["%d%d%d", toString(period), toString(matcherReward), toString(emissionReward)], SEP)
163196
164197
165198 func keyPayoutHistoryInfo (period) = makeString(["%s%s%d__payouts__history", toString(period)], SEP)
166199
167200
168201 func keyTotalWeightForPeriod (period) = makeString(["%s%d__totalWeightForPeriod", toString(period)], SEP)
169202
170203
171204 func keyUserKValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "k", toString(period)], SEP)
172205
173206
174207 func keyUserBValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "b", toString(period)], SEP)
175208
176209
177210 func keyUserWeightForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "weight", toString(period)], SEP)
178211
179212
180213 func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP)
181214
182215
183216 let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress()))
184217
218+func keyTradingRewardHistory (user,i) = makeString(["%s%s%s%s", "tradingReward", "history", user, toBase58String(i.transactionId)], SEP)
219+
220+
221+func keyTradingReward (userAddress) = makeString(["%s%s", "tradingReward", userAddress], SEP)
222+
223+
224+func keyMaxRecipients () = makeString(["%s", "maxRecipients"], SEP)
225+
226+
185227 func HistoryEntry (type,user,amount,i) = {
186228 let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP)
187229 let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP)
188230 StringEntry(historyKEY, historyDATA)
189231 }
190232
191233
192234 func keyManagerPublicKey () = "%s__managerPublicKey"
193235
194236
195-func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
237+func keyManagerVaultAddress () = "%s__managerVaultAddress"
196238
197239
198-func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
240+func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
199241 case s: String =>
200- fromBase58String(s)
201- case _: Unit =>
202- unit
242+ addressFromStringValue(s)
203243 case _ =>
204- throw("Match error")
244+ this
205245 }
206246
207247
208-func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
209- case s: String =>
210- fromBase58String(s)
211- case _: Unit =>
212- unit
213- case _ =>
214- throw("Match error")
215-}
248+func managerPublicKeyOrUnit () = {
249+ let managerVaultAddress = getManagerVaultAddressOrThis()
250+ match getString(managerVaultAddress, keyManagerPublicKey()) {
251+ case s: String =>
252+ fromBase58String(s)
253+ case _: Unit =>
254+ unit
255+ case _ =>
256+ throw("Match error")
257+ }
258+ }
216259
217260
218261 func mustManager (i) = {
219262 let pd = throw("Permission denied")
220263 match managerPublicKeyOrUnit() {
221264 case pk: ByteVector =>
222265 if ((i.callerPublicKey == pk))
223266 then true
224267 else pd
225268 case _: Unit =>
226269 if ((i.caller == this))
227270 then true
228271 else pd
229272 case _ =>
230273 throw("Match error")
231274 }
232275 }
233276
234277
235278 func calcUserWeight (boostingContractAddress,heightForPeriod,period,userIndex) = {
236279 let kLast = keyLastProcessedPeriodOfUser(userIndex)
237280 let kKey = keyUserKValueForPeriod(period, userIndex)
238281 let kRaw = getInteger(boostingContractAddress, kKey)
239282 let kUserWeight = keyUserWeightForPeriod(period, userIndex)
240283 if (isDefined(kRaw))
241284 then {
242285 let k = value(kRaw)
243286 let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(period, userIndex)))
244287 let w = ((k * heightForPeriod) + b)
245288 if ((w > 0))
246289 then $Tuple2((w / SCALE), [IntegerEntry(kLast, period), IntegerEntry(kUserWeight, w)])
247290 else $Tuple2(0, nil)
248291 }
249292 else {
250293 let p = getInteger(this, kLast)
251294 if (if (isDefined(p))
252295 then (period >= value(p))
253296 else false)
254297 then {
255298 let pv = value(p)
256299 let k = value(getInteger(boostingContractAddress, keyUserKValueForPeriod(pv, userIndex)))
257300 let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(pv, userIndex)))
258301 let w = ((k * heightForPeriod) + b)
259302 if ((w > 0))
260303 then $Tuple2((w / SCALE), [IntegerEntry(kUserWeight, w)])
261304 else $Tuple2(0, nil)
262305 }
263306 else $Tuple2(0, nil)
264307 }
265308 }
266309
267310
268311 func calcUserWeightForClaim (boostingContractAddress,heightForPeriod,period,userIndex) = {
269312 let kUserWeight = keyUserWeightForPeriod(period, userIndex)
270313 let userWeightOrUnit = getInteger(kUserWeight)
271314 match userWeightOrUnit {
272315 case _: Unit =>
273316 0
274317 case w: Int =>
275318 (w / SCALE)
276319 case _ =>
277320 throw("Match error")
278321 }
279322 }
280323
281324
282325 func getUserIndexByAddress (boostingContractAddressStr,userAddress) = {
283326 let key = makeString(["%s%s%s", "mapping", "user2num", userAddress], SEP)
284327 parseIntValue(valueOrErrorMessage(getString(Address(fromBase58String(boostingContractAddressStr)), key), ((("User address " + userAddress) + " is not found in boosting contract data, key=") + key)))
285328 }
286329
287330
288331 func nextPeriod () = getNumberByKey(keyNextPeriod())
289332
290333
291334 func commonClaimReward (userAddress) = {
292335 let cfgArray = readConfigArrayOrFail()
293336 let userIdx = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddress)
294337 let userUnclaimedOption = getInteger(keyUserUnclaimed(userIdx))
295338 match userUnclaimedOption {
296339 case _: Unit =>
297340 $Tuple2(0, nil)
298341 case u: Int =>
299342 $Tuple2(u, [IntegerEntry(keyUserUnclaimed(userIdx), 0)])
300343 case _ =>
301344 throw("Match error")
302345 }
303346 }
304347
305348
349+func getTradingReward (userAddress) = valueOrElse(getInteger(this, keyTradingReward(userAddress)), 0)
350+
351+
352+@Callable(i)
353+func tradeRewardInternal (paymentAmountLeftOver,userAddresses,rewards,currentIter) = if ((currentIter == size(userAddresses)))
354+ then nil
355+ else {
356+ let checks = [if ((i.caller == this))
357+ then true
358+ else throwErr("Permission denied"), if ((paymentAmountLeftOver >= rewards[currentIter]))
359+ then true
360+ else throwErr("insufficient payment assetId")]
361+ if ((checks == checks))
362+ then {
363+ let tradeRewardInternal = invoke(this, "tradeRewardInternal", [(paymentAmountLeftOver - rewards[currentIter]), userAddresses, rewards, (currentIter + 1)], nil)
364+ if ((tradeRewardInternal == tradeRewardInternal))
365+ then {
366+ let tradingRewardHistoryKey = keyTradingRewardHistory(userAddresses[currentIter], i)
367+ let userAddress = addressFromStringValue(userAddresses[currentIter])
368+ $Tuple2([IntegerEntry(tradingRewardHistoryKey, rewards[currentIter]), IntegerEntry(keyTradingReward(userAddresses[currentIter]), rewards[currentIter])], tradeRewardInternal)
369+ }
370+ else throw("Strict value is not equal to itself.")
371+ }
372+ else throw("Strict value is not equal to itself.")
373+ }
374+
375+
376+
306377 @Callable(i)
307378 func updateReferralActivity (userAddress,gWxAmountStart) = {
308379 let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
309380 let activeReferralInv = if ((referrer == unit))
310381 then unit
311382 else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil)
312383 if ((activeReferralInv == activeReferralInv))
313384 then $Tuple2(nil, unit)
314385 else throw("Strict value is not equal to itself.")
315386 }
316387
317388
318389
319390 @Callable(i)
320391 func finalizeHelper () = {
321392 let processingStage = valueOrElse(getInteger(keyProcessingStage()), processingStageTotal)
322393 let currentPeriod = getNumberByKey(keyNextProcessedPeriod())
323394 let currentUser = getNumberByKey(keyNextProcessedUser())
324395 let latestPeriod = getNumberByKey(keyLatestPeriod())
325396 let usersCount = valueOrElse(getInteger(boostingContractOrFail(), keyUsersCount()), 0)
326397 let totalWeightKey = keyTotalWeightForPeriod(currentPeriod)
327398 let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod))
328399 let heightForPeriod = getNumberByKey(keyHeightForPeriod(currentPeriod))
329400 if ((currentPeriod > latestPeriod))
330401 then $Tuple2(nil, false)
331402 else if ((processingStage == processingStageTotal))
332403 then {
333- let $t01208212198 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
334- let userWeight = $t01208212198._1
335- let userActions = $t01208212198._2
404+ let $t01451014626 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
405+ let userWeight = $t01451014626._1
406+ let userActions = $t01451014626._2
336407 let totalWeightNew = (totalWeight + userWeight)
337408 let processingActions = if (((usersCount - 1) > currentUser))
338409 then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))]
339410 else [IntegerEntry(keyProcessingStage(), processingStageShares), IntegerEntry(keyNextProcessedUser(), 0)]
340411 $Tuple2((([IntegerEntry(totalWeightKey, totalWeightNew)] ++ processingActions) ++ userActions), true)
341412 }
342413 else if ((processingStage == processingStageShares))
343414 then {
344415 let userWeight = calcUserWeightForClaim(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser)
345416 let userAmountMatcherForPeriod = fraction(getNumberByKey(keyTotalAmountForPeriod(currentPeriod)), userWeight, totalWeight)
346417 let userAmountEmissionForPeriod = fraction(getNumberByKey(keyAuxEmissionRewardForPeriod(currentPeriod)), userWeight, totalWeight)
347418 let userTotalAmount = (userAmountEmissionForPeriod + userAmountMatcherForPeriod)
348419 let userUnclaimedOption = getInteger(keyUserUnclaimed(currentUser))
349420 let userAddress = getStringValue(boostingContractOrFail(), keyNumToUserMapping(currentUser))
350421 let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress))
351422 let activeReferralInv = if ((referrer == unit))
352423 then unit
353424 else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userWeight >= referralMinGWxAmount)], nil)
354425 if ((activeReferralInv == activeReferralInv))
355426 then {
356427 let referralInv = if (if ((referrer == unit))
357428 then true
358429 else (referralMinGWxAmount > userWeight))
359430 then unit
360431 else {
361432 let referrerReward = fraction(userTotalAmount, referrerRewardPermille, SCALE)
362433 let referralReward = fraction(userTotalAmount, referralRewardPermille, SCALE)
363434 invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil)
364435 }
365436 if ((referralInv == referralInv))
366437 then {
367438 let unclaimedActions = [IntegerEntry(keyUserUnclaimed(currentUser), (valueOrElse(userUnclaimedOption, 0) + userTotalAmount))]
368439 let processingActions = if (((usersCount - 1) > currentUser))
369440 then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))]
370441 else [IntegerEntry(keyNextProcessedPeriod(), (currentPeriod + 1)), IntegerEntry(keyNextProcessedUser(), 0), DeleteEntry(keyProcessingStage())]
371442 $Tuple2((unclaimedActions ++ processingActions), true)
372443 }
373444 else throw("Strict value is not equal to itself.")
374445 }
375446 else throw("Strict value is not equal to itself.")
376447 }
377448 else throw("invalid processing stage")
378449 }
379450
380451
381452
382453 @Callable(i)
383454 func finalizeWrapper (counter) = {
384455 let result = {
385456 let @ = invoke(this, "finalizeHelper", nil, nil)
386457 if ($isInstanceOf(@, "Boolean"))
387458 then @
388459 else throw(($getType(@) + " couldn't be cast to Boolean"))
389460 }
390461 if ((result == result))
391462 then if (!(result))
392463 then if ((counter == maxDepth))
393464 then throw("Nothing to process")
394465 else $Tuple2(nil, unit)
395466 else if ((counter > 0))
396467 then $Tuple2(nil, invoke(this, "finalizeWrapper", [(counter - 1)], nil))
397468 else $Tuple2(nil, unit)
398469 else throw("Strict value is not equal to itself.")
399470 }
400471
401472
402473
403474 @Callable(i)
404475 func processPendingPeriodsAndUsers () = $Tuple2(nil, invoke(this, "finalizeWrapper", [maxDepth], nil))
405476
406477
407478
408479 @Callable(i)
409480 func deposit () = {
410- let cfgArray = readConfigArrayOrFail()
411- if ((i.caller != Address(fromBase58String(cfgArray[IdxCfgPacemakerAddress]))))
412- then throw("Wrong caller address")
413- else {
414- let assetId = value(value(i.payments[0]).assetId)
415- if ((assetId != fromBase58String(cfgArray[IdxCfgAssetId])))
416- then throw("Wrong payment asset")
417- else {
418- let period = nextPeriod()
419- let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight()))
420- let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined"))
421- let weight = valueOrErrorMessage(getInteger(factoryContract, keyPoolWeightVirtual()), (("mandatory factory_contract." + keyPoolWeightVirtual()) + " is not defined"))
422- let auxAmount = fraction((deltaH * weight), emissionRate, MULT8)
423- let em = invoke(emissionContract, "emit", [auxAmount], nil)
481+ let checkCaller = if ((i.caller == votingEmissionContract))
482+ then true
483+ else mustManager(i)
484+ if ((checkCaller == checkCaller))
485+ then {
486+ let period = nextPeriod()
487+ let deltaH = (height - getNumberOrFail(keyGwxRewardEmissionStartHeight()))
488+ let emissionRate = valueOrErrorMessage(getInteger(emissionContract, keyRatePerBlockCurrent()), (("mandatory emission_contract." + keyRatePerBlockCurrent()) + " is not defined"))
489+ let gwxHoldersRewardCurrent = valueOrElse(getInteger(emissionContract, keyGwxHoldersRewardCurrent()), 0)
490+ if ((gwxHoldersRewardCurrent == gwxHoldersRewardCurrent))
491+ then {
492+ let auxAmount = fraction((deltaH * gwxHoldersRewardCurrent), emissionRate, MULT8)
493+ let em = if ((auxAmount > 0))
494+ then invoke(emissionContract, "emit", [auxAmount], nil)
495+ else unit
424496 if ((em == em))
425497 then {
426- let matcherPart = value(i.payments[0]).amount
498+ let matcherPart = 0
427499 let payoutInfo = PeriodPayoutInfo(period, matcherPart, auxAmount)
428-[IntegerEntry(keyLatestPeriod(), period), IntegerEntry(keyHeightForPeriod(period), height), IntegerEntry(keyAuxEmissionRewardForPeriod(period), auxAmount), IntegerEntry(keyGwxRewardEmissionStartHeight(), height), IntegerEntry(keyTotalAmountForPeriod(period), matcherPart), IntegerEntry(keyNextPeriod(), (period + 1)), StringEntry(keyLastPayoutInfo(), payoutInfo), StringEntry(keyPayoutHistoryInfo(period), payoutInfo)]
500+ let gwxHoldersRewardUpdated = {
501+ let @ = invoke(emissionContract, "gwxHoldersRewardUpdate", nil, nil)
502+ if ($isInstanceOf(@, "Boolean"))
503+ then @
504+ else throw(($getType(@) + " couldn't be cast to Boolean"))
505+ }
506+ if ((gwxHoldersRewardUpdated == gwxHoldersRewardUpdated))
507+ then {
508+ let totalReward = (matcherPart + auxAmount)
509+ let actions = if (if ((totalReward == 0))
510+ then !(gwxHoldersRewardUpdated)
511+ else false)
512+ then nil
513+ else [IntegerEntry(keyLatestPeriod(), period), IntegerEntry(keyHeightForPeriod(period), height), IntegerEntry(keyAuxEmissionRewardForPeriod(period), auxAmount), IntegerEntry(keyGwxRewardEmissionStartHeight(), height), IntegerEntry(keyTotalAmountForPeriod(period), matcherPart), IntegerEntry(keyNextPeriod(), (period + 1)), StringEntry(keyLastPayoutInfo(), payoutInfo), StringEntry(keyPayoutHistoryInfo(period), payoutInfo)]
514+ $Tuple2(actions, unit)
515+ }
516+ else throw("Strict value is not equal to itself.")
429517 }
430518 else throw("Strict value is not equal to itself.")
431519 }
520+ else throw("Strict value is not equal to itself.")
432521 }
522+ else throw("Strict value is not equal to itself.")
433523 }
434524
435525
436526
437527 @Callable(i)
438528 func claimReward () = {
439529 let cfgArray = readConfigArrayOrFail()
440530 let address = toString(i.caller)
441- let $t01754017590 = commonClaimReward(address)
442- let amount = $t01754017590._1
443- let actions = $t01754017590._2
531+ let $t01981519865 = commonClaimReward(address)
532+ let amount = $t01981519865._1
533+ let actions = $t01981519865._2
444534 let checkAmount = if ((amount > 0))
445535 then true
446536 else throw("Nothing to claim")
447537 if ((checkAmount == checkAmount))
448538 then {
449539 let amountFromEmission = 0
450540 let claimedReferral = {
451541 let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil)
452542 if ($isInstanceOf(@, "Int"))
453543 then @
454544 else throw(($getType(@) + " couldn't be cast to Int"))
455545 }
456546 let totalAmount = (amount + claimedReferral)
457547 $Tuple2(([ScriptTransfer(i.caller, totalAmount, fromBase58String(cfgArray[IdxCfgAssetId])), HistoryEntry("claim", address, amount, i)] ++ actions), [totalAmount, amountFromEmission])
458548 }
459549 else throw("Strict value is not equal to itself.")
460550 }
461551
462552
463553
464554 @Callable(i)
465555 func claimRewardREADONLY (address) = {
466- let $t01816318213 = commonClaimReward(address)
467- let amount = $t01816318213._1
468- let actions = $t01816318213._2
556+ let $t02043820488 = commonClaimReward(address)
557+ let amount = $t02043820488._1
558+ let actions = $t02043820488._2
469559 let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0)
470560 let totalAmount = (amount + referralUnclaimed)
471561 $Tuple2(nil, totalAmount)
472562 }
473563
474564
475565
476566 @Callable(i)
477567 func latestFinalizedPeriodREADONLY (address) = $Tuple2(nil, valueOrElse(getInteger(this, keyLatestPeriod()), -1))
478568
479569
480570
481571 @Callable(i)
482572 func latestFinalizedPeriodInfoREADONLY (address) = $Tuple2(nil, getStringByKey(keyLastPayoutInfo()))
483573
484574
485575
486576 @Callable(i)
487577 func calcGwxParamsREADONLY (gwxAmountStart,lockStartHeight,lockDurationBlocks) = {
488578 let lockEndHeight = (lockStartHeight + lockDurationBlocks)
489579 let scale8ParamK = -(fraction(gwxAmountStart, SCALE, lockDurationBlocks))
490580 let scale8ParamB = (fraction(gwxAmountStart, SCALE, lockDurationBlocks) * lockEndHeight)
491581 $Tuple2(nil, [scale8ParamK, scale8ParamB, nextPeriod()])
492582 }
493583
494584
495585
496586 @Callable(i)
497587 func calcGwxAmountStartREADONLY (wxLockAmount,lockDuration,maxLockDuration) = {
498588 let coeffX8 = fraction(lockDuration, MULT8, maxLockDuration)
499589 let gWxAmountStart = fraction(wxLockAmount, coeffX8, MULT8)
500590 $Tuple2(nil, [gWxAmountStart])
501591 }
502592
503593
504594
505595 @Callable(i)
506596 func onEmissionForGwxStart () = if ((i.caller != factoryContract))
507597 then throw("permissions denied")
508598 else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)]
509599
510600
511601
512602 @Callable(i)
513603 func latestPeriodEmissionRewardsREADONLY (address) = {
514604 let period = nextPeriod()
515605 $Tuple2(nil, [getNumberByKey(keyAuxEmissionRewardForPeriod(period))])
516606 }
517607
518608
519609
520610 @Callable(i)
521611 func calcD (x1BigIntStr,x2BigIntStr,ampBigIntStr,aPrecisionBigIntStr,targetPrecisionBigIntStr) = {
522612 let nCoins = toBigInt(2)
523613 let aPrecision = parseBigIntValue(aPrecisionBigIntStr)
524614 let targetPrecision = parseBigIntValue(targetPrecisionBigIntStr)
525615 let x1 = parseBigIntValue(x1BigIntStr)
526616 let x2 = parseBigIntValue(x2BigIntStr)
527617 let amp = (parseBigIntValue(ampBigIntStr) * aPrecision)
528618 let s = (x1 + x2)
529619 if ((s == zeroBigInt))
530620 then $Tuple2(nil, toString(zeroBigInt))
531621 else {
532622 let ann = (amp * nCoins)
533623 let arr = [0, 1, 2, 3, 4, 5, 6]
534624 func calc (acc,cur) = {
535- let $t02084620873 = acc
536- let d = $t02084620873._1
537- let dPrev = $t02084620873._2
538- let found = $t02084620873._3
625+ let $t02312123148 = acc
626+ let d = $t02312123148._1
627+ let dPrev = $t02312123148._2
628+ let found = $t02312123148._3
539629 if ((found != unit))
540630 then acc
541631 else {
542632 let dp = (((d * d) * d) / (((x1 * x2) * nCoins) * nCoins))
543633 let dNext = (((((ann * s) / aPrecision) + (dp * nCoins)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((nCoins + toBigInt(1)) * dp)))
544634 let dDiff = absBigInt((dNext - value(d)))
545635 if ((targetPrecision >= dDiff))
546636 then $Tuple3(dNext, d, cur)
547637 else $Tuple3(dNext, d, unit)
548638 }
549639 }
550640
551- let $t02147121534 = {
641+ let $t02374623809 = {
552642 let $l = arr
553643 let $s = size($l)
554644 let $acc0 = $Tuple3(s, unit, unit)
555645 func $f0_1 ($a,$i) = if (($i >= $s))
556646 then $a
557647 else calc($a, $l[$i])
558648
559649 func $f0_2 ($a,$i) = if (($i >= $s))
560650 then $a
561651 else throw("List size exceeds 7")
562652
563653 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7)
564654 }
565- let dNext = $t02147121534._1
566- let dPrev = $t02147121534._2
567- let found = $t02147121534._3
655+ let dNext = $t02374623809._1
656+ let dPrev = $t02374623809._2
657+ let found = $t02374623809._3
568658 if ((found != unit))
569659 then $Tuple2(nil, toString(dNext))
570660 else {
571661 let dDiff = absBigInt((dNext - value(dPrev)))
572662 throw(("D calculation error, dDiff = " + toString(dDiff)))
573663 }
574664 }
575665 }
576666
577667
578668
579669 @Callable(i)
580-func setManager (pendingManagerPublicKey) = {
581- let checkCaller = mustManager(i)
582- if ((checkCaller == checkCaller))
670+func tradeReward (userAddresses,rewards) = {
671+ let argsComparison = (size(userAddresses) == size(rewards))
672+ let maxRecipients = valueOrElse(getInteger(keyMaxRecipients()), 0)
673+ let payment = i.payments[0]
674+ let paymentAssetId = payment.assetId
675+ let paymentAmount = payment.amount
676+ let checks = [if ((maxRecipients >= size(userAddresses)))
677+ then true
678+ else throwErr("Too many recipients"), if (argsComparison)
679+ then true
680+ else throwErr("Arguments size mismatch"), if ((paymentAssetId == wxAssetId))
681+ then true
682+ else throwErr("Wrong asset payment")]
683+ if ((checks == checks))
583684 then {
584- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
585- if ((checkManagerPublicKey == checkManagerPublicKey))
586- then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
685+ let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil)
686+ if ((tradeRewardInternal == tradeRewardInternal))
687+ then $Tuple2(nil, tradeRewardInternal)
587688 else throw("Strict value is not equal to itself.")
588689 }
589690 else throw("Strict value is not equal to itself.")
590691 }
591692
592693
593694
594695 @Callable(i)
595-func confirmManager () = {
596- let pm = pendingManagerPublicKeyOrUnit()
597- let hasPM = if (isDefined(pm))
598- then true
599- else throw("No pending manager")
600- if ((hasPM == hasPM))
601- then {
602- let checkPM = if ((i.callerPublicKey == value(pm)))
603- then true
604- else throw("You are not pending manager")
605- if ((checkPM == checkPM))
606- then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
607- else throw("Strict value is not equal to itself.")
608- }
609- else throw("Strict value is not equal to itself.")
696+func claimTradingReward () = {
697+ let userAddress = i.caller
698+ let userAddressString = toString(userAddress)
699+ let reward = getTradingReward(userAddressString)
700+ if ((reward > 0))
701+ then $Tuple2([ScriptTransfer(userAddress, reward, wxAssetId), IntegerEntry(keyTradingReward(userAddressString), 0)], reward)
702+ else throwErr("nothing to claim")
610703 }
704+
705+
706+
707+@Callable(i)
708+func claimTradingRewardREADONLY (userAddress) = $Tuple2(nil, getTradingReward(userAddress))
611709
612710
613711 @Verifier(tx)
614712 func verify () = {
615713 let targetPublicKey = match managerPublicKeyOrUnit() {
616714 case pk: ByteVector =>
617715 pk
618716 case _: Unit =>
619717 tx.senderPublicKey
620718 case _ =>
621719 throw("Match error")
622720 }
623721 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
624722 }
625723

github/deemru/w8io/fabc49c 
92.62 ms