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