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