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