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