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