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