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:BgJXCAISBgoEARgRARIECgIIARIAEgMKAQESABIAEgASAwoBCBIDCgEIEgMKAQgSBQoDAQEBEgUKAwEBARIAEgMKAQgSBwoFCAgICAgSBAoCGBESABIDCgEIXwADU0VQAgJfXwAFU0NBTEUA6AcABU1VTFQ4AIDC1y8ACnplcm9CaWdJbnQJALYCAQAAABRwcm9jZXNzaW5nU3RhZ2VUb3RhbAAAABVwcm9jZXNzaW5nU3RhZ2VTaGFyZXMAAQALd2F2ZXNTdHJpbmcCBVdBVkVTAQ5nZXROdW1iZXJCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFA2tleQAAAQ9nZXROdW1iZXJPckZhaWwBA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCaCAIFBHRoaXMFA2tleQkArAICCQCsAgICD21hbmRhdG9yeSB0aGlzLgUDa2V5Ag8gaXMgbm90IGRlZmluZWQBDmdldFN0cmluZ0J5S2V5AQNrZXkJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUEdGhpcwUDa2V5AgABD2dldFN0cmluZ09yRmFpbAEDa2V5CQETdmFsdWVP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Z2VyRW50cnkCCQEQa2V5VHJhZGluZ1Jld2FyZAEFEXVzZXJBZGRyZXNzU3RyaW5nAAAFA25pbAUGcmV3YXJkCQEIdGhyb3dFcnIBAhBub3RoaW5nIHRvIGNsYWltAWkBGmNsYWltVHJhZGluZ1Jld2FyZFJFQURPTkxZAQt1c2VyQWRkcmVzcwkAlAoCBQNuaWwJARBnZXRUcmFkaW5nUmV3YXJkAQULdXNlckFkZHJlc3MBAnR4AQZ2ZXJpZnkABA90YXJnZXRQdWJsaWNLZXkEByRtYXRjaDAJARZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJwawUHJG1hdGNoMAUCcGsDCQABAgUHJG1hdGNoMAIEVW5pdAgFAnR4D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXnmAhdQ", "height": 2672691, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3L9ZDgbF9Fvpxpnh1bovMzs1kfyBS3NndWTqKZRYFShR Next: none Diff:
Old | New | Differences | |
---|---|---|---|
13 | 13 | ||
14 | 14 | let processingStageShares = 1 | |
15 | 15 | ||
16 | + | let wavesString = "WAVES" | |
17 | + | ||
16 | 18 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
17 | 19 | ||
18 | 20 | ||
23 | 25 | ||
24 | 26 | ||
25 | 27 | 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)) | |
26 | 39 | ||
27 | 40 | ||
28 | 41 | func abs (val) = if ((0 > val)) | |
50 | 63 | ||
51 | 64 | func keyEmissionAddress () = "%s%s__config__emissionAddress" | |
52 | 65 | ||
66 | + | ||
67 | + | func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP) | |
68 | + | ||
69 | + | ||
70 | + | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract())) | |
53 | 71 | ||
54 | 72 | func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP) | |
55 | 73 | ||
99 | 117 | func keyConfig () = "%s__config" | |
100 | 118 | ||
101 | 119 | ||
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 | + | ||
102 | 129 | func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP) | |
103 | 130 | ||
104 | 131 | ||
118 | 145 | ||
119 | 146 | ||
120 | 147 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
148 | + | ||
149 | + | ||
150 | + | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
151 | + | ||
152 | + | ||
153 | + | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
121 | 154 | ||
122 | 155 | ||
123 | 156 | func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL" | |
182 | 215 | ||
183 | 216 | let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress())) | |
184 | 217 | ||
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 | + | ||
185 | 227 | func HistoryEntry (type,user,amount,i) = { | |
186 | 228 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
187 | 229 | let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
192 | 234 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
193 | 235 | ||
194 | 236 | ||
195 | - | func | |
237 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
196 | 238 | ||
197 | 239 | ||
198 | - | func | |
240 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
199 | 241 | case s: String => | |
200 | - | fromBase58String(s) | |
201 | - | case _: Unit => | |
202 | - | unit | |
242 | + | addressFromStringValue(s) | |
203 | 243 | case _ => | |
204 | - | | |
244 | + | this | |
205 | 245 | } | |
206 | 246 | ||
207 | 247 | ||
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 | + | } | |
216 | 259 | ||
217 | 260 | ||
218 | 261 | func mustManager (i) = { | |
303 | 346 | } | |
304 | 347 | ||
305 | 348 | ||
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 | + | ||
306 | 377 | @Callable(i) | |
307 | 378 | func updateReferralActivity (userAddress,gWxAmountStart) = { | |
308 | 379 | let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress)) | |
330 | 401 | then $Tuple2(nil, false) | |
331 | 402 | else if ((processingStage == processingStageTotal)) | |
332 | 403 | then { | |
333 | - | let $ | |
334 | - | let userWeight = $ | |
335 | - | let userActions = $ | |
404 | + | let $t01451014626 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser) | |
405 | + | let userWeight = $t01451014626._1 | |
406 | + | let userActions = $t01451014626._2 | |
336 | 407 | let totalWeightNew = (totalWeight + userWeight) | |
337 | 408 | let processingActions = if (((usersCount - 1) > currentUser)) | |
338 | 409 | then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))] | |
407 | 478 | ||
408 | 479 | @Callable(i) | |
409 | 480 | 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 | |
424 | 496 | if ((em == em)) | |
425 | 497 | then { | |
426 | - | let matcherPart = | |
498 | + | let matcherPart = 0 | |
427 | 499 | 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.") | |
429 | 517 | } | |
430 | 518 | else throw("Strict value is not equal to itself.") | |
431 | 519 | } | |
520 | + | else throw("Strict value is not equal to itself.") | |
432 | 521 | } | |
522 | + | else throw("Strict value is not equal to itself.") | |
433 | 523 | } | |
434 | 524 | ||
435 | 525 | ||
438 | 528 | func claimReward () = { | |
439 | 529 | let cfgArray = readConfigArrayOrFail() | |
440 | 530 | let address = toString(i.caller) | |
441 | - | let $ | |
442 | - | let amount = $ | |
443 | - | let actions = $ | |
531 | + | let $t01981519865 = commonClaimReward(address) | |
532 | + | let amount = $t01981519865._1 | |
533 | + | let actions = $t01981519865._2 | |
444 | 534 | let checkAmount = if ((amount > 0)) | |
445 | 535 | then true | |
446 | 536 | else throw("Nothing to claim") | |
463 | 553 | ||
464 | 554 | @Callable(i) | |
465 | 555 | func claimRewardREADONLY (address) = { | |
466 | - | let $ | |
467 | - | let amount = $ | |
468 | - | let actions = $ | |
556 | + | let $t02043820488 = commonClaimReward(address) | |
557 | + | let amount = $t02043820488._1 | |
558 | + | let actions = $t02043820488._2 | |
469 | 559 | let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0) | |
470 | 560 | let totalAmount = (amount + referralUnclaimed) | |
471 | 561 | $Tuple2(nil, totalAmount) | |
532 | 622 | let ann = (amp * nCoins) | |
533 | 623 | let arr = [0, 1, 2, 3, 4, 5, 6] | |
534 | 624 | func calc (acc,cur) = { | |
535 | - | let $ | |
536 | - | let d = $ | |
537 | - | let dPrev = $ | |
538 | - | let found = $ | |
625 | + | let $t02312123148 = acc | |
626 | + | let d = $t02312123148._1 | |
627 | + | let dPrev = $t02312123148._2 | |
628 | + | let found = $t02312123148._3 | |
539 | 629 | if ((found != unit)) | |
540 | 630 | then acc | |
541 | 631 | else { | |
548 | 638 | } | |
549 | 639 | } | |
550 | 640 | ||
551 | - | let $ | |
641 | + | let $t02374623809 = { | |
552 | 642 | let $l = arr | |
553 | 643 | let $s = size($l) | |
554 | 644 | let $acc0 = $Tuple3(s, unit, unit) | |
562 | 652 | ||
563 | 653 | $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) | |
564 | 654 | } | |
565 | - | let dNext = $ | |
566 | - | let dPrev = $ | |
567 | - | let found = $ | |
655 | + | let dNext = $t02374623809._1 | |
656 | + | let dPrev = $t02374623809._2 | |
657 | + | let found = $t02374623809._3 | |
568 | 658 | if ((found != unit)) | |
569 | 659 | then $Tuple2(nil, toString(dNext)) | |
570 | 660 | else { | |
577 | 667 | ||
578 | 668 | ||
579 | 669 | @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)) | |
583 | 684 | then { | |
584 | - | let | |
585 | - | if (( | |
586 | - | then | |
685 | + | let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil) | |
686 | + | if ((tradeRewardInternal == tradeRewardInternal)) | |
687 | + | then $Tuple2(nil, tradeRewardInternal) | |
587 | 688 | else throw("Strict value is not equal to itself.") | |
588 | 689 | } | |
589 | 690 | else throw("Strict value is not equal to itself.") | |
592 | 693 | ||
593 | 694 | ||
594 | 695 | @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") | |
610 | 703 | } | |
704 | + | ||
705 | + | ||
706 | + | ||
707 | + | @Callable(i) | |
708 | + | func claimTradingRewardREADONLY (userAddress) = $Tuple2(nil, getTradingReward(userAddress)) | |
611 | 709 | ||
612 | 710 | ||
613 | 711 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let SCALE = 1000 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let processingStageTotal = 0 | |
13 | 13 | ||
14 | 14 | let processingStageShares = 1 | |
15 | 15 | ||
16 | + | let wavesString = "WAVES" | |
17 | + | ||
16 | 18 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
17 | 19 | ||
18 | 20 | ||
19 | 21 | func getNumberOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("mandatory this." + key) + " is not defined")) | |
20 | 22 | ||
21 | 23 | ||
22 | 24 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
23 | 25 | ||
24 | 26 | ||
25 | 27 | 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)) | |
26 | 39 | ||
27 | 40 | ||
28 | 41 | func abs (val) = if ((0 > val)) | |
29 | 42 | then -(val) | |
30 | 43 | else val | |
31 | 44 | ||
32 | 45 | ||
33 | 46 | func absBigInt (val) = if ((zeroBigInt > val)) | |
34 | 47 | then -(val) | |
35 | 48 | else val | |
36 | 49 | ||
37 | 50 | ||
38 | 51 | let keyMaxDepth = "%s__maxDepth" | |
39 | 52 | ||
40 | 53 | let maxDepthDefault = 30 | |
41 | 54 | ||
42 | 55 | let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault) | |
43 | 56 | ||
44 | 57 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
45 | 58 | ||
46 | 59 | ||
47 | 60 | let factoryAddressStr = getStringOrFail(keyFactoryAddress()) | |
48 | 61 | ||
49 | 62 | let factoryContract = addressFromStringValue(factoryAddressStr) | |
50 | 63 | ||
51 | 64 | func keyEmissionAddress () = "%s%s__config__emissionAddress" | |
52 | 65 | ||
66 | + | ||
67 | + | func keyVotingEmissionContract () = makeString(["%s", "votingEmissionContract"], SEP) | |
68 | + | ||
69 | + | ||
70 | + | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract())) | |
53 | 71 | ||
54 | 72 | func keyNumToUserMapping (num) = makeString(["%s%s%s", "mapping", "num2user", toString(num)], SEP) | |
55 | 73 | ||
56 | 74 | ||
57 | 75 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
58 | 76 | ||
59 | 77 | let referralProgramNameDefault = "wxlock" | |
60 | 78 | ||
61 | 79 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
62 | 80 | ||
63 | 81 | let keyReferralMinGWxAmount = makeString(["%s%s", "referral", "minGWxAmount"], SEP) | |
64 | 82 | ||
65 | 83 | let referralMinGWxAmountDefault = (500 * MULT8) | |
66 | 84 | ||
67 | 85 | let referralMinGWxAmount = valueOrElse(getInteger(this, keyReferralMinGWxAmount), referralMinGWxAmountDefault) | |
68 | 86 | ||
69 | 87 | let keyReferrerRewardPermille = makeString(["%s%s", "referral", "referrerRewardPermille"], SEP) | |
70 | 88 | ||
71 | 89 | let referrerRewardPermilleDefault = 50 | |
72 | 90 | ||
73 | 91 | let referrerRewardPermille = valueOrElse(getInteger(this, keyReferrerRewardPermille), referrerRewardPermilleDefault) | |
74 | 92 | ||
75 | 93 | let keyReferralRewardPermille = makeString(["%s%s", "referral", "referralRewardPermille"], SEP) | |
76 | 94 | ||
77 | 95 | let referralRewardPermilleDefault = 50 | |
78 | 96 | ||
79 | 97 | let referralRewardPermille = valueOrElse(getInteger(this, keyReferralRewardPermille), referralRewardPermilleDefault) | |
80 | 98 | ||
81 | 99 | func keyReferrer (referralAddress) = makeString(["%s%s%s", "referrer", referralProgramName, referralAddress], SEP) | |
82 | 100 | ||
83 | 101 | ||
84 | 102 | func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], SEP) | |
85 | 103 | ||
86 | 104 | ||
87 | 105 | let emissionAddressStr = getStringOrFail(keyEmissionAddress()) | |
88 | 106 | ||
89 | 107 | let emissionContract = addressFromStringValue(emissionAddressStr) | |
90 | 108 | ||
91 | 109 | let IdxCfgAssetId = 1 | |
92 | 110 | ||
93 | 111 | let IdxCfgPacemakerAddress = 2 | |
94 | 112 | ||
95 | 113 | let IdxCfgBoostingContract = 3 | |
96 | 114 | ||
97 | 115 | let IdxCfgMaxDepth = 4 | |
98 | 116 | ||
99 | 117 | func keyConfig () = "%s__config" | |
100 | 118 | ||
101 | 119 | ||
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 | + | ||
102 | 129 | func readConfigArrayOrFail () = split(getStringOrFail(keyConfig()), SEP) | |
103 | 130 | ||
104 | 131 | ||
105 | 132 | func formatConfig (wxAssetIdStr,matcherPacemakerAddressStr,boostingContractAddressStr,maxDepth) = makeString(["%s%s%s%d", wxAssetIdStr, matcherPacemakerAddressStr, boostingContractAddressStr, toString(maxDepth)], SEP) | |
106 | 133 | ||
107 | 134 | ||
108 | 135 | func boostingContractOrFail () = { | |
109 | 136 | let cfgArray = readConfigArrayOrFail() | |
110 | 137 | valueOrErrorMessage(addressFromString(cfgArray[IdxCfgBoostingContract]), "boosting contract address is not defined") | |
111 | 138 | } | |
112 | 139 | ||
113 | 140 | ||
114 | 141 | func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight" | |
115 | 142 | ||
116 | 143 | ||
117 | 144 | func keyUsersCount () = "%s__nextUserNum" | |
118 | 145 | ||
119 | 146 | ||
120 | 147 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
148 | + | ||
149 | + | ||
150 | + | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
151 | + | ||
152 | + | ||
153 | + | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
121 | 154 | ||
122 | 155 | ||
123 | 156 | func keyPoolWeightVirtual () = "%s%s__poolWeight__GWXvirtualPOOL" | |
124 | 157 | ||
125 | 158 | ||
126 | 159 | func keyNextProcessedUser () = "%s__nextProcessedUser" | |
127 | 160 | ||
128 | 161 | ||
129 | 162 | func keyLatestPeriod () = "%s__latestPeriod" | |
130 | 163 | ||
131 | 164 | ||
132 | 165 | func keyNextPeriod () = "%s__nextPeriod" | |
133 | 166 | ||
134 | 167 | ||
135 | 168 | func keyProcessingStage () = "%s__processingStage" | |
136 | 169 | ||
137 | 170 | ||
138 | 171 | func keyNextProcessedPeriod () = "%s__nextProcessedPeriod" | |
139 | 172 | ||
140 | 173 | ||
141 | 174 | func keyUserUnclaimed (userIndex) = makeString(["%s%d", "userUnclaimed", toString(userIndex)], SEP) | |
142 | 175 | ||
143 | 176 | ||
144 | 177 | func keyNextUnlaimedPeriodOfUser (userIndex) = makeString(["%s%d__nextClaimedPeriod", toString(userIndex)], SEP) | |
145 | 178 | ||
146 | 179 | ||
147 | 180 | func keyLastProcessedPeriodOfUser (userIndex) = makeString(["%s%d__lastProcessedPeriod", toString(userIndex)], SEP) | |
148 | 181 | ||
149 | 182 | ||
150 | 183 | func keyHeightForPeriod (period) = makeString(["%s%d__startHeightForPeriod", toString(period)], SEP) | |
151 | 184 | ||
152 | 185 | ||
153 | 186 | func keyAuxEmissionRewardForPeriod (period) = makeString(["%s%d__auxEmissionReward", toString(period)], SEP) | |
154 | 187 | ||
155 | 188 | ||
156 | 189 | func keyTotalAmountForPeriod (period) = makeString(["%s%d__totalAmountForPeriod", toString(period)], SEP) | |
157 | 190 | ||
158 | 191 | ||
159 | 192 | func keyLastPayoutInfo () = "%s__lastPayoutInfo" | |
160 | 193 | ||
161 | 194 | ||
162 | 195 | func PeriodPayoutInfo (period,matcherReward,emissionReward) = makeString(["%d%d%d", toString(period), toString(matcherReward), toString(emissionReward)], SEP) | |
163 | 196 | ||
164 | 197 | ||
165 | 198 | func keyPayoutHistoryInfo (period) = makeString(["%s%s%d__payouts__history", toString(period)], SEP) | |
166 | 199 | ||
167 | 200 | ||
168 | 201 | func keyTotalWeightForPeriod (period) = makeString(["%s%d__totalWeightForPeriod", toString(period)], SEP) | |
169 | 202 | ||
170 | 203 | ||
171 | 204 | func keyUserKValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "k", toString(period)], SEP) | |
172 | 205 | ||
173 | 206 | ||
174 | 207 | func keyUserBValueForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "b", toString(period)], SEP) | |
175 | 208 | ||
176 | 209 | ||
177 | 210 | func keyUserWeightForPeriod (period,userIndex) = makeString(["%s%d%s%d__paramByPeriod", toString(userIndex), "weight", toString(period)], SEP) | |
178 | 211 | ||
179 | 212 | ||
180 | 213 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
181 | 214 | ||
182 | 215 | ||
183 | 216 | let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(keyReferralsContractAddress())) | |
184 | 217 | ||
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 | + | ||
185 | 227 | func HistoryEntry (type,user,amount,i) = { | |
186 | 228 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
187 | 229 | let historyDATA = makeString(["%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], SEP) | |
188 | 230 | StringEntry(historyKEY, historyDATA) | |
189 | 231 | } | |
190 | 232 | ||
191 | 233 | ||
192 | 234 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
193 | 235 | ||
194 | 236 | ||
195 | - | func | |
237 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
196 | 238 | ||
197 | 239 | ||
198 | - | func | |
240 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
199 | 241 | case s: String => | |
200 | - | fromBase58String(s) | |
201 | - | case _: Unit => | |
202 | - | unit | |
242 | + | addressFromStringValue(s) | |
203 | 243 | case _ => | |
204 | - | | |
244 | + | this | |
205 | 245 | } | |
206 | 246 | ||
207 | 247 | ||
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 | + | } | |
216 | 259 | ||
217 | 260 | ||
218 | 261 | func mustManager (i) = { | |
219 | 262 | let pd = throw("Permission denied") | |
220 | 263 | match managerPublicKeyOrUnit() { | |
221 | 264 | case pk: ByteVector => | |
222 | 265 | if ((i.callerPublicKey == pk)) | |
223 | 266 | then true | |
224 | 267 | else pd | |
225 | 268 | case _: Unit => | |
226 | 269 | if ((i.caller == this)) | |
227 | 270 | then true | |
228 | 271 | else pd | |
229 | 272 | case _ => | |
230 | 273 | throw("Match error") | |
231 | 274 | } | |
232 | 275 | } | |
233 | 276 | ||
234 | 277 | ||
235 | 278 | func calcUserWeight (boostingContractAddress,heightForPeriod,period,userIndex) = { | |
236 | 279 | let kLast = keyLastProcessedPeriodOfUser(userIndex) | |
237 | 280 | let kKey = keyUserKValueForPeriod(period, userIndex) | |
238 | 281 | let kRaw = getInteger(boostingContractAddress, kKey) | |
239 | 282 | let kUserWeight = keyUserWeightForPeriod(period, userIndex) | |
240 | 283 | if (isDefined(kRaw)) | |
241 | 284 | then { | |
242 | 285 | let k = value(kRaw) | |
243 | 286 | let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(period, userIndex))) | |
244 | 287 | let w = ((k * heightForPeriod) + b) | |
245 | 288 | if ((w > 0)) | |
246 | 289 | then $Tuple2((w / SCALE), [IntegerEntry(kLast, period), IntegerEntry(kUserWeight, w)]) | |
247 | 290 | else $Tuple2(0, nil) | |
248 | 291 | } | |
249 | 292 | else { | |
250 | 293 | let p = getInteger(this, kLast) | |
251 | 294 | if (if (isDefined(p)) | |
252 | 295 | then (period >= value(p)) | |
253 | 296 | else false) | |
254 | 297 | then { | |
255 | 298 | let pv = value(p) | |
256 | 299 | let k = value(getInteger(boostingContractAddress, keyUserKValueForPeriod(pv, userIndex))) | |
257 | 300 | let b = value(getInteger(boostingContractAddress, keyUserBValueForPeriod(pv, userIndex))) | |
258 | 301 | let w = ((k * heightForPeriod) + b) | |
259 | 302 | if ((w > 0)) | |
260 | 303 | then $Tuple2((w / SCALE), [IntegerEntry(kUserWeight, w)]) | |
261 | 304 | else $Tuple2(0, nil) | |
262 | 305 | } | |
263 | 306 | else $Tuple2(0, nil) | |
264 | 307 | } | |
265 | 308 | } | |
266 | 309 | ||
267 | 310 | ||
268 | 311 | func calcUserWeightForClaim (boostingContractAddress,heightForPeriod,period,userIndex) = { | |
269 | 312 | let kUserWeight = keyUserWeightForPeriod(period, userIndex) | |
270 | 313 | let userWeightOrUnit = getInteger(kUserWeight) | |
271 | 314 | match userWeightOrUnit { | |
272 | 315 | case _: Unit => | |
273 | 316 | 0 | |
274 | 317 | case w: Int => | |
275 | 318 | (w / SCALE) | |
276 | 319 | case _ => | |
277 | 320 | throw("Match error") | |
278 | 321 | } | |
279 | 322 | } | |
280 | 323 | ||
281 | 324 | ||
282 | 325 | func getUserIndexByAddress (boostingContractAddressStr,userAddress) = { | |
283 | 326 | let key = makeString(["%s%s%s", "mapping", "user2num", userAddress], SEP) | |
284 | 327 | parseIntValue(valueOrErrorMessage(getString(Address(fromBase58String(boostingContractAddressStr)), key), ((("User address " + userAddress) + " is not found in boosting contract data, key=") + key))) | |
285 | 328 | } | |
286 | 329 | ||
287 | 330 | ||
288 | 331 | func nextPeriod () = getNumberByKey(keyNextPeriod()) | |
289 | 332 | ||
290 | 333 | ||
291 | 334 | func commonClaimReward (userAddress) = { | |
292 | 335 | let cfgArray = readConfigArrayOrFail() | |
293 | 336 | let userIdx = getUserIndexByAddress(cfgArray[IdxCfgBoostingContract], userAddress) | |
294 | 337 | let userUnclaimedOption = getInteger(keyUserUnclaimed(userIdx)) | |
295 | 338 | match userUnclaimedOption { | |
296 | 339 | case _: Unit => | |
297 | 340 | $Tuple2(0, nil) | |
298 | 341 | case u: Int => | |
299 | 342 | $Tuple2(u, [IntegerEntry(keyUserUnclaimed(userIdx), 0)]) | |
300 | 343 | case _ => | |
301 | 344 | throw("Match error") | |
302 | 345 | } | |
303 | 346 | } | |
304 | 347 | ||
305 | 348 | ||
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 | + | ||
306 | 377 | @Callable(i) | |
307 | 378 | func updateReferralActivity (userAddress,gWxAmountStart) = { | |
308 | 379 | let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress)) | |
309 | 380 | let activeReferralInv = if ((referrer == unit)) | |
310 | 381 | then unit | |
311 | 382 | else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (gWxAmountStart >= referralMinGWxAmount)], nil) | |
312 | 383 | if ((activeReferralInv == activeReferralInv)) | |
313 | 384 | then $Tuple2(nil, unit) | |
314 | 385 | else throw("Strict value is not equal to itself.") | |
315 | 386 | } | |
316 | 387 | ||
317 | 388 | ||
318 | 389 | ||
319 | 390 | @Callable(i) | |
320 | 391 | func finalizeHelper () = { | |
321 | 392 | let processingStage = valueOrElse(getInteger(keyProcessingStage()), processingStageTotal) | |
322 | 393 | let currentPeriod = getNumberByKey(keyNextProcessedPeriod()) | |
323 | 394 | let currentUser = getNumberByKey(keyNextProcessedUser()) | |
324 | 395 | let latestPeriod = getNumberByKey(keyLatestPeriod()) | |
325 | 396 | let usersCount = valueOrElse(getInteger(boostingContractOrFail(), keyUsersCount()), 0) | |
326 | 397 | let totalWeightKey = keyTotalWeightForPeriod(currentPeriod) | |
327 | 398 | let totalWeight = getNumberByKey(keyTotalWeightForPeriod(currentPeriod)) | |
328 | 399 | let heightForPeriod = getNumberByKey(keyHeightForPeriod(currentPeriod)) | |
329 | 400 | if ((currentPeriod > latestPeriod)) | |
330 | 401 | then $Tuple2(nil, false) | |
331 | 402 | else if ((processingStage == processingStageTotal)) | |
332 | 403 | then { | |
333 | - | let $ | |
334 | - | let userWeight = $ | |
335 | - | let userActions = $ | |
404 | + | let $t01451014626 = calcUserWeight(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser) | |
405 | + | let userWeight = $t01451014626._1 | |
406 | + | let userActions = $t01451014626._2 | |
336 | 407 | let totalWeightNew = (totalWeight + userWeight) | |
337 | 408 | let processingActions = if (((usersCount - 1) > currentUser)) | |
338 | 409 | then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))] | |
339 | 410 | else [IntegerEntry(keyProcessingStage(), processingStageShares), IntegerEntry(keyNextProcessedUser(), 0)] | |
340 | 411 | $Tuple2((([IntegerEntry(totalWeightKey, totalWeightNew)] ++ processingActions) ++ userActions), true) | |
341 | 412 | } | |
342 | 413 | else if ((processingStage == processingStageShares)) | |
343 | 414 | then { | |
344 | 415 | let userWeight = calcUserWeightForClaim(boostingContractOrFail(), heightForPeriod, currentPeriod, currentUser) | |
345 | 416 | let userAmountMatcherForPeriod = fraction(getNumberByKey(keyTotalAmountForPeriod(currentPeriod)), userWeight, totalWeight) | |
346 | 417 | let userAmountEmissionForPeriod = fraction(getNumberByKey(keyAuxEmissionRewardForPeriod(currentPeriod)), userWeight, totalWeight) | |
347 | 418 | let userTotalAmount = (userAmountEmissionForPeriod + userAmountMatcherForPeriod) | |
348 | 419 | let userUnclaimedOption = getInteger(keyUserUnclaimed(currentUser)) | |
349 | 420 | let userAddress = getStringValue(boostingContractOrFail(), keyNumToUserMapping(currentUser)) | |
350 | 421 | let referrer = getString(referralsContractAddressOrFail, keyReferrer(userAddress)) | |
351 | 422 | let activeReferralInv = if ((referrer == unit)) | |
352 | 423 | then unit | |
353 | 424 | else invoke(referralsContractAddressOrFail, "updateReferralActivity", [referralProgramName, userAddress, (userWeight >= referralMinGWxAmount)], nil) | |
354 | 425 | if ((activeReferralInv == activeReferralInv)) | |
355 | 426 | then { | |
356 | 427 | let referralInv = if (if ((referrer == unit)) | |
357 | 428 | then true | |
358 | 429 | else (referralMinGWxAmount > userWeight)) | |
359 | 430 | then unit | |
360 | 431 | else { | |
361 | 432 | let referrerReward = fraction(userTotalAmount, referrerRewardPermille, SCALE) | |
362 | 433 | let referralReward = fraction(userTotalAmount, referralRewardPermille, SCALE) | |
363 | 434 | invoke(referralsContractAddressOrFail, "incUnclaimed", [referralProgramName, userAddress, referrerReward, referralReward], nil) | |
364 | 435 | } | |
365 | 436 | if ((referralInv == referralInv)) | |
366 | 437 | then { | |
367 | 438 | let unclaimedActions = [IntegerEntry(keyUserUnclaimed(currentUser), (valueOrElse(userUnclaimedOption, 0) + userTotalAmount))] | |
368 | 439 | let processingActions = if (((usersCount - 1) > currentUser)) | |
369 | 440 | then [IntegerEntry(keyNextProcessedUser(), (currentUser + 1))] | |
370 | 441 | else [IntegerEntry(keyNextProcessedPeriod(), (currentPeriod + 1)), IntegerEntry(keyNextProcessedUser(), 0), DeleteEntry(keyProcessingStage())] | |
371 | 442 | $Tuple2((unclaimedActions ++ processingActions), true) | |
372 | 443 | } | |
373 | 444 | else throw("Strict value is not equal to itself.") | |
374 | 445 | } | |
375 | 446 | else throw("Strict value is not equal to itself.") | |
376 | 447 | } | |
377 | 448 | else throw("invalid processing stage") | |
378 | 449 | } | |
379 | 450 | ||
380 | 451 | ||
381 | 452 | ||
382 | 453 | @Callable(i) | |
383 | 454 | func finalizeWrapper (counter) = { | |
384 | 455 | let result = { | |
385 | 456 | let @ = invoke(this, "finalizeHelper", nil, nil) | |
386 | 457 | if ($isInstanceOf(@, "Boolean")) | |
387 | 458 | then @ | |
388 | 459 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
389 | 460 | } | |
390 | 461 | if ((result == result)) | |
391 | 462 | then if (!(result)) | |
392 | 463 | then if ((counter == maxDepth)) | |
393 | 464 | then throw("Nothing to process") | |
394 | 465 | else $Tuple2(nil, unit) | |
395 | 466 | else if ((counter > 0)) | |
396 | 467 | then $Tuple2(nil, invoke(this, "finalizeWrapper", [(counter - 1)], nil)) | |
397 | 468 | else $Tuple2(nil, unit) | |
398 | 469 | else throw("Strict value is not equal to itself.") | |
399 | 470 | } | |
400 | 471 | ||
401 | 472 | ||
402 | 473 | ||
403 | 474 | @Callable(i) | |
404 | 475 | func processPendingPeriodsAndUsers () = $Tuple2(nil, invoke(this, "finalizeWrapper", [maxDepth], nil)) | |
405 | 476 | ||
406 | 477 | ||
407 | 478 | ||
408 | 479 | @Callable(i) | |
409 | 480 | 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 | |
424 | 496 | if ((em == em)) | |
425 | 497 | then { | |
426 | - | let matcherPart = | |
498 | + | let matcherPart = 0 | |
427 | 499 | 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.") | |
429 | 517 | } | |
430 | 518 | else throw("Strict value is not equal to itself.") | |
431 | 519 | } | |
520 | + | else throw("Strict value is not equal to itself.") | |
432 | 521 | } | |
522 | + | else throw("Strict value is not equal to itself.") | |
433 | 523 | } | |
434 | 524 | ||
435 | 525 | ||
436 | 526 | ||
437 | 527 | @Callable(i) | |
438 | 528 | func claimReward () = { | |
439 | 529 | let cfgArray = readConfigArrayOrFail() | |
440 | 530 | let address = toString(i.caller) | |
441 | - | let $ | |
442 | - | let amount = $ | |
443 | - | let actions = $ | |
531 | + | let $t01981519865 = commonClaimReward(address) | |
532 | + | let amount = $t01981519865._1 | |
533 | + | let actions = $t01981519865._2 | |
444 | 534 | let checkAmount = if ((amount > 0)) | |
445 | 535 | then true | |
446 | 536 | else throw("Nothing to claim") | |
447 | 537 | if ((checkAmount == checkAmount)) | |
448 | 538 | then { | |
449 | 539 | let amountFromEmission = 0 | |
450 | 540 | let claimedReferral = { | |
451 | 541 | let @ = invoke(referralsContractAddressOrFail, "claim", [referralProgramName], nil) | |
452 | 542 | if ($isInstanceOf(@, "Int")) | |
453 | 543 | then @ | |
454 | 544 | else throw(($getType(@) + " couldn't be cast to Int")) | |
455 | 545 | } | |
456 | 546 | let totalAmount = (amount + claimedReferral) | |
457 | 547 | $Tuple2(([ScriptTransfer(i.caller, totalAmount, fromBase58String(cfgArray[IdxCfgAssetId])), HistoryEntry("claim", address, amount, i)] ++ actions), [totalAmount, amountFromEmission]) | |
458 | 548 | } | |
459 | 549 | else throw("Strict value is not equal to itself.") | |
460 | 550 | } | |
461 | 551 | ||
462 | 552 | ||
463 | 553 | ||
464 | 554 | @Callable(i) | |
465 | 555 | func claimRewardREADONLY (address) = { | |
466 | - | let $ | |
467 | - | let amount = $ | |
468 | - | let actions = $ | |
556 | + | let $t02043820488 = commonClaimReward(address) | |
557 | + | let amount = $t02043820488._1 | |
558 | + | let actions = $t02043820488._2 | |
469 | 559 | let referralUnclaimed = valueOrElse(getInteger(referralsContractAddressOrFail, keyUnclaimedReferral(referralProgramName, address)), 0) | |
470 | 560 | let totalAmount = (amount + referralUnclaimed) | |
471 | 561 | $Tuple2(nil, totalAmount) | |
472 | 562 | } | |
473 | 563 | ||
474 | 564 | ||
475 | 565 | ||
476 | 566 | @Callable(i) | |
477 | 567 | func latestFinalizedPeriodREADONLY (address) = $Tuple2(nil, valueOrElse(getInteger(this, keyLatestPeriod()), -1)) | |
478 | 568 | ||
479 | 569 | ||
480 | 570 | ||
481 | 571 | @Callable(i) | |
482 | 572 | func latestFinalizedPeriodInfoREADONLY (address) = $Tuple2(nil, getStringByKey(keyLastPayoutInfo())) | |
483 | 573 | ||
484 | 574 | ||
485 | 575 | ||
486 | 576 | @Callable(i) | |
487 | 577 | func calcGwxParamsREADONLY (gwxAmountStart,lockStartHeight,lockDurationBlocks) = { | |
488 | 578 | let lockEndHeight = (lockStartHeight + lockDurationBlocks) | |
489 | 579 | let scale8ParamK = -(fraction(gwxAmountStart, SCALE, lockDurationBlocks)) | |
490 | 580 | let scale8ParamB = (fraction(gwxAmountStart, SCALE, lockDurationBlocks) * lockEndHeight) | |
491 | 581 | $Tuple2(nil, [scale8ParamK, scale8ParamB, nextPeriod()]) | |
492 | 582 | } | |
493 | 583 | ||
494 | 584 | ||
495 | 585 | ||
496 | 586 | @Callable(i) | |
497 | 587 | func calcGwxAmountStartREADONLY (wxLockAmount,lockDuration,maxLockDuration) = { | |
498 | 588 | let coeffX8 = fraction(lockDuration, MULT8, maxLockDuration) | |
499 | 589 | let gWxAmountStart = fraction(wxLockAmount, coeffX8, MULT8) | |
500 | 590 | $Tuple2(nil, [gWxAmountStart]) | |
501 | 591 | } | |
502 | 592 | ||
503 | 593 | ||
504 | 594 | ||
505 | 595 | @Callable(i) | |
506 | 596 | func onEmissionForGwxStart () = if ((i.caller != factoryContract)) | |
507 | 597 | then throw("permissions denied") | |
508 | 598 | else [IntegerEntry(keyGwxRewardEmissionStartHeight(), height)] | |
509 | 599 | ||
510 | 600 | ||
511 | 601 | ||
512 | 602 | @Callable(i) | |
513 | 603 | func latestPeriodEmissionRewardsREADONLY (address) = { | |
514 | 604 | let period = nextPeriod() | |
515 | 605 | $Tuple2(nil, [getNumberByKey(keyAuxEmissionRewardForPeriod(period))]) | |
516 | 606 | } | |
517 | 607 | ||
518 | 608 | ||
519 | 609 | ||
520 | 610 | @Callable(i) | |
521 | 611 | func calcD (x1BigIntStr,x2BigIntStr,ampBigIntStr,aPrecisionBigIntStr,targetPrecisionBigIntStr) = { | |
522 | 612 | let nCoins = toBigInt(2) | |
523 | 613 | let aPrecision = parseBigIntValue(aPrecisionBigIntStr) | |
524 | 614 | let targetPrecision = parseBigIntValue(targetPrecisionBigIntStr) | |
525 | 615 | let x1 = parseBigIntValue(x1BigIntStr) | |
526 | 616 | let x2 = parseBigIntValue(x2BigIntStr) | |
527 | 617 | let amp = (parseBigIntValue(ampBigIntStr) * aPrecision) | |
528 | 618 | let s = (x1 + x2) | |
529 | 619 | if ((s == zeroBigInt)) | |
530 | 620 | then $Tuple2(nil, toString(zeroBigInt)) | |
531 | 621 | else { | |
532 | 622 | let ann = (amp * nCoins) | |
533 | 623 | let arr = [0, 1, 2, 3, 4, 5, 6] | |
534 | 624 | func calc (acc,cur) = { | |
535 | - | let $ | |
536 | - | let d = $ | |
537 | - | let dPrev = $ | |
538 | - | let found = $ | |
625 | + | let $t02312123148 = acc | |
626 | + | let d = $t02312123148._1 | |
627 | + | let dPrev = $t02312123148._2 | |
628 | + | let found = $t02312123148._3 | |
539 | 629 | if ((found != unit)) | |
540 | 630 | then acc | |
541 | 631 | else { | |
542 | 632 | let dp = (((d * d) * d) / (((x1 * x2) * nCoins) * nCoins)) | |
543 | 633 | let dNext = (((((ann * s) / aPrecision) + (dp * nCoins)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((nCoins + toBigInt(1)) * dp))) | |
544 | 634 | let dDiff = absBigInt((dNext - value(d))) | |
545 | 635 | if ((targetPrecision >= dDiff)) | |
546 | 636 | then $Tuple3(dNext, d, cur) | |
547 | 637 | else $Tuple3(dNext, d, unit) | |
548 | 638 | } | |
549 | 639 | } | |
550 | 640 | ||
551 | - | let $ | |
641 | + | let $t02374623809 = { | |
552 | 642 | let $l = arr | |
553 | 643 | let $s = size($l) | |
554 | 644 | let $acc0 = $Tuple3(s, unit, unit) | |
555 | 645 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
556 | 646 | then $a | |
557 | 647 | else calc($a, $l[$i]) | |
558 | 648 | ||
559 | 649 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
560 | 650 | then $a | |
561 | 651 | else throw("List size exceeds 7") | |
562 | 652 | ||
563 | 653 | $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) | |
564 | 654 | } | |
565 | - | let dNext = $ | |
566 | - | let dPrev = $ | |
567 | - | let found = $ | |
655 | + | let dNext = $t02374623809._1 | |
656 | + | let dPrev = $t02374623809._2 | |
657 | + | let found = $t02374623809._3 | |
568 | 658 | if ((found != unit)) | |
569 | 659 | then $Tuple2(nil, toString(dNext)) | |
570 | 660 | else { | |
571 | 661 | let dDiff = absBigInt((dNext - value(dPrev))) | |
572 | 662 | throw(("D calculation error, dDiff = " + toString(dDiff))) | |
573 | 663 | } | |
574 | 664 | } | |
575 | 665 | } | |
576 | 666 | ||
577 | 667 | ||
578 | 668 | ||
579 | 669 | @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)) | |
583 | 684 | then { | |
584 | - | let | |
585 | - | if (( | |
586 | - | then | |
685 | + | let tradeRewardInternal = invoke(this, "tradeRewardInternal", [paymentAmount, userAddresses, rewards, 0], nil) | |
686 | + | if ((tradeRewardInternal == tradeRewardInternal)) | |
687 | + | then $Tuple2(nil, tradeRewardInternal) | |
587 | 688 | else throw("Strict value is not equal to itself.") | |
588 | 689 | } | |
589 | 690 | else throw("Strict value is not equal to itself.") | |
590 | 691 | } | |
591 | 692 | ||
592 | 693 | ||
593 | 694 | ||
594 | 695 | @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") | |
610 | 703 | } | |
704 | + | ||
705 | + | ||
706 | + | ||
707 | + | @Callable(i) | |
708 | + | func claimTradingRewardREADONLY (userAddress) = $Tuple2(nil, getTradingReward(userAddress)) | |
611 | 709 | ||
612 | 710 | ||
613 | 711 | @Verifier(tx) | |
614 | 712 | func verify () = { | |
615 | 713 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
616 | 714 | case pk: ByteVector => | |
617 | 715 | pk | |
618 | 716 | case _: Unit => | |
619 | 717 | tx.senderPublicKey | |
620 | 718 | case _ => | |
621 | 719 | throw("Match error") | |
622 | 720 | } | |
623 | 721 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
624 | 722 | } | |
625 | 723 |
github/deemru/w8io/fabc49c 92.62 ms ◑