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