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