tx · GGrxUtyWStFqoWpfsizaH2df2wUuz1wdjQGdkBjksJVx 3N9Zi6AcWcGbM23jQJ4fnzFsoHoTsxYDznr: -0.02700000 Waves 2024.04.17 09:39 [3066422] smart account 3N9Zi6AcWcGbM23jQJ4fnzFsoHoTsxYDznr > SELF 0.00000000 Waves
{ "type": 13, "id": "GGrxUtyWStFqoWpfsizaH2df2wUuz1wdjQGdkBjksJVx", "fee": 2700000, "feeAssetId": null, "timestamp": 1713335985603, "version": 2, "chainId": 84, "sender": "3N9Zi6AcWcGbM23jQJ4fnzFsoHoTsxYDznr", "senderPublicKey": "GFbasS3jufhZkK4xR7tdTjjnP8K33KvJFEDHRtxXDkaJ", "proofs": [ "3g4rQKcH5hmFVTW3F7q6PXUFaBiBiCgKMaSQMA1JR9qW6ZJjHKdAJYNxThsrxgQrKVmBB4GcDjpGnoxtRJivPW6o" ], "script": "base64:BgKtGggCEgQKAggBEgcKBQgICAgBEgQKAggIEgUKAwgIARIECgIICBIDCgEBEgMKAQESAwoBCBIECgIICBIECgIIBBIAEgMKAQESABIECgIICBIECgIICBIECgIICBIAEgQKAggIEgQKAggIIglzZXBhcmF0b3IiDnBvb2xXZWlnaHRNdWx0Ig9tYXhEZXB0aERlZmF1bHQiGWZpbmFsaXphdGlvblN0YWdlQmFsYW5jZXMiFmZpbmFsaXphdGlvblN0YWdlVG90YWwiF2ZpbmFsaXphdGlvblN0YWdlU2hhcmVzIhRyZXN1bXB0aW9uRmVlRGVmYXVsdCIOa2V5RXBvY2hMZW5ndGgiEWtleUVwb2NoTGVuZ3RoTmV3IhVrZXlFcG9jaExlbmd0aEJ5RXBvY2giBWVwb2NoIg9rZXlDdXJyZW50RXBvY2giC2tleU1heERlcHRoIhBrZXlSZXN1bXB0aW9uRmVlIiJrZXlWb3RpbmdFbWlzc2lvbkNhbmRpZGF0ZUNvbnRyYWN0Ih1rZXlWb3RpbmdFbWlzc2lvblJhdGVDb250cmFjdCISa2V5RmFjdG9yeUNvbnRyYWN0I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QJjWg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCY1oJYm9keUJ5dGVzCQCRAwIIBQJjWgZwcm9vZnMAAAUCZGIAx6uQ", "height": 3066422, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Gf6pwhR3UYk3PnoMQGNGJTH1ioev6wyS3FTEY5qj9AC3 Next: GSPTD42ZfJuujPW4kMVGFUbmJF82gZzGM2p1WJ26e4mc Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let maxDepthDefault = 10 | |
9 | 9 | ||
10 | - | let | |
10 | + | let finalizationStageBalances = 0 | |
11 | 11 | ||
12 | - | let finalizationStageShares = 1 | |
12 | + | let finalizationStageTotal = 1 | |
13 | + | ||
14 | + | let finalizationStageShares = 2 | |
15 | + | ||
16 | + | let resumptionFeeDefault = 500000000000 | |
13 | 17 | ||
14 | 18 | let keyEpochLength = makeString(["%s", "epochLength"], separator) | |
15 | 19 | ||
21 | 25 | let keyCurrentEpoch = makeString(["%s", "currentEpoch"], separator) | |
22 | 26 | ||
23 | 27 | let keyMaxDepth = makeString(["%s", "maxDepth"], separator) | |
28 | + | ||
29 | + | let keyResumptionFee = makeString(["%s", "resumptionFee"], separator) | |
24 | 30 | ||
25 | 31 | let keyVotingEmissionCandidateContract = makeString(["%s", "votingEmissionCandidateContract"], separator) | |
26 | 32 | ||
55 | 61 | ||
56 | 62 | ||
57 | 63 | func keyInList (pool) = { | |
58 | - | let $ | |
59 | - | let amountAssetId = $ | |
60 | - | let priceAssetId = $ | |
64 | + | let $t020132053 = pool | |
65 | + | let amountAssetId = $t020132053._1 | |
66 | + | let priceAssetId = $t020132053._2 | |
61 | 67 | makeString(["%s%s%s", "inList", amountAssetId, priceAssetId], separator) | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | func keyInsufficientBalances (pool,epoch) = { | |
72 | + | let $t022022242 = pool | |
73 | + | let amountAssetId = $t022022242._1 | |
74 | + | let priceAssetId = $t022022242._2 | |
75 | + | makeString(["%s%s%s%d", "insufficientBalances", amountAssetId, priceAssetId, toString(epoch)], separator) | |
62 | 76 | } | |
63 | 77 | ||
64 | 78 | ||
66 | 80 | ||
67 | 81 | ||
68 | 82 | func keyVote (pool,address,epoch) = { | |
69 | - | let $ | |
70 | - | let amountAssetId = $ | |
71 | - | let priceAssetId = $ | |
83 | + | let $t025502590 = pool | |
84 | + | let amountAssetId = $t025502590._1 | |
85 | + | let priceAssetId = $t025502590._2 | |
72 | 86 | makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], separator) | |
73 | 87 | } | |
74 | 88 | ||
75 | 89 | ||
76 | 90 | func keyVotingResult (pool,epoch) = { | |
77 | - | let $ | |
78 | - | let amountAssetId = $ | |
79 | - | let priceAssetId = $ | |
91 | + | let $t027722812 = pool | |
92 | + | let amountAssetId = $t027722812._1 | |
93 | + | let priceAssetId = $t027722812._2 | |
80 | 94 | makeString(["%s%s%s%d", "votingResult", amountAssetId, priceAssetId, toString(epoch)], separator) | |
81 | 95 | } | |
82 | 96 | ||
85 | 99 | ||
86 | 100 | ||
87 | 101 | func keyPoolShare (pool,epoch) = { | |
88 | - | let $ | |
89 | - | let amountAssetId = $ | |
90 | - | let priceAssetId = $ | |
102 | + | let $t031333173 = pool | |
103 | + | let amountAssetId = $t031333173._1 | |
104 | + | let priceAssetId = $t031333173._2 | |
91 | 105 | makeString(["%s%s%s%d", "poolShare", amountAssetId, priceAssetId, toString(epoch)], separator) | |
92 | 106 | } | |
93 | 107 | ||
157 | 171 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
158 | 172 | ||
159 | 173 | ||
174 | + | func getPoolInfo (amountAssetId,priceAssetId) = { | |
175 | + | let poolInfoOption = { | |
176 | + | let @ = invoke(factoryContract, "poolInfoREADONLY", [amountAssetId, priceAssetId], nil) | |
177 | + | if ($isInstanceOf(@, "(Address, ByteVector)")) | |
178 | + | then @ | |
179 | + | else unit | |
180 | + | } | |
181 | + | poolInfoOption | |
182 | + | } | |
183 | + | ||
184 | + | ||
160 | 185 | func getLpAssetByPoolAssets (amountAssetId,priceAssetId) = { | |
161 | 186 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
162 | 187 | ||
173 | 198 | ||
174 | 199 | ||
175 | 200 | func checkWxEmissionPoolLabel (pool) = { | |
176 | - | let $ | |
177 | - | let amountAssetId = $ | |
178 | - | let priceAssetId = $ | |
201 | + | let $t062996339 = pool | |
202 | + | let amountAssetId = $t062996339._1 | |
203 | + | let priceAssetId = $t062996339._2 | |
179 | 204 | let @ = invoke(factoryContract, "checkWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
180 | 205 | if ($isInstanceOf(@, "Boolean")) | |
181 | 206 | then @ | |
193 | 218 | let poolsListName = "pools" | |
194 | 219 | ||
195 | 220 | func getVotesListName (pool) = { | |
196 | - | let $ | |
197 | - | let amountAssetId = $ | |
198 | - | let priceAssetId = $ | |
221 | + | let $t067566796 = pool | |
222 | + | let amountAssetId = $t067566796._1 | |
223 | + | let priceAssetId = $t067566796._2 | |
199 | 224 | makeString(["votes", amountAssetId, priceAssetId], separator) | |
200 | 225 | } | |
201 | 226 | ||
487 | 512 | ||
488 | 513 | ||
489 | 514 | @Callable(i) | |
515 | + | func processPoolBalanceINTERNAL (poolStr) = { | |
516 | + | let checkCaller = mustThis(i) | |
517 | + | if ((checkCaller == checkCaller)) | |
518 | + | then { | |
519 | + | let epoch = getIntOrFail(this, keyCurrentEpoch) | |
520 | + | let epochPrevious = (epoch - 1) | |
521 | + | let pool = stringToPool(poolStr) | |
522 | + | let $t01702017060 = pool | |
523 | + | let amountAssetId = $t01702017060._1 | |
524 | + | let priceAssetId = $t01702017060._2 | |
525 | + | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
526 | + | let balanceIsOkCurrent = { | |
527 | + | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
528 | + | if ($isInstanceOf(@, "Boolean")) | |
529 | + | then @ | |
530 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
531 | + | } | |
532 | + | let balanceIsOkPrevious = !(valueOrElse(getBoolean(this, keyInsufficientBalances(pool, (epochPrevious - 1))), false)) | |
533 | + | let actions = if (!(balanceIsOkCurrent)) | |
534 | + | then if (!(balanceIsOkPrevious)) | |
535 | + | then { | |
536 | + | let deleteWxEmissionInv = invoke(factoryContract, "deleteWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
537 | + | if ((deleteWxEmissionInv == deleteWxEmissionInv)) | |
538 | + | then { | |
539 | + | let modifyWeightInv = invoke(factoryContract, "modifyWeight", [lpAssetId, 0], nil) | |
540 | + | if ((modifyWeightInv == modifyWeightInv)) | |
541 | + | then { | |
542 | + | let poolAddress = valueOrErrorMessage(getPoolInfo(amountAssetId, priceAssetId), wrapErr("invalid assets"))._1 | |
543 | + | let newStatus = 3 | |
544 | + | let setPoolStatusInv = invoke(factoryContract, "managePool", [toString(poolAddress), newStatus], nil) | |
545 | + | if ((setPoolStatusInv == setPoolStatusInv)) | |
546 | + | then { | |
547 | + | let listActions = ([DeleteEntry(keyInList(pool))] ++ deleteNodeActions(poolsListName, poolToString(pool))) | |
548 | + | ([IntegerEntry(keyPoolShare(pool, epochPrevious), 0)] ++ listActions) | |
549 | + | } | |
550 | + | else throw("Strict value is not equal to itself.") | |
551 | + | } | |
552 | + | else throw("Strict value is not equal to itself.") | |
553 | + | } | |
554 | + | else throw("Strict value is not equal to itself.") | |
555 | + | } | |
556 | + | else [BooleanEntry(keyInsufficientBalances(pool, epochPrevious), true)] | |
557 | + | else nil | |
558 | + | $Tuple2(actions, unit) | |
559 | + | } | |
560 | + | else throw("Strict value is not equal to itself.") | |
561 | + | } | |
562 | + | ||
563 | + | ||
564 | + | ||
565 | + | @Callable(i) | |
490 | 566 | func processVoteINTERNAL (poolStr,userAddressStr) = { | |
491 | 567 | let checkCaller = mustThis(i) | |
492 | 568 | if ((checkCaller == checkCaller)) | |
506 | 582 | if ((checkTargetEpoch == checkTargetEpoch)) | |
507 | 583 | then { | |
508 | 584 | let pool = stringToPool(poolStr) | |
509 | - | let $t01814618186 = pool | |
510 | - | let amountAssetId = $t01814618186._1 | |
511 | - | let priceAssetId = $t01814618186._2 | |
512 | - | let wxEmission = checkWxEmissionPoolLabel(pool) | |
585 | + | let $t01941319453 = pool | |
586 | + | let amountAssetId = $t01941319453._1 | |
587 | + | let priceAssetId = $t01941319453._2 | |
513 | 588 | let gwxAmountAtEndTotal = { | |
514 | 589 | let @ = invoke(this, "getUserGwxAmountAtHeight", [userAddressStr, endHeight], nil) | |
515 | 590 | if ($isInstanceOf(@, "Int")) | |
534 | 609 | then nil | |
535 | 610 | else [IntegerEntry(keyVotingResultStaked(lpAssetIdStr, epochPrevious), (votingResultStakedPrevious + votePrevious))] | |
536 | 611 | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
537 | - | let balanceIsOk = { | |
538 | - | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
539 | - | if ($isInstanceOf(@, "Boolean")) | |
540 | - | then @ | |
541 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
542 | - | } | |
543 | 612 | let newVote = if ((gwxAmountAtEndTotalPrevious > 0)) | |
544 | 613 | then fraction(votePrevious, gwxAmountAtEndTotal, gwxAmountAtEndTotalPrevious) | |
545 | 614 | else 0 | |
546 | - | let actions = if (if (if ((newVote > 0)) | |
547 | - | then wxEmission | |
548 | - | else false) | |
549 | - | then balanceIsOk | |
550 | - | else false) | |
615 | + | let actions = if ((newVote > 0)) | |
551 | 616 | then [IntegerEntry(keyVote(pool, userAddress, epoch), newVote), IntegerEntry(keyTotalVotes(epoch), (totalVotes + newVote)), IntegerEntry(keyVotingResult(pool, epoch), (votingResult + newVote)), IntegerEntry(keyUsed(userAddress, epoch), (used + newVote))] | |
552 | 617 | else deleteNodeActions(getVotesListName(pool), userAddressStr) | |
553 | 618 | $Tuple2((actions ++ votingResultStakedActions), unit) | |
576 | 641 | if ((checkTargetEpoch == checkTargetEpoch)) | |
577 | 642 | then { | |
578 | 643 | let pool = stringToPool(poolStr) | |
579 | - | let $ | |
580 | - | let amountAssetId = $ | |
581 | - | let priceAssetId = $ | |
644 | + | let $t02181621856 = pool | |
645 | + | let amountAssetId = $t02181621856._1 | |
646 | + | let priceAssetId = $t02181621856._2 | |
582 | 647 | let stakingContract = addressFromStringValue(getStrOrFail(this, keyStakingContract)) | |
583 | 648 | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
584 | 649 | let r = { | |
591 | 656 | then if (r) | |
592 | 657 | then $Tuple2(nil, true) | |
593 | 658 | else { | |
594 | - | let assetsStoreContract = addressFromStringValue(valueOrElse(getString(this, keyAssetsStoreContract), "invalid assets store contract")) | |
595 | - | let wxEmission = checkWxEmissionPoolLabel(pool) | |
596 | - | let balanceIsOk = { | |
597 | - | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
598 | - | if ($isInstanceOf(@, "Boolean")) | |
599 | - | then @ | |
600 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
601 | - | } | |
602 | - | let amountAssetVerified = { | |
603 | - | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) | |
604 | - | if ($isInstanceOf(@, "Boolean")) | |
605 | - | then @ | |
606 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
607 | - | } | |
608 | - | let priceAssetVerified = { | |
609 | - | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [priceAssetId], nil) | |
610 | - | if ($isInstanceOf(@, "Boolean")) | |
611 | - | then @ | |
612 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
613 | - | } | |
614 | - | let setWxEmissionInv = if (if (if (if (!(wxEmission)) | |
615 | - | then balanceIsOk | |
616 | - | else false) | |
617 | - | then amountAssetVerified | |
618 | - | else false) | |
619 | - | then priceAssetVerified | |
620 | - | else false) | |
621 | - | then invoke(factoryContract, "setWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
622 | - | else unit | |
623 | - | if ((setWxEmissionInv == setWxEmissionInv)) | |
624 | - | then { | |
625 | - | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(targetEpoch)), 0) | |
626 | - | let votingResult = valueOrElse(getInteger(this, keyVotingResult(pool, targetEpoch)), 0) | |
627 | - | let share = if (if (if ((totalVotes == 0)) | |
628 | - | then true | |
629 | - | else !(wxEmission)) | |
630 | - | then true | |
631 | - | else !(balanceIsOk)) | |
632 | - | then 0 | |
633 | - | else fraction(votingResult, poolWeightMult, totalVotes) | |
634 | - | let modifyWeightInv = invoke(factoryContract, "modifyWeight", [lpAssetId, share], nil) | |
635 | - | if ((modifyWeightInv == modifyWeightInv)) | |
636 | - | then $Tuple2([IntegerEntry(keyPoolShare(pool, targetEpoch), share)], false) | |
637 | - | else throw("Strict value is not equal to itself.") | |
638 | - | } | |
659 | + | let assetsStoreContract = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyAssetsStoreContract), "invalid assets store contract")) | |
660 | + | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(targetEpoch)), 0) | |
661 | + | let votingResult = valueOrElse(getInteger(this, keyVotingResult(pool, targetEpoch)), 0) | |
662 | + | let share = if ((totalVotes == 0)) | |
663 | + | then 0 | |
664 | + | else fraction(votingResult, poolWeightMult, totalVotes) | |
665 | + | let modifyWeightInv = invoke(factoryContract, "modifyWeight", [lpAssetId, share], nil) | |
666 | + | if ((modifyWeightInv == modifyWeightInv)) | |
667 | + | then $Tuple2([IntegerEntry(keyPoolShare(pool, targetEpoch), share)], false) | |
639 | 668 | else throw("Strict value is not equal to itself.") | |
640 | 669 | } | |
641 | 670 | else throw("Strict value is not equal to itself.") | |
672 | 701 | case _ => | |
673 | 702 | throw("Match error") | |
674 | 703 | } | |
675 | - | $Tuple2(([IntegerEntry(keyStartHeightByEpoch(newEpoch), height), IntegerEntry(keyStartHeight, height), IntegerEntry(keyCurrentEpoch, newEpoch), IntegerEntry(keyFinalizationStage, | |
704 | + | $Tuple2(([IntegerEntry(keyStartHeightByEpoch(newEpoch), height), IntegerEntry(keyStartHeight, height), IntegerEntry(keyCurrentEpoch, newEpoch), IntegerEntry(keyFinalizationStage, finalizationStageBalances), IntegerEntry(keyEpochLengthByEpoch(epoch), epochLength)] ++ newEpochLengthActions), true) | |
676 | 705 | } | |
677 | 706 | else if (if (force) | |
678 | 707 | then (finalizationStageOrUnit == unit) | |
680 | 709 | then $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares)], true) | |
681 | 710 | else if ((finalizationStageOrUnit == unit)) | |
682 | 711 | then $Tuple2(nil, false) | |
683 | - | else if ((finalizationStageOrUnit == | |
712 | + | else if ((finalizationStageOrUnit == finalizationStageBalances)) | |
684 | 713 | then { | |
685 | 714 | let poolOrUnit = getString(keyNextPool) | |
686 | - | let userOrUnit = getString(keyNextUser) | |
687 | 715 | match poolOrUnit { | |
688 | 716 | case _: Unit => | |
689 | 717 | match getString(keyListHead(poolsListName)) { | |
690 | 718 | case _: Unit => | |
691 | - | $Tuple2([IntegerEntry(keyFinalizationStage, | |
692 | - | case | |
693 | - | $Tuple2([StringEntry(keyNextPool, | |
719 | + | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageTotal), DeleteEntry(keyNextPool)], true) | |
720 | + | case nextPoolStr: String => | |
721 | + | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
694 | 722 | case _ => | |
695 | 723 | throw("Match error") | |
696 | 724 | } | |
697 | 725 | case poolStr: String => | |
698 | - | let pool = stringToPool(poolStr) | |
699 | - | let nextUserOrUnit = match userOrUnit { | |
726 | + | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
727 | + | if ((nextPoolOrUnit == nextPoolOrUnit)) | |
728 | + | then { | |
729 | + | let r = invoke(this, "processPoolBalanceINTERNAL", [poolStr], nil) | |
730 | + | if ((r == r)) | |
731 | + | then match nextPoolOrUnit { | |
732 | + | case _: Unit => | |
733 | + | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageTotal), DeleteEntry(keyNextPool)], true) | |
734 | + | case nextPoolStr: String => | |
735 | + | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
736 | + | case _ => | |
737 | + | throw("Match error") | |
738 | + | } | |
739 | + | else throw("Strict value is not equal to itself.") | |
740 | + | } | |
741 | + | else throw("Strict value is not equal to itself.") | |
742 | + | case _ => | |
743 | + | throw("Match error") | |
744 | + | } | |
745 | + | } | |
746 | + | else if ((finalizationStageOrUnit == finalizationStageTotal)) | |
747 | + | then { | |
748 | + | let poolOrUnit = getString(keyNextPool) | |
749 | + | let userOrUnit = getString(keyNextUser) | |
750 | + | match poolOrUnit { | |
751 | + | case _: Unit => | |
752 | + | match getString(keyListHead(poolsListName)) { | |
753 | + | case _: Unit => | |
754 | + | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares), DeleteEntry(keyNextPool), DeleteEntry(keyNextUser)], true) | |
755 | + | case poolsHeadStr: String => | |
756 | + | $Tuple2([StringEntry(keyNextPool, poolsHeadStr)], true) | |
757 | + | case _ => | |
758 | + | throw("Match error") | |
759 | + | } | |
760 | + | case poolStr: String => | |
761 | + | let pool = stringToPool(poolStr) | |
762 | + | let nextUserOrUnit = match userOrUnit { | |
763 | + | case _: Unit => | |
764 | + | getString(keyListHead(getVotesListName(pool))) | |
765 | + | case user: String => | |
766 | + | let next = getString(keyListNext(getVotesListName(pool), user)) | |
767 | + | if ((next == next)) | |
768 | + | then { | |
769 | + | let processVoteInv = invoke(this, "processVoteINTERNAL", [poolStr, user], nil) | |
770 | + | if ((processVoteInv == processVoteInv)) | |
771 | + | then next | |
772 | + | else throw("Strict value is not equal to itself.") | |
773 | + | } | |
774 | + | else throw("Strict value is not equal to itself.") | |
775 | + | case _ => | |
776 | + | throw("Match error") | |
777 | + | } | |
778 | + | match nextUserOrUnit { | |
779 | + | case _: Unit => | |
780 | + | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
781 | + | match nextPoolOrUnit { | |
782 | + | case _: Unit => | |
783 | + | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares), DeleteEntry(keyNextPool), DeleteEntry(keyNextUser)], true) | |
784 | + | case s: String => | |
785 | + | $Tuple2([StringEntry(keyNextPool, s), DeleteEntry(keyNextUser)], true) | |
786 | + | case _ => | |
787 | + | throw("Match error") | |
788 | + | } | |
789 | + | case nextUser: String => | |
790 | + | $Tuple2([StringEntry(keyNextUser, nextUser)], true) | |
791 | + | case _ => | |
792 | + | throw("Match error") | |
793 | + | } | |
794 | + | case _ => | |
795 | + | throw("Match error") | |
796 | + | } | |
797 | + | } | |
798 | + | else if ((finalizationStageOrUnit == finalizationStageShares)) | |
799 | + | then { | |
800 | + | let poolOrUnit = getString(keyNextPool) | |
801 | + | match poolOrUnit { | |
700 | 802 | case _: Unit => | |
701 | - | getString(keyListHead(getVotesListName(pool))) | |
702 | - | case user: String => | |
703 | - | let next = getString(keyListNext(getVotesListName(pool), user)) | |
704 | - | if ((next == next)) | |
803 | + | match getString(keyListHead(poolsListName)) { | |
804 | + | case _: Unit => | |
805 | + | let actions = if (force) | |
806 | + | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced)] | |
807 | + | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight)] | |
808 | + | let gwxRewardDepositInv = gwxRewardDeposit() | |
809 | + | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
810 | + | then $Tuple2(actions, true) | |
811 | + | else throw("Strict value is not equal to itself.") | |
812 | + | case nextPoolStr: String => | |
813 | + | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
814 | + | case _ => | |
815 | + | throw("Match error") | |
816 | + | } | |
817 | + | case poolStr: String => | |
818 | + | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
819 | + | if ((nextPoolOrUnit == nextPoolOrUnit)) | |
705 | 820 | then { | |
706 | - | let processVoteInv = invoke(this, "processVoteINTERNAL", [poolStr, user], nil) | |
707 | - | if ((processVoteInv == processVoteInv)) | |
708 | - | then next | |
821 | + | let r = { | |
822 | + | let @ = invoke(this, "processPoolINTERNAL", [poolStr, force], nil) | |
823 | + | if ($isInstanceOf(@, "Boolean")) | |
824 | + | then @ | |
825 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
826 | + | } | |
827 | + | if ((r == r)) | |
828 | + | then if (r) | |
829 | + | then $Tuple2(nil, true) | |
830 | + | else match nextPoolOrUnit { | |
831 | + | case _: Unit => | |
832 | + | let actions = if (force) | |
833 | + | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced), DeleteEntry(keyNextPool)] | |
834 | + | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight), DeleteEntry(keyNextPool)] | |
835 | + | let gwxRewardDepositInv = gwxRewardDeposit() | |
836 | + | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
837 | + | then $Tuple2(actions, true) | |
838 | + | else throw("Strict value is not equal to itself.") | |
839 | + | case nextPoolStr: String => | |
840 | + | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
841 | + | case _ => | |
842 | + | throw("Match error") | |
843 | + | } | |
709 | 844 | else throw("Strict value is not equal to itself.") | |
710 | 845 | } | |
711 | 846 | else throw("Strict value is not equal to itself.") | |
712 | 847 | case _ => | |
713 | 848 | throw("Match error") | |
714 | 849 | } | |
715 | - | match nextUserOrUnit { | |
716 | - | case _: Unit => | |
717 | - | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
718 | - | match nextPoolOrUnit { | |
719 | - | case _: Unit => | |
720 | - | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares), DeleteEntry(keyNextPool), DeleteEntry(keyNextUser)], true) | |
721 | - | case s: String => | |
722 | - | $Tuple2([StringEntry(keyNextPool, s), DeleteEntry(keyNextUser)], true) | |
723 | - | case _ => | |
724 | - | throw("Match error") | |
725 | - | } | |
726 | - | case nextUser: String => | |
727 | - | $Tuple2([StringEntry(keyNextUser, nextUser)], true) | |
728 | - | case _ => | |
729 | - | throw("Match error") | |
730 | 850 | } | |
731 | - | case _ => | |
732 | - | throw("Match error") | |
733 | - | } | |
734 | - | } | |
735 | - | else if ((finalizationStageOrUnit == finalizationStageShares)) | |
736 | - | then { | |
737 | - | let poolOrUnit = getString(keyNextPool) | |
738 | - | match poolOrUnit { | |
739 | - | case _: Unit => | |
740 | - | match getString(keyListHead(poolsListName)) { | |
741 | - | case _: Unit => | |
742 | - | let actions = if (force) | |
743 | - | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced)] | |
744 | - | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight)] | |
745 | - | let gwxRewardDepositInv = gwxRewardDeposit() | |
746 | - | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
747 | - | then $Tuple2(actions, true) | |
748 | - | else throw("Strict value is not equal to itself.") | |
749 | - | case nextPoolStr: String => | |
750 | - | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
751 | - | case _ => | |
752 | - | throw("Match error") | |
753 | - | } | |
754 | - | case poolStr: String => | |
755 | - | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
756 | - | if ((nextPoolOrUnit == nextPoolOrUnit)) | |
757 | - | then { | |
758 | - | let r = { | |
759 | - | let @ = invoke(this, "processPoolINTERNAL", [poolStr, force], nil) | |
760 | - | if ($isInstanceOf(@, "Boolean")) | |
761 | - | then @ | |
762 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
763 | - | } | |
764 | - | if ((r == r)) | |
765 | - | then if (r) | |
766 | - | then $Tuple2(nil, true) | |
767 | - | else match nextPoolOrUnit { | |
768 | - | case _: Unit => | |
769 | - | let actions = if (force) | |
770 | - | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced), DeleteEntry(keyNextPool)] | |
771 | - | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight), DeleteEntry(keyNextPool)] | |
772 | - | let gwxRewardDepositInv = gwxRewardDeposit() | |
773 | - | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
774 | - | then $Tuple2(actions, true) | |
775 | - | else throw("Strict value is not equal to itself.") | |
776 | - | case nextPoolStr: String => | |
777 | - | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
778 | - | case _ => | |
779 | - | throw("Match error") | |
780 | - | } | |
781 | - | else throw("Strict value is not equal to itself.") | |
782 | - | } | |
783 | - | else throw("Strict value is not equal to itself.") | |
784 | - | case _ => | |
785 | - | throw("Match error") | |
786 | - | } | |
787 | - | } | |
788 | - | else throwErr("finalization is broken") | |
851 | + | else throwErr("finalization is broken") | |
789 | 852 | } | |
790 | 853 | ||
791 | 854 | ||
890 | 953 | } | |
891 | 954 | ||
892 | 955 | ||
956 | + | ||
957 | + | @Callable(i) | |
958 | + | func resume (amountAssetId,priceAssetId) = { | |
959 | + | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
960 | + | let balanceIsOk = { | |
961 | + | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
962 | + | if ($isInstanceOf(@, "Boolean")) | |
963 | + | then @ | |
964 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
965 | + | } | |
966 | + | let payment = i.payments[0] | |
967 | + | let assetsStoreContract = addressFromStringValue(getStringValue(this, keyAssetsStoreContract)) | |
968 | + | let kBoostingConfig = "%s__config" | |
969 | + | let idxCfgAssetId = 1 | |
970 | + | let boostingContract = addressFromStringValue(getStrOrFail(this, keyBoostingContract)) | |
971 | + | let wxAssetId = fromBase58String(split(getStringValue(boostingContract, kBoostingConfig), separator)[idxCfgAssetId]) | |
972 | + | let amountAssetVerified = { | |
973 | + | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) | |
974 | + | if ($isInstanceOf(@, "Boolean")) | |
975 | + | then @ | |
976 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
977 | + | } | |
978 | + | let priceAssetVerified = { | |
979 | + | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [priceAssetId], nil) | |
980 | + | if ($isInstanceOf(@, "Boolean")) | |
981 | + | then @ | |
982 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
983 | + | } | |
984 | + | let resumptionFee = valueOrElse(getInteger(this, keyResumptionFee), resumptionFeeDefault) | |
985 | + | let checks = [if (balanceIsOk) | |
986 | + | then true | |
987 | + | else throwErr("insufficient balances"), if ((size(i.payments) == 1)) | |
988 | + | then true | |
989 | + | else throwErr("1 payment is required"), if ((payment.assetId == wxAssetId)) | |
990 | + | then true | |
991 | + | else throwErr("invalid payment asset id"), if ((payment.amount == resumptionFee)) | |
992 | + | then true | |
993 | + | else throwErr("invalid payment amount"), if (if (amountAssetVerified) | |
994 | + | then priceAssetVerified | |
995 | + | else false) | |
996 | + | then true | |
997 | + | else throwErr("both assets should be verified")] | |
998 | + | if ((checks == checks)) | |
999 | + | then { | |
1000 | + | let pool = $Tuple2(amountAssetId, priceAssetId) | |
1001 | + | let inListActions = ([BooleanEntry(keyInList(pool), true)] ++ insertNodeActions(poolsListName, poolToString(pool))) | |
1002 | + | $Tuple2(inListActions, unit) | |
1003 | + | } | |
1004 | + | else throw("Strict value is not equal to itself.") | |
1005 | + | } | |
1006 | + | ||
1007 | + | ||
893 | 1008 | @Verifier(tx) | |
894 | 1009 | func verify () = { | |
895 | 1010 | 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 separator = "__" | |
5 | 5 | ||
6 | 6 | let poolWeightMult = 100000000 | |
7 | 7 | ||
8 | 8 | let maxDepthDefault = 10 | |
9 | 9 | ||
10 | - | let | |
10 | + | let finalizationStageBalances = 0 | |
11 | 11 | ||
12 | - | let finalizationStageShares = 1 | |
12 | + | let finalizationStageTotal = 1 | |
13 | + | ||
14 | + | let finalizationStageShares = 2 | |
15 | + | ||
16 | + | let resumptionFeeDefault = 500000000000 | |
13 | 17 | ||
14 | 18 | let keyEpochLength = makeString(["%s", "epochLength"], separator) | |
15 | 19 | ||
16 | 20 | let keyEpochLengthNew = makeString(["%s%s", "epochLength__new"], separator) | |
17 | 21 | ||
18 | 22 | func keyEpochLengthByEpoch (epoch) = makeString(["%s%d", "epochLength", toString(epoch)], separator) | |
19 | 23 | ||
20 | 24 | ||
21 | 25 | let keyCurrentEpoch = makeString(["%s", "currentEpoch"], separator) | |
22 | 26 | ||
23 | 27 | let keyMaxDepth = makeString(["%s", "maxDepth"], separator) | |
28 | + | ||
29 | + | let keyResumptionFee = makeString(["%s", "resumptionFee"], separator) | |
24 | 30 | ||
25 | 31 | let keyVotingEmissionCandidateContract = makeString(["%s", "votingEmissionCandidateContract"], separator) | |
26 | 32 | ||
27 | 33 | let keyVotingEmissionRateContract = makeString(["%s", "votingEmissionRateContract"], separator) | |
28 | 34 | ||
29 | 35 | let keyFactoryContract = makeString(["%s", "factoryContract"], separator) | |
30 | 36 | ||
31 | 37 | let keyBoostingContract = makeString(["%s", "boostingContract"], separator) | |
32 | 38 | ||
33 | 39 | let keyStakingContract = makeString(["%s", "stakingContract"], separator) | |
34 | 40 | ||
35 | 41 | let keyAssetsStoreContract = makeString(["%s", "assetsStoreContract"], separator) | |
36 | 42 | ||
37 | 43 | let keyFinalizationStage = makeString(["%s", "finalizationStage"], separator) | |
38 | 44 | ||
39 | 45 | let keyNextPool = makeString(["%s", "nextPool"], separator) | |
40 | 46 | ||
41 | 47 | let keyNextUser = makeString(["%s", "nextUser"], separator) | |
42 | 48 | ||
43 | 49 | let keyStartHeight = makeString(["%s", "startHeight"], separator) | |
44 | 50 | ||
45 | 51 | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], separator) | |
46 | 52 | ||
47 | 53 | let keyStartHeightUi = makeString(["%s", "startHeightUi"], separator) | |
48 | 54 | ||
49 | 55 | let keyFinalizationShouldBeForced = makeString(["%s", "force"], separator) | |
50 | 56 | ||
51 | 57 | func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], separator) | |
52 | 58 | ||
53 | 59 | ||
54 | 60 | func keyFinalized (epoch) = makeString(["%s%d", "finalized", toString(epoch)], separator) | |
55 | 61 | ||
56 | 62 | ||
57 | 63 | func keyInList (pool) = { | |
58 | - | let $ | |
59 | - | let amountAssetId = $ | |
60 | - | let priceAssetId = $ | |
64 | + | let $t020132053 = pool | |
65 | + | let amountAssetId = $t020132053._1 | |
66 | + | let priceAssetId = $t020132053._2 | |
61 | 67 | makeString(["%s%s%s", "inList", amountAssetId, priceAssetId], separator) | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | func keyInsufficientBalances (pool,epoch) = { | |
72 | + | let $t022022242 = pool | |
73 | + | let amountAssetId = $t022022242._1 | |
74 | + | let priceAssetId = $t022022242._2 | |
75 | + | makeString(["%s%s%s%d", "insufficientBalances", amountAssetId, priceAssetId, toString(epoch)], separator) | |
62 | 76 | } | |
63 | 77 | ||
64 | 78 | ||
65 | 79 | func keyUsed (address,epoch) = makeString(["%s%s%d", "used", toString(address), toString(epoch)], separator) | |
66 | 80 | ||
67 | 81 | ||
68 | 82 | func keyVote (pool,address,epoch) = { | |
69 | - | let $ | |
70 | - | let amountAssetId = $ | |
71 | - | let priceAssetId = $ | |
83 | + | let $t025502590 = pool | |
84 | + | let amountAssetId = $t025502590._1 | |
85 | + | let priceAssetId = $t025502590._2 | |
72 | 86 | makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], separator) | |
73 | 87 | } | |
74 | 88 | ||
75 | 89 | ||
76 | 90 | func keyVotingResult (pool,epoch) = { | |
77 | - | let $ | |
78 | - | let amountAssetId = $ | |
79 | - | let priceAssetId = $ | |
91 | + | let $t027722812 = pool | |
92 | + | let amountAssetId = $t027722812._1 | |
93 | + | let priceAssetId = $t027722812._2 | |
80 | 94 | makeString(["%s%s%s%d", "votingResult", amountAssetId, priceAssetId, toString(epoch)], separator) | |
81 | 95 | } | |
82 | 96 | ||
83 | 97 | ||
84 | 98 | func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], separator) | |
85 | 99 | ||
86 | 100 | ||
87 | 101 | func keyPoolShare (pool,epoch) = { | |
88 | - | let $ | |
89 | - | let amountAssetId = $ | |
90 | - | let priceAssetId = $ | |
102 | + | let $t031333173 = pool | |
103 | + | let amountAssetId = $t031333173._1 | |
104 | + | let priceAssetId = $t031333173._2 | |
91 | 105 | makeString(["%s%s%s%d", "poolShare", amountAssetId, priceAssetId, toString(epoch)], separator) | |
92 | 106 | } | |
93 | 107 | ||
94 | 108 | ||
95 | 109 | func keyTotalVotes (epoch) = makeString(["%s%d", "totalVotes", toString(epoch)], separator) | |
96 | 110 | ||
97 | 111 | ||
98 | 112 | func keyStakedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], separator) | |
99 | 113 | ||
100 | 114 | ||
101 | 115 | func wrapErr (msg) = makeString(["voting_emission.ride:", msg], " ") | |
102 | 116 | ||
103 | 117 | ||
104 | 118 | func throwErr (msg) = throw(wrapErr(msg)) | |
105 | 119 | ||
106 | 120 | ||
107 | 121 | func getValueOrFail (address,key,type) = { | |
108 | 122 | let error = wrapErr(makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
109 | 123 | valueOrErrorMessage( match type { | |
110 | 124 | case str: String => | |
111 | 125 | getString(address, key) | |
112 | 126 | case int: Int => | |
113 | 127 | getInteger(address, key) | |
114 | 128 | case _ => | |
115 | 129 | throwErr("invalid entry type") | |
116 | 130 | }, error) | |
117 | 131 | } | |
118 | 132 | ||
119 | 133 | ||
120 | 134 | func getStrOrFail (address,key) = { | |
121 | 135 | let @ = getValueOrFail(address, key, "") | |
122 | 136 | if ($isInstanceOf(@, "String")) | |
123 | 137 | then @ | |
124 | 138 | else throw(($getType(@) + " couldn't be cast to String")) | |
125 | 139 | } | |
126 | 140 | ||
127 | 141 | ||
128 | 142 | func getIntOrFail (address,key) = { | |
129 | 143 | let @ = getValueOrFail(address, key, 0) | |
130 | 144 | if ($isInstanceOf(@, "Int")) | |
131 | 145 | then @ | |
132 | 146 | else throw(($getType(@) + " couldn't be cast to Int")) | |
133 | 147 | } | |
134 | 148 | ||
135 | 149 | ||
136 | 150 | func poolToString (pool) = ((pool._1 + separator) + pool._2) | |
137 | 151 | ||
138 | 152 | ||
139 | 153 | func stringToPool (str) = { | |
140 | 154 | let parts = split(str, separator) | |
141 | 155 | if ((size(parts) == 2)) | |
142 | 156 | then $Tuple2(parts[0], parts[1]) | |
143 | 157 | else throwErr("invalid pool string") | |
144 | 158 | } | |
145 | 159 | ||
146 | 160 | ||
147 | 161 | let factoryContract = addressFromStringValue(getStrOrFail(this, keyFactoryContract)) | |
148 | 162 | ||
149 | 163 | let IdxFactoryCfgGwxRewardDapp = 10 | |
150 | 164 | ||
151 | 165 | func keyFactoryCfg () = "%s__factoryConfig" | |
152 | 166 | ||
153 | 167 | ||
154 | 168 | func readFactoryCfgOrFail (factory) = split(getStrOrFail(factory, keyFactoryCfg()), separator) | |
155 | 169 | ||
156 | 170 | ||
157 | 171 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
158 | 172 | ||
159 | 173 | ||
174 | + | func getPoolInfo (amountAssetId,priceAssetId) = { | |
175 | + | let poolInfoOption = { | |
176 | + | let @ = invoke(factoryContract, "poolInfoREADONLY", [amountAssetId, priceAssetId], nil) | |
177 | + | if ($isInstanceOf(@, "(Address, ByteVector)")) | |
178 | + | then @ | |
179 | + | else unit | |
180 | + | } | |
181 | + | poolInfoOption | |
182 | + | } | |
183 | + | ||
184 | + | ||
160 | 185 | func getLpAssetByPoolAssets (amountAssetId,priceAssetId) = { | |
161 | 186 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
162 | 187 | ||
163 | 188 | func keyMappingPoolAssetsToPoolContractAddress (internalAmountAssetIdStr,internalPriceAssetIdStr) = (((("%d%d%s%s__" + toString(internalAmountAssetIdStr)) + "__") + toString(internalPriceAssetIdStr)) + "__mappings__poolAssets2PoolContract") | |
164 | 189 | ||
165 | 190 | func keyMappingPoolContractToLPAsset (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
166 | 191 | ||
167 | 192 | let amountAssetInternalId = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amountAssetId)) | |
168 | 193 | let priceAssetInternalId = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAssetId)) | |
169 | 194 | let poolContractAddress = getStrOrFail(factoryContract, keyMappingPoolAssetsToPoolContractAddress(amountAssetInternalId, priceAssetInternalId)) | |
170 | 195 | let lpAssetId = getStrOrFail(factoryContract, keyMappingPoolContractToLPAsset(poolContractAddress)) | |
171 | 196 | lpAssetId | |
172 | 197 | } | |
173 | 198 | ||
174 | 199 | ||
175 | 200 | func checkWxEmissionPoolLabel (pool) = { | |
176 | - | let $ | |
177 | - | let amountAssetId = $ | |
178 | - | let priceAssetId = $ | |
201 | + | let $t062996339 = pool | |
202 | + | let amountAssetId = $t062996339._1 | |
203 | + | let priceAssetId = $t062996339._2 | |
179 | 204 | let @ = invoke(factoryContract, "checkWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
180 | 205 | if ($isInstanceOf(@, "Boolean")) | |
181 | 206 | then @ | |
182 | 207 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
183 | 208 | } | |
184 | 209 | ||
185 | 210 | ||
186 | 211 | func gwxRewardDeposit () = { | |
187 | 212 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
188 | 213 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
189 | 214 | invoke(gwxRewardsContract, "deposit", nil, nil) | |
190 | 215 | } | |
191 | 216 | ||
192 | 217 | ||
193 | 218 | let poolsListName = "pools" | |
194 | 219 | ||
195 | 220 | func getVotesListName (pool) = { | |
196 | - | let $ | |
197 | - | let amountAssetId = $ | |
198 | - | let priceAssetId = $ | |
221 | + | let $t067566796 = pool | |
222 | + | let amountAssetId = $t067566796._1 | |
223 | + | let priceAssetId = $t067566796._2 | |
199 | 224 | makeString(["votes", amountAssetId, priceAssetId], separator) | |
200 | 225 | } | |
201 | 226 | ||
202 | 227 | ||
203 | 228 | func keyListHead (listName) = { | |
204 | 229 | let meta = if ((listName == poolsListName)) | |
205 | 230 | then "%s%s" | |
206 | 231 | else "%s%s%s%s" | |
207 | 232 | makeString([meta, listName, "head"], separator) | |
208 | 233 | } | |
209 | 234 | ||
210 | 235 | ||
211 | 236 | func keyListSize (listName) = { | |
212 | 237 | let meta = if ((listName == poolsListName)) | |
213 | 238 | then "%s%s" | |
214 | 239 | else "%s%s%s%s" | |
215 | 240 | makeString([meta, listName, "size"], separator) | |
216 | 241 | } | |
217 | 242 | ||
218 | 243 | ||
219 | 244 | func keyListPrev (listName,id) = { | |
220 | 245 | let meta = if ((listName == poolsListName)) | |
221 | 246 | then "%s%s%s%s" | |
222 | 247 | else "%s%s%s%s%s" | |
223 | 248 | makeString([meta, listName, id, "prev"], separator) | |
224 | 249 | } | |
225 | 250 | ||
226 | 251 | ||
227 | 252 | func keyListNext (listName,id) = { | |
228 | 253 | let meta = if ((listName == poolsListName)) | |
229 | 254 | then "%s%s%s%s" | |
230 | 255 | else "%s%s%s%s%s" | |
231 | 256 | makeString([meta, listName, id, "next"], separator) | |
232 | 257 | } | |
233 | 258 | ||
234 | 259 | ||
235 | 260 | func containsNode (listName,id) = { | |
236 | 261 | let headOrUnit = getString(this, keyListHead(listName)) | |
237 | 262 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
238 | 263 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
239 | 264 | if (if ((id == valueOrElse(headOrUnit, ""))) | |
240 | 265 | then true | |
241 | 266 | else (prevOrUnit != unit)) | |
242 | 267 | then true | |
243 | 268 | else (nextOrUnit != unit) | |
244 | 269 | } | |
245 | 270 | ||
246 | 271 | ||
247 | 272 | func insertNodeActions (listName,id) = { | |
248 | 273 | let headOrUnit = getString(this, keyListHead(listName)) | |
249 | 274 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
250 | 275 | let checkNode = if (!(containsNode(listName, id))) | |
251 | 276 | then true | |
252 | 277 | else throwErr("Node exists") | |
253 | 278 | if ((checkNode == checkNode)) | |
254 | 279 | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
255 | 280 | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
256 | 281 | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
257 | 282 | else throw("Strict value is not equal to itself.") | |
258 | 283 | } | |
259 | 284 | ||
260 | 285 | ||
261 | 286 | func deleteNodeActions (listName,id) = { | |
262 | 287 | let headOrUnit = getString(this, keyListHead(listName)) | |
263 | 288 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
264 | 289 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
265 | 290 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
266 | 291 | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
267 | 292 | then (nextOrUnit != unit) | |
268 | 293 | else false) | |
269 | 294 | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
270 | 295 | else if ((nextOrUnit != unit)) | |
271 | 296 | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
272 | 297 | else if ((prevOrUnit != unit)) | |
273 | 298 | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
274 | 299 | else if ((id == valueOrElse(headOrUnit, ""))) | |
275 | 300 | then [DeleteEntry(keyListHead(listName))] | |
276 | 301 | else throwErr(((("invalid node: " + listName) + ".") + id)))) | |
277 | 302 | } | |
278 | 303 | ||
279 | 304 | ||
280 | 305 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
281 | 306 | ||
282 | 307 | ||
283 | 308 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
284 | 309 | ||
285 | 310 | ||
286 | 311 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
287 | 312 | case s: String => | |
288 | 313 | addressFromStringValue(s) | |
289 | 314 | case _ => | |
290 | 315 | this | |
291 | 316 | } | |
292 | 317 | ||
293 | 318 | ||
294 | 319 | func managerPublicKeyOrUnit () = { | |
295 | 320 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
296 | 321 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
297 | 322 | case s: String => | |
298 | 323 | fromBase58String(s) | |
299 | 324 | case _: Unit => | |
300 | 325 | unit | |
301 | 326 | case _ => | |
302 | 327 | throw("Match error") | |
303 | 328 | } | |
304 | 329 | } | |
305 | 330 | ||
306 | 331 | ||
307 | 332 | func isManager (i) = match managerPublicKeyOrUnit() { | |
308 | 333 | case pk: ByteVector => | |
309 | 334 | (i.callerPublicKey == pk) | |
310 | 335 | case _: Unit => | |
311 | 336 | (i.caller == this) | |
312 | 337 | case _ => | |
313 | 338 | throw("Match error") | |
314 | 339 | } | |
315 | 340 | ||
316 | 341 | ||
317 | 342 | func mustManager (i) = if (isManager(i)) | |
318 | 343 | then true | |
319 | 344 | else throw("permission denied") | |
320 | 345 | ||
321 | 346 | ||
322 | 347 | func mustThis (i) = if ((i.caller == this)) | |
323 | 348 | then true | |
324 | 349 | else throw("permission denied") | |
325 | 350 | ||
326 | 351 | ||
327 | 352 | @Callable(i) | |
328 | 353 | func getUserGwxAmountAtHeight (userAddress,targetHeight) = { | |
329 | 354 | let boostingContractAddress = valueOrErrorMessage(addressFromString(getStrOrFail(this, keyBoostingContract)), wrapErr("invalid boosting contract address")) | |
330 | 355 | $Tuple2(nil, { | |
331 | 356 | let @ = invoke(boostingContractAddress, "getUserGwxAmountAtHeightREADONLY", [userAddress, targetHeight], nil) | |
332 | 357 | if ($isInstanceOf(@, "Int")) | |
333 | 358 | then @ | |
334 | 359 | else throw(($getType(@) + " couldn't be cast to Int")) | |
335 | 360 | }) | |
336 | 361 | } | |
337 | 362 | ||
338 | 363 | ||
339 | 364 | ||
340 | 365 | @Callable(i) | |
341 | 366 | func constructor (factoryContract,votingEmissionCandidateContract,boostingContract,stakingContract,epochLength) = { | |
342 | 367 | let checks = [mustManager(i), if ((addressFromString(factoryContract) != unit)) | |
343 | 368 | then true | |
344 | 369 | else "invalid factory contract address", if ((addressFromString(votingEmissionCandidateContract) != unit)) | |
345 | 370 | then true | |
346 | 371 | else "invalid voting emission candidate contract address", if ((addressFromString(boostingContract) != unit)) | |
347 | 372 | then true | |
348 | 373 | else "invalid boosting contract address", if ((addressFromString(stakingContract) != unit)) | |
349 | 374 | then true | |
350 | 375 | else "invalid staking contract address", if ((epochLength > 0)) | |
351 | 376 | then true | |
352 | 377 | else throwErr("invalid epoch length")] | |
353 | 378 | if ((checks == checks)) | |
354 | 379 | then $Tuple2([StringEntry(keyFactoryContract, factoryContract), StringEntry(keyVotingEmissionCandidateContract, votingEmissionCandidateContract), StringEntry(keyBoostingContract, boostingContract), StringEntry(keyStakingContract, stakingContract), IntegerEntry(keyEpochLength, epochLength)], unit) | |
355 | 380 | else throw("Strict value is not equal to itself.") | |
356 | 381 | } | |
357 | 382 | ||
358 | 383 | ||
359 | 384 | ||
360 | 385 | @Callable(i) | |
361 | 386 | func create (amountAssetId,priceAssetId) = { | |
362 | 387 | let checks = [if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionCandidateContract), ""))) | |
363 | 388 | then true | |
364 | 389 | else mustManager(i)] | |
365 | 390 | if ((checks == checks)) | |
366 | 391 | then { | |
367 | 392 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
368 | 393 | let inListActions = ([BooleanEntry(keyInList(pool), true)] ++ insertNodeActions(poolsListName, poolToString(pool))) | |
369 | 394 | let currentEpochIsNotDefined = (getInteger(this, keyCurrentEpoch) == unit) | |
370 | 395 | let startHeightActions = if (currentEpochIsNotDefined) | |
371 | 396 | then { | |
372 | 397 | let epoch = 0 | |
373 | 398 | [IntegerEntry(keyCurrentEpoch, epoch), IntegerEntry(keyStartHeightByEpoch(epoch), height), IntegerEntry(keyStartHeight, height), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, height)] | |
374 | 399 | } | |
375 | 400 | else nil | |
376 | 401 | $Tuple2((inListActions ++ startHeightActions), unit) | |
377 | 402 | } | |
378 | 403 | else throw("Strict value is not equal to itself.") | |
379 | 404 | } | |
380 | 405 | ||
381 | 406 | ||
382 | 407 | ||
383 | 408 | @Callable(i) | |
384 | 409 | func vote (amountAssetId,priceAssetId,amount) = { | |
385 | 410 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
386 | 411 | let epoch = valueOrElse(getInteger(this, keyCurrentEpoch), 0) | |
387 | 412 | let startHeight = getIntOrFail(this, keyStartHeightByEpoch(epoch)) | |
388 | 413 | let epochLength = getIntOrFail(this, keyEpochLength) | |
389 | 414 | let endHeight = (startHeight + epochLength) | |
390 | 415 | let finalizationStageOrUnit = getInteger(this, keyFinalizationStage) | |
391 | 416 | let used = valueOrElse(getInteger(this, keyUsed(i.caller, epoch)), 0) | |
392 | 417 | let vote = valueOrElse(getInteger(this, keyVote(pool, i.caller, epoch)), 0) | |
393 | 418 | let poolResult = valueOrElse(getInteger(this, keyVotingResult(pool, epoch)), 0) | |
394 | 419 | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(epoch)), 0) | |
395 | 420 | let gwxAmountAtEndTotal = { | |
396 | 421 | let @ = invoke(this, "getUserGwxAmountAtHeight", [toBase58String(i.caller.bytes), endHeight], nil) | |
397 | 422 | if ($isInstanceOf(@, "Int")) | |
398 | 423 | then @ | |
399 | 424 | else throw(($getType(@) + " couldn't be cast to Int")) | |
400 | 425 | } | |
401 | 426 | let available = (gwxAmountAtEndTotal - used) | |
402 | 427 | let newVote = (vote + amount) | |
403 | 428 | let wxEmission = checkWxEmissionPoolLabel(pool) | |
404 | 429 | let checks = [if ((getBoolean(keyInList(pool)) != unit)) | |
405 | 430 | then true | |
406 | 431 | else throwErr("invalid assets"), if ((endHeight > height)) | |
407 | 432 | then true | |
408 | 433 | else throwErr("invalid height"), if ((finalizationStageOrUnit == unit)) | |
409 | 434 | then true | |
410 | 435 | else throwErr("finalization in progress"), if ((gwxAmountAtEndTotal > 0)) | |
411 | 436 | then true | |
412 | 437 | else throwErr("you do not have gWX"), if (if ((amount > 0)) | |
413 | 438 | then (available >= amount) | |
414 | 439 | else false) | |
415 | 440 | then true | |
416 | 441 | else throwErr("invalid amount"), if (wxEmission) | |
417 | 442 | then true | |
418 | 443 | else throwErr("pool hasn't WX_EMISSION label")] | |
419 | 444 | if ((checks == checks)) | |
420 | 445 | then { | |
421 | 446 | let votesListName = getVotesListName(pool) | |
422 | 447 | let userAddressStr = toString(i.caller) | |
423 | 448 | let votesListActions = if (containsNode(votesListName, userAddressStr)) | |
424 | 449 | then nil | |
425 | 450 | else insertNodeActions(votesListName, userAddressStr) | |
426 | 451 | $Tuple2(([IntegerEntry(keyUsed(i.caller, epoch), (used + amount)), IntegerEntry(keyVote(pool, i.caller, epoch), newVote), IntegerEntry(keyVotingResult(pool, epoch), (poolResult + amount)), IntegerEntry(keyTotalVotes(epoch), (totalVotes + amount))] ++ votesListActions), unit) | |
427 | 452 | } | |
428 | 453 | else throw("Strict value is not equal to itself.") | |
429 | 454 | } | |
430 | 455 | ||
431 | 456 | ||
432 | 457 | ||
433 | 458 | @Callable(i) | |
434 | 459 | func cancelVote (amountAssetId,priceAssetId) = { | |
435 | 460 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
436 | 461 | let epoch = valueOrElse(getInteger(this, keyCurrentEpoch), 0) | |
437 | 462 | let startHeight = getIntOrFail(this, keyStartHeightByEpoch(epoch)) | |
438 | 463 | let epochLength = getIntOrFail(this, keyEpochLength) | |
439 | 464 | let endHeight = (startHeight + epochLength) | |
440 | 465 | let finalizationStageOrUnit = getInteger(this, keyFinalizationStage) | |
441 | 466 | let used = valueOrElse(getInteger(this, keyUsed(i.caller, epoch)), 0) | |
442 | 467 | let vote = valueOrElse(getInteger(this, keyVote(pool, i.caller, epoch)), 0) | |
443 | 468 | let poolResult = valueOrElse(getInteger(this, keyVotingResult(pool, epoch)), 0) | |
444 | 469 | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(epoch)), 0) | |
445 | 470 | let checks = [if ((getBoolean(keyInList(pool)) != unit)) | |
446 | 471 | then true | |
447 | 472 | else throwErr("invalid assets"), if ((endHeight > height)) | |
448 | 473 | then true | |
449 | 474 | else throwErr("invalid height"), if ((finalizationStageOrUnit == unit)) | |
450 | 475 | then true | |
451 | 476 | else throwErr("finalization in progress"), if ((vote > 0)) | |
452 | 477 | then true | |
453 | 478 | else throwErr("no vote")] | |
454 | 479 | if ((checks == checks)) | |
455 | 480 | then { | |
456 | 481 | let votesListName = getVotesListName(pool) | |
457 | 482 | let userAddressStr = toString(i.caller) | |
458 | 483 | $Tuple2(([IntegerEntry(keyUsed(i.caller, epoch), max([(used - vote), 0])), DeleteEntry(keyVote(pool, i.caller, epoch)), IntegerEntry(keyVotingResult(pool, epoch), (poolResult - vote)), IntegerEntry(keyTotalVotes(epoch), (totalVotes - vote))] ++ deleteNodeActions(votesListName, userAddressStr)), unit) | |
459 | 484 | } | |
460 | 485 | else throw("Strict value is not equal to itself.") | |
461 | 486 | } | |
462 | 487 | ||
463 | 488 | ||
464 | 489 | ||
465 | 490 | @Callable(i) | |
466 | 491 | func setEpochLength (newEpochLength) = { | |
467 | 492 | let checks = [mustManager(i), if ((newEpochLength > 0)) | |
468 | 493 | then true | |
469 | 494 | else throwErr("invalid epoch length")] | |
470 | 495 | if ((checks == checks)) | |
471 | 496 | then $Tuple2([IntegerEntry(keyEpochLengthNew, newEpochLength)], unit) | |
472 | 497 | else throw("Strict value is not equal to itself.") | |
473 | 498 | } | |
474 | 499 | ||
475 | 500 | ||
476 | 501 | ||
477 | 502 | @Callable(i) | |
478 | 503 | func setMaxDepth (newMaxDepth) = { | |
479 | 504 | let checks = [mustManager(i), if ((newMaxDepth > 0)) | |
480 | 505 | then true | |
481 | 506 | else throwErr("invalid max depth")] | |
482 | 507 | if ((checks == checks)) | |
483 | 508 | then $Tuple2([IntegerEntry(keyMaxDepth, newMaxDepth)], unit) | |
484 | 509 | else throw("Strict value is not equal to itself.") | |
485 | 510 | } | |
486 | 511 | ||
487 | 512 | ||
488 | 513 | ||
489 | 514 | @Callable(i) | |
515 | + | func processPoolBalanceINTERNAL (poolStr) = { | |
516 | + | let checkCaller = mustThis(i) | |
517 | + | if ((checkCaller == checkCaller)) | |
518 | + | then { | |
519 | + | let epoch = getIntOrFail(this, keyCurrentEpoch) | |
520 | + | let epochPrevious = (epoch - 1) | |
521 | + | let pool = stringToPool(poolStr) | |
522 | + | let $t01702017060 = pool | |
523 | + | let amountAssetId = $t01702017060._1 | |
524 | + | let priceAssetId = $t01702017060._2 | |
525 | + | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
526 | + | let balanceIsOkCurrent = { | |
527 | + | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
528 | + | if ($isInstanceOf(@, "Boolean")) | |
529 | + | then @ | |
530 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
531 | + | } | |
532 | + | let balanceIsOkPrevious = !(valueOrElse(getBoolean(this, keyInsufficientBalances(pool, (epochPrevious - 1))), false)) | |
533 | + | let actions = if (!(balanceIsOkCurrent)) | |
534 | + | then if (!(balanceIsOkPrevious)) | |
535 | + | then { | |
536 | + | let deleteWxEmissionInv = invoke(factoryContract, "deleteWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
537 | + | if ((deleteWxEmissionInv == deleteWxEmissionInv)) | |
538 | + | then { | |
539 | + | let modifyWeightInv = invoke(factoryContract, "modifyWeight", [lpAssetId, 0], nil) | |
540 | + | if ((modifyWeightInv == modifyWeightInv)) | |
541 | + | then { | |
542 | + | let poolAddress = valueOrErrorMessage(getPoolInfo(amountAssetId, priceAssetId), wrapErr("invalid assets"))._1 | |
543 | + | let newStatus = 3 | |
544 | + | let setPoolStatusInv = invoke(factoryContract, "managePool", [toString(poolAddress), newStatus], nil) | |
545 | + | if ((setPoolStatusInv == setPoolStatusInv)) | |
546 | + | then { | |
547 | + | let listActions = ([DeleteEntry(keyInList(pool))] ++ deleteNodeActions(poolsListName, poolToString(pool))) | |
548 | + | ([IntegerEntry(keyPoolShare(pool, epochPrevious), 0)] ++ listActions) | |
549 | + | } | |
550 | + | else throw("Strict value is not equal to itself.") | |
551 | + | } | |
552 | + | else throw("Strict value is not equal to itself.") | |
553 | + | } | |
554 | + | else throw("Strict value is not equal to itself.") | |
555 | + | } | |
556 | + | else [BooleanEntry(keyInsufficientBalances(pool, epochPrevious), true)] | |
557 | + | else nil | |
558 | + | $Tuple2(actions, unit) | |
559 | + | } | |
560 | + | else throw("Strict value is not equal to itself.") | |
561 | + | } | |
562 | + | ||
563 | + | ||
564 | + | ||
565 | + | @Callable(i) | |
490 | 566 | func processVoteINTERNAL (poolStr,userAddressStr) = { | |
491 | 567 | let checkCaller = mustThis(i) | |
492 | 568 | if ((checkCaller == checkCaller)) | |
493 | 569 | then { | |
494 | 570 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr(("processVoteINTERNAL: invalid user address " + userAddressStr))) | |
495 | 571 | let epoch = getIntOrFail(this, keyCurrentEpoch) | |
496 | 572 | let epochPrevious = (epoch - 1) | |
497 | 573 | let epochLength = getIntOrFail(this, keyEpochLength) | |
498 | 574 | let startHeight = getIntOrFail(this, keyStartHeightByEpoch(epoch)) | |
499 | 575 | let endHeight = (startHeight + epochLength) | |
500 | 576 | let startHeightPrevious = getIntOrFail(this, keyStartHeightByEpoch(epochPrevious)) | |
501 | 577 | let epochLengthPrevious = getIntOrFail(this, keyEpochLengthByEpoch(epochPrevious)) | |
502 | 578 | let endHeightPrevious = (startHeightPrevious + epochLengthPrevious) | |
503 | 579 | let checkTargetEpoch = if ((epochPrevious >= 0)) | |
504 | 580 | then true | |
505 | 581 | else throwErr("processVoteINTERNAL: invalid previous epoch") | |
506 | 582 | if ((checkTargetEpoch == checkTargetEpoch)) | |
507 | 583 | then { | |
508 | 584 | let pool = stringToPool(poolStr) | |
509 | - | let $t01814618186 = pool | |
510 | - | let amountAssetId = $t01814618186._1 | |
511 | - | let priceAssetId = $t01814618186._2 | |
512 | - | let wxEmission = checkWxEmissionPoolLabel(pool) | |
585 | + | let $t01941319453 = pool | |
586 | + | let amountAssetId = $t01941319453._1 | |
587 | + | let priceAssetId = $t01941319453._2 | |
513 | 588 | let gwxAmountAtEndTotal = { | |
514 | 589 | let @ = invoke(this, "getUserGwxAmountAtHeight", [userAddressStr, endHeight], nil) | |
515 | 590 | if ($isInstanceOf(@, "Int")) | |
516 | 591 | then @ | |
517 | 592 | else throw(($getType(@) + " couldn't be cast to Int")) | |
518 | 593 | } | |
519 | 594 | let gwxAmountAtEndTotalPrevious = { | |
520 | 595 | let @ = invoke(this, "getUserGwxAmountAtHeight", [userAddressStr, endHeightPrevious], nil) | |
521 | 596 | if ($isInstanceOf(@, "Int")) | |
522 | 597 | then @ | |
523 | 598 | else throw(($getType(@) + " couldn't be cast to Int")) | |
524 | 599 | } | |
525 | 600 | let totalVotes = valueOrElse(getInteger(keyTotalVotes(epoch)), 0) | |
526 | 601 | let votingResult = valueOrElse(getInteger(keyVotingResult(pool, epoch)), 0) | |
527 | 602 | let votePrevious = valueOrErrorMessage(getInteger(keyVote(pool, userAddress, epochPrevious)), wrapErr((((("processVoteINTERNAL " + poolStr) + " ") + userAddressStr) + ": no previous vote"))) | |
528 | 603 | let used = valueOrElse(getInteger(this, keyUsed(userAddress, epoch)), 0) | |
529 | 604 | let lpAssetIdStr = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
530 | 605 | let votingResultStakedPrevious = valueOrElse(getInteger(keyVotingResultStaked(lpAssetIdStr, epochPrevious)), 0) | |
531 | 606 | let stakingContract = addressFromStringValue(getStrOrFail(this, keyStakingContract)) | |
532 | 607 | let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(lpAssetIdStr, userAddressStr)), 0) | |
533 | 608 | let votingResultStakedActions = if ((stakedByUser == 0)) | |
534 | 609 | then nil | |
535 | 610 | else [IntegerEntry(keyVotingResultStaked(lpAssetIdStr, epochPrevious), (votingResultStakedPrevious + votePrevious))] | |
536 | 611 | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
537 | - | let balanceIsOk = { | |
538 | - | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
539 | - | if ($isInstanceOf(@, "Boolean")) | |
540 | - | then @ | |
541 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
542 | - | } | |
543 | 612 | let newVote = if ((gwxAmountAtEndTotalPrevious > 0)) | |
544 | 613 | then fraction(votePrevious, gwxAmountAtEndTotal, gwxAmountAtEndTotalPrevious) | |
545 | 614 | else 0 | |
546 | - | let actions = if (if (if ((newVote > 0)) | |
547 | - | then wxEmission | |
548 | - | else false) | |
549 | - | then balanceIsOk | |
550 | - | else false) | |
615 | + | let actions = if ((newVote > 0)) | |
551 | 616 | then [IntegerEntry(keyVote(pool, userAddress, epoch), newVote), IntegerEntry(keyTotalVotes(epoch), (totalVotes + newVote)), IntegerEntry(keyVotingResult(pool, epoch), (votingResult + newVote)), IntegerEntry(keyUsed(userAddress, epoch), (used + newVote))] | |
552 | 617 | else deleteNodeActions(getVotesListName(pool), userAddressStr) | |
553 | 618 | $Tuple2((actions ++ votingResultStakedActions), unit) | |
554 | 619 | } | |
555 | 620 | else throw("Strict value is not equal to itself.") | |
556 | 621 | } | |
557 | 622 | else throw("Strict value is not equal to itself.") | |
558 | 623 | } | |
559 | 624 | ||
560 | 625 | ||
561 | 626 | ||
562 | 627 | @Callable(i) | |
563 | 628 | func processPoolINTERNAL (poolStr,force) = { | |
564 | 629 | let checkCaller = mustThis(i) | |
565 | 630 | if ((checkCaller == checkCaller)) | |
566 | 631 | then { | |
567 | 632 | let targetEpoch = { | |
568 | 633 | let currentEpoch = getIntOrFail(this, keyCurrentEpoch) | |
569 | 634 | if (force) | |
570 | 635 | then currentEpoch | |
571 | 636 | else (currentEpoch - 1) | |
572 | 637 | } | |
573 | 638 | let checkTargetEpoch = if ((targetEpoch >= 0)) | |
574 | 639 | then true | |
575 | 640 | else throwErr("processPoolINTERNAL: invalid target epoch") | |
576 | 641 | if ((checkTargetEpoch == checkTargetEpoch)) | |
577 | 642 | then { | |
578 | 643 | let pool = stringToPool(poolStr) | |
579 | - | let $ | |
580 | - | let amountAssetId = $ | |
581 | - | let priceAssetId = $ | |
644 | + | let $t02181621856 = pool | |
645 | + | let amountAssetId = $t02181621856._1 | |
646 | + | let priceAssetId = $t02181621856._2 | |
582 | 647 | let stakingContract = addressFromStringValue(getStrOrFail(this, keyStakingContract)) | |
583 | 648 | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
584 | 649 | let r = { | |
585 | 650 | let @ = invoke(stakingContract, "usersListTraversal", [lpAssetId], nil) | |
586 | 651 | if ($isInstanceOf(@, "Boolean")) | |
587 | 652 | then @ | |
588 | 653 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
589 | 654 | } | |
590 | 655 | if ((r == r)) | |
591 | 656 | then if (r) | |
592 | 657 | then $Tuple2(nil, true) | |
593 | 658 | else { | |
594 | - | let assetsStoreContract = addressFromStringValue(valueOrElse(getString(this, keyAssetsStoreContract), "invalid assets store contract")) | |
595 | - | let wxEmission = checkWxEmissionPoolLabel(pool) | |
596 | - | let balanceIsOk = { | |
597 | - | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
598 | - | if ($isInstanceOf(@, "Boolean")) | |
599 | - | then @ | |
600 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
601 | - | } | |
602 | - | let amountAssetVerified = { | |
603 | - | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) | |
604 | - | if ($isInstanceOf(@, "Boolean")) | |
605 | - | then @ | |
606 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
607 | - | } | |
608 | - | let priceAssetVerified = { | |
609 | - | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [priceAssetId], nil) | |
610 | - | if ($isInstanceOf(@, "Boolean")) | |
611 | - | then @ | |
612 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
613 | - | } | |
614 | - | let setWxEmissionInv = if (if (if (if (!(wxEmission)) | |
615 | - | then balanceIsOk | |
616 | - | else false) | |
617 | - | then amountAssetVerified | |
618 | - | else false) | |
619 | - | then priceAssetVerified | |
620 | - | else false) | |
621 | - | then invoke(factoryContract, "setWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
622 | - | else unit | |
623 | - | if ((setWxEmissionInv == setWxEmissionInv)) | |
624 | - | then { | |
625 | - | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(targetEpoch)), 0) | |
626 | - | let votingResult = valueOrElse(getInteger(this, keyVotingResult(pool, targetEpoch)), 0) | |
627 | - | let share = if (if (if ((totalVotes == 0)) | |
628 | - | then true | |
629 | - | else !(wxEmission)) | |
630 | - | then true | |
631 | - | else !(balanceIsOk)) | |
632 | - | then 0 | |
633 | - | else fraction(votingResult, poolWeightMult, totalVotes) | |
634 | - | let modifyWeightInv = invoke(factoryContract, "modifyWeight", [lpAssetId, share], nil) | |
635 | - | if ((modifyWeightInv == modifyWeightInv)) | |
636 | - | then $Tuple2([IntegerEntry(keyPoolShare(pool, targetEpoch), share)], false) | |
637 | - | else throw("Strict value is not equal to itself.") | |
638 | - | } | |
659 | + | let assetsStoreContract = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyAssetsStoreContract), "invalid assets store contract")) | |
660 | + | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(targetEpoch)), 0) | |
661 | + | let votingResult = valueOrElse(getInteger(this, keyVotingResult(pool, targetEpoch)), 0) | |
662 | + | let share = if ((totalVotes == 0)) | |
663 | + | then 0 | |
664 | + | else fraction(votingResult, poolWeightMult, totalVotes) | |
665 | + | let modifyWeightInv = invoke(factoryContract, "modifyWeight", [lpAssetId, share], nil) | |
666 | + | if ((modifyWeightInv == modifyWeightInv)) | |
667 | + | then $Tuple2([IntegerEntry(keyPoolShare(pool, targetEpoch), share)], false) | |
639 | 668 | else throw("Strict value is not equal to itself.") | |
640 | 669 | } | |
641 | 670 | else throw("Strict value is not equal to itself.") | |
642 | 671 | } | |
643 | 672 | else throw("Strict value is not equal to itself.") | |
644 | 673 | } | |
645 | 674 | else throw("Strict value is not equal to itself.") | |
646 | 675 | } | |
647 | 676 | ||
648 | 677 | ||
649 | 678 | ||
650 | 679 | @Callable(i) | |
651 | 680 | func finalizeHelper () = { | |
652 | 681 | let force = valueOrElse(getBoolean(keyFinalizationShouldBeForced), false) | |
653 | 682 | let epoch = valueOrElse(getInteger(this, keyCurrentEpoch), 0) | |
654 | 683 | let previousEpoch = (epoch - 1) | |
655 | 684 | let startHeight = getIntOrFail(this, keyStartHeightByEpoch(epoch)) | |
656 | 685 | let epochLength = getIntOrFail(this, keyEpochLength) | |
657 | 686 | let endHeight = (startHeight + epochLength) | |
658 | 687 | let finalizationStageOrUnit = getInteger(this, keyFinalizationStage) | |
659 | 688 | if (if (if ((height >= endHeight)) | |
660 | 689 | then (finalizationStageOrUnit == unit) | |
661 | 690 | else false) | |
662 | 691 | then !(force) | |
663 | 692 | else false) | |
664 | 693 | then { | |
665 | 694 | let newEpoch = (epoch + 1) | |
666 | 695 | let newEpochLengthOption = getInteger(this, keyEpochLengthNew) | |
667 | 696 | let newEpochLengthActions = match newEpochLengthOption { | |
668 | 697 | case newEpochLength: Int => | |
669 | 698 | [IntegerEntry(keyEpochLength, newEpochLength), DeleteEntry(keyEpochLengthNew)] | |
670 | 699 | case _: Unit => | |
671 | 700 | nil | |
672 | 701 | case _ => | |
673 | 702 | throw("Match error") | |
674 | 703 | } | |
675 | - | $Tuple2(([IntegerEntry(keyStartHeightByEpoch(newEpoch), height), IntegerEntry(keyStartHeight, height), IntegerEntry(keyCurrentEpoch, newEpoch), IntegerEntry(keyFinalizationStage, | |
704 | + | $Tuple2(([IntegerEntry(keyStartHeightByEpoch(newEpoch), height), IntegerEntry(keyStartHeight, height), IntegerEntry(keyCurrentEpoch, newEpoch), IntegerEntry(keyFinalizationStage, finalizationStageBalances), IntegerEntry(keyEpochLengthByEpoch(epoch), epochLength)] ++ newEpochLengthActions), true) | |
676 | 705 | } | |
677 | 706 | else if (if (force) | |
678 | 707 | then (finalizationStageOrUnit == unit) | |
679 | 708 | else false) | |
680 | 709 | then $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares)], true) | |
681 | 710 | else if ((finalizationStageOrUnit == unit)) | |
682 | 711 | then $Tuple2(nil, false) | |
683 | - | else if ((finalizationStageOrUnit == | |
712 | + | else if ((finalizationStageOrUnit == finalizationStageBalances)) | |
684 | 713 | then { | |
685 | 714 | let poolOrUnit = getString(keyNextPool) | |
686 | - | let userOrUnit = getString(keyNextUser) | |
687 | 715 | match poolOrUnit { | |
688 | 716 | case _: Unit => | |
689 | 717 | match getString(keyListHead(poolsListName)) { | |
690 | 718 | case _: Unit => | |
691 | - | $Tuple2([IntegerEntry(keyFinalizationStage, | |
692 | - | case | |
693 | - | $Tuple2([StringEntry(keyNextPool, | |
719 | + | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageTotal), DeleteEntry(keyNextPool)], true) | |
720 | + | case nextPoolStr: String => | |
721 | + | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
694 | 722 | case _ => | |
695 | 723 | throw("Match error") | |
696 | 724 | } | |
697 | 725 | case poolStr: String => | |
698 | - | let pool = stringToPool(poolStr) | |
699 | - | let nextUserOrUnit = match userOrUnit { | |
726 | + | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
727 | + | if ((nextPoolOrUnit == nextPoolOrUnit)) | |
728 | + | then { | |
729 | + | let r = invoke(this, "processPoolBalanceINTERNAL", [poolStr], nil) | |
730 | + | if ((r == r)) | |
731 | + | then match nextPoolOrUnit { | |
732 | + | case _: Unit => | |
733 | + | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageTotal), DeleteEntry(keyNextPool)], true) | |
734 | + | case nextPoolStr: String => | |
735 | + | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
736 | + | case _ => | |
737 | + | throw("Match error") | |
738 | + | } | |
739 | + | else throw("Strict value is not equal to itself.") | |
740 | + | } | |
741 | + | else throw("Strict value is not equal to itself.") | |
742 | + | case _ => | |
743 | + | throw("Match error") | |
744 | + | } | |
745 | + | } | |
746 | + | else if ((finalizationStageOrUnit == finalizationStageTotal)) | |
747 | + | then { | |
748 | + | let poolOrUnit = getString(keyNextPool) | |
749 | + | let userOrUnit = getString(keyNextUser) | |
750 | + | match poolOrUnit { | |
751 | + | case _: Unit => | |
752 | + | match getString(keyListHead(poolsListName)) { | |
753 | + | case _: Unit => | |
754 | + | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares), DeleteEntry(keyNextPool), DeleteEntry(keyNextUser)], true) | |
755 | + | case poolsHeadStr: String => | |
756 | + | $Tuple2([StringEntry(keyNextPool, poolsHeadStr)], true) | |
757 | + | case _ => | |
758 | + | throw("Match error") | |
759 | + | } | |
760 | + | case poolStr: String => | |
761 | + | let pool = stringToPool(poolStr) | |
762 | + | let nextUserOrUnit = match userOrUnit { | |
763 | + | case _: Unit => | |
764 | + | getString(keyListHead(getVotesListName(pool))) | |
765 | + | case user: String => | |
766 | + | let next = getString(keyListNext(getVotesListName(pool), user)) | |
767 | + | if ((next == next)) | |
768 | + | then { | |
769 | + | let processVoteInv = invoke(this, "processVoteINTERNAL", [poolStr, user], nil) | |
770 | + | if ((processVoteInv == processVoteInv)) | |
771 | + | then next | |
772 | + | else throw("Strict value is not equal to itself.") | |
773 | + | } | |
774 | + | else throw("Strict value is not equal to itself.") | |
775 | + | case _ => | |
776 | + | throw("Match error") | |
777 | + | } | |
778 | + | match nextUserOrUnit { | |
779 | + | case _: Unit => | |
780 | + | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
781 | + | match nextPoolOrUnit { | |
782 | + | case _: Unit => | |
783 | + | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares), DeleteEntry(keyNextPool), DeleteEntry(keyNextUser)], true) | |
784 | + | case s: String => | |
785 | + | $Tuple2([StringEntry(keyNextPool, s), DeleteEntry(keyNextUser)], true) | |
786 | + | case _ => | |
787 | + | throw("Match error") | |
788 | + | } | |
789 | + | case nextUser: String => | |
790 | + | $Tuple2([StringEntry(keyNextUser, nextUser)], true) | |
791 | + | case _ => | |
792 | + | throw("Match error") | |
793 | + | } | |
794 | + | case _ => | |
795 | + | throw("Match error") | |
796 | + | } | |
797 | + | } | |
798 | + | else if ((finalizationStageOrUnit == finalizationStageShares)) | |
799 | + | then { | |
800 | + | let poolOrUnit = getString(keyNextPool) | |
801 | + | match poolOrUnit { | |
700 | 802 | case _: Unit => | |
701 | - | getString(keyListHead(getVotesListName(pool))) | |
702 | - | case user: String => | |
703 | - | let next = getString(keyListNext(getVotesListName(pool), user)) | |
704 | - | if ((next == next)) | |
803 | + | match getString(keyListHead(poolsListName)) { | |
804 | + | case _: Unit => | |
805 | + | let actions = if (force) | |
806 | + | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced)] | |
807 | + | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight)] | |
808 | + | let gwxRewardDepositInv = gwxRewardDeposit() | |
809 | + | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
810 | + | then $Tuple2(actions, true) | |
811 | + | else throw("Strict value is not equal to itself.") | |
812 | + | case nextPoolStr: String => | |
813 | + | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
814 | + | case _ => | |
815 | + | throw("Match error") | |
816 | + | } | |
817 | + | case poolStr: String => | |
818 | + | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
819 | + | if ((nextPoolOrUnit == nextPoolOrUnit)) | |
705 | 820 | then { | |
706 | - | let processVoteInv = invoke(this, "processVoteINTERNAL", [poolStr, user], nil) | |
707 | - | if ((processVoteInv == processVoteInv)) | |
708 | - | then next | |
821 | + | let r = { | |
822 | + | let @ = invoke(this, "processPoolINTERNAL", [poolStr, force], nil) | |
823 | + | if ($isInstanceOf(@, "Boolean")) | |
824 | + | then @ | |
825 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
826 | + | } | |
827 | + | if ((r == r)) | |
828 | + | then if (r) | |
829 | + | then $Tuple2(nil, true) | |
830 | + | else match nextPoolOrUnit { | |
831 | + | case _: Unit => | |
832 | + | let actions = if (force) | |
833 | + | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced), DeleteEntry(keyNextPool)] | |
834 | + | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight), DeleteEntry(keyNextPool)] | |
835 | + | let gwxRewardDepositInv = gwxRewardDeposit() | |
836 | + | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
837 | + | then $Tuple2(actions, true) | |
838 | + | else throw("Strict value is not equal to itself.") | |
839 | + | case nextPoolStr: String => | |
840 | + | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
841 | + | case _ => | |
842 | + | throw("Match error") | |
843 | + | } | |
709 | 844 | else throw("Strict value is not equal to itself.") | |
710 | 845 | } | |
711 | 846 | else throw("Strict value is not equal to itself.") | |
712 | 847 | case _ => | |
713 | 848 | throw("Match error") | |
714 | 849 | } | |
715 | - | match nextUserOrUnit { | |
716 | - | case _: Unit => | |
717 | - | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
718 | - | match nextPoolOrUnit { | |
719 | - | case _: Unit => | |
720 | - | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares), DeleteEntry(keyNextPool), DeleteEntry(keyNextUser)], true) | |
721 | - | case s: String => | |
722 | - | $Tuple2([StringEntry(keyNextPool, s), DeleteEntry(keyNextUser)], true) | |
723 | - | case _ => | |
724 | - | throw("Match error") | |
725 | - | } | |
726 | - | case nextUser: String => | |
727 | - | $Tuple2([StringEntry(keyNextUser, nextUser)], true) | |
728 | - | case _ => | |
729 | - | throw("Match error") | |
730 | 850 | } | |
731 | - | case _ => | |
732 | - | throw("Match error") | |
733 | - | } | |
734 | - | } | |
735 | - | else if ((finalizationStageOrUnit == finalizationStageShares)) | |
736 | - | then { | |
737 | - | let poolOrUnit = getString(keyNextPool) | |
738 | - | match poolOrUnit { | |
739 | - | case _: Unit => | |
740 | - | match getString(keyListHead(poolsListName)) { | |
741 | - | case _: Unit => | |
742 | - | let actions = if (force) | |
743 | - | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced)] | |
744 | - | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight)] | |
745 | - | let gwxRewardDepositInv = gwxRewardDeposit() | |
746 | - | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
747 | - | then $Tuple2(actions, true) | |
748 | - | else throw("Strict value is not equal to itself.") | |
749 | - | case nextPoolStr: String => | |
750 | - | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
751 | - | case _ => | |
752 | - | throw("Match error") | |
753 | - | } | |
754 | - | case poolStr: String => | |
755 | - | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
756 | - | if ((nextPoolOrUnit == nextPoolOrUnit)) | |
757 | - | then { | |
758 | - | let r = { | |
759 | - | let @ = invoke(this, "processPoolINTERNAL", [poolStr, force], nil) | |
760 | - | if ($isInstanceOf(@, "Boolean")) | |
761 | - | then @ | |
762 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
763 | - | } | |
764 | - | if ((r == r)) | |
765 | - | then if (r) | |
766 | - | then $Tuple2(nil, true) | |
767 | - | else match nextPoolOrUnit { | |
768 | - | case _: Unit => | |
769 | - | let actions = if (force) | |
770 | - | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced), DeleteEntry(keyNextPool)] | |
771 | - | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight), DeleteEntry(keyNextPool)] | |
772 | - | let gwxRewardDepositInv = gwxRewardDeposit() | |
773 | - | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
774 | - | then $Tuple2(actions, true) | |
775 | - | else throw("Strict value is not equal to itself.") | |
776 | - | case nextPoolStr: String => | |
777 | - | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
778 | - | case _ => | |
779 | - | throw("Match error") | |
780 | - | } | |
781 | - | else throw("Strict value is not equal to itself.") | |
782 | - | } | |
783 | - | else throw("Strict value is not equal to itself.") | |
784 | - | case _ => | |
785 | - | throw("Match error") | |
786 | - | } | |
787 | - | } | |
788 | - | else throwErr("finalization is broken") | |
851 | + | else throwErr("finalization is broken") | |
789 | 852 | } | |
790 | 853 | ||
791 | 854 | ||
792 | 855 | ||
793 | 856 | @Callable(i) | |
794 | 857 | func finalizeWrapper (counter) = { | |
795 | 858 | let votingEmissionRateContract = addressFromStringValue(getStringValue(this, keyVotingEmissionRateContract)) | |
796 | 859 | let result = { | |
797 | 860 | let @ = invoke(this, "finalizeHelper", nil, nil) | |
798 | 861 | if ($isInstanceOf(@, "Boolean")) | |
799 | 862 | then @ | |
800 | 863 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
801 | 864 | } | |
802 | 865 | if ((result == result)) | |
803 | 866 | then if (!(result)) | |
804 | 867 | then if ((counter == 0)) | |
805 | 868 | then throwErr("Current voting is not over yet") | |
806 | 869 | else { | |
807 | 870 | let inv = invoke(votingEmissionRateContract, "finalize", nil, nil) | |
808 | 871 | if ((inv == inv)) | |
809 | 872 | then $Tuple2(nil, unit) | |
810 | 873 | else throw("Strict value is not equal to itself.") | |
811 | 874 | } | |
812 | 875 | else { | |
813 | 876 | let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault) | |
814 | 877 | if ((maxDepth > counter)) | |
815 | 878 | then { | |
816 | 879 | let inv = invoke(this, "finalizeWrapper", [(counter + 1)], nil) | |
817 | 880 | if ((inv == inv)) | |
818 | 881 | then $Tuple2(nil, unit) | |
819 | 882 | else throw("Strict value is not equal to itself.") | |
820 | 883 | } | |
821 | 884 | else $Tuple2(nil, unit) | |
822 | 885 | } | |
823 | 886 | else throw("Strict value is not equal to itself.") | |
824 | 887 | } | |
825 | 888 | ||
826 | 889 | ||
827 | 890 | ||
828 | 891 | @Callable(i) | |
829 | 892 | func finalize () = { | |
830 | 893 | let inv = invoke(this, "finalizeWrapper", [0], nil) | |
831 | 894 | if ((inv == inv)) | |
832 | 895 | then $Tuple2(nil, unit) | |
833 | 896 | else throw("Strict value is not equal to itself.") | |
834 | 897 | } | |
835 | 898 | ||
836 | 899 | ||
837 | 900 | ||
838 | 901 | @Callable(i) | |
839 | 902 | func containsNodeREADONLY (listName,id) = $Tuple2(nil, containsNode(listName, id)) | |
840 | 903 | ||
841 | 904 | ||
842 | 905 | ||
843 | 906 | @Callable(i) | |
844 | 907 | func insertNode (listName,id) = { | |
845 | 908 | let checkCaller = mustManager(i) | |
846 | 909 | if ((checkCaller == checkCaller)) | |
847 | 910 | then $Tuple2(insertNodeActions(listName, id), unit) | |
848 | 911 | else throw("Strict value is not equal to itself.") | |
849 | 912 | } | |
850 | 913 | ||
851 | 914 | ||
852 | 915 | ||
853 | 916 | @Callable(i) | |
854 | 917 | func deleteNode (listName,id) = { | |
855 | 918 | let checkCaller = mustManager(i) | |
856 | 919 | if ((checkCaller == checkCaller)) | |
857 | 920 | then $Tuple2(deleteNodeActions(listName, id), unit) | |
858 | 921 | else throw("Strict value is not equal to itself.") | |
859 | 922 | } | |
860 | 923 | ||
861 | 924 | ||
862 | 925 | ||
863 | 926 | @Callable(i) | |
864 | 927 | func isFinalizationInProgress () = { | |
865 | 928 | let finalizationStageOrUnit = getInteger(this, keyFinalizationStage) | |
866 | 929 | let finalizationInProgress = (finalizationStageOrUnit != unit) | |
867 | 930 | $Tuple2(nil, finalizationInProgress) | |
868 | 931 | } | |
869 | 932 | ||
870 | 933 | ||
871 | 934 | ||
872 | 935 | @Callable(i) | |
873 | 936 | func deletePool (amountAssetId,priceAssetId) = { | |
874 | 937 | let checkCaller = if (if ((i.caller == factoryContract)) | |
875 | 938 | then true | |
876 | 939 | else mustManager(i)) | |
877 | 940 | then true | |
878 | 941 | else throwErr("Permission denied") | |
879 | 942 | if ((checkCaller == checkCaller)) | |
880 | 943 | then { | |
881 | 944 | let listName = "pools" | |
882 | 945 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
883 | 946 | let id = makeString([amountAssetId, priceAssetId], separator) | |
884 | 947 | let actions = if (containsNode(listName, id)) | |
885 | 948 | then deleteNodeActions(listName, id) | |
886 | 949 | else nil | |
887 | 950 | ([DeleteEntry(keyInList(pool))] ++ actions) | |
888 | 951 | } | |
889 | 952 | else throw("Strict value is not equal to itself.") | |
890 | 953 | } | |
891 | 954 | ||
892 | 955 | ||
956 | + | ||
957 | + | @Callable(i) | |
958 | + | func resume (amountAssetId,priceAssetId) = { | |
959 | + | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
960 | + | let balanceIsOk = { | |
961 | + | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
962 | + | if ($isInstanceOf(@, "Boolean")) | |
963 | + | then @ | |
964 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
965 | + | } | |
966 | + | let payment = i.payments[0] | |
967 | + | let assetsStoreContract = addressFromStringValue(getStringValue(this, keyAssetsStoreContract)) | |
968 | + | let kBoostingConfig = "%s__config" | |
969 | + | let idxCfgAssetId = 1 | |
970 | + | let boostingContract = addressFromStringValue(getStrOrFail(this, keyBoostingContract)) | |
971 | + | let wxAssetId = fromBase58String(split(getStringValue(boostingContract, kBoostingConfig), separator)[idxCfgAssetId]) | |
972 | + | let amountAssetVerified = { | |
973 | + | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) | |
974 | + | if ($isInstanceOf(@, "Boolean")) | |
975 | + | then @ | |
976 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
977 | + | } | |
978 | + | let priceAssetVerified = { | |
979 | + | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [priceAssetId], nil) | |
980 | + | if ($isInstanceOf(@, "Boolean")) | |
981 | + | then @ | |
982 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
983 | + | } | |
984 | + | let resumptionFee = valueOrElse(getInteger(this, keyResumptionFee), resumptionFeeDefault) | |
985 | + | let checks = [if (balanceIsOk) | |
986 | + | then true | |
987 | + | else throwErr("insufficient balances"), if ((size(i.payments) == 1)) | |
988 | + | then true | |
989 | + | else throwErr("1 payment is required"), if ((payment.assetId == wxAssetId)) | |
990 | + | then true | |
991 | + | else throwErr("invalid payment asset id"), if ((payment.amount == resumptionFee)) | |
992 | + | then true | |
993 | + | else throwErr("invalid payment amount"), if (if (amountAssetVerified) | |
994 | + | then priceAssetVerified | |
995 | + | else false) | |
996 | + | then true | |
997 | + | else throwErr("both assets should be verified")] | |
998 | + | if ((checks == checks)) | |
999 | + | then { | |
1000 | + | let pool = $Tuple2(amountAssetId, priceAssetId) | |
1001 | + | let inListActions = ([BooleanEntry(keyInList(pool), true)] ++ insertNodeActions(poolsListName, poolToString(pool))) | |
1002 | + | $Tuple2(inListActions, unit) | |
1003 | + | } | |
1004 | + | else throw("Strict value is not equal to itself.") | |
1005 | + | } | |
1006 | + | ||
1007 | + | ||
893 | 1008 | @Verifier(tx) | |
894 | 1009 | func verify () = { | |
895 | 1010 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
896 | 1011 | case pk: ByteVector => | |
897 | 1012 | pk | |
898 | 1013 | case _: Unit => | |
899 | 1014 | tx.senderPublicKey | |
900 | 1015 | case _ => | |
901 | 1016 | throw("Match error") | |
902 | 1017 | } | |
903 | 1018 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
904 | 1019 | } | |
905 | 1020 |
github/deemru/w8io/fabc49c 263.29 ms ◑