tx · 9eVb3p4s8WX1DWApeLM47hFinqjrMK2nfYEqDVNKrjEf 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy: -0.02600000 Waves 2023.08.10 10:57 [2704219] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves
{ "type": 13, "id": "9eVb3p4s8WX1DWApeLM47hFinqjrMK2nfYEqDVNKrjEf", "fee": 2600000, "feeAssetId": null, "timestamp": 1691654271673, "version": 2, "chainId": 84, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "2xGB3yc9o88y4XEW6XrHeiP5JgMj1Jp8NeRHJ47KomTPLepqEsb5sM93vsZZBYmLXrH4XbwJAzz9F1XNYwr1UPPa" ], "script": "base64:BgL9LQgCEggKBggIAQEBCBIFCgMBCAISAwoBARIECgIICBIECgIICBIECgIIARIDCgEIEgMKAQgSBAoCCAESAwoBCBIAEgASBQoDCAgEEgMKAQgSAwoBCBIECgIICBIECgIICCIDU0VQIgZTQ0FMRTgiBU1VTFQ4Ig5QT09MV0VJR0hUTVVMVCIQY29udHJhY3RGaWxlbmFtZSIHU0NBTEUxOCIGTVVMVDE4IghNVUxUMThCSSILYmxvY2tzSW5EYXkiDWJsb2Nrc0luTW9udGgiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiD2dldFN0cmluZ09yRmFpbCIHYWRkcmVzcyIDa2V5IgxnZXRJbnRPclplcm8iD2dldEludE9yRGVmYXVsdCIKZGVmYXVsdFZhbCIMZ2V0SW50T3JGYWlsIgNhYnMiA3ZhbCIOZW5zdXJlUG9zaXRpdmUiAXYiAW0iG2tleVJlZmVycmFsc0NvbnRyYWN0QWRkcmVzcyIecmVmZXJyYWxzQ29udHJhY3RBZGRyZXNzT3JGYWlsIhZrZXlSZWZlcnJhbFByb2dyYW1OYW1lIhpyZWZlcnJhbF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FAmFKBQJhUQMJAAECBQJhSgIEVW5pdAgFAmVaD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJlWglib2R5Qnl0ZXMJAJEDAggFAmVaBnByb29mcwAABQJmYvDf4mQ=", "height": 2704219, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: zA6j6EDYvB3GAAWCpZvJFNXRXhhNnGpY6FZfzemuy8K Next: AfNWRVN7bymiUtmGAYa1qUApok2Y2dPo1hHZMmrE7T6U Diff:
Old | New | Differences | |
---|---|---|---|
158 | 158 | ||
159 | 159 | let IdxCfgMathContract = 5 | |
160 | 160 | ||
161 | + | let IdxCfgBlocksInPeriod = 6 | |
162 | + | ||
161 | 163 | func keyConfig () = "%s__config" | |
162 | 164 | ||
163 | 165 | ||
175 | 177 | let maxLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMaxLockDuration]), wrapErr("invalid max lock duration")) | |
176 | 178 | ||
177 | 179 | let mathContract = valueOrErrorMessage(addressFromString(cfgArray[IdxCfgMathContract]), wrapErr("invalid math contract address")) | |
180 | + | ||
181 | + | let blocksInPeriod = valueOrErrorMessage(parseInt(cfgArray[IdxCfgBlocksInPeriod]), wrapErr("invalid blocks in period")) | |
178 | 182 | ||
179 | 183 | func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d%s", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP) | |
180 | 184 | ||
430 | 434 | ||
431 | 435 | ||
432 | 436 | func getVotingEmissionEpochInfo () = { | |
433 | - | let $ | |
437 | + | let $t01516415454 = { | |
434 | 438 | let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi())) | |
435 | 439 | let lastFinalizedEpoch = (currentEpochUi - 1) | |
436 | 440 | if ((0 > lastFinalizedEpoch)) | |
437 | 441 | then throwErr("invalid epoch") | |
438 | 442 | else $Tuple2(currentEpochUi, lastFinalizedEpoch) | |
439 | 443 | } | |
440 | - | let currentEpochUi = $ | |
441 | - | let lastFinalizedEpoch = $ | |
444 | + | let currentEpochUi = $t01516415454._1 | |
445 | + | let lastFinalizedEpoch = $t01516415454._2 | |
442 | 446 | let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi))) | |
443 | 447 | $Tuple2(lastFinalizedEpoch, currentEpochStartHeight) | |
444 | 448 | } | |
471 | 475 | ||
472 | 476 | func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = { | |
473 | 477 | let userAddress = addressFromStringValue(userAddressStr) | |
474 | - | let $ | |
475 | - | let lastFinalizedEpoch = $ | |
476 | - | let currentEpochStartHeight = $ | |
477 | - | let $ | |
478 | - | let amountAssetId = $ | |
479 | - | let priceAssetId = $ | |
478 | + | let $t01614516225 = getVotingEmissionEpochInfo() | |
479 | + | let lastFinalizedEpoch = $t01614516225._1 | |
480 | + | let currentEpochStartHeight = $t01614516225._2 | |
481 | + | let $t01622816303 = getPoolAssetsByLpAssetId(lpAssetIdStr) | |
482 | + | let amountAssetId = $t01622816303._1 | |
483 | + | let priceAssetId = $t01622816303._2 | |
480 | 484 | let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch) | |
481 | 485 | let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0) | |
482 | 486 | userVote | |
493 | 497 | ||
494 | 498 | ||
495 | 499 | func getVotingResultStaked (lpAssetIdStr) = { | |
496 | - | let $ | |
497 | - | let lastFinalizedEpoch = $ | |
498 | - | let currentEpochStartHeight = $ | |
500 | + | let $t01684716927 = getVotingEmissionEpochInfo() | |
501 | + | let lastFinalizedEpoch = $t01684716927._1 | |
502 | + | let currentEpochStartHeight = $t01684716927._2 | |
499 | 503 | let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
500 | 504 | let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart) | |
501 | 505 | votingResultStaked | |
503 | 507 | ||
504 | 508 | ||
505 | 509 | func getVotingResultStakedIntegral (lpAssetIdStr) = { | |
506 | - | let $ | |
507 | - | let lastFinalizedEpoch = $ | |
508 | - | let currentEpochStartHeight = $ | |
510 | + | let $t01728917369 = getVotingEmissionEpochInfo() | |
511 | + | let lastFinalizedEpoch = $t01728917369._1 | |
512 | + | let currentEpochStartHeight = $t01728917369._2 | |
509 | 513 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
510 | 514 | let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
511 | 515 | let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight) | |
516 | 520 | ||
517 | 521 | ||
518 | 522 | func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = { | |
519 | - | let $ | |
520 | - | let lastFinalizedEpoch = $ | |
521 | - | let currentEpochStartHeight = $ | |
523 | + | let $t01820618286 = getVotingEmissionEpochInfo() | |
524 | + | let lastFinalizedEpoch = $t01820618286._1 | |
525 | + | let currentEpochStartHeight = $t01820618286._2 | |
522 | 526 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
523 | 527 | let votingResultStakedNew = (votingResultStaked + stakedVoteDelta) | |
524 | 528 | let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr) | |
527 | 531 | ||
528 | 532 | ||
529 | 533 | func getUserVoteStakedIntegral (lpAssetIdStr,userAddressStr) = { | |
530 | - | let $ | |
531 | - | let lastFinalizedEpoch = $ | |
532 | - | let currentEpochStartHeight = $ | |
534 | + | let $t01889718977 = getVotingEmissionEpochInfo() | |
535 | + | let lastFinalizedEpoch = $t01889718977._1 | |
536 | + | let currentEpochStartHeight = $t01889718977._2 | |
533 | 537 | let userAddress = addressFromStringValue(userAddressStr) | |
534 | 538 | let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr) | |
535 | 539 | let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0) | |
541 | 545 | ||
542 | 546 | ||
543 | 547 | func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = { | |
544 | - | let $ | |
545 | - | let lastFinalizedEpoch = $ | |
546 | - | let currentEpochStartHeight = $ | |
548 | + | let $t01976519845 = getVotingEmissionEpochInfo() | |
549 | + | let lastFinalizedEpoch = $t01976519845._1 | |
550 | + | let currentEpochStartHeight = $t01976519845._2 | |
547 | 551 | let userAddress = addressFromStringValue(userAddressStr) | |
548 | 552 | let userVoteFinalized = getUserVoteFinalized(lpAssetIdStr, userAddressStr) | |
549 | 553 | let actions = if ((userVoteFinalized == 0)) | |
562 | 566 | ||
563 | 567 | ||
564 | 568 | func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = { | |
565 | - | let $ | |
566 | - | let lastFinalizedEpoch = $ | |
567 | - | let currentEpochStartHeight = $ | |
569 | + | let $t02069920779 = getVotingEmissionEpochInfo() | |
570 | + | let lastFinalizedEpoch = $t02069920779._1 | |
571 | + | let currentEpochStartHeight = $t02069920779._2 | |
568 | 572 | let userAddress = addressFromStringValue(userAddressStr) | |
569 | 573 | let userVoteStakedIntegralLastKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
570 | 574 | let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralLastKey), 0) | |
623 | 627 | if ((0 > userBoostEmissionIntegral)) | |
624 | 628 | then throwErr("wrong calculations") | |
625 | 629 | else { | |
626 | - | let $ | |
627 | - | let stakedVotesIntegralsActions = $ | |
628 | - | let userVoteIntegralDiff = $ | |
629 | - | let totalVotesIntegralDiff = $ | |
630 | + | let $t02432124460 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr) | |
631 | + | let stakedVotesIntegralsActions = $t02432124460._1 | |
632 | + | let userVoteIntegralDiff = $t02432124460._2 | |
633 | + | let totalVotesIntegralDiff = $t02432124460._3 | |
630 | 634 | let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT) | |
631 | 635 | let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0)) | |
632 | 636 | then 0 | |
705 | 709 | let lockEnd = (lockStart + lockDuration) | |
706 | 710 | let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed]) | |
707 | 711 | let gwxAmount = parseIntValue(userRecordArray[IdxLockGwxAmount]) | |
708 | - | let t = ((height - lockStart) / | |
709 | - | let exponent = fraction(toBigInt(t), (toBigInt((8 * | |
712 | + | let t = ((height - lockStart) / blocksInPeriod) | |
713 | + | let exponent = fraction(toBigInt(t), (toBigInt((8 * blocksInPeriod)) * MULT18BI), toBigInt(lockDuration)) | |
710 | 714 | let wxWithdrawable = if ((height > lockEnd)) | |
711 | 715 | then (userAmount - wxClaimed) | |
712 | 716 | else toInt(fraction(toBigInt(userAmount), (MULT18BI - pow(toBigInt(5), 1, exponent, SCALE18, SCALE18, DOWN)), MULT18BI)) | |
726 | 730 | ||
727 | 731 | @Callable(i) | |
728 | 732 | func lockRef (duration,referrerAddress,signature) = { | |
729 | - | let $ | |
730 | - | let lockActionsResult = $ | |
731 | - | let gWxAmountStart = $ | |
733 | + | let $t02942729492 = lockActions(i, duration) | |
734 | + | let lockActionsResult = $t02942729492._1 | |
735 | + | let gWxAmountStart = $t02942729492._2 | |
732 | 736 | let referralAddress = toString(i.caller) | |
733 | 737 | let refInv = if (if ((referrerAddress == "")) | |
734 | 738 | then true | |
749 | 753 | ||
750 | 754 | @Callable(i) | |
751 | 755 | func lock (duration) = { | |
752 | - | let $ | |
753 | - | let lockActionsResult = $ | |
754 | - | let gWxAmountStart = $ | |
756 | + | let $t02995030015 = lockActions(i, duration) | |
757 | + | let lockActionsResult = $t02995030015._1 | |
758 | + | let gWxAmountStart = $t02995030015._2 | |
755 | 759 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
756 | 760 | if ((updateRefActivity == updateRefActivity)) | |
757 | 761 | then $Tuple2(lockActionsResult, unit) | |
764 | 768 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
765 | 769 | then throwErr("permissions denied") | |
766 | 770 | else { | |
767 | - | let $ | |
768 | - | let userBoostAvailable = $ | |
769 | - | let dataState = $ | |
770 | - | let debug = $ | |
771 | + | let $t03032530427 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
772 | + | let userBoostAvailable = $t03032530427._1 | |
773 | + | let dataState = $t03032530427._2 | |
774 | + | let debug = $t03032530427._3 | |
771 | 775 | $Tuple2(dataState, [userBoostAvailable]) | |
772 | 776 | } | |
773 | 777 | ||
775 | 779 | ||
776 | 780 | @Callable(i) | |
777 | 781 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
778 | - | let $ | |
779 | - | let userBoostAvailable = $ | |
780 | - | let dataState = $ | |
781 | - | let debug = $ | |
782 | + | let $t03055930660 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
783 | + | let userBoostAvailable = $t03055930660._1 | |
784 | + | let dataState = $t03055930660._2 | |
785 | + | let debug = $t03055930660._3 | |
782 | 786 | $Tuple2(nil, [userBoostAvailable, debug]) | |
783 | 787 | } | |
784 | 788 | ||
798 | 802 | let lockEnd = (lockStart + lockDuration) | |
799 | 803 | let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed]) | |
800 | 804 | let gwxAmount = parseIntValue(userRecordArray[IdxLockGwxAmount]) | |
801 | - | let t = ((height - lockStart) / | |
805 | + | let t = ((height - lockStart) / blocksInPeriod) | |
802 | 806 | let wxWithdrawable = getWxWithdrawable(userAddress, if ((txIdStr == "")) | |
803 | 807 | then unit | |
804 | 808 | else txId) | |
805 | 809 | if ((amount > wxWithdrawable)) | |
806 | 810 | then throwErr(("maximum amount to unlock: " + toString(wxWithdrawable))) | |
807 | 811 | else { | |
808 | - | let gwxBurned = max([amount, fraction((t * | |
812 | + | let gwxBurned = max([amount, fraction((t * blocksInPeriod), userAmount, maxLockDuration)]) | |
809 | 813 | let gwxRemaining = ensurePositive((gwxAmount - gwxBurned), "gwxRemaining") | |
810 | 814 | let lockedGwxAmount = getLockedGwxAmount(userAddress) | |
811 | 815 | if ((lockedGwxAmount > gwxRemaining)) |
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 SCALE8 = 8 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let POOLWEIGHTMULT = MULT8 | |
11 | 11 | ||
12 | 12 | let contractFilename = "boosting.ride" | |
13 | 13 | ||
14 | 14 | let SCALE18 = 18 | |
15 | 15 | ||
16 | 16 | let MULT18 = 1000000000000000000 | |
17 | 17 | ||
18 | 18 | let MULT18BI = toBigInt(MULT18) | |
19 | 19 | ||
20 | 20 | let blocksInDay = 1440 | |
21 | 21 | ||
22 | 22 | let blocksInMonth = 43800 | |
23 | 23 | ||
24 | 24 | func wrapErr (msg) = makeString([contractFilename, ": ", msg], "") | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func throwErr (msg) = throw(wrapErr(msg)) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func getIntOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getIntOrDefault (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func abs (val) = if ((0 > val)) | |
43 | 43 | then -(val) | |
44 | 44 | else val | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func ensurePositive (v,m) = if ((v >= 0)) | |
48 | 48 | then v | |
49 | 49 | else throwErr((valueOrElse(m, "value") + " should be positive")) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | let referralsContractAddressOrFail = addressFromStringValue(getStringOrFail(this, keyReferralsContractAddress())) | |
56 | 56 | ||
57 | 57 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
58 | 58 | ||
59 | 59 | let referralProgramNameDefault = "wxlock" | |
60 | 60 | ||
61 | 61 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
62 | 62 | ||
63 | 63 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | let IdxFactoryCfgStakingDapp = 1 | |
67 | 67 | ||
68 | 68 | let IdxFactoryCfgBoostingDapp = 2 | |
69 | 69 | ||
70 | 70 | let IdxFactoryCfgIdoDapp = 3 | |
71 | 71 | ||
72 | 72 | let IdxFactoryCfgTeamDapp = 4 | |
73 | 73 | ||
74 | 74 | let IdxFactoryCfgEmissionDapp = 5 | |
75 | 75 | ||
76 | 76 | let IdxFactoryCfgRestDapp = 6 | |
77 | 77 | ||
78 | 78 | let IdxFactoryCfgSlippageDapp = 7 | |
79 | 79 | ||
80 | 80 | let IdxFactoryCfgDaoDapp = 8 | |
81 | 81 | ||
82 | 82 | let IdxFactoryCfgMarketingDapp = 9 | |
83 | 83 | ||
84 | 84 | let IdxFactoryCfgGwxRewardDapp = 10 | |
85 | 85 | ||
86 | 86 | let IdxFactoryCfgBirdsDapp = 11 | |
87 | 87 | ||
88 | 88 | func keyFactoryCfg () = "%s__factoryConfig" | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func keyFactoryPoolWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func keyEmissionRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func keyEmissionRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func keyBoostingV2LastUpdateHeight () = "%s%s__boostingV2__startBlock" | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func keyBoostingV2Integral () = "%s%s__boostingV2__integral" | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func keyNextPergetIntOrDefault () = "%s__nextPeriod" | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight" | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | let IdxCfgAssetId = 1 | |
152 | 152 | ||
153 | 153 | let IdxCfgMinLockAmount = 2 | |
154 | 154 | ||
155 | 155 | let IdxCfgMinLockDuration = 3 | |
156 | 156 | ||
157 | 157 | let IdxCfgMaxLockDuration = 4 | |
158 | 158 | ||
159 | 159 | let IdxCfgMathContract = 5 | |
160 | 160 | ||
161 | + | let IdxCfgBlocksInPeriod = 6 | |
162 | + | ||
161 | 163 | func keyConfig () = "%s__config" | |
162 | 164 | ||
163 | 165 | ||
164 | 166 | func readConfigArrayOrFail () = split(getStringOrFail(this, keyConfig()), SEP) | |
165 | 167 | ||
166 | 168 | ||
167 | 169 | let cfgArray = readConfigArrayOrFail() | |
168 | 170 | ||
169 | 171 | let assetId = fromBase58String(cfgArray[IdxCfgAssetId]) | |
170 | 172 | ||
171 | 173 | let minLockAmount = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMinLockAmount]), wrapErr("invalid min lock amount")) | |
172 | 174 | ||
173 | 175 | let minLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMinLockDuration]), wrapErr("invalid min lock duration")) | |
174 | 176 | ||
175 | 177 | let maxLockDuration = valueOrErrorMessage(parseInt(cfgArray[IdxCfgMaxLockDuration]), wrapErr("invalid max lock duration")) | |
176 | 178 | ||
177 | 179 | let mathContract = valueOrErrorMessage(addressFromString(cfgArray[IdxCfgMathContract]), wrapErr("invalid math contract address")) | |
180 | + | ||
181 | + | let blocksInPeriod = valueOrErrorMessage(parseInt(cfgArray[IdxCfgBlocksInPeriod]), wrapErr("invalid blocks in period")) | |
178 | 182 | ||
179 | 183 | func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d%s", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP) | |
180 | 184 | ||
181 | 185 | ||
182 | 186 | func formatConfig (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = formatConfigS(assetId, toString(minLockAmount), toString(minLockDuration), toString(maxLockDuration), mathContract) | |
183 | 187 | ||
184 | 188 | ||
185 | 189 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
186 | 190 | case s: String => | |
187 | 191 | addressFromStringValue(s) | |
188 | 192 | case _ => | |
189 | 193 | this | |
190 | 194 | } | |
191 | 195 | ||
192 | 196 | ||
193 | 197 | func managerPublicKeyOrUnit () = { | |
194 | 198 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
195 | 199 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
196 | 200 | case s: String => | |
197 | 201 | fromBase58String(s) | |
198 | 202 | case _: Unit => | |
199 | 203 | unit | |
200 | 204 | case _ => | |
201 | 205 | throw("Match error") | |
202 | 206 | } | |
203 | 207 | } | |
204 | 208 | ||
205 | 209 | ||
206 | 210 | func mustManager (i) = { | |
207 | 211 | let pd = throwErr("Permission denied") | |
208 | 212 | match managerPublicKeyOrUnit() { | |
209 | 213 | case pk: ByteVector => | |
210 | 214 | if ((i.callerPublicKey == pk)) | |
211 | 215 | then true | |
212 | 216 | else pd | |
213 | 217 | case _: Unit => | |
214 | 218 | if ((i.caller == this)) | |
215 | 219 | then true | |
216 | 220 | else pd | |
217 | 221 | case _ => | |
218 | 222 | throw("Match error") | |
219 | 223 | } | |
220 | 224 | } | |
221 | 225 | ||
222 | 226 | ||
223 | 227 | let IdxLockAmount = 1 | |
224 | 228 | ||
225 | 229 | let IdxLockStart = 2 | |
226 | 230 | ||
227 | 231 | let IdxLockDuration = 3 | |
228 | 232 | ||
229 | 233 | let IdxLockLastUpdateTimestamp = 4 | |
230 | 234 | ||
231 | 235 | let IdxLockGwxAmount = 5 | |
232 | 236 | ||
233 | 237 | let IdxLockWxClaimed = 6 | |
234 | 238 | ||
235 | 239 | func keyLockParamsRecord (userAddress,txId) = makeString(["%s%s%s__lock", toString(userAddress), match txId { | |
236 | 240 | case b: ByteVector => | |
237 | 241 | toBase58String(b) | |
238 | 242 | case _: Unit => | |
239 | 243 | "legacy" | |
240 | 244 | case _ => | |
241 | 245 | throw("Match error") | |
242 | 246 | }], SEP) | |
243 | 247 | ||
244 | 248 | ||
245 | 249 | func readLockParamsRecordOrFail (userAddress,txId) = split(getStringOrFail(this, keyLockParamsRecord(userAddress, txId)), SEP) | |
246 | 250 | ||
247 | 251 | ||
248 | 252 | func keyUserGwxAmountTotal (userAddress) = makeString(["%s%s__gwxAmountTotal", toString(userAddress)], SEP) | |
249 | 253 | ||
250 | 254 | ||
251 | 255 | func formatLockParamsRecord (amount,start,duration,gwxAmount,wxClaimed) = makeString(["%d%d%d%d%d%d%d", toString(amount), toString(start), toString(duration), toString(lastBlock.timestamp), toString(gwxAmount), toString(wxClaimed)], SEP) | |
252 | 256 | ||
253 | 257 | ||
254 | 258 | func keyNextUserNum () = "%s__nextUserNum" | |
255 | 259 | ||
256 | 260 | ||
257 | 261 | func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP) | |
258 | 262 | ||
259 | 263 | ||
260 | 264 | func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP) | |
261 | 265 | ||
262 | 266 | ||
263 | 267 | func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked" | |
264 | 268 | ||
265 | 269 | ||
266 | 270 | func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks" | |
267 | 271 | ||
268 | 272 | ||
269 | 273 | func keyStatsLocksCount () = "%s%s__stats__locksCount" | |
270 | 274 | ||
271 | 275 | ||
272 | 276 | func keyStatsUsersCount () = "%s%s__stats__activeUsersCount" | |
273 | 277 | ||
274 | 278 | ||
275 | 279 | func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastIntV2", toString(userNum)], SEP) | |
276 | 280 | ||
277 | 281 | ||
278 | 282 | func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastIntV2", toString(userNum), lpAssetId], SEP) | |
279 | 283 | ||
280 | 284 | ||
281 | 285 | func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", toString(userNum)], SEP) | |
282 | 286 | ||
283 | 287 | ||
284 | 288 | func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total" | |
285 | 289 | ||
286 | 290 | ||
287 | 291 | func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", toString(userNum)], SEP) | |
288 | 292 | ||
289 | 293 | ||
290 | 294 | func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", toString(userNum)], SEP) | |
291 | 295 | ||
292 | 296 | ||
293 | 297 | func keyGwxTotal () = "%s%s__gwx__total" | |
294 | 298 | ||
295 | 299 | ||
296 | 300 | func keyVote (amountAssetId,priceAssetId,address,epoch) = makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], SEP) | |
297 | 301 | ||
298 | 302 | ||
299 | 303 | func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], SEP) | |
300 | 304 | ||
301 | 305 | ||
302 | 306 | func keyCurrentEpochUi () = makeString(["%s", "currentEpochUi"], SEP) | |
303 | 307 | ||
304 | 308 | ||
305 | 309 | func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], SEP) | |
306 | 310 | ||
307 | 311 | ||
308 | 312 | func keyVotingResultStakedIntegral (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegral", lpAssetIdStr, toString(epoch)], SEP) | |
309 | 313 | ||
310 | 314 | ||
311 | 315 | func keyVotingResultStakedLastUpdateHeight (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(epoch)], SEP) | |
312 | 316 | ||
313 | 317 | ||
314 | 318 | func keyVotingResultStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "votingResultStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
315 | 319 | ||
316 | 320 | ||
317 | 321 | func keyVoteStakedIntegral (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegral", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
318 | 322 | ||
319 | 323 | ||
320 | 324 | func keyVoteStakedLastUpdateHeight (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLastUpdateHeight", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
321 | 325 | ||
322 | 326 | ||
323 | 327 | func keyVoteStakedIntegralLast (lpAssetIdStr,address,epoch) = makeString(["%s%s%s%d", "voteStakedIntegralLast", lpAssetIdStr, toString(address), toString(epoch)], SEP) | |
324 | 328 | ||
325 | 329 | ||
326 | 330 | func keyStakedByUser (userAddressStr,lpAssetIdStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], SEP) | |
327 | 331 | ||
328 | 332 | ||
329 | 333 | let factoryContract = readFactoryAddressOrFail() | |
330 | 334 | ||
331 | 335 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
332 | 336 | ||
333 | 337 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
334 | 338 | ||
335 | 339 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
336 | 340 | ||
337 | 341 | let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg) | |
338 | 342 | ||
339 | 343 | let lpStakingPoolsContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(makeString(["%s", "lpStakingPoolsContract"], SEP)), wrapErr("lp_staking_pools contract address is undefined"))), wrapErr("invalid lp_staking_pools contract address")) | |
340 | 344 | ||
341 | 345 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
342 | 346 | ||
343 | 347 | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
344 | 348 | ||
345 | 349 | let keyVotingEmissionRateContract = makeString(["%s", "votingEmissionRateContract"], SEP) | |
346 | 350 | ||
347 | 351 | let boostCoeff = { | |
348 | 352 | let @ = invoke(emissionContract, "getBoostCoeffREADONLY", nil, nil) | |
349 | 353 | if ($isInstanceOf(@, "Int")) | |
350 | 354 | then @ | |
351 | 355 | else throw(($getType(@) + " couldn't be cast to Int")) | |
352 | 356 | } | |
353 | 357 | ||
354 | 358 | func userNumberByAddressOrFail (userAddress) = match getString(this, keyUser2NumMapping(toString(userAddress))) { | |
355 | 359 | case s: String => | |
356 | 360 | valueOrErrorMessage(parseInt(s), wrapErr("invalid user number")) | |
357 | 361 | case _: Unit => | |
358 | 362 | throwErr("invalid user") | |
359 | 363 | case _ => | |
360 | 364 | throw("Match error") | |
361 | 365 | } | |
362 | 366 | ||
363 | 367 | ||
364 | 368 | func getGwxAmountTotal () = valueOrElse(getInteger(this, keyGwxTotal()), 0) | |
365 | 369 | ||
366 | 370 | ||
367 | 371 | func getLockedGwxAmount (userAddress) = { | |
368 | 372 | let functionName = "getLockedGwxAmount" | |
369 | 373 | let votingEmissionRateContract = valueOrErrorMessage( match getString(votingEmissionContract, keyVotingEmissionRateContract) { | |
370 | 374 | case _: Unit => | |
371 | 375 | unit | |
372 | 376 | case s: String => | |
373 | 377 | addressFromString(s) | |
374 | 378 | case _ => | |
375 | 379 | throw("Match error") | |
376 | 380 | }, wrapErr("invalid voting emission rate address")) | |
377 | 381 | let lockedVotingEmissionRate = { | |
378 | 382 | let @ = invoke(votingEmissionContract, functionName, [toString(userAddress)], nil) | |
379 | 383 | if ($isInstanceOf(@, "Int")) | |
380 | 384 | then @ | |
381 | 385 | else throw(($getType(@) + " couldn't be cast to Int")) | |
382 | 386 | } | |
383 | 387 | let lockedVotingEmission = { | |
384 | 388 | let @ = invoke(votingEmissionRateContract, functionName, [toString(userAddress)], nil) | |
385 | 389 | if ($isInstanceOf(@, "Int")) | |
386 | 390 | then @ | |
387 | 391 | else throw(($getType(@) + " couldn't be cast to Int")) | |
388 | 392 | } | |
389 | 393 | let locked = max([lockedVotingEmissionRate, lockedVotingEmission]) | |
390 | 394 | locked | |
391 | 395 | } | |
392 | 396 | ||
393 | 397 | ||
394 | 398 | func HistoryEntry (type,user,amount,lockStart,duration,gwxAmount,i) = { | |
395 | 399 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
396 | 400 | let historyDATA = makeString(["%d%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(lockStart), toString(duration), toString(gwxAmount)], SEP) | |
397 | 401 | StringEntry(historyKEY, historyDATA) | |
398 | 402 | } | |
399 | 403 | ||
400 | 404 | ||
401 | 405 | func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = { | |
402 | 406 | let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks() | |
403 | 407 | let locksCountKEY = keyStatsLocksCount() | |
404 | 408 | let usersCountKEY = keyStatsUsersCount() | |
405 | 409 | let totalAmountKEY = keyLockParamTotalAmount() | |
406 | 410 | let locksDurationSumInBlocks = getIntOrZero(this, locksDurationSumInBlocksKEY) | |
407 | 411 | let locksCount = getIntOrZero(this, locksCountKEY) | |
408 | 412 | let usersCount = getIntOrZero(this, usersCountKEY) | |
409 | 413 | let totalAmount = getIntOrZero(this, totalAmountKEY) | |
410 | 414 | [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))] | |
411 | 415 | } | |
412 | 416 | ||
413 | 417 | ||
414 | 418 | func LockParamsEntry (userAddress,txId,amount,start,duration,gwxAmount,wxClaimed) = [StringEntry(keyLockParamsRecord(userAddress, txId), formatLockParamsRecord(amount, start, duration, gwxAmount, wxClaimed))] | |
415 | 419 | ||
416 | 420 | ||
417 | 421 | func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1)) | |
418 | 422 | then throwErr("only one payment is allowed") | |
419 | 423 | else if ((size(i.payments) == 0)) | |
420 | 424 | then 0 | |
421 | 425 | else { | |
422 | 426 | let pmt = i.payments[0] | |
423 | 427 | if ((value(pmt.assetId) != expectedAssetId)) | |
424 | 428 | then throwErr("invalid asset id in payment") | |
425 | 429 | else pmt.amount | |
426 | 430 | } | |
427 | 431 | ||
428 | 432 | ||
429 | 433 | func getUserGwxAmountTotal (userAddress) = valueOrElse(getInteger(this, keyUserGwxAmountTotal(userAddress)), 0) | |
430 | 434 | ||
431 | 435 | ||
432 | 436 | func getVotingEmissionEpochInfo () = { | |
433 | - | let $ | |
437 | + | let $t01516415454 = { | |
434 | 438 | let currentEpochUi = value(getInteger(votingEmissionContract, keyCurrentEpochUi())) | |
435 | 439 | let lastFinalizedEpoch = (currentEpochUi - 1) | |
436 | 440 | if ((0 > lastFinalizedEpoch)) | |
437 | 441 | then throwErr("invalid epoch") | |
438 | 442 | else $Tuple2(currentEpochUi, lastFinalizedEpoch) | |
439 | 443 | } | |
440 | - | let currentEpochUi = $ | |
441 | - | let lastFinalizedEpoch = $ | |
444 | + | let currentEpochUi = $t01516415454._1 | |
445 | + | let lastFinalizedEpoch = $t01516415454._2 | |
442 | 446 | let currentEpochStartHeight = value(getInteger(votingEmissionContract, keyStartHeightByEpoch(currentEpochUi))) | |
443 | 447 | $Tuple2(lastFinalizedEpoch, currentEpochStartHeight) | |
444 | 448 | } | |
445 | 449 | ||
446 | 450 | ||
447 | 451 | func getPoolAssetsByLpAssetId (lpAssetIdStr) = { | |
448 | 452 | let idxAmountAssetId = 4 | |
449 | 453 | let idxPriceAssetId = 5 | |
450 | 454 | let poolCfg = { | |
451 | 455 | let @ = invoke(factoryContract, "getPoolConfigByLpAssetIdREADONLY", [lpAssetIdStr], nil) | |
452 | 456 | if ($isInstanceOf(@, "List[Any]")) | |
453 | 457 | then @ | |
454 | 458 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
455 | 459 | } | |
456 | 460 | let amountAssetId = { | |
457 | 461 | let @ = poolCfg[idxAmountAssetId] | |
458 | 462 | if ($isInstanceOf(@, "String")) | |
459 | 463 | then @ | |
460 | 464 | else throw(($getType(@) + " couldn't be cast to String")) | |
461 | 465 | } | |
462 | 466 | let priceAssetId = { | |
463 | 467 | let @ = poolCfg[idxPriceAssetId] | |
464 | 468 | if ($isInstanceOf(@, "String")) | |
465 | 469 | then @ | |
466 | 470 | else throw(($getType(@) + " couldn't be cast to String")) | |
467 | 471 | } | |
468 | 472 | $Tuple2(amountAssetId, priceAssetId) | |
469 | 473 | } | |
470 | 474 | ||
471 | 475 | ||
472 | 476 | func getUserVoteFinalized (lpAssetIdStr,userAddressStr) = { | |
473 | 477 | let userAddress = addressFromStringValue(userAddressStr) | |
474 | - | let $ | |
475 | - | let lastFinalizedEpoch = $ | |
476 | - | let currentEpochStartHeight = $ | |
477 | - | let $ | |
478 | - | let amountAssetId = $ | |
479 | - | let priceAssetId = $ | |
478 | + | let $t01614516225 = getVotingEmissionEpochInfo() | |
479 | + | let lastFinalizedEpoch = $t01614516225._1 | |
480 | + | let currentEpochStartHeight = $t01614516225._2 | |
481 | + | let $t01622816303 = getPoolAssetsByLpAssetId(lpAssetIdStr) | |
482 | + | let amountAssetId = $t01622816303._1 | |
483 | + | let priceAssetId = $t01622816303._2 | |
480 | 484 | let userVoteKey = keyVote(amountAssetId, priceAssetId, userAddress, lastFinalizedEpoch) | |
481 | 485 | let userVote = valueOrElse(getInteger(votingEmissionContract, userVoteKey), 0) | |
482 | 486 | userVote | |
483 | 487 | } | |
484 | 488 | ||
485 | 489 | ||
486 | 490 | func getUserVoteStaked (lpAssetIdStr,userAddressStr) = { | |
487 | 491 | let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(userAddressStr, lpAssetIdStr)), 0) | |
488 | 492 | let userVote = getUserVoteFinalized(lpAssetIdStr, userAddressStr) | |
489 | 493 | if ((stakedByUser == 0)) | |
490 | 494 | then 0 | |
491 | 495 | else userVote | |
492 | 496 | } | |
493 | 497 | ||
494 | 498 | ||
495 | 499 | func getVotingResultStaked (lpAssetIdStr) = { | |
496 | - | let $ | |
497 | - | let lastFinalizedEpoch = $ | |
498 | - | let currentEpochStartHeight = $ | |
500 | + | let $t01684716927 = getVotingEmissionEpochInfo() | |
501 | + | let lastFinalizedEpoch = $t01684716927._1 | |
502 | + | let currentEpochStartHeight = $t01684716927._2 | |
499 | 503 | let votingResultStakedStart = valueOrElse(getInteger(votingEmissionContract, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
500 | 504 | let votingResultStaked = valueOrElse(getInteger(this, keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch)), votingResultStakedStart) | |
501 | 505 | votingResultStaked | |
502 | 506 | } | |
503 | 507 | ||
504 | 508 | ||
505 | 509 | func getVotingResultStakedIntegral (lpAssetIdStr) = { | |
506 | - | let $ | |
507 | - | let lastFinalizedEpoch = $ | |
508 | - | let currentEpochStartHeight = $ | |
510 | + | let $t01728917369 = getVotingEmissionEpochInfo() | |
511 | + | let lastFinalizedEpoch = $t01728917369._1 | |
512 | + | let currentEpochStartHeight = $t01728917369._2 | |
509 | 513 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
510 | 514 | let votingResultStakedIntegralPrev = valueOrElse(getInteger(this, keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch)), 0) | |
511 | 515 | let votingResultStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch)), currentEpochStartHeight) | |
512 | 516 | let votingResultStakedIntegralDh = (height - votingResultStakedLastUpdateHeight) | |
513 | 517 | let votingResultStakedIntegral = ((votingResultStakedIntegralDh * votingResultStaked) + votingResultStakedIntegralPrev) | |
514 | 518 | votingResultStakedIntegral | |
515 | 519 | } | |
516 | 520 | ||
517 | 521 | ||
518 | 522 | func refreshVotingResultStakedIntegral (lpAssetIdStr,stakedVoteDelta) = { | |
519 | - | let $ | |
520 | - | let lastFinalizedEpoch = $ | |
521 | - | let currentEpochStartHeight = $ | |
523 | + | let $t01820618286 = getVotingEmissionEpochInfo() | |
524 | + | let lastFinalizedEpoch = $t01820618286._1 | |
525 | + | let currentEpochStartHeight = $t01820618286._2 | |
522 | 526 | let votingResultStaked = getVotingResultStaked(lpAssetIdStr) | |
523 | 527 | let votingResultStakedNew = (votingResultStaked + stakedVoteDelta) | |
524 | 528 | let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr) | |
525 | 529 | [IntegerEntry(keyVotingResultStaked(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedNew), IntegerEntry(keyVotingResultStakedLastUpdateHeight(lpAssetIdStr, lastFinalizedEpoch), height), IntegerEntry(keyVotingResultStakedIntegral(lpAssetIdStr, lastFinalizedEpoch), votingResultStakedIntegral)] | |
526 | 530 | } | |
527 | 531 | ||
528 | 532 | ||
529 | 533 | func getUserVoteStakedIntegral (lpAssetIdStr,userAddressStr) = { | |
530 | - | let $ | |
531 | - | let lastFinalizedEpoch = $ | |
532 | - | let currentEpochStartHeight = $ | |
534 | + | let $t01889718977 = getVotingEmissionEpochInfo() | |
535 | + | let lastFinalizedEpoch = $t01889718977._1 | |
536 | + | let currentEpochStartHeight = $t01889718977._2 | |
533 | 537 | let userAddress = addressFromStringValue(userAddressStr) | |
534 | 538 | let userVoteStaked = getUserVoteStaked(lpAssetIdStr, userAddressStr) | |
535 | 539 | let userVoteStakedIntegralPrev = valueOrElse(getInteger(this, keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch)), 0) | |
536 | 540 | let userVoteStakedLastUpdateHeight = valueOrElse(getInteger(this, keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch)), currentEpochStartHeight) | |
537 | 541 | let userVoteStakedIntegralDh = (height - userVoteStakedLastUpdateHeight) | |
538 | 542 | let userVoteStakedIntegral = ((userVoteStakedIntegralDh * userVoteStaked) + userVoteStakedIntegralPrev) | |
539 | 543 | userVoteStakedIntegral | |
540 | 544 | } | |
541 | 545 | ||
542 | 546 | ||
543 | 547 | func refreshVoteStakedIntegral (lpAssetIdStr,userAddressStr,edge) = { | |
544 | - | let $ | |
545 | - | let lastFinalizedEpoch = $ | |
546 | - | let currentEpochStartHeight = $ | |
548 | + | let $t01976519845 = getVotingEmissionEpochInfo() | |
549 | + | let lastFinalizedEpoch = $t01976519845._1 | |
550 | + | let currentEpochStartHeight = $t01976519845._2 | |
547 | 551 | let userAddress = addressFromStringValue(userAddressStr) | |
548 | 552 | let userVoteFinalized = getUserVoteFinalized(lpAssetIdStr, userAddressStr) | |
549 | 553 | let actions = if ((userVoteFinalized == 0)) | |
550 | 554 | then nil | |
551 | 555 | else { | |
552 | 556 | let stakedVoteDelta = if (edge) | |
553 | 557 | then userVoteFinalized | |
554 | 558 | else -(userVoteFinalized) | |
555 | 559 | let votingResultActions = refreshVotingResultStakedIntegral(lpAssetIdStr, stakedVoteDelta) | |
556 | 560 | let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr) | |
557 | 561 | let voteActions = [IntegerEntry(keyVoteStakedLastUpdateHeight(lpAssetIdStr, userAddress, lastFinalizedEpoch), height), IntegerEntry(keyVoteStakedIntegral(lpAssetIdStr, userAddress, lastFinalizedEpoch), userVoteStakedIntegral)] | |
558 | 562 | (votingResultActions ++ voteActions) | |
559 | 563 | } | |
560 | 564 | actions | |
561 | 565 | } | |
562 | 566 | ||
563 | 567 | ||
564 | 568 | func getStakedVotesIntegralsDiff (lpAssetIdStr,userAddressStr) = { | |
565 | - | let $ | |
566 | - | let lastFinalizedEpoch = $ | |
567 | - | let currentEpochStartHeight = $ | |
569 | + | let $t02069920779 = getVotingEmissionEpochInfo() | |
570 | + | let lastFinalizedEpoch = $t02069920779._1 | |
571 | + | let currentEpochStartHeight = $t02069920779._2 | |
568 | 572 | let userAddress = addressFromStringValue(userAddressStr) | |
569 | 573 | let userVoteStakedIntegralLastKey = keyVoteStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
570 | 574 | let userVoteStakedIntegralLast = valueOrElse(getInteger(this, userVoteStakedIntegralLastKey), 0) | |
571 | 575 | let votingResultStakedIntegralLastKey = keyVotingResultStakedIntegralLast(lpAssetIdStr, userAddress, lastFinalizedEpoch) | |
572 | 576 | let votingResultStakedIntegralLast = valueOrElse(getInteger(this, votingResultStakedIntegralLastKey), 0) | |
573 | 577 | let userVoteStakedIntegral = getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr) | |
574 | 578 | let votingResultStakedIntegral = getVotingResultStakedIntegral(lpAssetIdStr) | |
575 | 579 | let userVoteStakedIntegralDiff = (userVoteStakedIntegral - userVoteStakedIntegralLast) | |
576 | 580 | let votingResultStakedIntegralDiff = (votingResultStakedIntegral - votingResultStakedIntegralLast) | |
577 | 581 | $Tuple3([IntegerEntry(userVoteStakedIntegralLastKey, userVoteStakedIntegral), IntegerEntry(votingResultStakedIntegralLastKey, votingResultStakedIntegral)], userVoteStakedIntegralDiff, votingResultStakedIntegralDiff) | |
578 | 582 | } | |
579 | 583 | ||
580 | 584 | ||
581 | 585 | func refreshBoostEmissionIntegral () = { | |
582 | 586 | let wxEmissionPerBlock = getIntOrFail(emissionContract, keyEmissionRatePerBlockCurrent()) | |
583 | 587 | let boostingV2LastUpdateHeightOption = getInteger(this, keyBoostingV2LastUpdateHeight()) | |
584 | 588 | let boostingV2IngergalOption = getInteger(this, keyBoostingV2Integral()) | |
585 | 589 | let emissionEnd = getIntOrFail(emissionContract, keyEmissionEndBlock()) | |
586 | 590 | let h = if ((height > emissionEnd)) | |
587 | 591 | then emissionEnd | |
588 | 592 | else height | |
589 | 593 | let dh = match boostingV2LastUpdateHeightOption { | |
590 | 594 | case lastUpdateHeight: Int => | |
591 | 595 | max([(h - lastUpdateHeight), 0]) | |
592 | 596 | case _: Unit => | |
593 | 597 | 0 | |
594 | 598 | case _ => | |
595 | 599 | throw("Match error") | |
596 | 600 | } | |
597 | 601 | let boostEmissionPerBlock = ((wxEmissionPerBlock * (boostCoeff - 1)) / boostCoeff) | |
598 | 602 | let boostEmissionIntegralPrev = valueOrElse(boostingV2IngergalOption, 0) | |
599 | 603 | let boostEmissionIntegral = ((boostEmissionPerBlock * dh) + boostEmissionIntegralPrev) | |
600 | 604 | $Tuple2([IntegerEntry(keyBoostingV2Integral(), boostEmissionIntegral), IntegerEntry(keyBoostingV2LastUpdateHeight(), height)], boostEmissionIntegral) | |
601 | 605 | } | |
602 | 606 | ||
603 | 607 | ||
604 | 608 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
605 | 609 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
606 | 610 | let userNum = userNumberByAddressOrFail(userAddress) | |
607 | 611 | if ((userNum == userNum)) | |
608 | 612 | then { | |
609 | 613 | let EMPTYSTR = "empty" | |
610 | 614 | let poolWeight = if ((lpAssetIdStr != EMPTYSTR)) | |
611 | 615 | then { | |
612 | 616 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLpAssetToPoolContractAddress(lpAssetIdStr)), wrapErr(("unsupported lp asset " + lpAssetIdStr))) | |
613 | 617 | getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
614 | 618 | } | |
615 | 619 | else if (readOnly) | |
616 | 620 | then 0 | |
617 | 621 | else throwErr(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
618 | 622 | let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNum, lpAssetIdStr) | |
619 | 623 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum) | |
620 | 624 | let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), getIntOrZero(this, userBoostEmissionLastIntegralKEY)) | |
621 | 625 | let boostEmissionIntegral = refreshBoostEmissionIntegral()._2 | |
622 | 626 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
623 | 627 | if ((0 > userBoostEmissionIntegral)) | |
624 | 628 | then throwErr("wrong calculations") | |
625 | 629 | else { | |
626 | - | let $ | |
627 | - | let stakedVotesIntegralsActions = $ | |
628 | - | let userVoteIntegralDiff = $ | |
629 | - | let totalVotesIntegralDiff = $ | |
630 | + | let $t02432124460 = getStakedVotesIntegralsDiff(lpAssetIdStr, userAddressStr) | |
631 | + | let stakedVotesIntegralsActions = $t02432124460._1 | |
632 | + | let userVoteIntegralDiff = $t02432124460._2 | |
633 | + | let totalVotesIntegralDiff = $t02432124460._3 | |
630 | 634 | let poolUserBoostEmissionIntegral = fraction(userBoostEmissionIntegral, poolWeight, POOLWEIGHTMULT) | |
631 | 635 | let userBoostAvaliableToClaimTotalNew = if ((totalVotesIntegralDiff == 0)) | |
632 | 636 | then 0 | |
633 | 637 | else fraction(poolUserBoostEmissionIntegral, userVoteIntegralDiff, totalVotesIntegralDiff) | |
634 | 638 | let dataState = ([IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] ++ stakedVotesIntegralsActions) | |
635 | 639 | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(poolWeight), toString(userVoteIntegralDiff), toString(totalVotesIntegralDiff)], ":") | |
636 | 640 | $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug) | |
637 | 641 | } | |
638 | 642 | } | |
639 | 643 | else throw("Strict value is not equal to itself.") | |
640 | 644 | } | |
641 | 645 | ||
642 | 646 | ||
643 | 647 | func lockActions (i,durationMonths) = { | |
644 | 648 | let durationMonthsAllowed = [1, 3, 6, 12, 24, 48] | |
645 | 649 | if (!(containsElement(durationMonthsAllowed, durationMonths))) | |
646 | 650 | then throwErr("invalid duration") | |
647 | 651 | else { | |
648 | 652 | let duration = (durationMonths * blocksInMonth) | |
649 | 653 | let assetIdStr = toBase58String(assetId) | |
650 | 654 | if ((size(i.payments) != 1)) | |
651 | 655 | then throwErr("invalid payment - exact one payment must be attached") | |
652 | 656 | else { | |
653 | 657 | let pmt = i.payments[0] | |
654 | 658 | let pmtAmount = pmt.amount | |
655 | 659 | if ((assetId != value(pmt.assetId))) | |
656 | 660 | then throwErr((("invalid asset is in payment - " + assetIdStr) + " is expected")) | |
657 | 661 | else { | |
658 | 662 | let nextUserNumKEY = keyNextUserNum() | |
659 | 663 | let userAddress = i.caller | |
660 | 664 | let userAddressStr = toString(userAddress) | |
661 | 665 | let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr))) | |
662 | 666 | let userNumStr = if (userIsExisting) | |
663 | 667 | then value(getString(keyUser2NumMapping(userAddressStr))) | |
664 | 668 | else toString(getIntOrFail(this, nextUserNumKEY)) | |
665 | 669 | let userNum = parseIntValue(userNumStr) | |
666 | 670 | let lockStart = height | |
667 | 671 | if (if ((minLockAmount > pmtAmount)) | |
668 | 672 | then (userAddress != lpStakingPoolsContract) | |
669 | 673 | else false) | |
670 | 674 | then throwErr(("amount is less then minLockAmount=" + toString(minLockAmount))) | |
671 | 675 | else if ((minLockDuration > duration)) | |
672 | 676 | then throwErr(("passed duration is less then minLockDuration=" + toString(minLockDuration))) | |
673 | 677 | else if ((duration > maxLockDuration)) | |
674 | 678 | then throwErr(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
675 | 679 | else { | |
676 | 680 | let coeffX8 = fraction(duration, MULT8, maxLockDuration) | |
677 | 681 | let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8) | |
678 | 682 | let gwxAmountTotal = getGwxAmountTotal() | |
679 | 683 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNum) | |
680 | 684 | let boostEmissionIntegral = refreshBoostEmissionIntegral()._2 | |
681 | 685 | let userGwxAmountTotal = getUserGwxAmountTotal(userAddress) | |
682 | 686 | let gwxRewardInv = reentrantInvoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil) | |
683 | 687 | if ((gwxRewardInv == gwxRewardInv)) | |
684 | 688 | then { | |
685 | 689 | let arr = if (userIsExisting) | |
686 | 690 | then nil | |
687 | 691 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
688 | 692 | $Tuple2(((((arr ++ LockParamsEntry(userAddress, i.transactionId, pmtAmount, lockStart, duration, gWxAmountStart, 0)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
689 | 693 | then 0 | |
690 | 694 | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, gWxAmountStart, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyGwxTotal(), (gwxAmountTotal + gWxAmountStart)), IntegerEntry(keyUserGwxAmountTotal(userAddress), (userGwxAmountTotal + gWxAmountStart))]), gWxAmountStart) | |
691 | 695 | } | |
692 | 696 | else throw("Strict value is not equal to itself.") | |
693 | 697 | } | |
694 | 698 | } | |
695 | 699 | } | |
696 | 700 | } | |
697 | 701 | } | |
698 | 702 | ||
699 | 703 | ||
700 | 704 | func getWxWithdrawable (userAddress,txIdOption) = { | |
701 | 705 | let userRecordArray = readLockParamsRecordOrFail(userAddress, txIdOption) | |
702 | 706 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
703 | 707 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
704 | 708 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
705 | 709 | let lockEnd = (lockStart + lockDuration) | |
706 | 710 | let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed]) | |
707 | 711 | let gwxAmount = parseIntValue(userRecordArray[IdxLockGwxAmount]) | |
708 | - | let t = ((height - lockStart) / | |
709 | - | let exponent = fraction(toBigInt(t), (toBigInt((8 * | |
712 | + | let t = ((height - lockStart) / blocksInPeriod) | |
713 | + | let exponent = fraction(toBigInt(t), (toBigInt((8 * blocksInPeriod)) * MULT18BI), toBigInt(lockDuration)) | |
710 | 714 | let wxWithdrawable = if ((height > lockEnd)) | |
711 | 715 | then (userAmount - wxClaimed) | |
712 | 716 | else toInt(fraction(toBigInt(userAmount), (MULT18BI - pow(toBigInt(5), 1, exponent, SCALE18, SCALE18, DOWN)), MULT18BI)) | |
713 | 717 | wxWithdrawable | |
714 | 718 | } | |
715 | 719 | ||
716 | 720 | ||
717 | 721 | @Callable(i) | |
718 | 722 | func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = { | |
719 | 723 | let checkCaller = mustManager(i) | |
720 | 724 | if ((checkCaller == checkCaller)) | |
721 | 725 | then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0)) | |
722 | 726 | else throw("Strict value is not equal to itself.") | |
723 | 727 | } | |
724 | 728 | ||
725 | 729 | ||
726 | 730 | ||
727 | 731 | @Callable(i) | |
728 | 732 | func lockRef (duration,referrerAddress,signature) = { | |
729 | - | let $ | |
730 | - | let lockActionsResult = $ | |
731 | - | let gWxAmountStart = $ | |
733 | + | let $t02942729492 = lockActions(i, duration) | |
734 | + | let lockActionsResult = $t02942729492._1 | |
735 | + | let gWxAmountStart = $t02942729492._2 | |
732 | 736 | let referralAddress = toString(i.caller) | |
733 | 737 | let refInv = if (if ((referrerAddress == "")) | |
734 | 738 | then true | |
735 | 739 | else (signature == base58'')) | |
736 | 740 | then unit | |
737 | 741 | else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil) | |
738 | 742 | if ((refInv == refInv)) | |
739 | 743 | then { | |
740 | 744 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
741 | 745 | if ((updateRefActivity == updateRefActivity)) | |
742 | 746 | then $Tuple2(lockActionsResult, unit) | |
743 | 747 | else throw("Strict value is not equal to itself.") | |
744 | 748 | } | |
745 | 749 | else throw("Strict value is not equal to itself.") | |
746 | 750 | } | |
747 | 751 | ||
748 | 752 | ||
749 | 753 | ||
750 | 754 | @Callable(i) | |
751 | 755 | func lock (duration) = { | |
752 | - | let $ | |
753 | - | let lockActionsResult = $ | |
754 | - | let gWxAmountStart = $ | |
756 | + | let $t02995030015 = lockActions(i, duration) | |
757 | + | let lockActionsResult = $t02995030015._1 | |
758 | + | let gWxAmountStart = $t02995030015._2 | |
755 | 759 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
756 | 760 | if ((updateRefActivity == updateRefActivity)) | |
757 | 761 | then $Tuple2(lockActionsResult, unit) | |
758 | 762 | else throw("Strict value is not equal to itself.") | |
759 | 763 | } | |
760 | 764 | ||
761 | 765 | ||
762 | 766 | ||
763 | 767 | @Callable(i) | |
764 | 768 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
765 | 769 | then throwErr("permissions denied") | |
766 | 770 | else { | |
767 | - | let $ | |
768 | - | let userBoostAvailable = $ | |
769 | - | let dataState = $ | |
770 | - | let debug = $ | |
771 | + | let $t03032530427 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
772 | + | let userBoostAvailable = $t03032530427._1 | |
773 | + | let dataState = $t03032530427._2 | |
774 | + | let debug = $t03032530427._3 | |
771 | 775 | $Tuple2(dataState, [userBoostAvailable]) | |
772 | 776 | } | |
773 | 777 | ||
774 | 778 | ||
775 | 779 | ||
776 | 780 | @Callable(i) | |
777 | 781 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
778 | - | let $ | |
779 | - | let userBoostAvailable = $ | |
780 | - | let dataState = $ | |
781 | - | let debug = $ | |
782 | + | let $t03055930660 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
783 | + | let userBoostAvailable = $t03055930660._1 | |
784 | + | let dataState = $t03055930660._2 | |
785 | + | let debug = $t03055930660._3 | |
782 | 786 | $Tuple2(nil, [userBoostAvailable, debug]) | |
783 | 787 | } | |
784 | 788 | ||
785 | 789 | ||
786 | 790 | ||
787 | 791 | @Callable(i) | |
788 | 792 | func unlock (txIdStr,amount) = { | |
789 | 793 | let userAddress = i.caller | |
790 | 794 | let userAddressStr = toString(userAddress) | |
791 | 795 | let txId = fromBase58String(txIdStr) | |
792 | 796 | let userRecordArray = readLockParamsRecordOrFail(userAddress, if ((txIdStr == "")) | |
793 | 797 | then unit | |
794 | 798 | else txId) | |
795 | 799 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
796 | 800 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
797 | 801 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
798 | 802 | let lockEnd = (lockStart + lockDuration) | |
799 | 803 | let wxClaimed = parseIntValue(userRecordArray[IdxLockWxClaimed]) | |
800 | 804 | let gwxAmount = parseIntValue(userRecordArray[IdxLockGwxAmount]) | |
801 | - | let t = ((height - lockStart) / | |
805 | + | let t = ((height - lockStart) / blocksInPeriod) | |
802 | 806 | let wxWithdrawable = getWxWithdrawable(userAddress, if ((txIdStr == "")) | |
803 | 807 | then unit | |
804 | 808 | else txId) | |
805 | 809 | if ((amount > wxWithdrawable)) | |
806 | 810 | then throwErr(("maximum amount to unlock: " + toString(wxWithdrawable))) | |
807 | 811 | else { | |
808 | - | let gwxBurned = max([amount, fraction((t * | |
812 | + | let gwxBurned = max([amount, fraction((t * blocksInPeriod), userAmount, maxLockDuration)]) | |
809 | 813 | let gwxRemaining = ensurePositive((gwxAmount - gwxBurned), "gwxRemaining") | |
810 | 814 | let lockedGwxAmount = getLockedGwxAmount(userAddress) | |
811 | 815 | if ((lockedGwxAmount > gwxRemaining)) | |
812 | 816 | then throwErr(("locked gwx amount: " + toString(lockedGwxAmount))) | |
813 | 817 | else if ((0 >= userAmount)) | |
814 | 818 | then throwErr("nothing to unlock") | |
815 | 819 | else { | |
816 | 820 | let gwxAmountTotal = getGwxAmountTotal() | |
817 | 821 | let userGwxAmountTotal = getUserGwxAmountTotal(userAddress) | |
818 | 822 | let gwxRewardInv = reentrantInvoke(gwxRewardContract, "refreshUserReward", [userAddress.bytes], nil) | |
819 | 823 | if ((gwxRewardInv == gwxRewardInv)) | |
820 | 824 | then ((((LockParamsEntry(userAddress, txId, userAmount, lockStart, lockDuration, gwxRemaining, (wxClaimed + amount)) ++ StatsEntry(-(amount), 0, 0, 0)) :+ HistoryEntry("unlock", userAddressStr, amount, lockStart, lockDuration, gwxBurned, i)) :+ ScriptTransfer(userAddress, amount, assetId)) ++ [IntegerEntry(keyGwxTotal(), ensurePositive((gwxAmountTotal - gwxBurned), "gwxTotal")), IntegerEntry(keyUserGwxAmountTotal(userAddress), ensurePositive((userGwxAmountTotal - gwxBurned), "userGwxAmountTotal"))]) | |
821 | 825 | else throw("Strict value is not equal to itself.") | |
822 | 826 | } | |
823 | 827 | } | |
824 | 828 | } | |
825 | 829 | ||
826 | 830 | ||
827 | 831 | ||
828 | 832 | @Callable(i) | |
829 | 833 | func gwxUserInfoREADONLY (userAddressStr) = { | |
830 | 834 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
831 | 835 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
832 | 836 | $Tuple2(nil, [gwxAmount]) | |
833 | 837 | } | |
834 | 838 | ||
835 | 839 | ||
836 | 840 | ||
837 | 841 | @Callable(i) | |
838 | 842 | func userMaxDurationREADONLY (userAddressStr) = $Tuple2(nil, $Tuple2("increaseLock", maxLockDuration)) | |
839 | 843 | ||
840 | 844 | ||
841 | 845 | ||
842 | 846 | @Callable(i) | |
843 | 847 | func getUserGwxAmountAtHeightREADONLY (userAddressStr,targetHeight) = { | |
844 | 848 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
845 | 849 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
846 | 850 | $Tuple2(nil, gwxAmount) | |
847 | 851 | } | |
848 | 852 | ||
849 | 853 | ||
850 | 854 | ||
851 | 855 | @Callable(i) | |
852 | 856 | func getUserGwxAmount (userAddressStr) = { | |
853 | 857 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid user address")) | |
854 | 858 | let gwxAmount = getUserGwxAmountTotal(userAddress) | |
855 | 859 | $Tuple2(nil, gwxAmount) | |
856 | 860 | } | |
857 | 861 | ||
858 | 862 | ||
859 | 863 | ||
860 | 864 | @Callable(i) | |
861 | 865 | func getGwxTotalREADONLY () = $Tuple2(nil, getGwxAmountTotal()) | |
862 | 866 | ||
863 | 867 | ||
864 | 868 | ||
865 | 869 | @Callable(i) | |
866 | 870 | func onBoostEmissionUpdate () = { | |
867 | 871 | let checkCaller = if ((i.caller == emissionContract)) | |
868 | 872 | then true | |
869 | 873 | else mustManager(i) | |
870 | 874 | if ((checkCaller == checkCaller)) | |
871 | 875 | then refreshBoostEmissionIntegral() | |
872 | 876 | else throw("Strict value is not equal to itself.") | |
873 | 877 | } | |
874 | 878 | ||
875 | 879 | ||
876 | 880 | ||
877 | 881 | @Callable(i) | |
878 | 882 | func onStakedVoteUpdate (lpAssetIdStr,userAddressStr,edge) = { | |
879 | 883 | let checkCaller = if ((i.caller == stakingContract)) | |
880 | 884 | then true | |
881 | 885 | else mustManager(i) | |
882 | 886 | if ((checkCaller == checkCaller)) | |
883 | 887 | then { | |
884 | 888 | let actions = refreshVoteStakedIntegral(lpAssetIdStr, userAddressStr, edge) | |
885 | 889 | $Tuple2(actions, unit) | |
886 | 890 | } | |
887 | 891 | else throw("Strict value is not equal to itself.") | |
888 | 892 | } | |
889 | 893 | ||
890 | 894 | ||
891 | 895 | ||
892 | 896 | @Callable(i) | |
893 | 897 | func getVotingResultStakedREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStaked(lpAssetIdStr)) | |
894 | 898 | ||
895 | 899 | ||
896 | 900 | ||
897 | 901 | @Callable(i) | |
898 | 902 | func getVotingResultStakedIntegralREADONLY (lpAssetIdStr) = $Tuple2(nil, getVotingResultStakedIntegral(lpAssetIdStr)) | |
899 | 903 | ||
900 | 904 | ||
901 | 905 | ||
902 | 906 | @Callable(i) | |
903 | 907 | func getUserVoteFinalizedREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteFinalized(lpAssetIdStr, userAddressStr)) | |
904 | 908 | ||
905 | 909 | ||
906 | 910 | ||
907 | 911 | @Callable(i) | |
908 | 912 | func getUserVoteStakedIntegralREADONLY (lpAssetIdStr,userAddressStr) = $Tuple2(nil, getUserVoteStakedIntegral(lpAssetIdStr, userAddressStr)) | |
909 | 913 | ||
910 | 914 | ||
911 | 915 | @Verifier(tx) | |
912 | 916 | func verify () = { | |
913 | 917 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
914 | 918 | case pk: ByteVector => | |
915 | 919 | pk | |
916 | 920 | case _: Unit => | |
917 | 921 | tx.senderPublicKey | |
918 | 922 | case _ => | |
919 | 923 | throw("Match error") | |
920 | 924 | } | |
921 | 925 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
922 | 926 | } | |
923 | 927 |
github/deemru/w8io/026f985 116.40 ms ◑