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