tx · GL9kJKSTJswuHRxcWnZuSZikRskFLmDWWaxfsobkfGYv 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy: -0.02300000 Waves 2022.12.02 18:35 [2342912] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves
{ "type": 13, "id": "GL9kJKSTJswuHRxcWnZuSZikRskFLmDWWaxfsobkfGYv", "fee": 2300000, "feeAssetId": null, "timestamp": 1669995327546, "version": 1, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "2tRne2ANc913SsjJdodGRts6kfNSEtDmD9FTWGqDCYDkL11DmBSTucS6oqEQUawXse7qRjApGosdjFJPodgBvvUt" ], "script": "base64:BgLnJQgCEggKBggIAQEBCBIFCgMBCAISAwoBARIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIECgIIARIAEgMKAQgSACIDU0VQIgZTQ0FMRTgiBU1VTFQ4Ig5QT09MV0VJR0hUTVVMVCIEc3RyZiIHYWRkcmVzcyIDa2V5IgNpb3oiA2lvZCIKZGVmYXVsdFZhbCIDaW9mIgNhYnMiA3ZhbCIDYWFsIgckbWF0Y2gwIgp2YWxBbnlMeXN0IgJhaSIGdmFsSW50IhtrZXlSZWZlcnJhbHNDb250cmFjdEFkZHJlc3MiHnJlZmVycmFsc0NvbnRyYWN0QWRkcmVzc09yRmFpbCIWa2V5UmVmZXJyYWxQcm9ncmFtTmFtZSIacmVmZXJyYWxQcm9ncmFtTmFtZURlZmF1bHQiE3JlZmVycmFsUHJvZ3JhbU5hbWUiEWtleUZhY3RvcnlBZGRyZXNzIhhJZHhGYWN0b3J5Q2ZnU3Rha2luZ0RhcHAiGUlkeEZhY3RvcnlDZmdCb29zdGluZ0RhcHAiFElkeEZhY3RvcnlDZmdJZG9EYXBwIhVJZHhGYWN0b3J5Q2ZnVGVhbUR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AQBCQEFdmFsdWUBBQJlbgkAzAgCCQELRGVsZXRlRW50cnkBCQECYWQABQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAmVxAQJlcgAEAmVzBAFvCQECYXoAAwkAAQIFAW8CCkJ5dGVWZWN0b3IEAmFGBQFvBQJhRgMJAAECBQFvAgRVbml0CAUCZXEPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmVxCWJvZHlCeXRlcwkAkQMCCAUCZXEGcHJvb2ZzAAAFAmVz4t4b9w==", "chainId": 84, "height": 2342912, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3w5fMivBRZeY46AN91sL18eDv5NzibAxhB9Z67QywU7v Next: 2fEEN3q6s94quRF4Wh34BHKjkFUnvdo9nbCzk29pccJs Diff:
Old | New | Differences | |
---|---|---|---|
305 | 305 | ||
306 | 306 | let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg) | |
307 | 307 | ||
308 | - | func getTotalCachedGwx () = { | |
308 | + | func getTotalCachedGwx (correct) = { | |
309 | 309 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
310 | 310 | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
311 | 311 | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP) | |
316 | 316 | let isCorrectionActivated = if (isDefined(targetEpochOption)) | |
317 | 317 | then (currentEpochUi >= value(targetEpochOption)) | |
318 | 318 | else false | |
319 | - | let corrective = if (isCorrectionActivated) | |
319 | + | let corrective = if (if (isCorrectionActivated) | |
320 | + | then correct | |
321 | + | else false) | |
320 | 322 | then valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0) | |
321 | 323 | else 0 | |
322 | 324 | max([0, (totalCachedGwxRaw + corrective)]) | |
401 | 403 | let userNumStr = userRecordArray[IdxLockUserNum] | |
402 | 404 | let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0) | |
403 | 405 | let EMPTYSTR = "empty" | |
404 | - | let $ | |
406 | + | let $t01496315531 = if ((lpAssetIdStr != EMPTYSTR)) | |
405 | 407 | then { | |
406 | 408 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
407 | 409 | let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
411 | 413 | else if (readOnly) | |
412 | 414 | then $Tuple2(0, 0) | |
413 | 415 | else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
414 | - | let poolWeight0 = $ | |
415 | - | let poolWeight1 = $ | |
416 | + | let poolWeight0 = $t01496315531._1 | |
417 | + | let poolWeight1 = $t01496315531._2 | |
416 | 418 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
417 | 419 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
418 | 420 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
442 | 444 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
443 | 445 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
444 | 446 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
445 | - | let | |
447 | + | let totalCachedGwxCorrected = getTotalCachedGwx(true) | |
446 | 448 | let userCurrGwx = calcCurrentGwxAmount(userAddressStr) | |
447 | 449 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
448 | 450 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
454 | 456 | else fraction(userBoostEmissionIntegral, udh1, udh) | |
455 | 457 | let poolUserBoostEmissionIntegral0 = fraction(userBoostEmissionIntegral0, poolWeight0, POOLWEIGHTMULT) | |
456 | 458 | let poolUserBoostEmissionIntegral1 = fraction(userBoostEmissionIntegral1, poolWeight1, POOLWEIGHTMULT) | |
457 | - | let userBoostAvaliableToClaimTotalNew0 = if (( | |
459 | + | let userBoostAvaliableToClaimTotalNew0 = if ((totalCachedGwxCorrected == 0)) | |
458 | 460 | then 0 | |
459 | - | else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, | |
460 | - | let userBoostAvaliableToClaimTotalNew1 = if (( | |
461 | + | else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, totalCachedGwxCorrected) | |
462 | + | let userBoostAvaliableToClaimTotalNew1 = if ((totalCachedGwxCorrected == 0)) | |
461 | 463 | then 0 | |
462 | - | else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, | |
464 | + | else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, totalCachedGwxCorrected) | |
463 | 465 | let userBoostAvaliableToClaimTotalNew = (userBoostAvaliableToClaimTotalNew0 + userBoostAvaliableToClaimTotalNew1) | |
464 | 466 | let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr) | |
465 | 467 | let userBoostClaimed = ioz(this, userBoostClaimedKEY) | |
466 | 468 | let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed) | |
467 | 469 | let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] | |
468 | - | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(userBoostClaimed), toString(userBoostAvailable), toString(poolWeight0), toString(poolWeight1), toString(h), toString(udh), toString(uLastH), toString(udh0), toString(udh1), toString(userCurrGwx), toString( | |
470 | + | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(userBoostClaimed), toString(userBoostAvailable), toString(poolWeight0), toString(poolWeight1), toString(h), toString(udh), toString(uLastH), toString(udh0), toString(udh1), toString(userCurrGwx), toString(totalCachedGwxCorrected)], ":") | |
469 | 471 | $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug) | |
470 | 472 | } | |
471 | 473 | } | |
530 | 532 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
531 | 533 | let userMaxBoostInt = ((gWxAmountStart * duration) / 2) | |
532 | 534 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
533 | - | let | |
535 | + | let totalCachedGwxRaw = getTotalCachedGwx(false) | |
534 | 536 | let arr = if (userIsExisting) | |
535 | 537 | then nil | |
536 | 538 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
537 | 539 | $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
538 | 540 | then 0 | |
539 | - | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), ( | |
541 | + | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gWxAmountStart))]), gWxAmountStart) | |
540 | 542 | } | |
541 | 543 | } | |
542 | 544 | } | |
555 | 557 | ||
556 | 558 | @Callable(i) | |
557 | 559 | func lockRef (duration,referrerAddress,signature) = { | |
558 | - | let $ | |
559 | - | let lockActionsResult = $ | |
560 | - | let gWxAmountStart = $ | |
560 | + | let $t02389023955 = lockActions(i, duration) | |
561 | + | let lockActionsResult = $t02389023955._1 | |
562 | + | let gWxAmountStart = $t02389023955._2 | |
561 | 563 | let referralAddress = toString(i.caller) | |
562 | 564 | let refInv = if (if ((referrerAddress == "")) | |
563 | 565 | then true | |
578 | 580 | ||
579 | 581 | @Callable(i) | |
580 | 582 | func lock (duration) = { | |
581 | - | let $ | |
582 | - | let lockActionsResult = $ | |
583 | - | let gWxAmountStart = $ | |
583 | + | let $t02441324478 = lockActions(i, duration) | |
584 | + | let lockActionsResult = $t02441324478._1 | |
585 | + | let gWxAmountStart = $t02441324478._2 | |
584 | 586 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
585 | 587 | if ((updateRefActivity == updateRefActivity)) | |
586 | 588 | then $Tuple2(lockActionsResult, unit) | |
647 | 649 | if ((0 > gwxDiff)) | |
648 | 650 | then throw(("gwxDiff is less then 0: " + toString(gwxDiff))) | |
649 | 651 | else { | |
650 | - | let totalCachedGwx = getTotalCachedGwx() | |
652 | + | let totalCachedGwxRaw = getTotalCachedGwx(false) | |
653 | + | let totalCachedGwxCorrected = getTotalCachedGwx(true) | |
651 | 654 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
652 | 655 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
653 | - | let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, | |
656 | + | let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwxCorrected) | |
654 | 657 | let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2) | |
655 | 658 | let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2) | |
656 | 659 | let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt) | |
657 | - | (((LockParamsEntry(userAddressStr, userNumStr, userAmountNew, lockStartNew, lockDurationNew, k, b, period) ++ StatsEntry(pmtAmount, deltaDuration, 0, 0)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, lockDurationNew, k, b, i)) ++ [IntegerEntry(keyTotalCachedGwx(), ( | |
660 | + | (((LockParamsEntry(userAddressStr, userNumStr, userAmountNew, lockStartNew, lockDurationNew, k, b, period) ++ StatsEntry(pmtAmount, deltaDuration, 0, 0)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, lockDurationNew, k, b, i)) ++ [IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gwxDiff))]) | |
658 | 661 | } | |
659 | 662 | } | |
660 | 663 | } | |
668 | 671 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
669 | 672 | then throw("permissions denied") | |
670 | 673 | else { | |
671 | - | let $ | |
672 | - | let userBoostAvailable = $ | |
673 | - | let dataState = $ | |
674 | - | let debug = $ | |
674 | + | let $t02945929561 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
675 | + | let userBoostAvailable = $t02945929561._1 | |
676 | + | let dataState = $t02945929561._2 | |
677 | + | let debug = $t02945929561._3 | |
675 | 678 | $Tuple2(dataState, [userBoostAvailable]) | |
676 | 679 | } | |
677 | 680 | ||
679 | 682 | ||
680 | 683 | @Callable(i) | |
681 | 684 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
682 | - | let $ | |
683 | - | let userBoostAvailable = $ | |
684 | - | let dataState = $ | |
685 | - | let debug = $ | |
685 | + | let $t02969329794 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
686 | + | let userBoostAvailable = $t02969329794._1 | |
687 | + | let dataState = $t02969329794._2 | |
688 | + | let debug = $t02969329794._3 | |
686 | 689 | $Tuple2(nil, [userBoostAvailable, debug]) | |
687 | 690 | } | |
688 | 691 | ||
727 | 730 | ||
728 | 731 | ||
729 | 732 | @Callable(i) | |
730 | - | func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx()) | |
733 | + | func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true)) | |
731 | 734 | ||
732 | 735 | ||
733 | 736 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let SCALE8 = 8 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let POOLWEIGHTMULT = MULT8 | |
11 | 11 | ||
12 | 12 | func strf (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func ioz (address,key) = valueOrElse(getInteger(address, key), 0) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func iod (address,key,defaultVal) = valueOrElse(getInteger(address, key), defaultVal) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func iof (address,key) = valueOrErrorMessage(getInteger(address, key), (("mandatory this." + key) + " is not defined")) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func abs (val) = if ((0 > val)) | |
25 | 25 | then -(val) | |
26 | 26 | else val | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func aal (val) = match val { | |
30 | 30 | case valAnyLyst: List[Any] => | |
31 | 31 | valAnyLyst | |
32 | 32 | case _ => | |
33 | 33 | throw("fail to cast into List[Any]") | |
34 | 34 | } | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func ai (val) = match val { | |
38 | 38 | case valInt: Int => | |
39 | 39 | valInt | |
40 | 40 | case _ => | |
41 | 41 | throw("fail to cast into Int") | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func keyReferralsContractAddress () = makeString(["%s%s", "config", "referralsContractAddress"], SEP) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | let referralsContractAddressOrFail = addressFromStringValue(strf(this, keyReferralsContractAddress())) | |
49 | 49 | ||
50 | 50 | let keyReferralProgramName = makeString(["%s%s", "referral", "programName"], SEP) | |
51 | 51 | ||
52 | 52 | let referralProgramNameDefault = "wxlock" | |
53 | 53 | ||
54 | 54 | let referralProgramName = valueOrElse(getString(this, keyReferralProgramName), referralProgramNameDefault) | |
55 | 55 | ||
56 | 56 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | let IdxFactoryCfgStakingDapp = 1 | |
60 | 60 | ||
61 | 61 | let IdxFactoryCfgBoostingDapp = 2 | |
62 | 62 | ||
63 | 63 | let IdxFactoryCfgIdoDapp = 3 | |
64 | 64 | ||
65 | 65 | let IdxFactoryCfgTeamDapp = 4 | |
66 | 66 | ||
67 | 67 | let IdxFactoryCfgEmissionDapp = 5 | |
68 | 68 | ||
69 | 69 | let IdxFactoryCfgRestDapp = 6 | |
70 | 70 | ||
71 | 71 | let IdxFactoryCfgSlippageDapp = 7 | |
72 | 72 | ||
73 | 73 | let IdxFactoryCfgDaoDapp = 8 | |
74 | 74 | ||
75 | 75 | let IdxFactoryCfgMarketingDapp = 9 | |
76 | 76 | ||
77 | 77 | let IdxFactoryCfgGwxRewardDapp = 10 | |
78 | 78 | ||
79 | 79 | let IdxFactoryCfgBirdsDapp = 11 | |
80 | 80 | ||
81 | 81 | func keyFactoryCfg () = "%s__factoryConfig" | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func keyFactoryLpList () = "%s__lpTokensList" | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func keyFactoryPoolWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num)) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func readFactoryAddressOrFail () = addressFromStringValue(strf(this, keyFactoryAddress())) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func readFactoryCfgOrFail (factory) = split(strf(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 keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
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 keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func keyNextPeriod () = "%s__nextPeriod" | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func keyGwxRewardEmissionStartHeight () = "%s%s__gwxRewardEmissionPart__startHeight" | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | let IdxCfgAssetId = 1 | |
148 | 148 | ||
149 | 149 | let IdxCfgMinLockAmount = 2 | |
150 | 150 | ||
151 | 151 | let IdxCfgMinLockDuration = 3 | |
152 | 152 | ||
153 | 153 | let IdxCfgMaxLockDuration = 4 | |
154 | 154 | ||
155 | 155 | let IdxCfgMathContract = 5 | |
156 | 156 | ||
157 | 157 | func keyConfig () = "%s__config" | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func readConfigArrayOrFail () = split(strf(this, keyConfig()), SEP) | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | let mathContract = addressFromStringValue(readConfigArrayOrFail()[IdxCfgMathContract]) | |
164 | 164 | ||
165 | 165 | func formatConfigS (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = makeString(["%s%d%d%d", assetId, minLockAmount, minLockDuration, maxLockDuration, mathContract], SEP) | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func formatConfig (assetId,minLockAmount,minLockDuration,maxLockDuration,mathContract) = formatConfigS(assetId, toString(minLockAmount), toString(minLockDuration), toString(maxLockDuration), mathContract) | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
172 | 172 | case s: String => | |
173 | 173 | fromBase58String(s) | |
174 | 174 | case _: Unit => | |
175 | 175 | unit | |
176 | 176 | case _ => | |
177 | 177 | throw("Match error") | |
178 | 178 | } | |
179 | 179 | ||
180 | 180 | ||
181 | 181 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
182 | 182 | case s: String => | |
183 | 183 | fromBase58String(s) | |
184 | 184 | case _: Unit => | |
185 | 185 | unit | |
186 | 186 | case _ => | |
187 | 187 | throw("Match error") | |
188 | 188 | } | |
189 | 189 | ||
190 | 190 | ||
191 | 191 | func mustManager (i) = { | |
192 | 192 | let pd = throw("Permission denied") | |
193 | 193 | match managerPublicKeyOrUnit() { | |
194 | 194 | case pk: ByteVector => | |
195 | 195 | if ((i.callerPublicKey == pk)) | |
196 | 196 | then true | |
197 | 197 | else pd | |
198 | 198 | case _: Unit => | |
199 | 199 | if ((i.caller == this)) | |
200 | 200 | then true | |
201 | 201 | else pd | |
202 | 202 | case _ => | |
203 | 203 | throw("Match error") | |
204 | 204 | } | |
205 | 205 | } | |
206 | 206 | ||
207 | 207 | ||
208 | 208 | let IdxLockUserNum = 1 | |
209 | 209 | ||
210 | 210 | let IdxLockAmount = 2 | |
211 | 211 | ||
212 | 212 | let IdxLockStart = 3 | |
213 | 213 | ||
214 | 214 | let IdxLockDuration = 4 | |
215 | 215 | ||
216 | 216 | let IdxLockParamK = 5 | |
217 | 217 | ||
218 | 218 | let IdxLockParamB = 6 | |
219 | 219 | ||
220 | 220 | func keyLockParamsRecord (userAddress) = makeString(["%s%s__lock", userAddress], SEP) | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | func readLockParamsRecordOrFail (userAddress) = split(strf(this, keyLockParamsRecord(userAddress)), SEP) | |
224 | 224 | ||
225 | 225 | ||
226 | 226 | func formatLockParamsRecordS (userNum,amount,start,duration,paramK,paramB,lastUpdTimestamp,gwxAmount) = makeString(["%d%d%d%d%d%d%d%d", userNum, amount, start, duration, paramK, paramB, lastUpdTimestamp, gwxAmount], SEP) | |
227 | 227 | ||
228 | 228 | ||
229 | 229 | func formatLockParamsRecord (userNum,amount,start,duration,paramK,paramB,gwxAmount) = formatLockParamsRecordS(userNum, toString(amount), toString(start), toString(duration), toString(paramK), toString(paramB), toString(lastBlock.timestamp), toString(gwxAmount)) | |
230 | 230 | ||
231 | 231 | ||
232 | 232 | func keyNextUserNum () = "%s__nextUserNum" | |
233 | 233 | ||
234 | 234 | ||
235 | 235 | func keyUser2NumMapping (userAddress) = makeString(["%s%s%s__mapping__user2num", userAddress], SEP) | |
236 | 236 | ||
237 | 237 | ||
238 | 238 | func keyNum2UserMapping (num) = makeString(["%s%s%s__mapping__num2user", num], SEP) | |
239 | 239 | ||
240 | 240 | ||
241 | 241 | func keyLockParamUserAmount (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "amount"], SEP) | |
242 | 242 | ||
243 | 243 | ||
244 | 244 | func keyLockParamStartBlock (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "start"], SEP) | |
245 | 245 | ||
246 | 246 | ||
247 | 247 | func keyLockParamDuration (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "duration"], SEP) | |
248 | 248 | ||
249 | 249 | ||
250 | 250 | func keyLockParamK (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "k"], SEP) | |
251 | 251 | ||
252 | 252 | ||
253 | 253 | func keyLockParamB (userNum) = makeString(["%s%d%s__paramByUserNum", userNum, "b"], SEP) | |
254 | 254 | ||
255 | 255 | ||
256 | 256 | func keyLockParamByPeriodK (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "k", period], SEP) | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | func keyLockParamByPeriodB (userNum,period) = makeString(["%s%d%s%d__paramByPeriod", userNum, "b", period], SEP) | |
260 | 260 | ||
261 | 261 | ||
262 | 262 | func keyLockParamTotalAmount () = "%s%s__stats__activeTotalLocked" | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | func keyStatsLocksDurationSumInBlocks () = "%s%s__stats__locksDurationSumInBlocks" | |
266 | 266 | ||
267 | 267 | ||
268 | 268 | func keyStatsLocksCount () = "%s%s__stats__locksCount" | |
269 | 269 | ||
270 | 270 | ||
271 | 271 | func keyStatsUsersCount () = "%s%s__stats__activeUsersCount" | |
272 | 272 | ||
273 | 273 | ||
274 | 274 | func keyUserBoostEmissionLastINTEGRAL (userNum) = makeString(["%s%d__userBoostEmissionLastInt", userNum], SEP) | |
275 | 275 | ||
276 | 276 | ||
277 | 277 | func keyUserLpBoostEmissionLastINTEGRAL (userNum,lpAssetId) = makeString(["%s%d__userBoostEmissionLastInt", userNum, lpAssetId], SEP) | |
278 | 278 | ||
279 | 279 | ||
280 | 280 | func keyUserMaxBoostINTEGRAL (userNum) = makeString(["%s%d__maxBoostInt", userNum], SEP) | |
281 | 281 | ||
282 | 282 | ||
283 | 283 | func keyTotalMaxBoostINTEGRAL () = "%s%s__maxBoostInt__total" | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | func keyUserBoostAvalaibleToClaimTotal (userNum) = makeString(["%s%d__userBoostAvaliableToClaimTotal", userNum], SEP) | |
287 | 287 | ||
288 | 288 | ||
289 | 289 | func keyUserBoostClaimed (userNum) = makeString(["%s%d__userBoostClaimed", userNum], SEP) | |
290 | 290 | ||
291 | 291 | ||
292 | 292 | func keyTotalCachedGwx () = "%s%s__gwxCached__total" | |
293 | 293 | ||
294 | 294 | ||
295 | 295 | func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective" | |
296 | 296 | ||
297 | 297 | ||
298 | 298 | let factoryContract = readFactoryAddressOrFail() | |
299 | 299 | ||
300 | 300 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
301 | 301 | ||
302 | 302 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
303 | 303 | ||
304 | 304 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
305 | 305 | ||
306 | 306 | let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg) | |
307 | 307 | ||
308 | - | func getTotalCachedGwx () = { | |
308 | + | func getTotalCachedGwx (correct) = { | |
309 | 309 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
310 | 310 | let votingEmissionContract = addressFromStringValue(getStringValue(factoryContract, keyVotingEmissionContract)) | |
311 | 311 | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], SEP) | |
312 | 312 | let currentEpochUi = getIntegerValue(votingEmissionContract, keyCurrentEpochUi) | |
313 | 313 | let keyTargetEpoch = makeString(["%s", "totalCachedGwxCorrection__activationEpoch"], SEP) | |
314 | 314 | let targetEpochOption = getInteger(this, keyTargetEpoch) | |
315 | 315 | let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0) | |
316 | 316 | let isCorrectionActivated = if (isDefined(targetEpochOption)) | |
317 | 317 | then (currentEpochUi >= value(targetEpochOption)) | |
318 | 318 | else false | |
319 | - | let corrective = if (isCorrectionActivated) | |
319 | + | let corrective = if (if (isCorrectionActivated) | |
320 | + | then correct | |
321 | + | else false) | |
320 | 322 | then valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0) | |
321 | 323 | else 0 | |
322 | 324 | max([0, (totalCachedGwxRaw + corrective)]) | |
323 | 325 | } | |
324 | 326 | ||
325 | 327 | ||
326 | 328 | func HistoryEntry (type,user,amount,lockStart,duration,k,b,i) = { | |
327 | 329 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
328 | 330 | let historyDATA = makeString(["%d%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount), toString(lockStart), toString(duration), toString(k), toString(b)], SEP) | |
329 | 331 | StringEntry(historyKEY, historyDATA) | |
330 | 332 | } | |
331 | 333 | ||
332 | 334 | ||
333 | 335 | func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = { | |
334 | 336 | let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks() | |
335 | 337 | let locksCountKEY = keyStatsLocksCount() | |
336 | 338 | let usersCountKEY = keyStatsUsersCount() | |
337 | 339 | let totalAmountKEY = keyLockParamTotalAmount() | |
338 | 340 | let locksDurationSumInBlocks = ioz(this, locksDurationSumInBlocksKEY) | |
339 | 341 | let locksCount = ioz(this, locksCountKEY) | |
340 | 342 | let usersCount = ioz(this, usersCountKEY) | |
341 | 343 | let totalAmount = ioz(this, totalAmountKEY) | |
342 | 344 | [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))] | |
343 | 345 | } | |
344 | 346 | ||
345 | 347 | ||
346 | 348 | func calcGwxAmount (kRaw,bRaw,h) = { | |
347 | 349 | let SCALE = 1000 | |
348 | 350 | (((kRaw * h) + bRaw) / SCALE) | |
349 | 351 | } | |
350 | 352 | ||
351 | 353 | ||
352 | 354 | func LockParamsEntry (userAddress,userNum,amount,start,duration,k,b,period) = { | |
353 | 355 | let userAmountKEY = keyLockParamUserAmount(userNum) | |
354 | 356 | let startBlockKEY = keyLockParamStartBlock(userNum) | |
355 | 357 | let durationKEY = keyLockParamDuration(userNum) | |
356 | 358 | let kKEY = keyLockParamK(userNum) | |
357 | 359 | let bKEY = keyLockParamB(userNum) | |
358 | 360 | let kByPeriodKEY = keyLockParamByPeriodK(userNum, period) | |
359 | 361 | let bByPeriodKEY = keyLockParamByPeriodB(userNum, period) | |
360 | 362 | let gwxAmount = calcGwxAmount(k, b, height) | |
361 | 363 | [IntegerEntry(userAmountKEY, amount), IntegerEntry(startBlockKEY, start), IntegerEntry(durationKEY, duration), IntegerEntry(kKEY, k), IntegerEntry(bKEY, b), IntegerEntry(kByPeriodKEY, k), IntegerEntry(bByPeriodKEY, b), StringEntry(keyLockParamsRecord(userAddress), formatLockParamsRecord(userNum, amount, start, duration, k, b, gwxAmount))] | |
362 | 364 | } | |
363 | 365 | ||
364 | 366 | ||
365 | 367 | func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1)) | |
366 | 368 | then throw("only one payment is allowed") | |
367 | 369 | else if ((size(i.payments) == 0)) | |
368 | 370 | then 0 | |
369 | 371 | else { | |
370 | 372 | let pmt = i.payments[0] | |
371 | 373 | if ((value(pmt.assetId) != expectedAssetId)) | |
372 | 374 | then throw("invalid asset id in payment") | |
373 | 375 | else pmt.amount | |
374 | 376 | } | |
375 | 377 | ||
376 | 378 | ||
377 | 379 | func calcUserGwxAmountAtHeight (userAddress,targetHeight) = { | |
378 | 380 | let EMPTY = "empty" | |
379 | 381 | let user2NumMappingKEY = keyUser2NumMapping(userAddress) | |
380 | 382 | let userNum = valueOrElse(getString(user2NumMappingKEY), EMPTY) | |
381 | 383 | let k = valueOrElse(getInteger(keyLockParamK(userNum)), 0) | |
382 | 384 | let b = valueOrElse(getInteger(keyLockParamB(userNum)), 0) | |
383 | 385 | let gwxAmountCalc = calcGwxAmount(k, b, targetHeight) | |
384 | 386 | let gwxAmount = if ((0 > gwxAmountCalc)) | |
385 | 387 | then 0 | |
386 | 388 | else gwxAmountCalc | |
387 | 389 | gwxAmount | |
388 | 390 | } | |
389 | 391 | ||
390 | 392 | ||
391 | 393 | func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height) | |
392 | 394 | ||
393 | 395 | ||
394 | 396 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
395 | 397 | let EMPTY = "EMPTY" | |
396 | 398 | let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY) | |
397 | 399 | if ((userRecordOrEmpty == EMPTY)) | |
398 | 400 | then $Tuple3(0, nil, "userRecord::is::empty") | |
399 | 401 | else { | |
400 | 402 | let userRecordArray = split(userRecordOrEmpty, SEP) | |
401 | 403 | let userNumStr = userRecordArray[IdxLockUserNum] | |
402 | 404 | let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0) | |
403 | 405 | let EMPTYSTR = "empty" | |
404 | - | let $ | |
406 | + | let $t01496315531 = if ((lpAssetIdStr != EMPTYSTR)) | |
405 | 407 | then { | |
406 | 408 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
407 | 409 | let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
408 | 410 | let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1) | |
409 | 411 | $Tuple2(pw0, pw1) | |
410 | 412 | } | |
411 | 413 | else if (readOnly) | |
412 | 414 | then $Tuple2(0, 0) | |
413 | 415 | else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
414 | - | let poolWeight0 = $ | |
415 | - | let poolWeight1 = $ | |
416 | + | let poolWeight0 = $t01496315531._1 | |
417 | + | let poolWeight1 = $t01496315531._2 | |
416 | 418 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
417 | 419 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
418 | 420 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
419 | 421 | let h = if ((height > emissionEnd)) | |
420 | 422 | then emissionEnd | |
421 | 423 | else height | |
422 | 424 | let dh = max([(h - emissionStart), 0]) | |
423 | 425 | let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr) | |
424 | 426 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
425 | 427 | let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY)) | |
426 | 428 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
427 | 429 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
428 | 430 | let udh = fraction(userBoostEmissionIntegral, 3, (2 * wxEmissionPerBlock)) | |
429 | 431 | let uLastH = (h - udh) | |
430 | 432 | let udh0 = max([(gwxRewardEmissionStartHeight - uLastH), 0]) | |
431 | 433 | let udh1 = ((h - uLastH) - udh0) | |
432 | 434 | if (if (if ((0 > uLastH)) | |
433 | 435 | then true | |
434 | 436 | else (0 > udh1)) | |
435 | 437 | then true | |
436 | 438 | else (abs(((udh0 + udh1) - udh)) >= 1)) | |
437 | 439 | then throw(((((((("invalid udh calc: udh=" + toString(udh)) + " uLastH=") + toString(uLastH)) + " udh0=") + toString(udh0)) + " udh1=") + toString(udh1))) | |
438 | 440 | else if ((0 > userBoostEmissionIntegral)) | |
439 | 441 | then throw("wrong calculations") | |
440 | 442 | else { | |
441 | 443 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
442 | 444 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
443 | 445 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
444 | 446 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
445 | - | let | |
447 | + | let totalCachedGwxCorrected = getTotalCachedGwx(true) | |
446 | 448 | let userCurrGwx = calcCurrentGwxAmount(userAddressStr) | |
447 | 449 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
448 | 450 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
449 | 451 | let userBoostEmissionIntegral0 = if ((udh == 0)) | |
450 | 452 | then 0 | |
451 | 453 | else fraction(userBoostEmissionIntegral, udh0, udh) | |
452 | 454 | let userBoostEmissionIntegral1 = if ((udh == 0)) | |
453 | 455 | then 0 | |
454 | 456 | else fraction(userBoostEmissionIntegral, udh1, udh) | |
455 | 457 | let poolUserBoostEmissionIntegral0 = fraction(userBoostEmissionIntegral0, poolWeight0, POOLWEIGHTMULT) | |
456 | 458 | let poolUserBoostEmissionIntegral1 = fraction(userBoostEmissionIntegral1, poolWeight1, POOLWEIGHTMULT) | |
457 | - | let userBoostAvaliableToClaimTotalNew0 = if (( | |
459 | + | let userBoostAvaliableToClaimTotalNew0 = if ((totalCachedGwxCorrected == 0)) | |
458 | 460 | then 0 | |
459 | - | else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, | |
460 | - | let userBoostAvaliableToClaimTotalNew1 = if (( | |
461 | + | else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, totalCachedGwxCorrected) | |
462 | + | let userBoostAvaliableToClaimTotalNew1 = if ((totalCachedGwxCorrected == 0)) | |
461 | 463 | then 0 | |
462 | - | else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, | |
464 | + | else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, totalCachedGwxCorrected) | |
463 | 465 | let userBoostAvaliableToClaimTotalNew = (userBoostAvaliableToClaimTotalNew0 + userBoostAvaliableToClaimTotalNew1) | |
464 | 466 | let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr) | |
465 | 467 | let userBoostClaimed = ioz(this, userBoostClaimedKEY) | |
466 | 468 | let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed) | |
467 | 469 | let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] | |
468 | - | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(userBoostClaimed), toString(userBoostAvailable), toString(poolWeight0), toString(poolWeight1), toString(h), toString(udh), toString(uLastH), toString(udh0), toString(udh1), toString(userCurrGwx), toString( | |
470 | + | let debug = makeString([toString(userBoostEmissionLastIntegral), toString(userBoostEmissionIntegral), toString(userBoostClaimed), toString(userBoostAvailable), toString(poolWeight0), toString(poolWeight1), toString(h), toString(udh), toString(uLastH), toString(udh0), toString(udh1), toString(userCurrGwx), toString(totalCachedGwxCorrected)], ":") | |
469 | 471 | $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug) | |
470 | 472 | } | |
471 | 473 | } | |
472 | 474 | } | |
473 | 475 | ||
474 | 476 | ||
475 | 477 | func lockActions (i,duration) = { | |
476 | 478 | let cfgArray = readConfigArrayOrFail() | |
477 | 479 | let assetIdStr = cfgArray[IdxCfgAssetId] | |
478 | 480 | let assetId = fromBase58String(assetIdStr) | |
479 | 481 | let minLockAmount = parseIntValue(cfgArray[IdxCfgMinLockAmount]) | |
480 | 482 | let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration]) | |
481 | 483 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
482 | 484 | if ((size(i.payments) != 1)) | |
483 | 485 | then throw("invalid payment - exact one payment must be attached") | |
484 | 486 | else { | |
485 | 487 | let pmt = i.payments[0] | |
486 | 488 | let pmtAmount = pmt.amount | |
487 | 489 | if ((assetId != value(pmt.assetId))) | |
488 | 490 | then throw((("invalid asset is in payment - " + assetIdStr) + " is expected")) | |
489 | 491 | else { | |
490 | 492 | let nextUserNumKEY = keyNextUserNum() | |
491 | 493 | let userAddressStr = toString(i.caller) | |
492 | 494 | let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr))) | |
493 | 495 | let userNumStr = if (userIsExisting) | |
494 | 496 | then value(getString(keyUser2NumMapping(userAddressStr))) | |
495 | 497 | else toString(iof(this, nextUserNumKEY)) | |
496 | 498 | let userNum = parseIntValue(userNumStr) | |
497 | 499 | let lockStart = height | |
498 | 500 | let startBlockKEY = keyLockParamStartBlock(userNumStr) | |
499 | 501 | let durationKEY = keyLockParamDuration(userNumStr) | |
500 | 502 | let userAmountKEY = keyLockParamUserAmount(userNumStr) | |
501 | 503 | if ((minLockAmount > pmtAmount)) | |
502 | 504 | then throw(("amount is less then minLockAmount=" + toString(minLockAmount))) | |
503 | 505 | else if ((minLockDuration > duration)) | |
504 | 506 | then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration))) | |
505 | 507 | else if ((duration > maxLockDuration)) | |
506 | 508 | then throw(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
507 | 509 | else if (if (userIsExisting) | |
508 | 510 | then ((iof(this, startBlockKEY) + iof(this, durationKEY)) >= lockStart) | |
509 | 511 | else false) | |
510 | 512 | then throw("there is an active lock - consider to use increaseLock") | |
511 | 513 | else if ((ioz(this, userAmountKEY) > 0)) | |
512 | 514 | then throw(("there are locked WXs - consider to use increaseLock " + userAmountKEY)) | |
513 | 515 | else { | |
514 | 516 | let coeffX8 = fraction(duration, MULT8, maxLockDuration) | |
515 | 517 | let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8) | |
516 | 518 | let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStart, duration], nil)) | |
517 | 519 | let k = ai(gWxParamsResultList[0]) | |
518 | 520 | let b = ai(gWxParamsResultList[1]) | |
519 | 521 | let period = toString(ai(gWxParamsResultList[2])) | |
520 | 522 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
521 | 523 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
522 | 524 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
523 | 525 | let h = if ((height > emissionEnd)) | |
524 | 526 | then emissionEnd | |
525 | 527 | else height | |
526 | 528 | let dh = max([(h - emissionStart), 0]) | |
527 | 529 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
528 | 530 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
529 | 531 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
530 | 532 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
531 | 533 | let userMaxBoostInt = ((gWxAmountStart * duration) / 2) | |
532 | 534 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
533 | - | let | |
535 | + | let totalCachedGwxRaw = getTotalCachedGwx(false) | |
534 | 536 | let arr = if (userIsExisting) | |
535 | 537 | then nil | |
536 | 538 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
537 | 539 | $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
538 | 540 | then 0 | |
539 | - | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), ( | |
541 | + | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gWxAmountStart))]), gWxAmountStart) | |
540 | 542 | } | |
541 | 543 | } | |
542 | 544 | } | |
543 | 545 | } | |
544 | 546 | ||
545 | 547 | ||
546 | 548 | @Callable(i) | |
547 | 549 | func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = { | |
548 | 550 | let checkCaller = mustManager(i) | |
549 | 551 | if ((checkCaller == checkCaller)) | |
550 | 552 | then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0)) | |
551 | 553 | else throw("Strict value is not equal to itself.") | |
552 | 554 | } | |
553 | 555 | ||
554 | 556 | ||
555 | 557 | ||
556 | 558 | @Callable(i) | |
557 | 559 | func lockRef (duration,referrerAddress,signature) = { | |
558 | - | let $ | |
559 | - | let lockActionsResult = $ | |
560 | - | let gWxAmountStart = $ | |
560 | + | let $t02389023955 = lockActions(i, duration) | |
561 | + | let lockActionsResult = $t02389023955._1 | |
562 | + | let gWxAmountStart = $t02389023955._2 | |
561 | 563 | let referralAddress = toString(i.caller) | |
562 | 564 | let refInv = if (if ((referrerAddress == "")) | |
563 | 565 | then true | |
564 | 566 | else (signature == base58'')) | |
565 | 567 | then unit | |
566 | 568 | else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil) | |
567 | 569 | if ((refInv == refInv)) | |
568 | 570 | then { | |
569 | 571 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
570 | 572 | if ((updateRefActivity == updateRefActivity)) | |
571 | 573 | then $Tuple2(lockActionsResult, unit) | |
572 | 574 | else throw("Strict value is not equal to itself.") | |
573 | 575 | } | |
574 | 576 | else throw("Strict value is not equal to itself.") | |
575 | 577 | } | |
576 | 578 | ||
577 | 579 | ||
578 | 580 | ||
579 | 581 | @Callable(i) | |
580 | 582 | func lock (duration) = { | |
581 | - | let $ | |
582 | - | let lockActionsResult = $ | |
583 | - | let gWxAmountStart = $ | |
583 | + | let $t02441324478 = lockActions(i, duration) | |
584 | + | let lockActionsResult = $t02441324478._1 | |
585 | + | let gWxAmountStart = $t02441324478._2 | |
584 | 586 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
585 | 587 | if ((updateRefActivity == updateRefActivity)) | |
586 | 588 | then $Tuple2(lockActionsResult, unit) | |
587 | 589 | else throw("Strict value is not equal to itself.") | |
588 | 590 | } | |
589 | 591 | ||
590 | 592 | ||
591 | 593 | ||
592 | 594 | @Callable(i) | |
593 | 595 | func increaseLock (deltaDuration) = { | |
594 | 596 | let cfgArray = readConfigArrayOrFail() | |
595 | 597 | let assetIdStr = cfgArray[IdxCfgAssetId] | |
596 | 598 | let assetId = fromBase58String(assetIdStr) | |
597 | 599 | let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration]) | |
598 | 600 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
599 | 601 | let pmtAmount = extractOptionalPaymentAmountOrFail(i, assetId) | |
600 | 602 | let userAddressStr = toString(i.caller) | |
601 | 603 | let userRecordArray = readLockParamsRecordOrFail(userAddressStr) | |
602 | 604 | let userNumStr = userRecordArray[IdxLockUserNum] | |
603 | 605 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
604 | 606 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
605 | 607 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
606 | 608 | let lockEnd = (lockStart + lockDuration) | |
607 | 609 | let remainingDuration = max([(lockEnd - height), 0]) | |
608 | 610 | let userAmountNew = (userAmount + pmtAmount) | |
609 | 611 | let lockDurationNew = (remainingDuration + deltaDuration) | |
610 | 612 | if ((0 > deltaDuration)) | |
611 | 613 | then throw("duration is less then zero") | |
612 | 614 | else if ((minLockDuration > lockDurationNew)) | |
613 | 615 | then throw(("lockDurationNew is less then minLockDuration=" + toString(minLockDuration))) | |
614 | 616 | else if ((lockDurationNew > maxLockDuration)) | |
615 | 617 | then throw(("deltaDuration + existedLockDuration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
616 | 618 | else { | |
617 | 619 | let coeffX8 = fraction(lockDurationNew, MULT8, maxLockDuration) | |
618 | 620 | let gWxAmountStart = fraction(userAmountNew, coeffX8, MULT8) | |
619 | 621 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
620 | 622 | if ((updateRefActivity == updateRefActivity)) | |
621 | 623 | then { | |
622 | 624 | let lockStartNew = height | |
623 | 625 | let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStartNew, lockDurationNew], nil)) | |
624 | 626 | let k = ai(gWxParamsResultList[0]) | |
625 | 627 | let b = ai(gWxParamsResultList[1]) | |
626 | 628 | let period = toString(ai(gWxParamsResultList[2])) | |
627 | 629 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
628 | 630 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
629 | 631 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
630 | 632 | let h = if ((height > emissionEnd)) | |
631 | 633 | then emissionEnd | |
632 | 634 | else height | |
633 | 635 | let dh = max([(h - emissionStart), 0]) | |
634 | 636 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
635 | 637 | let userBoostEmissionLastIntegral = ioz(this, userBoostEmissionLastIntegralKEY) | |
636 | 638 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
637 | 639 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
638 | 640 | if ((0 > userBoostEmissionIntegral)) | |
639 | 641 | then throw("wrong calculations") | |
640 | 642 | else { | |
641 | 643 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
642 | 644 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
643 | 645 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
644 | 646 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
645 | 647 | let currUserGwx = calcCurrentGwxAmount(userAddressStr) | |
646 | 648 | let gwxDiff = (gWxAmountStart - currUserGwx) | |
647 | 649 | if ((0 > gwxDiff)) | |
648 | 650 | then throw(("gwxDiff is less then 0: " + toString(gwxDiff))) | |
649 | 651 | else { | |
650 | - | let totalCachedGwx = getTotalCachedGwx() | |
652 | + | let totalCachedGwxRaw = getTotalCachedGwx(false) | |
653 | + | let totalCachedGwxCorrected = getTotalCachedGwx(true) | |
651 | 654 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
652 | 655 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
653 | - | let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, | |
656 | + | let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwxCorrected) | |
654 | 657 | let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2) | |
655 | 658 | let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2) | |
656 | 659 | let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt) | |
657 | - | (((LockParamsEntry(userAddressStr, userNumStr, userAmountNew, lockStartNew, lockDurationNew, k, b, period) ++ StatsEntry(pmtAmount, deltaDuration, 0, 0)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, lockDurationNew, k, b, i)) ++ [IntegerEntry(keyTotalCachedGwx(), ( | |
660 | + | (((LockParamsEntry(userAddressStr, userNumStr, userAmountNew, lockStartNew, lockDurationNew, k, b, period) ++ StatsEntry(pmtAmount, deltaDuration, 0, 0)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, lockDurationNew, k, b, i)) ++ [IntegerEntry(keyTotalCachedGwx(), (totalCachedGwxRaw + gwxDiff))]) | |
658 | 661 | } | |
659 | 662 | } | |
660 | 663 | } | |
661 | 664 | else throw("Strict value is not equal to itself.") | |
662 | 665 | } | |
663 | 666 | } | |
664 | 667 | ||
665 | 668 | ||
666 | 669 | ||
667 | 670 | @Callable(i) | |
668 | 671 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
669 | 672 | then throw("permissions denied") | |
670 | 673 | else { | |
671 | - | let $ | |
672 | - | let userBoostAvailable = $ | |
673 | - | let dataState = $ | |
674 | - | let debug = $ | |
674 | + | let $t02945929561 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
675 | + | let userBoostAvailable = $t02945929561._1 | |
676 | + | let dataState = $t02945929561._2 | |
677 | + | let debug = $t02945929561._3 | |
675 | 678 | $Tuple2(dataState, [userBoostAvailable]) | |
676 | 679 | } | |
677 | 680 | ||
678 | 681 | ||
679 | 682 | ||
680 | 683 | @Callable(i) | |
681 | 684 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
682 | - | let $ | |
683 | - | let userBoostAvailable = $ | |
684 | - | let dataState = $ | |
685 | - | let debug = $ | |
685 | + | let $t02969329794 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
686 | + | let userBoostAvailable = $t02969329794._1 | |
687 | + | let dataState = $t02969329794._2 | |
688 | + | let debug = $t02969329794._3 | |
686 | 689 | $Tuple2(nil, [userBoostAvailable, debug]) | |
687 | 690 | } | |
688 | 691 | ||
689 | 692 | ||
690 | 693 | ||
691 | 694 | @Callable(i) | |
692 | 695 | func unlock (userAddress) = { | |
693 | 696 | let userRecordArray = readLockParamsRecordOrFail(userAddress) | |
694 | 697 | let userNumStr = userRecordArray[IdxLockUserNum] | |
695 | 698 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
696 | 699 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
697 | 700 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
698 | 701 | let lockEnd = (lockStart + lockDuration) | |
699 | 702 | let cfgArray = readConfigArrayOrFail() | |
700 | 703 | let assetId = fromBase58String(cfgArray[IdxCfgAssetId]) | |
701 | 704 | if ((lockEnd >= height)) | |
702 | 705 | then throw((("wait " + toString(lockEnd)) + " to unlock")) | |
703 | 706 | else if ((0 >= userAmount)) | |
704 | 707 | then throw("nothing to unlock") | |
705 | 708 | else { | |
706 | 709 | let period = valueOrElse(getInteger(mathContract, keyNextPeriod()), 0) | |
707 | 710 | (((LockParamsEntry(userAddress, userNumStr, 0, lockStart, lockDuration, 0, 0, toString(period)) ++ StatsEntry(-(userAmount), 0, 0, -1)) :+ HistoryEntry("unlock", userAddress, userAmount, lockStart, lockDuration, 0, 0, i)) :+ ScriptTransfer(addressFromStringValue(userAddress), userAmount, assetId)) | |
708 | 711 | } | |
709 | 712 | } | |
710 | 713 | ||
711 | 714 | ||
712 | 715 | ||
713 | 716 | @Callable(i) | |
714 | 717 | func gwxUserInfoREADONLY (userAddress) = { | |
715 | 718 | let gwxAmount = calcCurrentGwxAmount(userAddress) | |
716 | 719 | $Tuple2(nil, [gwxAmount]) | |
717 | 720 | } | |
718 | 721 | ||
719 | 722 | ||
720 | 723 | ||
721 | 724 | @Callable(i) | |
722 | 725 | func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = { | |
723 | 726 | let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight) | |
724 | 727 | $Tuple2(nil, gwxAmount) | |
725 | 728 | } | |
726 | 729 | ||
727 | 730 | ||
728 | 731 | ||
729 | 732 | @Callable(i) | |
730 | - | func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx()) | |
733 | + | func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx(true)) | |
731 | 734 | ||
732 | 735 | ||
733 | 736 | ||
734 | 737 | @Callable(i) | |
735 | 738 | func setManager (pendingManagerPublicKey) = { | |
736 | 739 | let checkCaller = mustManager(i) | |
737 | 740 | if ((checkCaller == checkCaller)) | |
738 | 741 | then { | |
739 | 742 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
740 | 743 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
741 | 744 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
742 | 745 | else throw("Strict value is not equal to itself.") | |
743 | 746 | } | |
744 | 747 | else throw("Strict value is not equal to itself.") | |
745 | 748 | } | |
746 | 749 | ||
747 | 750 | ||
748 | 751 | ||
749 | 752 | @Callable(i) | |
750 | 753 | func confirmManager () = { | |
751 | 754 | let pm = pendingManagerPublicKeyOrUnit() | |
752 | 755 | let hasPM = if (isDefined(pm)) | |
753 | 756 | then true | |
754 | 757 | else throw("No pending manager") | |
755 | 758 | if ((hasPM == hasPM)) | |
756 | 759 | then { | |
757 | 760 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
758 | 761 | then true | |
759 | 762 | else throw("You are not pending manager") | |
760 | 763 | if ((checkPM == checkPM)) | |
761 | 764 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
762 | 765 | else throw("Strict value is not equal to itself.") | |
763 | 766 | } | |
764 | 767 | else throw("Strict value is not equal to itself.") | |
765 | 768 | } | |
766 | 769 | ||
767 | 770 | ||
768 | 771 | @Verifier(tx) | |
769 | 772 | func verify () = { | |
770 | 773 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
771 | 774 | case pk: ByteVector => | |
772 | 775 | pk | |
773 | 776 | case _: Unit => | |
774 | 777 | tx.senderPublicKey | |
775 | 778 | case _ => | |
776 | 779 | throw("Match error") | |
777 | 780 | } | |
778 | 781 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
779 | 782 | } | |
780 | 783 |
github/deemru/w8io/026f985 101.22 ms ◑