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