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