tx · AvCLJowAAydmYuskxvj2EusRRvrZdzvmLnn2wurXzax8 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy: -0.02200000 Waves 2022.12.02 14:16 [2342652] smart account 3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy > SELF 0.00000000 Waves
{ "type": 13, "id": "AvCLJowAAydmYuskxvj2EusRRvrZdzvmLnn2wurXzax8", "fee": 2200000, "feeAssetId": null, "timestamp": 1669979808451, "version": 1, "sender": "3Myn55vLkduxbX3ZXfiDCZhaQsLxYp1kmCy", "senderPublicKey": "9W33iCCNfmFxUbiC6XZcH5x7f6xfwC7Jb3BoExT5q2PV", "proofs": [ "2eLSaaRCV9VRUDSt315XXUBH5tPknU8ZADbiQ5empibFnhQsRuCxaDRy3hdx6DU6CPVSvds3v74LjczW6ZEMsNns" ], "script": "base64:BgLFJAgCEggKBggIAQEBCBIFCgMBCAISAwoBARIDCgEBEgQKAggIEgQKAggIEgMKAQgSAwoBCBIECgIIARIAEgMKAQgSACIDU0VQIgZTQ0FMRTgiBU1VTFQ4Ig5QT09MV0VJR0hUTVVMVCIEc3RyZiIHYWRkcmVzcyIDa2V5IgNpb3oiA2lvZCIKZGVmYXVsdFZhbCIDaW9mIgNhYnMiA3ZhbCIDYWFsIgckbWF0Y2gwIgp2YWxBbnlMeXN0IgJhaSIGdmFsSW50IhtrZXlSZWZlcnJhbHNDb250cmFjdEFkZHJlc3MiHnJlZmVycmFsc0NvbnRyYWN0QWRkcmVzc09yRmFpbCIWa2V5UmVmZXJyYWxQcm9ncmFtTmFtZSIacmVmZXJyYWxQcm9ncmFtTmFtZURlZmF1bHQiE3JlZmVycmFsUHJvZ3JhbU5hbWUiEWtleUZhY3RvcnlBZGRyZXNzIhhJZHhGYWN0b3J5Q2ZnU3Rha2luZ0RhcHAiGUlkeEZhY3RvcnlDZmdCb29zdGluZ0RhcHAiFElkeEZhY3RvcnlDZmdJZG9EYXBwIhVJZHhGYWN0b3J5Q2ZnVGVhbUR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aXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4CYUQBDmNvbmZpcm1NYW5hZ2VyAAQCZWYJAQJhQgAEAmVnAwkBCWlzRGVmaW5lZAEFAmVmBgkAAgECEk5vIHBlbmRpbmcgbWFuYWdlcgMJAAACBQJlZwUCZWcEAmVoAwkAAAIIBQJhRA9jYWxsZXJQdWJsaWNLZXkJAQV2YWx1ZQEFAmVmBgkAAgECG1lvdSBhcmUgbm90IHBlbmRpbmcgbWFuYWdlcgMJAAACBQJlaAUCZWgJAMwIAgkBC1N0cmluZ0VudHJ5AgkBAmFjAAkA2AQBCQEFdmFsdWUBBQJlZgkAzAgCCQELRGVsZXRlRW50cnkBCQECYWQABQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAmVpAQJlagAEAmVrBAFvCQECYXoAAwkAAQIFAW8CCkJ5dGVWZWN0b3IEAmFGBQFvBQJhRgMJAAECBQFvAgRVbml0CAUCZWkPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmVpCWJvZHlCeXRlcwkAkQMCCAUCZWkGcHJvb2ZzAAAFAmVr1gmEPw==", "chainId": 84, "height": 2342652, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Au35qn3LW4ZRrqtPmTYt4Kxug4GDGtSvURfGQtthm8bZ Next: HV6rgNS8CSqUWPrvUQ8CFGXWCdxf6Q3KjYog82DcSQte Diff:
Old | New | Differences | |
---|---|---|---|
292 | 292 | func keyTotalCachedGwx () = "%s%s__gwxCached__total" | |
293 | 293 | ||
294 | 294 | ||
295 | + | func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective" | |
296 | + | ||
297 | + | ||
298 | + | func getTotalCachedGwx () = { | |
299 | + | let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0) | |
300 | + | let corrective = valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0) | |
301 | + | max([0, (totalCachedGwxRaw - corrective)]) | |
302 | + | } | |
303 | + | ||
304 | + | ||
295 | 305 | let factoryContract = readFactoryAddressOrFail() | |
296 | 306 | ||
297 | 307 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
380 | 390 | let userNumStr = userRecordArray[IdxLockUserNum] | |
381 | 391 | let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0) | |
382 | 392 | let EMPTYSTR = "empty" | |
383 | - | let $ | |
393 | + | let $t01428014848 = if ((lpAssetIdStr != EMPTYSTR)) | |
384 | 394 | then { | |
385 | 395 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
386 | 396 | let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
390 | 400 | else if (readOnly) | |
391 | 401 | then $Tuple2(0, 0) | |
392 | 402 | else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
393 | - | let poolWeight0 = $ | |
394 | - | let poolWeight1 = $ | |
403 | + | let poolWeight0 = $t01428014848._1 | |
404 | + | let poolWeight1 = $t01428014848._2 | |
395 | 405 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
396 | 406 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
397 | 407 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
421 | 431 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
422 | 432 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
423 | 433 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
424 | - | let totalCachedGwxKEY = keyTotalCachedGwx() | |
425 | - | let totalCachedGwx = valueOrElse(getInteger(this, totalCachedGwxKEY), 0) | |
434 | + | let totalCachedGwx = getTotalCachedGwx() | |
426 | 435 | let userCurrGwx = calcCurrentGwxAmount(userAddressStr) | |
427 | 436 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
428 | 437 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
510 | 519 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
511 | 520 | let userMaxBoostInt = ((gWxAmountStart * duration) / 2) | |
512 | 521 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
513 | - | let totalCachedGwxKEY = keyTotalCachedGwx() | |
514 | - | let totalCachedGwx = valueOrElse(getInteger(this, totalCachedGwxKEY), 0) | |
522 | + | let totalCachedGwx = getTotalCachedGwx() | |
515 | 523 | let arr = if (userIsExisting) | |
516 | 524 | then nil | |
517 | 525 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
518 | 526 | $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
519 | 527 | then 0 | |
520 | - | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry( | |
528 | + | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwx + gWxAmountStart))]), gWxAmountStart) | |
521 | 529 | } | |
522 | 530 | } | |
523 | 531 | } | |
536 | 544 | ||
537 | 545 | @Callable(i) | |
538 | 546 | func lockRef (duration,referrerAddress,signature) = { | |
539 | - | let $ | |
540 | - | let lockActionsResult = $ | |
541 | - | let gWxAmountStart = $ | |
547 | + | let $t02313823203 = lockActions(i, duration) | |
548 | + | let lockActionsResult = $t02313823203._1 | |
549 | + | let gWxAmountStart = $t02313823203._2 | |
542 | 550 | let referralAddress = toString(i.caller) | |
543 | 551 | let refInv = if (if ((referrerAddress == "")) | |
544 | 552 | then true | |
559 | 567 | ||
560 | 568 | @Callable(i) | |
561 | 569 | func lock (duration) = { | |
562 | - | let $ | |
563 | - | let lockActionsResult = $ | |
564 | - | let gWxAmountStart = $ | |
570 | + | let $t02366123726 = lockActions(i, duration) | |
571 | + | let lockActionsResult = $t02366123726._1 | |
572 | + | let gWxAmountStart = $t02366123726._2 | |
565 | 573 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
566 | 574 | if ((updateRefActivity == updateRefActivity)) | |
567 | 575 | then $Tuple2(lockActionsResult, unit) | |
628 | 636 | if ((0 > gwxDiff)) | |
629 | 637 | then throw(("gwxDiff is less then 0: " + toString(gwxDiff))) | |
630 | 638 | else { | |
631 | - | let totalCachedGwxKEY = keyTotalCachedGwx() | |
632 | - | let totalCachedGwx = valueOrElse(getInteger(this, totalCachedGwxKEY), 0) | |
639 | + | let totalCachedGwx = getTotalCachedGwx() | |
633 | 640 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
634 | 641 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
635 | 642 | let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwx) | |
636 | 643 | let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2) | |
637 | 644 | let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2) | |
638 | 645 | let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt) | |
639 | - | (((LockParamsEntry(userAddressStr, userNumStr, userAmountNew, lockStartNew, lockDurationNew, k, b, period) ++ StatsEntry(pmtAmount, deltaDuration, 0, 0)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, lockDurationNew, k, b, i)) ++ [IntegerEntry( | |
646 | + | (((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(), (totalCachedGwx + gwxDiff))]) | |
640 | 647 | } | |
641 | 648 | } | |
642 | 649 | } | |
650 | 657 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
651 | 658 | then throw("permissions denied") | |
652 | 659 | else { | |
653 | - | let $ | |
654 | - | let userBoostAvailable = $ | |
655 | - | let dataState = $ | |
656 | - | let debug = $ | |
660 | + | let $t02863128733 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
661 | + | let userBoostAvailable = $t02863128733._1 | |
662 | + | let dataState = $t02863128733._2 | |
663 | + | let debug = $t02863128733._3 | |
657 | 664 | $Tuple2(dataState, [userBoostAvailable]) | |
658 | 665 | } | |
659 | 666 | ||
661 | 668 | ||
662 | 669 | @Callable(i) | |
663 | 670 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
664 | - | let $ | |
665 | - | let userBoostAvailable = $ | |
666 | - | let dataState = $ | |
667 | - | let debug = $ | |
671 | + | let $t02886528966 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
672 | + | let userBoostAvailable = $t02886528966._1 | |
673 | + | let dataState = $t02886528966._2 | |
674 | + | let debug = $t02886528966._3 | |
668 | 675 | $Tuple2(nil, [userBoostAvailable, debug]) | |
669 | 676 | } | |
670 | 677 | ||
705 | 712 | let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight) | |
706 | 713 | $Tuple2(nil, gwxAmount) | |
707 | 714 | } | |
715 | + | ||
716 | + | ||
717 | + | ||
718 | + | @Callable(i) | |
719 | + | func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx()) | |
708 | 720 | ||
709 | 721 | ||
710 | 722 |
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 | + | func keyTotalCachedGwxCorrective () = "%s__gwxCachedTotalCorrective" | |
296 | + | ||
297 | + | ||
298 | + | func getTotalCachedGwx () = { | |
299 | + | let totalCachedGwxRaw = valueOrElse(getInteger(this, keyTotalCachedGwx()), 0) | |
300 | + | let corrective = valueOrElse(getInteger(this, keyTotalCachedGwxCorrective()), 0) | |
301 | + | max([0, (totalCachedGwxRaw - corrective)]) | |
302 | + | } | |
303 | + | ||
304 | + | ||
295 | 305 | let factoryContract = readFactoryAddressOrFail() | |
296 | 306 | ||
297 | 307 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
298 | 308 | ||
299 | 309 | let emissionContract = getEmissionAddressOrFail(factoryCfg) | |
300 | 310 | ||
301 | 311 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
302 | 312 | ||
303 | 313 | let gwxRewardContract = getGwxRewardAddressOrFail(factoryCfg) | |
304 | 314 | ||
305 | 315 | func HistoryEntry (type,user,amount,lockStart,duration,k,b,i) = { | |
306 | 316 | let historyKEY = makeString(["%s%s%s%s__history", type, user, toBase58String(i.transactionId)], SEP) | |
307 | 317 | 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) | |
308 | 318 | StringEntry(historyKEY, historyDATA) | |
309 | 319 | } | |
310 | 320 | ||
311 | 321 | ||
312 | 322 | func StatsEntry (totalLockedInc,durationInc,lockCountInc,usersCountInc) = { | |
313 | 323 | let locksDurationSumInBlocksKEY = keyStatsLocksDurationSumInBlocks() | |
314 | 324 | let locksCountKEY = keyStatsLocksCount() | |
315 | 325 | let usersCountKEY = keyStatsUsersCount() | |
316 | 326 | let totalAmountKEY = keyLockParamTotalAmount() | |
317 | 327 | let locksDurationSumInBlocks = ioz(this, locksDurationSumInBlocksKEY) | |
318 | 328 | let locksCount = ioz(this, locksCountKEY) | |
319 | 329 | let usersCount = ioz(this, usersCountKEY) | |
320 | 330 | let totalAmount = ioz(this, totalAmountKEY) | |
321 | 331 | [IntegerEntry(locksDurationSumInBlocksKEY, (locksDurationSumInBlocks + durationInc)), IntegerEntry(locksCountKEY, (locksCount + lockCountInc)), IntegerEntry(usersCountKEY, (usersCount + usersCountInc)), IntegerEntry(totalAmountKEY, (totalAmount + totalLockedInc))] | |
322 | 332 | } | |
323 | 333 | ||
324 | 334 | ||
325 | 335 | func calcGwxAmount (kRaw,bRaw,h) = { | |
326 | 336 | let SCALE = 1000 | |
327 | 337 | (((kRaw * h) + bRaw) / SCALE) | |
328 | 338 | } | |
329 | 339 | ||
330 | 340 | ||
331 | 341 | func LockParamsEntry (userAddress,userNum,amount,start,duration,k,b,period) = { | |
332 | 342 | let userAmountKEY = keyLockParamUserAmount(userNum) | |
333 | 343 | let startBlockKEY = keyLockParamStartBlock(userNum) | |
334 | 344 | let durationKEY = keyLockParamDuration(userNum) | |
335 | 345 | let kKEY = keyLockParamK(userNum) | |
336 | 346 | let bKEY = keyLockParamB(userNum) | |
337 | 347 | let kByPeriodKEY = keyLockParamByPeriodK(userNum, period) | |
338 | 348 | let bByPeriodKEY = keyLockParamByPeriodB(userNum, period) | |
339 | 349 | let gwxAmount = calcGwxAmount(k, b, height) | |
340 | 350 | [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))] | |
341 | 351 | } | |
342 | 352 | ||
343 | 353 | ||
344 | 354 | func extractOptionalPaymentAmountOrFail (i,expectedAssetId) = if ((size(i.payments) > 1)) | |
345 | 355 | then throw("only one payment is allowed") | |
346 | 356 | else if ((size(i.payments) == 0)) | |
347 | 357 | then 0 | |
348 | 358 | else { | |
349 | 359 | let pmt = i.payments[0] | |
350 | 360 | if ((value(pmt.assetId) != expectedAssetId)) | |
351 | 361 | then throw("invalid asset id in payment") | |
352 | 362 | else pmt.amount | |
353 | 363 | } | |
354 | 364 | ||
355 | 365 | ||
356 | 366 | func calcUserGwxAmountAtHeight (userAddress,targetHeight) = { | |
357 | 367 | let EMPTY = "empty" | |
358 | 368 | let user2NumMappingKEY = keyUser2NumMapping(userAddress) | |
359 | 369 | let userNum = valueOrElse(getString(user2NumMappingKEY), EMPTY) | |
360 | 370 | let k = valueOrElse(getInteger(keyLockParamK(userNum)), 0) | |
361 | 371 | let b = valueOrElse(getInteger(keyLockParamB(userNum)), 0) | |
362 | 372 | let gwxAmountCalc = calcGwxAmount(k, b, targetHeight) | |
363 | 373 | let gwxAmount = if ((0 > gwxAmountCalc)) | |
364 | 374 | then 0 | |
365 | 375 | else gwxAmountCalc | |
366 | 376 | gwxAmount | |
367 | 377 | } | |
368 | 378 | ||
369 | 379 | ||
370 | 380 | func calcCurrentGwxAmount (userAddress) = calcUserGwxAmountAtHeight(userAddress, height) | |
371 | 381 | ||
372 | 382 | ||
373 | 383 | func internalClaimWxBoost (lpAssetIdStr,userAddressStr,readOnly) = { | |
374 | 384 | let EMPTY = "EMPTY" | |
375 | 385 | let userRecordOrEmpty = valueOrElse(getString(this, keyLockParamsRecord(userAddressStr)), EMPTY) | |
376 | 386 | if ((userRecordOrEmpty == EMPTY)) | |
377 | 387 | then $Tuple3(0, nil, "userRecord::is::empty") | |
378 | 388 | else { | |
379 | 389 | let userRecordArray = split(userRecordOrEmpty, SEP) | |
380 | 390 | let userNumStr = userRecordArray[IdxLockUserNum] | |
381 | 391 | let gwxRewardEmissionStartHeight = valueOrElse(getInteger(gwxRewardContract, keyGwxRewardEmissionStartHeight()), 0) | |
382 | 392 | let EMPTYSTR = "empty" | |
383 | - | let $ | |
393 | + | let $t01428014848 = if ((lpAssetIdStr != EMPTYSTR)) | |
384 | 394 | then { | |
385 | 395 | let poolAddressStr = valueOrErrorMessage(getString(factoryContract, keyFactoryLp2AssetsMapping(lpAssetIdStr)), ("unsupported lp asset " + lpAssetIdStr)) | |
386 | 396 | let pw1 = getIntegerValue(factoryContract, keyFactoryPoolWeight(poolAddressStr)) | |
387 | 397 | let pw0 = valueOrElse(getInteger(factoryContract, keyFactoryPoolWeightHistory(poolAddressStr, 0)), pw1) | |
388 | 398 | $Tuple2(pw0, pw1) | |
389 | 399 | } | |
390 | 400 | else if (readOnly) | |
391 | 401 | then $Tuple2(0, 0) | |
392 | 402 | else throw(("not readonly mode: unsupported lp asset " + lpAssetIdStr)) | |
393 | - | let poolWeight0 = $ | |
394 | - | let poolWeight1 = $ | |
403 | + | let poolWeight0 = $t01428014848._1 | |
404 | + | let poolWeight1 = $t01428014848._2 | |
395 | 405 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
396 | 406 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
397 | 407 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
398 | 408 | let h = if ((height > emissionEnd)) | |
399 | 409 | then emissionEnd | |
400 | 410 | else height | |
401 | 411 | let dh = max([(h - emissionStart), 0]) | |
402 | 412 | let userLpBoostEmissionLastIntegralKEY = keyUserLpBoostEmissionLastINTEGRAL(userNumStr, lpAssetIdStr) | |
403 | 413 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
404 | 414 | let userBoostEmissionLastIntegral = valueOrElse(getInteger(this, userLpBoostEmissionLastIntegralKEY), ioz(this, userBoostEmissionLastIntegralKEY)) | |
405 | 415 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
406 | 416 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
407 | 417 | let udh = fraction(userBoostEmissionIntegral, 3, (2 * wxEmissionPerBlock)) | |
408 | 418 | let uLastH = (h - udh) | |
409 | 419 | let udh0 = max([(gwxRewardEmissionStartHeight - uLastH), 0]) | |
410 | 420 | let udh1 = ((h - uLastH) - udh0) | |
411 | 421 | if (if (if ((0 > uLastH)) | |
412 | 422 | then true | |
413 | 423 | else (0 > udh1)) | |
414 | 424 | then true | |
415 | 425 | else (abs(((udh0 + udh1) - udh)) >= 1)) | |
416 | 426 | then throw(((((((("invalid udh calc: udh=" + toString(udh)) + " uLastH=") + toString(uLastH)) + " udh0=") + toString(udh0)) + " udh1=") + toString(udh1))) | |
417 | 427 | else if ((0 > userBoostEmissionIntegral)) | |
418 | 428 | then throw("wrong calculations") | |
419 | 429 | else { | |
420 | 430 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
421 | 431 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
422 | 432 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
423 | 433 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
424 | - | let totalCachedGwxKEY = keyTotalCachedGwx() | |
425 | - | let totalCachedGwx = valueOrElse(getInteger(this, totalCachedGwxKEY), 0) | |
434 | + | let totalCachedGwx = getTotalCachedGwx() | |
426 | 435 | let userCurrGwx = calcCurrentGwxAmount(userAddressStr) | |
427 | 436 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
428 | 437 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
429 | 438 | let userBoostEmissionIntegral0 = if ((udh == 0)) | |
430 | 439 | then 0 | |
431 | 440 | else fraction(userBoostEmissionIntegral, udh0, udh) | |
432 | 441 | let userBoostEmissionIntegral1 = if ((udh == 0)) | |
433 | 442 | then 0 | |
434 | 443 | else fraction(userBoostEmissionIntegral, udh1, udh) | |
435 | 444 | let poolUserBoostEmissionIntegral0 = fraction(userBoostEmissionIntegral0, poolWeight0, POOLWEIGHTMULT) | |
436 | 445 | let poolUserBoostEmissionIntegral1 = fraction(userBoostEmissionIntegral1, poolWeight1, POOLWEIGHTMULT) | |
437 | 446 | let userBoostAvaliableToClaimTotalNew0 = if ((totalCachedGwx == 0)) | |
438 | 447 | then 0 | |
439 | 448 | else fraction(poolUserBoostEmissionIntegral0, userCurrGwx, totalCachedGwx) | |
440 | 449 | let userBoostAvaliableToClaimTotalNew1 = if ((totalCachedGwx == 0)) | |
441 | 450 | then 0 | |
442 | 451 | else fraction(poolUserBoostEmissionIntegral1, userCurrGwx, totalCachedGwx) | |
443 | 452 | let userBoostAvaliableToClaimTotalNew = (userBoostAvaliableToClaimTotalNew0 + userBoostAvaliableToClaimTotalNew1) | |
444 | 453 | let userBoostClaimedKEY = keyUserBoostClaimed(userNumStr) | |
445 | 454 | let userBoostClaimed = ioz(this, userBoostClaimedKEY) | |
446 | 455 | let userBoostAvailable = (userBoostAvaliableToClaimTotalNew - userBoostClaimed) | |
447 | 456 | let dataState = [IntegerEntry(userLpBoostEmissionLastIntegralKEY, boostEmissionIntegral)] | |
448 | 457 | 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(totalCachedGwx)], ":") | |
449 | 458 | $Tuple3(userBoostAvaliableToClaimTotalNew, dataState, debug) | |
450 | 459 | } | |
451 | 460 | } | |
452 | 461 | } | |
453 | 462 | ||
454 | 463 | ||
455 | 464 | func lockActions (i,duration) = { | |
456 | 465 | let cfgArray = readConfigArrayOrFail() | |
457 | 466 | let assetIdStr = cfgArray[IdxCfgAssetId] | |
458 | 467 | let assetId = fromBase58String(assetIdStr) | |
459 | 468 | let minLockAmount = parseIntValue(cfgArray[IdxCfgMinLockAmount]) | |
460 | 469 | let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration]) | |
461 | 470 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
462 | 471 | if ((size(i.payments) != 1)) | |
463 | 472 | then throw("invalid payment - exact one payment must be attached") | |
464 | 473 | else { | |
465 | 474 | let pmt = i.payments[0] | |
466 | 475 | let pmtAmount = pmt.amount | |
467 | 476 | if ((assetId != value(pmt.assetId))) | |
468 | 477 | then throw((("invalid asset is in payment - " + assetIdStr) + " is expected")) | |
469 | 478 | else { | |
470 | 479 | let nextUserNumKEY = keyNextUserNum() | |
471 | 480 | let userAddressStr = toString(i.caller) | |
472 | 481 | let userIsExisting = isDefined(getString(keyUser2NumMapping(userAddressStr))) | |
473 | 482 | let userNumStr = if (userIsExisting) | |
474 | 483 | then value(getString(keyUser2NumMapping(userAddressStr))) | |
475 | 484 | else toString(iof(this, nextUserNumKEY)) | |
476 | 485 | let userNum = parseIntValue(userNumStr) | |
477 | 486 | let lockStart = height | |
478 | 487 | let startBlockKEY = keyLockParamStartBlock(userNumStr) | |
479 | 488 | let durationKEY = keyLockParamDuration(userNumStr) | |
480 | 489 | let userAmountKEY = keyLockParamUserAmount(userNumStr) | |
481 | 490 | if ((minLockAmount > pmtAmount)) | |
482 | 491 | then throw(("amount is less then minLockAmount=" + toString(minLockAmount))) | |
483 | 492 | else if ((minLockDuration > duration)) | |
484 | 493 | then throw(("passed duration is less then minLockDuration=" + toString(minLockDuration))) | |
485 | 494 | else if ((duration > maxLockDuration)) | |
486 | 495 | then throw(("passed duration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
487 | 496 | else if (if (userIsExisting) | |
488 | 497 | then ((iof(this, startBlockKEY) + iof(this, durationKEY)) >= lockStart) | |
489 | 498 | else false) | |
490 | 499 | then throw("there is an active lock - consider to use increaseLock") | |
491 | 500 | else if ((ioz(this, userAmountKEY) > 0)) | |
492 | 501 | then throw(("there are locked WXs - consider to use increaseLock " + userAmountKEY)) | |
493 | 502 | else { | |
494 | 503 | let coeffX8 = fraction(duration, MULT8, maxLockDuration) | |
495 | 504 | let gWxAmountStart = fraction(pmtAmount, coeffX8, MULT8) | |
496 | 505 | let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStart, duration], nil)) | |
497 | 506 | let k = ai(gWxParamsResultList[0]) | |
498 | 507 | let b = ai(gWxParamsResultList[1]) | |
499 | 508 | let period = toString(ai(gWxParamsResultList[2])) | |
500 | 509 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
501 | 510 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
502 | 511 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
503 | 512 | let h = if ((height > emissionEnd)) | |
504 | 513 | then emissionEnd | |
505 | 514 | else height | |
506 | 515 | let dh = max([(h - emissionStart), 0]) | |
507 | 516 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
508 | 517 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
509 | 518 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
510 | 519 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
511 | 520 | let userMaxBoostInt = ((gWxAmountStart * duration) / 2) | |
512 | 521 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
513 | - | let totalCachedGwxKEY = keyTotalCachedGwx() | |
514 | - | let totalCachedGwx = valueOrElse(getInteger(this, totalCachedGwxKEY), 0) | |
522 | + | let totalCachedGwx = getTotalCachedGwx() | |
515 | 523 | let arr = if (userIsExisting) | |
516 | 524 | then nil | |
517 | 525 | else [IntegerEntry(nextUserNumKEY, (userNum + 1)), StringEntry(keyUser2NumMapping(userAddressStr), userNumStr), StringEntry(keyNum2UserMapping(userNumStr), userAddressStr)] | |
518 | 526 | $Tuple2(((((arr ++ LockParamsEntry(userAddressStr, userNumStr, pmtAmount, lockStart, duration, k, b, period)) ++ StatsEntry(pmtAmount, duration, 1, if (userIsExisting) | |
519 | 527 | then 0 | |
520 | - | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry( | |
528 | + | else 1)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, duration, k, b, i)) ++ [IntegerEntry(userBoostEmissionLastIntegralKEY, boostEmissionIntegral), IntegerEntry(keyTotalCachedGwx(), (totalCachedGwx + gWxAmountStart))]), gWxAmountStart) | |
521 | 529 | } | |
522 | 530 | } | |
523 | 531 | } | |
524 | 532 | } | |
525 | 533 | ||
526 | 534 | ||
527 | 535 | @Callable(i) | |
528 | 536 | func constructor (factoryAddressStr,lockAssetIdStr,minLockAmount,minDuration,maxDuration,mathContract) = { | |
529 | 537 | let checkCaller = mustManager(i) | |
530 | 538 | if ((checkCaller == checkCaller)) | |
531 | 539 | then ([IntegerEntry(keyNextUserNum(), 0), StringEntry(keyConfig(), formatConfig(lockAssetIdStr, minLockAmount, minDuration, maxDuration, mathContract)), StringEntry(keyFactoryAddress(), factoryAddressStr)] ++ StatsEntry(0, 0, 0, 0)) | |
532 | 540 | else throw("Strict value is not equal to itself.") | |
533 | 541 | } | |
534 | 542 | ||
535 | 543 | ||
536 | 544 | ||
537 | 545 | @Callable(i) | |
538 | 546 | func lockRef (duration,referrerAddress,signature) = { | |
539 | - | let $ | |
540 | - | let lockActionsResult = $ | |
541 | - | let gWxAmountStart = $ | |
547 | + | let $t02313823203 = lockActions(i, duration) | |
548 | + | let lockActionsResult = $t02313823203._1 | |
549 | + | let gWxAmountStart = $t02313823203._2 | |
542 | 550 | let referralAddress = toString(i.caller) | |
543 | 551 | let refInv = if (if ((referrerAddress == "")) | |
544 | 552 | then true | |
545 | 553 | else (signature == base58'')) | |
546 | 554 | then unit | |
547 | 555 | else invoke(referralsContractAddressOrFail, "createPair", [referralProgramName, referrerAddress, referralAddress, signature], nil) | |
548 | 556 | if ((refInv == refInv)) | |
549 | 557 | then { | |
550 | 558 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
551 | 559 | if ((updateRefActivity == updateRefActivity)) | |
552 | 560 | then $Tuple2(lockActionsResult, unit) | |
553 | 561 | else throw("Strict value is not equal to itself.") | |
554 | 562 | } | |
555 | 563 | else throw("Strict value is not equal to itself.") | |
556 | 564 | } | |
557 | 565 | ||
558 | 566 | ||
559 | 567 | ||
560 | 568 | @Callable(i) | |
561 | 569 | func lock (duration) = { | |
562 | - | let $ | |
563 | - | let lockActionsResult = $ | |
564 | - | let gWxAmountStart = $ | |
570 | + | let $t02366123726 = lockActions(i, duration) | |
571 | + | let lockActionsResult = $t02366123726._1 | |
572 | + | let gWxAmountStart = $t02366123726._2 | |
565 | 573 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
566 | 574 | if ((updateRefActivity == updateRefActivity)) | |
567 | 575 | then $Tuple2(lockActionsResult, unit) | |
568 | 576 | else throw("Strict value is not equal to itself.") | |
569 | 577 | } | |
570 | 578 | ||
571 | 579 | ||
572 | 580 | ||
573 | 581 | @Callable(i) | |
574 | 582 | func increaseLock (deltaDuration) = { | |
575 | 583 | let cfgArray = readConfigArrayOrFail() | |
576 | 584 | let assetIdStr = cfgArray[IdxCfgAssetId] | |
577 | 585 | let assetId = fromBase58String(assetIdStr) | |
578 | 586 | let minLockDuration = parseIntValue(cfgArray[IdxCfgMinLockDuration]) | |
579 | 587 | let maxLockDuration = parseIntValue(cfgArray[IdxCfgMaxLockDuration]) | |
580 | 588 | let pmtAmount = extractOptionalPaymentAmountOrFail(i, assetId) | |
581 | 589 | let userAddressStr = toString(i.caller) | |
582 | 590 | let userRecordArray = readLockParamsRecordOrFail(userAddressStr) | |
583 | 591 | let userNumStr = userRecordArray[IdxLockUserNum] | |
584 | 592 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
585 | 593 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
586 | 594 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
587 | 595 | let lockEnd = (lockStart + lockDuration) | |
588 | 596 | let remainingDuration = max([(lockEnd - height), 0]) | |
589 | 597 | let userAmountNew = (userAmount + pmtAmount) | |
590 | 598 | let lockDurationNew = (remainingDuration + deltaDuration) | |
591 | 599 | if ((0 > deltaDuration)) | |
592 | 600 | then throw("duration is less then zero") | |
593 | 601 | else if ((minLockDuration > lockDurationNew)) | |
594 | 602 | then throw(("lockDurationNew is less then minLockDuration=" + toString(minLockDuration))) | |
595 | 603 | else if ((lockDurationNew > maxLockDuration)) | |
596 | 604 | then throw(("deltaDuration + existedLockDuration is greater then maxLockDuration=" + toString(maxLockDuration))) | |
597 | 605 | else { | |
598 | 606 | let coeffX8 = fraction(lockDurationNew, MULT8, maxLockDuration) | |
599 | 607 | let gWxAmountStart = fraction(userAmountNew, coeffX8, MULT8) | |
600 | 608 | let updateRefActivity = invoke(mathContract, "updateReferralActivity", [toString(i.caller), gWxAmountStart], nil) | |
601 | 609 | if ((updateRefActivity == updateRefActivity)) | |
602 | 610 | then { | |
603 | 611 | let lockStartNew = height | |
604 | 612 | let gWxParamsResultList = aal(invoke(mathContract, "calcGwxParamsREADONLY", [gWxAmountStart, lockStartNew, lockDurationNew], nil)) | |
605 | 613 | let k = ai(gWxParamsResultList[0]) | |
606 | 614 | let b = ai(gWxParamsResultList[1]) | |
607 | 615 | let period = toString(ai(gWxParamsResultList[2])) | |
608 | 616 | let wxEmissionPerBlock = iof(emissionContract, keyEmissionRatePerBlockCurrent()) | |
609 | 617 | let emissionStart = iof(emissionContract, keyEmissionStartBlock()) | |
610 | 618 | let emissionEnd = iof(emissionContract, keyEmissionEndBlock()) | |
611 | 619 | let h = if ((height > emissionEnd)) | |
612 | 620 | then emissionEnd | |
613 | 621 | else height | |
614 | 622 | let dh = max([(h - emissionStart), 0]) | |
615 | 623 | let userBoostEmissionLastIntegralKEY = keyUserBoostEmissionLastINTEGRAL(userNumStr) | |
616 | 624 | let userBoostEmissionLastIntegral = ioz(this, userBoostEmissionLastIntegralKEY) | |
617 | 625 | let boostEmissionIntegral = (((wxEmissionPerBlock * dh) * 2) / 3) | |
618 | 626 | let userBoostEmissionIntegral = (boostEmissionIntegral - userBoostEmissionLastIntegral) | |
619 | 627 | if ((0 > userBoostEmissionIntegral)) | |
620 | 628 | then throw("wrong calculations") | |
621 | 629 | else { | |
622 | 630 | let userMaxBoostIntegralKEY = keyUserMaxBoostINTEGRAL(userNumStr) | |
623 | 631 | let totalMaxBoostIntegralKEY = keyTotalMaxBoostINTEGRAL() | |
624 | 632 | let userMaxBoostInt = ioz(this, userMaxBoostIntegralKEY) | |
625 | 633 | let totalMaxBoostInt = ioz(this, totalMaxBoostIntegralKEY) | |
626 | 634 | let currUserGwx = calcCurrentGwxAmount(userAddressStr) | |
627 | 635 | let gwxDiff = (gWxAmountStart - currUserGwx) | |
628 | 636 | if ((0 > gwxDiff)) | |
629 | 637 | then throw(("gwxDiff is less then 0: " + toString(gwxDiff))) | |
630 | 638 | else { | |
631 | - | let totalCachedGwxKEY = keyTotalCachedGwx() | |
632 | - | let totalCachedGwx = valueOrElse(getInteger(this, totalCachedGwxKEY), 0) | |
639 | + | let totalCachedGwx = getTotalCachedGwx() | |
633 | 640 | let userBoostAvalaibleToClaimTotalKEY = keyUserBoostAvalaibleToClaimTotal(userNumStr) | |
634 | 641 | let userBoostAvaliableToClaimTotal = ioz(this, userBoostAvalaibleToClaimTotalKEY) | |
635 | 642 | let userBoostAvaliableToClaimTotalNew = fraction(userBoostEmissionIntegral, currUserGwx, totalCachedGwx) | |
636 | 643 | let userMaxBoostIntNew = ((gWxAmountStart * lockDurationNew) / 2) | |
637 | 644 | let remainingUserMaxBoostInt = ((currUserGwx * remainingDuration) / 2) | |
638 | 645 | let userMaxBoostIntDiff = (userMaxBoostIntNew - remainingUserMaxBoostInt) | |
639 | - | (((LockParamsEntry(userAddressStr, userNumStr, userAmountNew, lockStartNew, lockDurationNew, k, b, period) ++ StatsEntry(pmtAmount, deltaDuration, 0, 0)) :+ HistoryEntry("lock", userAddressStr, pmtAmount, lockStart, lockDurationNew, k, b, i)) ++ [IntegerEntry( | |
646 | + | (((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(), (totalCachedGwx + gwxDiff))]) | |
640 | 647 | } | |
641 | 648 | } | |
642 | 649 | } | |
643 | 650 | else throw("Strict value is not equal to itself.") | |
644 | 651 | } | |
645 | 652 | } | |
646 | 653 | ||
647 | 654 | ||
648 | 655 | ||
649 | 656 | @Callable(i) | |
650 | 657 | func claimWxBoost (lpAssetIdStr,userAddressStr) = if ((stakingContract != i.caller)) | |
651 | 658 | then throw("permissions denied") | |
652 | 659 | else { | |
653 | - | let $ | |
654 | - | let userBoostAvailable = $ | |
655 | - | let dataState = $ | |
656 | - | let debug = $ | |
660 | + | let $t02863128733 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, false) | |
661 | + | let userBoostAvailable = $t02863128733._1 | |
662 | + | let dataState = $t02863128733._2 | |
663 | + | let debug = $t02863128733._3 | |
657 | 664 | $Tuple2(dataState, [userBoostAvailable]) | |
658 | 665 | } | |
659 | 666 | ||
660 | 667 | ||
661 | 668 | ||
662 | 669 | @Callable(i) | |
663 | 670 | func claimWxBoostREADONLY (lpAssetIdStr,userAddressStr) = { | |
664 | - | let $ | |
665 | - | let userBoostAvailable = $ | |
666 | - | let dataState = $ | |
667 | - | let debug = $ | |
671 | + | let $t02886528966 = internalClaimWxBoost(lpAssetIdStr, userAddressStr, true) | |
672 | + | let userBoostAvailable = $t02886528966._1 | |
673 | + | let dataState = $t02886528966._2 | |
674 | + | let debug = $t02886528966._3 | |
668 | 675 | $Tuple2(nil, [userBoostAvailable, debug]) | |
669 | 676 | } | |
670 | 677 | ||
671 | 678 | ||
672 | 679 | ||
673 | 680 | @Callable(i) | |
674 | 681 | func unlock (userAddress) = { | |
675 | 682 | let userRecordArray = readLockParamsRecordOrFail(userAddress) | |
676 | 683 | let userNumStr = userRecordArray[IdxLockUserNum] | |
677 | 684 | let userAmount = parseIntValue(userRecordArray[IdxLockAmount]) | |
678 | 685 | let lockStart = parseIntValue(userRecordArray[IdxLockStart]) | |
679 | 686 | let lockDuration = parseIntValue(userRecordArray[IdxLockDuration]) | |
680 | 687 | let lockEnd = (lockStart + lockDuration) | |
681 | 688 | let cfgArray = readConfigArrayOrFail() | |
682 | 689 | let assetId = fromBase58String(cfgArray[IdxCfgAssetId]) | |
683 | 690 | if ((lockEnd >= height)) | |
684 | 691 | then throw((("wait " + toString(lockEnd)) + " to unlock")) | |
685 | 692 | else if ((0 >= userAmount)) | |
686 | 693 | then throw("nothing to unlock") | |
687 | 694 | else { | |
688 | 695 | let period = valueOrElse(getInteger(mathContract, keyNextPeriod()), 0) | |
689 | 696 | (((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)) | |
690 | 697 | } | |
691 | 698 | } | |
692 | 699 | ||
693 | 700 | ||
694 | 701 | ||
695 | 702 | @Callable(i) | |
696 | 703 | func gwxUserInfoREADONLY (userAddress) = { | |
697 | 704 | let gwxAmount = calcCurrentGwxAmount(userAddress) | |
698 | 705 | $Tuple2(nil, [gwxAmount]) | |
699 | 706 | } | |
700 | 707 | ||
701 | 708 | ||
702 | 709 | ||
703 | 710 | @Callable(i) | |
704 | 711 | func getUserGwxAmountAtHeightREADONLY (userAddress,targetHeight) = { | |
705 | 712 | let gwxAmount = calcUserGwxAmountAtHeight(userAddress, targetHeight) | |
706 | 713 | $Tuple2(nil, gwxAmount) | |
707 | 714 | } | |
715 | + | ||
716 | + | ||
717 | + | ||
718 | + | @Callable(i) | |
719 | + | func getTotalCachedGwxREADONLY () = $Tuple2(nil, getTotalCachedGwx()) | |
708 | 720 | ||
709 | 721 | ||
710 | 722 | ||
711 | 723 | @Callable(i) | |
712 | 724 | func setManager (pendingManagerPublicKey) = { | |
713 | 725 | let checkCaller = mustManager(i) | |
714 | 726 | if ((checkCaller == checkCaller)) | |
715 | 727 | then { | |
716 | 728 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
717 | 729 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
718 | 730 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
719 | 731 | else throw("Strict value is not equal to itself.") | |
720 | 732 | } | |
721 | 733 | else throw("Strict value is not equal to itself.") | |
722 | 734 | } | |
723 | 735 | ||
724 | 736 | ||
725 | 737 | ||
726 | 738 | @Callable(i) | |
727 | 739 | func confirmManager () = { | |
728 | 740 | let pm = pendingManagerPublicKeyOrUnit() | |
729 | 741 | let hasPM = if (isDefined(pm)) | |
730 | 742 | then true | |
731 | 743 | else throw("No pending manager") | |
732 | 744 | if ((hasPM == hasPM)) | |
733 | 745 | then { | |
734 | 746 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
735 | 747 | then true | |
736 | 748 | else throw("You are not pending manager") | |
737 | 749 | if ((checkPM == checkPM)) | |
738 | 750 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
739 | 751 | else throw("Strict value is not equal to itself.") | |
740 | 752 | } | |
741 | 753 | else throw("Strict value is not equal to itself.") | |
742 | 754 | } | |
743 | 755 | ||
744 | 756 | ||
745 | 757 | @Verifier(tx) | |
746 | 758 | func verify () = { | |
747 | 759 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
748 | 760 | case pk: ByteVector => | |
749 | 761 | pk | |
750 | 762 | case _: Unit => | |
751 | 763 | tx.senderPublicKey | |
752 | 764 | case _ => | |
753 | 765 | throw("Match error") | |
754 | 766 | } | |
755 | 767 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
756 | 768 | } | |
757 | 769 |
github/deemru/w8io/169f3d6 101.72 ms ◑