tx · GRcFi8nMnpSuK2qCwNkiQC8pSkvtEdqofCaugFZbQnRN 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT: -0.04000000 Waves 2023.09.25 13:59 [2770843] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves
{ "type": 13, "id": "GRcFi8nMnpSuK2qCwNkiQC8pSkvtEdqofCaugFZbQnRN", "fee": 4000000, "feeAssetId": null, "timestamp": 1695639579529, "version": 2, "chainId": 84, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "3oWxnR8posaQvnPeCCY1goxYQ9WW7eqdkvxeTmyyUnHcNPWruDgQFDeB4BaK5m9CpMuHQtboKxuVUYYXCti1xaby" ], "script": "base64:BgKSLAgCEgUKAwEEARIHCgUBBAEIARIDCgEIEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgRiaWczIgRiaWc0IgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2l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FNAgRVbml0CAUCaWkPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IEAmFNBQJpaQMJAAECBQJhTQIFT3JkZXIEAmZiBQJhTQQCaWwJAQJiZQAEAmltAwkBAmd4AAkAlAoCBgIACQECZmEBBQJmYgQCYUcIBQJpbQJfMQQCYUgIBQJpbQJfMgQCYUkJAPQDAwgFAmZiCWJvZHlCeXRlcwkAkQMCCAUCZmIGcHJvb2ZzAAAIBQJmYg9zZW5kZXJQdWJsaWNLZXkEAmFKCQD0AwMIBQJmYglib2R5Qnl0ZXMJAJEDAggFAmZiBnByb29mcwABBQJpbAMDAwUCYUcFAmFJBwUCYUoHBgkBAmFGBAUCYUcFAmFIBQJhSQUCYUoDCQABAgUCYU0CFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJhUgUCYU0DCQD0AwMIBQJpaQlib2R5Qnl0ZXMJAJEDAggFAmlpBnByb29mcwAABQJpawYEAmluCQD2AwEJAQV2YWx1ZQEIBQJhUgZzY3JpcHQEAmlvCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYVEJAQJhQgAEAmlwCQDxBwEFBHRoaXMDCQAAAgUCaW8FAmluCQECIT0CBQJpcAUCaW4HCQD0AwMIBQJpaQlib2R5Qnl0ZXMJAJEDAggFAmlpBnByb29mcwAABQJpa0XxHmY=", "height": 2770843, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9SE62DHbFfFbbZQXXRaUEGKirf2imixTrqmk9hDGYSKv Next: JFbdagHpBNy3qRjSWLENLoGQgGKW4W16TfJTNB2LHPQ Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
23 | 23 | ||
24 | 24 | let wavesString = "WAVES" | |
25 | - | ||
26 | - | let ampInitial = 50 | |
27 | 25 | ||
28 | 26 | let Amult = "100" | |
29 | 27 | ||
127 | 125 | func pa () = "%s__priceAsset" | |
128 | 126 | ||
129 | 127 | ||
130 | - | func amp () = "%s__amp" | |
131 | - | ||
132 | - | ||
133 | - | func keyAmpHistory (heightBlocks) = ("%s%d__amp__" + toString(heightBlocks)) | |
134 | - | ||
135 | - | ||
136 | - | func keyChangeAmpLastCall () = "%s__changeAmpLastCall" | |
128 | + | func amp () = makeString(["%s%s", "amp", toString(this)], SEP) | |
137 | 129 | ||
138 | 130 | ||
139 | 131 | let keyFee = "%s__fee" | |
229 | 221 | else throw(($getType(@) + " couldn't be cast to Int")) | |
230 | 222 | } | |
231 | 223 | ||
232 | - | let A = strf( | |
224 | + | let A = strf(fca, amp()) | |
233 | 225 | ||
234 | 226 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
235 | 227 | ||
263 | 255 | ||
264 | 256 | let poolConfigParsed = parsePoolConfig(gpc()) | |
265 | 257 | ||
266 | - | let $ | |
258 | + | let $t084928678 = poolConfigParsed | |
267 | 259 | ||
268 | - | let cfgPoolAddress = $ | |
260 | + | let cfgPoolAddress = $t084928678._1 | |
269 | 261 | ||
270 | - | let cfgPoolStatus = $ | |
262 | + | let cfgPoolStatus = $t084928678._2 | |
271 | 263 | ||
272 | - | let cfgLpAssetId = $ | |
264 | + | let cfgLpAssetId = $t084928678._3 | |
273 | 265 | ||
274 | - | let cfgAmountAssetId = $ | |
266 | + | let cfgAmountAssetId = $t084928678._4 | |
275 | 267 | ||
276 | - | let cfgPriceAssetId = $ | |
268 | + | let cfgPriceAssetId = $t084928678._5 | |
277 | 269 | ||
278 | - | let cfgAmountAssetDecimals = $ | |
270 | + | let cfgAmountAssetDecimals = $t084928678._6 | |
279 | 271 | ||
280 | - | let cfgPriceAssetDecimals = $ | |
272 | + | let cfgPriceAssetDecimals = $t084928678._7 | |
281 | 273 | ||
282 | 274 | func gfc () = split(strf(fca, fcfg()), SEP) | |
283 | 275 | ||
398 | 390 | } | |
399 | 391 | ||
400 | 392 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
401 | - | let $ | |
393 | + | let $t01318313231 = { | |
402 | 394 | let $l = arr | |
403 | 395 | let $s = size($l) | |
404 | 396 | let $acc0 = $Tuple2(s, false) | |
412 | 404 | ||
413 | 405 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
414 | 406 | } | |
415 | - | let d = $ | |
416 | - | let found = $ | |
407 | + | let d = $t01318313231._1 | |
408 | + | let found = $t01318313231._2 | |
417 | 409 | if (found) | |
418 | 410 | then d | |
419 | 411 | else throw(("D calculation error, D = " + toString(d))) | |
547 | 539 | else calcLpAmt | |
548 | 540 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
549 | 541 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
550 | - | let $ | |
542 | + | let $t02099321338 = if (if (isOneAsset) | |
551 | 543 | then (pmtId == amIdStr) | |
552 | 544 | else false) | |
553 | 545 | then $Tuple2(pmtAmt, 0) | |
556 | 548 | else false) | |
557 | 549 | then $Tuple2(0, pmtAmt) | |
558 | 550 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
559 | - | let writeAmAmt = $ | |
560 | - | let writePrAmt = $ | |
551 | + | let writeAmAmt = $t02099321338._1 | |
552 | + | let writePrAmt = $t02099321338._2 | |
561 | 553 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
562 | 554 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
563 | 555 | } | |
576 | 568 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
577 | 569 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
578 | 570 | func calc (acc,cur) = { | |
579 | - | let $ | |
580 | - | let y = $ | |
581 | - | let found = $ | |
571 | + | let $t02253322553 = acc | |
572 | + | let y = $t02253322553._1 | |
573 | + | let found = $t02253322553._2 | |
582 | 574 | if ((found != unit)) | |
583 | 575 | then acc | |
584 | 576 | else { | |
591 | 583 | } | |
592 | 584 | ||
593 | 585 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
594 | - | let $ | |
586 | + | let $t02286022907 = { | |
595 | 587 | let $l = arr | |
596 | 588 | let $s = size($l) | |
597 | 589 | let $acc0 = $Tuple2(D, unit) | |
605 | 597 | ||
606 | 598 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
607 | 599 | } | |
608 | - | let y = $ | |
609 | - | let found = $ | |
600 | + | let y = $t02286022907._1 | |
601 | + | let found = $t02286022907._2 | |
610 | 602 | if ((found != unit)) | |
611 | 603 | then y | |
612 | 604 | else throw(("Y calculation error, Y = " + toString(y))) | |
650 | 642 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
651 | 643 | let amountAssetAmount = order.amount | |
652 | 644 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
653 | - | let $ | |
645 | + | let $t02510525317 = if ((order.orderType == Buy)) | |
654 | 646 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
655 | 647 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
656 | - | let amountAssetBalanceDelta = $ | |
657 | - | let priceAssetBalanceDelta = $ | |
648 | + | let amountAssetBalanceDelta = $t02510525317._1 | |
649 | + | let priceAssetBalanceDelta = $t02510525317._2 | |
658 | 650 | if (if (if (igs()) | |
659 | 651 | then true | |
660 | 652 | else (cfgPoolStatus == PoolMatcherDis)) | |
667 | 659 | then throw("Wr assets") | |
668 | 660 | else { | |
669 | 661 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
670 | - | let $ | |
671 | - | let unusedActions = $ | |
672 | - | let dLpNew = $ | |
662 | + | let $t02565925759 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
663 | + | let unusedActions = $t02565925759._1 | |
664 | + | let dLpNew = $t02565925759._2 | |
673 | 665 | let isOrderValid = (dLpNew >= dLp) | |
674 | 666 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
675 | 667 | $Tuple2(isOrderValid, info) | |
723 | 715 | then { | |
724 | 716 | let amBalance = getAccBalance(amId) | |
725 | 717 | let prBalance = getAccBalance(prId) | |
726 | - | let $ | |
718 | + | let $t02841528877 = if ((txId == "")) | |
727 | 719 | then $Tuple2(amBalance, prBalance) | |
728 | 720 | else if ((pmtAssetId == amId)) | |
729 | 721 | then if ((pmtAmtRaw > amBalance)) | |
734 | 726 | then throw("invalid payment amount") | |
735 | 727 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
736 | 728 | else throw("wrong pmtAssetId") | |
737 | - | let amBalanceOld = $ | |
738 | - | let prBalanceOld = $ | |
739 | - | let $ | |
729 | + | let amBalanceOld = $t02841528877._1 | |
730 | + | let prBalanceOld = $t02841528877._2 | |
731 | + | let $t02888329059 = if ((pmtAssetId == amId)) | |
740 | 732 | then $Tuple2(pmtAmtRaw, 0) | |
741 | 733 | else if ((pmtAssetId == prId)) | |
742 | 734 | then $Tuple2(0, pmtAmtRaw) | |
743 | 735 | else throw("invalid payment") | |
744 | - | let amAmountRaw = $ | |
745 | - | let prAmountRaw = $ | |
746 | - | let $ | |
736 | + | let amAmountRaw = $t02888329059._1 | |
737 | + | let prAmountRaw = $t02888329059._2 | |
738 | + | let $t02906329317 = if (withTakeFee) | |
747 | 739 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
748 | 740 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
749 | - | let amAmount = $ | |
750 | - | let prAmount = $ | |
751 | - | let feeAmount = $ | |
741 | + | let amAmount = $t02906329317._1 | |
742 | + | let prAmount = $t02906329317._2 | |
743 | + | let feeAmount = $t02906329317._3 | |
752 | 744 | let amBalanceNew = (amBalanceOld + amAmount) | |
753 | 745 | let prBalanceNew = (prBalanceOld + prAmount) | |
754 | 746 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
796 | 788 | else { | |
797 | 789 | let amBalance = getAccBalance(amId) | |
798 | 790 | let prBalance = getAccBalance(prId) | |
799 | - | let $ | |
791 | + | let $t03142931540 = { | |
800 | 792 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
801 | 793 | if ($isInstanceOf(@, "(Int, Int)")) | |
802 | 794 | then @ | |
803 | 795 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
804 | 796 | } | |
805 | - | if (($ | |
797 | + | if (($t03142931540 == $t03142931540)) | |
806 | 798 | then { | |
807 | - | let feeAmount = $ | |
808 | - | let totalGet = $ | |
799 | + | let feeAmount = $t03142931540._2 | |
800 | + | let totalGet = $t03142931540._1 | |
809 | 801 | let totalAmount = if (if ((minOutAmount > 0)) | |
810 | 802 | then (minOutAmount > totalGet) | |
811 | 803 | else false) | |
812 | 804 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
813 | 805 | else totalGet | |
814 | - | let $ | |
806 | + | let $t03173032037 = if ((outAssetId == amId)) | |
815 | 807 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
816 | 808 | else if ((outAssetId == prId)) | |
817 | 809 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
818 | 810 | else throw("invalid out asset id") | |
819 | - | let outAm = $ | |
820 | - | let outPr = $ | |
821 | - | let amBalanceNew = $ | |
822 | - | let prBalanceNew = $ | |
811 | + | let outAm = $t03173032037._1 | |
812 | + | let outPr = $t03173032037._2 | |
813 | + | let amBalanceNew = $t03173032037._3 | |
814 | + | let prBalanceNew = $t03173032037._4 | |
823 | 815 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
824 | 816 | let curPr = f1(curPrX18, scale8) | |
825 | 817 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
834 | 826 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
835 | 827 | if ((burn == burn)) | |
836 | 828 | then { | |
837 | - | let $ | |
829 | + | let $t03282233172 = { | |
838 | 830 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
839 | 831 | then 0 | |
840 | 832 | else feeAmount | |
845 | 837 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
846 | 838 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
847 | 839 | } | |
848 | - | let amountAssetBalanceDelta = $ | |
849 | - | let priceAssetBalanceDelta = $ | |
850 | - | let $ | |
851 | - | let refreshDLpActions = $ | |
852 | - | let updatedDLp = $ | |
840 | + | let amountAssetBalanceDelta = $t03282233172._1 | |
841 | + | let priceAssetBalanceDelta = $t03282233172._2 | |
842 | + | let $t03317533283 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
843 | + | let refreshDLpActions = $t03317533283._1 | |
844 | + | let updatedDLp = $t03317533283._2 | |
853 | 845 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
854 | 846 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
855 | 847 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
921 | 913 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
922 | 914 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
923 | 915 | func calc (acc,cur) = { | |
924 | - | let $ | |
925 | - | let y = $ | |
926 | - | let found = $ | |
916 | + | let $t03477034790 = acc | |
917 | + | let y = $t03477034790._1 | |
918 | + | let found = $t03477034790._2 | |
927 | 919 | if ((found != unit)) | |
928 | 920 | then acc | |
929 | 921 | else { | |
936 | 928 | } | |
937 | 929 | ||
938 | 930 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
939 | - | let $ | |
931 | + | let $t03512135168 = { | |
940 | 932 | let $l = arr | |
941 | 933 | let $s = size($l) | |
942 | 934 | let $acc0 = $Tuple2(D, unit) | |
950 | 942 | ||
951 | 943 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
952 | 944 | } | |
953 | - | let y = $ | |
954 | - | let found = $ | |
945 | + | let y = $t03512135168._1 | |
946 | + | let found = $t03512135168._2 | |
955 | 947 | if ((found != unit)) | |
956 | 948 | then y | |
957 | 949 | else throw(("Y calculation error, Y = " + toString(y))) | |
963 | 955 | ||
964 | 956 | @Callable(i) | |
965 | 957 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
966 | - | let $ | |
958 | + | let $t03552035944 = if ((isReverse == false)) | |
967 | 959 | then { | |
968 | 960 | let assetOut = strf(this, pa()) | |
969 | 961 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
974 | 966 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
975 | 967 | $Tuple2(assetOut, poolAmountInBalance) | |
976 | 968 | } | |
977 | - | let assetOut = $ | |
978 | - | let poolAmountInBalance = $ | |
969 | + | let assetOut = $t03552035944._1 | |
970 | + | let poolAmountInBalance = $t03552035944._2 | |
979 | 971 | let poolConfig = gpc() | |
980 | 972 | let amId = poolConfig[idxAmAsId] | |
981 | 973 | let prId = poolConfig[idxPrAsId] | |
1030 | 1022 | then { | |
1031 | 1023 | let pmt = value(i.payments[0]) | |
1032 | 1024 | let assetIn = assetIdToString(pmt.assetId) | |
1033 | - | let $ | |
1025 | + | let $t03767938073 = if ((isReverse == false)) | |
1034 | 1026 | then { | |
1035 | 1027 | let assetOut = strf(this, pa()) | |
1036 | 1028 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1041 | 1033 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1042 | 1034 | $Tuple2(assetOut, poolAmountInBalance) | |
1043 | 1035 | } | |
1044 | - | let assetOut = $ | |
1045 | - | let poolAmountInBalance = $ | |
1036 | + | let assetOut = $t03767938073._1 | |
1037 | + | let poolAmountInBalance = $t03767938073._2 | |
1046 | 1038 | let poolConfig = gpc() | |
1047 | 1039 | let amId = poolConfig[idxAmAsId] | |
1048 | 1040 | let prId = poolConfig[idxPrAsId] | |
1158 | 1150 | else throw("Strict value is not equal to itself.") | |
1159 | 1151 | } | |
1160 | 1152 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1161 | - | let $ | |
1162 | - | let refreshDLpActions = $ | |
1163 | - | let updatedDLp = $ | |
1153 | + | let $t04252842670 = refreshDLpInternal(0, 0, 0) | |
1154 | + | let refreshDLpActions = $t04252842670._1 | |
1155 | + | let updatedDLp = $t04252842670._2 | |
1164 | 1156 | let check = if ((updatedDLp >= currentDLp)) | |
1165 | 1157 | then true | |
1166 | 1158 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1233 | 1225 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1234 | 1226 | if ((currentDLp == currentDLp)) | |
1235 | 1227 | then { | |
1236 | - | let $ | |
1237 | - | if (($ | |
1228 | + | let $t04431144469 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1229 | + | if (($t04431144469 == $t04431144469)) | |
1238 | 1230 | then { | |
1239 | - | let feeAmount = $ | |
1240 | - | let state = $ | |
1241 | - | let estimLP = $ | |
1231 | + | let feeAmount = $t04431144469._3 | |
1232 | + | let state = $t04431144469._2 | |
1233 | + | let estimLP = $t04431144469._1 | |
1242 | 1234 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1243 | 1235 | then (minOutAmount > estimLP) | |
1244 | 1236 | else false) | |
1266 | 1258 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1267 | 1259 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1268 | 1260 | else nil | |
1269 | - | let $ | |
1261 | + | let $t04535445703 = if ((this == feeCollectorAddress)) | |
1270 | 1262 | then $Tuple2(0, 0) | |
1271 | 1263 | else { | |
1272 | 1264 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1276 | 1268 | then $Tuple2(-(feeAmount), 0) | |
1277 | 1269 | else $Tuple2(0, -(feeAmount)) | |
1278 | 1270 | } | |
1279 | - | let amountAssetBalanceDelta = $ | |
1280 | - | let priceAssetBalanceDelta = $ | |
1281 | - | let $ | |
1282 | - | let refreshDLpActions = $ | |
1283 | - | let updatedDLp = $ | |
1271 | + | let amountAssetBalanceDelta = $t04535445703._1 | |
1272 | + | let priceAssetBalanceDelta = $t04535445703._2 | |
1273 | + | let $t04570645814 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1274 | + | let refreshDLpActions = $t04570645814._1 | |
1275 | + | let updatedDLp = $t04570645814._2 | |
1284 | 1276 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1285 | 1277 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1286 | 1278 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1312 | 1304 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1313 | 1305 | if ((currentDLp == currentDLp)) | |
1314 | 1306 | then { | |
1315 | - | let $ | |
1316 | - | let refreshDLpActions = $ | |
1317 | - | let updatedDLp = $ | |
1307 | + | let $t04684446909 = refreshDLpInternal(0, 0, 0) | |
1308 | + | let refreshDLpActions = $t04684446909._1 | |
1309 | + | let updatedDLp = $t04684446909._2 | |
1318 | 1310 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1319 | 1311 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1320 | 1312 | then (state ++ refreshDLpActions) | |
1339 | 1331 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1340 | 1332 | if ((b == b)) | |
1341 | 1333 | then { | |
1342 | - | let $ | |
1343 | - | let refreshDLpActions = $ | |
1344 | - | let updatedDLp = $ | |
1334 | + | let $t04808248164 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1335 | + | let refreshDLpActions = $t04808248164._1 | |
1336 | + | let updatedDLp = $t04808248164._2 | |
1345 | 1337 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1346 | 1338 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1347 | 1339 | then (state ++ refreshDLpActions) | |
1376 | 1368 | else throwErr("exactly 1 payment are expected")] | |
1377 | 1369 | if ((checks == checks)) | |
1378 | 1370 | then { | |
1379 | - | let $ | |
1380 | - | let state = $ | |
1381 | - | let totalAmount = $ | |
1371 | + | let $t04878248937 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1372 | + | let state = $t04878248937._1 | |
1373 | + | let totalAmount = $t04878248937._2 | |
1382 | 1374 | $Tuple2(state, totalAmount) | |
1383 | 1375 | } | |
1384 | 1376 | else throw("Strict value is not equal to itself.") | |
1395 | 1387 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1396 | 1388 | then { | |
1397 | 1389 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1398 | - | let $ | |
1399 | - | let dLpUpdateActions = $ | |
1400 | - | let updatedDLp = $ | |
1390 | + | let $t04946149525 = refreshDLpInternal(0, 0, 0) | |
1391 | + | let dLpUpdateActions = $t04946149525._1 | |
1392 | + | let updatedDLp = $t04946149525._2 | |
1401 | 1393 | let actions = if ((dLp != updatedDLp)) | |
1402 | 1394 | then dLpUpdateActions | |
1403 | 1395 | else throwErr("nothing to refresh") | |
1425 | 1417 | let newY = getYD(xp, index, D1) | |
1426 | 1418 | let dy = (xp[index] - newY) | |
1427 | 1419 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1428 | - | let $ | |
1429 | - | let totalGet = $ | |
1430 | - | let feeAmount = $ | |
1420 | + | let $t05053550590 = takeFee(totalGetRaw, outFee) | |
1421 | + | let totalGet = $t05053550590._1 | |
1422 | + | let feeAmount = $t05053550590._2 | |
1431 | 1423 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1432 | 1424 | } | |
1433 | 1425 | ||
1440 | 1432 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1441 | 1433 | let amBalance = getAccBalance(amId) | |
1442 | 1434 | let prBalance = getAccBalance(prId) | |
1443 | - | let $ | |
1435 | + | let $t05096551080 = { | |
1444 | 1436 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1445 | 1437 | if ($isInstanceOf(@, "(Int, Int)")) | |
1446 | 1438 | then @ | |
1447 | 1439 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1448 | 1440 | } | |
1449 | - | let totalGet = $ | |
1450 | - | let feeAmount = $ | |
1441 | + | let totalGet = $t05096551080._1 | |
1442 | + | let feeAmount = $t05096551080._2 | |
1451 | 1443 | let r = ego("", lpId, lpAssetAmount, this) | |
1452 | 1444 | let outAmAmt = r._1 | |
1453 | 1445 | let outPrAmt = r._2 | |
1481 | 1473 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1482 | 1474 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1483 | 1475 | then { | |
1484 | - | let $ | |
1485 | - | let refreshDLpActions = $ | |
1486 | - | let updatedDLp = $ | |
1476 | + | let $t05224652327 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1477 | + | let refreshDLpActions = $t05224652327._1 | |
1478 | + | let updatedDLp = $t05224652327._2 | |
1487 | 1479 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1488 | 1480 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1489 | 1481 | then (state ++ refreshDLpActions) | |
1528 | 1520 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1529 | 1521 | if ((burnA == burnA)) | |
1530 | 1522 | then { | |
1531 | - | let $ | |
1532 | - | let refreshDLpActions = $ | |
1533 | - | let updatedDLp = $ | |
1523 | + | let $t05335453435 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1524 | + | let refreshDLpActions = $t05335453435._1 | |
1525 | + | let updatedDLp = $t05335453435._2 | |
1534 | 1526 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1535 | 1527 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1536 | 1528 | then (state ++ refreshDLpActions) | |
1581 | 1573 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1582 | 1574 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1583 | 1575 | then { | |
1584 | - | let $ | |
1585 | - | let refreshDLpActions = $ | |
1586 | - | let updatedDLp = $ | |
1576 | + | let $t05468654767 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1577 | + | let refreshDLpActions = $t05468654767._1 | |
1578 | + | let updatedDLp = $t05468654767._2 | |
1587 | 1579 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1588 | 1580 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1589 | 1581 | then (state ++ refreshDLpActions) | |
1632 | 1624 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1633 | 1625 | if ((unstakeInv == unstakeInv)) | |
1634 | 1626 | then { | |
1635 | - | let $ | |
1636 | - | let state = $ | |
1637 | - | let totalAmount = $ | |
1627 | + | let $t05578955977 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1628 | + | let state = $t05578955977._1 | |
1629 | + | let totalAmount = $t05578955977._2 | |
1638 | 1630 | $Tuple2(state, totalAmount) | |
1639 | 1631 | } | |
1640 | 1632 | else throw("Strict value is not equal to itself.") | |
1646 | 1638 | ||
1647 | 1639 | @Callable(i) | |
1648 | 1640 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1649 | - | let $ | |
1650 | - | let lpAmount = $ | |
1651 | - | let state = $ | |
1652 | - | let feeAmount = $ | |
1653 | - | let bonus = $ | |
1641 | + | let $t05610556208 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1642 | + | let lpAmount = $t05610556208._1 | |
1643 | + | let state = $t05610556208._2 | |
1644 | + | let feeAmount = $t05610556208._3 | |
1645 | + | let bonus = $t05610556208._4 | |
1654 | 1646 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1655 | 1647 | } | |
1656 | 1648 | ||
1658 | 1650 | ||
1659 | 1651 | @Callable(i) | |
1660 | 1652 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1661 | - | let $ | |
1662 | - | let lpAmount = $ | |
1663 | - | let state = $ | |
1664 | - | let feeAmount = $ | |
1665 | - | let bonus = $ | |
1653 | + | let $t05635656460 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1654 | + | let lpAmount = $t05635656460._1 | |
1655 | + | let state = $t05635656460._2 | |
1656 | + | let feeAmount = $t05635656460._3 | |
1657 | + | let bonus = $t05635656460._4 | |
1666 | 1658 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1667 | 1659 | } | |
1668 | 1660 | ||
1671 | 1663 | @Callable(i) | |
1672 | 1664 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1673 | 1665 | then throw("denied") | |
1674 | - | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr), StringEntry(amp(), toString(ampInitial)), StringEntry(keyAmpHistory(height), toString(ampInitial))], "success") | |
1675 | - | ||
1676 | - | ||
1677 | - | ||
1678 | - | @Callable(i) | |
1679 | - | func invert () = { | |
1680 | - | let checks = [if ((i.caller == fca)) | |
1681 | - | then true | |
1682 | - | else throwErr("invalid caller")] | |
1683 | - | if ((checks == checks)) | |
1684 | - | then $Tuple2([StringEntry(aa(), assetIdToString(cfgPriceAssetId)), StringEntry(pa(), assetIdToString(cfgAmountAssetId))], unit) | |
1685 | - | else throw("Strict value is not equal to itself.") | |
1686 | - | } | |
1666 | + | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1687 | 1667 | ||
1688 | 1668 | ||
1689 | 1669 | ||
1735 | 1715 | ||
1736 | 1716 | @Callable(i) | |
1737 | 1717 | func changeAmp () = { | |
1738 | - | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1739 | - | let $t05929759496 = match cfg { | |
1740 | - | case list: List[Any] => | |
1741 | - | $Tuple3({ | |
1742 | - | let @ = list[0] | |
1743 | - | if ($isInstanceOf(@, "Int")) | |
1744 | - | then @ | |
1745 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
1746 | - | }, { | |
1747 | - | let @ = list[1] | |
1748 | - | if ($isInstanceOf(@, "Int")) | |
1749 | - | then @ | |
1750 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
1751 | - | }, { | |
1752 | - | let @ = list[2] | |
1753 | - | if ($isInstanceOf(@, "Int")) | |
1754 | - | then @ | |
1755 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
1756 | - | }) | |
1757 | - | case _ => | |
1758 | - | throwErr("invalid entry type") | |
1759 | - | } | |
1760 | - | let delay = $t05929759496._1 | |
1761 | - | let delta = $t05929759496._2 | |
1762 | - | let target = $t05929759496._3 | |
1763 | - | let curAmp = parseIntValue(getStringValue(amp())) | |
1764 | - | let newAmpRaw = (curAmp + delta) | |
1765 | - | let newAmp = if ((0 > delta)) | |
1766 | - | then if ((target > newAmpRaw)) | |
1767 | - | then target | |
1768 | - | else newAmpRaw | |
1769 | - | else if ((newAmpRaw > target)) | |
1770 | - | then target | |
1771 | - | else newAmpRaw | |
1772 | - | let lastCall = valueOrElse(getInteger(keyChangeAmpLastCall()), 0) | |
1773 | - | let wait = (lastCall + delay) | |
1774 | - | let checks = [if ((height > wait)) | |
1775 | - | then true | |
1776 | - | else throwErr("try again in few blocks"), if ((curAmp != newAmp)) | |
1777 | - | then true | |
1778 | - | else throwErr("already reached target")] | |
1779 | - | if ((checks == checks)) | |
1780 | - | then [IntegerEntry(keyChangeAmpLastCall(), height), StringEntry(amp(), toString(newAmp)), StringEntry(keyAmpHistory(height), toString(newAmp))] | |
1718 | + | let fcaInv = invoke(fca, "changeAmp", [toString(this)], nil) | |
1719 | + | if ((fcaInv == fcaInv)) | |
1720 | + | then nil | |
1781 | 1721 | else throw("Strict value is not equal to itself.") | |
1782 | 1722 | } | |
1783 | 1723 | ||
1795 | 1735 | match tx { | |
1796 | 1736 | case order: Order => | |
1797 | 1737 | let matcherPub = mp() | |
1798 | - | let $ | |
1738 | + | let $t05904859165 = if (skipOrderValidation()) | |
1799 | 1739 | then $Tuple2(true, "") | |
1800 | 1740 | else validateMatcherOrderAllowed(order) | |
1801 | - | let orderValid = $ | |
1802 | - | let orderValidInfo = $ | |
1741 | + | let orderValid = $t05904859165._1 | |
1742 | + | let orderValidInfo = $t05904859165._2 | |
1803 | 1743 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1804 | 1744 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1805 | 1745 | if (if (if (orderValid) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let scale8BigInt = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | let scale18 = toBigInt(1000000000000000000) | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let big0 = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | 17 | ||
18 | 18 | let big3 = toBigInt(3) | |
19 | 19 | ||
20 | 20 | let big4 = toBigInt(4) | |
21 | 21 | ||
22 | 22 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
23 | 23 | ||
24 | 24 | let wavesString = "WAVES" | |
25 | - | ||
26 | - | let ampInitial = 50 | |
27 | 25 | ||
28 | 26 | let Amult = "100" | |
29 | 27 | ||
30 | 28 | let Dconv = "1" | |
31 | 29 | ||
32 | 30 | let SEP = "__" | |
33 | 31 | ||
34 | 32 | let EMPTY = "" | |
35 | 33 | ||
36 | 34 | let PoolActive = 1 | |
37 | 35 | ||
38 | 36 | let PoolPutDis = 2 | |
39 | 37 | ||
40 | 38 | let PoolMatcherDis = 3 | |
41 | 39 | ||
42 | 40 | let PoolShutdown = 4 | |
43 | 41 | ||
44 | 42 | let idxPoolAddress = 1 | |
45 | 43 | ||
46 | 44 | let idxPoolSt = 2 | |
47 | 45 | ||
48 | 46 | let idxLPAsId = 3 | |
49 | 47 | ||
50 | 48 | let idxAmAsId = 4 | |
51 | 49 | ||
52 | 50 | let idxPrAsId = 5 | |
53 | 51 | ||
54 | 52 | let idxAmtAsDcm = 6 | |
55 | 53 | ||
56 | 54 | let idxPriceAsDcm = 7 | |
57 | 55 | ||
58 | 56 | let idxIAmtAsId = 8 | |
59 | 57 | ||
60 | 58 | let idxIPriceAsId = 9 | |
61 | 59 | ||
62 | 60 | let idxFactStakCntr = 1 | |
63 | 61 | ||
64 | 62 | let idxFactoryRestCntr = 6 | |
65 | 63 | ||
66 | 64 | let idxFactSlippCntr = 7 | |
67 | 65 | ||
68 | 66 | let idxFactGwxRewCntr = 10 | |
69 | 67 | ||
70 | 68 | let feeDefault = fraction(10, scale8, 10000) | |
71 | 69 | ||
72 | 70 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
73 | 71 | ||
74 | 72 | ||
75 | 73 | func t1BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
76 | 74 | ||
77 | 75 | ||
78 | 76 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
79 | 77 | ||
80 | 78 | ||
81 | 79 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
82 | 80 | ||
83 | 81 | ||
84 | 82 | func t2 (origVal,origScaleMult) = fraction(origVal, scale18, toBigInt(origScaleMult)) | |
85 | 83 | ||
86 | 84 | ||
87 | 85 | func f2 (val,resultScaleMult) = fraction(val, toBigInt(resultScaleMult), scale18) | |
88 | 86 | ||
89 | 87 | ||
90 | 88 | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
91 | 89 | ||
92 | 90 | ||
93 | 91 | func abs (val) = if ((zeroBigInt > val)) | |
94 | 92 | then -(val) | |
95 | 93 | else val | |
96 | 94 | ||
97 | 95 | ||
98 | 96 | func absBigInt (val) = if ((zeroBigInt > val)) | |
99 | 97 | then -(val) | |
100 | 98 | else val | |
101 | 99 | ||
102 | 100 | ||
103 | 101 | func fc () = "%s__factoryContract" | |
104 | 102 | ||
105 | 103 | ||
106 | 104 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
107 | 105 | ||
108 | 106 | ||
109 | 107 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
110 | 108 | ||
111 | 109 | ||
112 | 110 | func pl () = "%s%s__price__last" | |
113 | 111 | ||
114 | 112 | ||
115 | 113 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
116 | 114 | ||
117 | 115 | ||
118 | 116 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
119 | 117 | ||
120 | 118 | ||
121 | 119 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
122 | 120 | ||
123 | 121 | ||
124 | 122 | func aa () = "%s__amountAsset" | |
125 | 123 | ||
126 | 124 | ||
127 | 125 | func pa () = "%s__priceAsset" | |
128 | 126 | ||
129 | 127 | ||
130 | - | func amp () = "%s__amp" | |
131 | - | ||
132 | - | ||
133 | - | func keyAmpHistory (heightBlocks) = ("%s%d__amp__" + toString(heightBlocks)) | |
134 | - | ||
135 | - | ||
136 | - | func keyChangeAmpLastCall () = "%s__changeAmpLastCall" | |
128 | + | func amp () = makeString(["%s%s", "amp", toString(this)], SEP) | |
137 | 129 | ||
138 | 130 | ||
139 | 131 | let keyFee = "%s__fee" | |
140 | 132 | ||
141 | 133 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
142 | 134 | ||
143 | 135 | let keyDLp = makeString(["%s", "dLp"], SEP) | |
144 | 136 | ||
145 | 137 | let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP) | |
146 | 138 | ||
147 | 139 | let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP) | |
148 | 140 | ||
149 | 141 | let dLpRefreshDelayDefault = 30 | |
150 | 142 | ||
151 | 143 | let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault) | |
152 | 144 | ||
153 | 145 | func fcfg () = "%s__factoryConfig" | |
154 | 146 | ||
155 | 147 | ||
156 | 148 | func mtpk () = "%s%s__matcher__publicKey" | |
157 | 149 | ||
158 | 150 | ||
159 | 151 | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
160 | 152 | ||
161 | 153 | ||
162 | 154 | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
163 | 155 | ||
164 | 156 | ||
165 | 157 | func aps () = "%s__shutdown" | |
166 | 158 | ||
167 | 159 | ||
168 | 160 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
169 | 161 | ||
170 | 162 | ||
171 | 163 | func keyFeeCollectorAddress () = "%s__feeCollectorAddress" | |
172 | 164 | ||
173 | 165 | ||
174 | 166 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
175 | 167 | ||
176 | 168 | ||
177 | 169 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
178 | 170 | ||
179 | 171 | ||
180 | 172 | func addressFromStringOrThis (addressString) = match addressFromString(addressString) { | |
181 | 173 | case a: Address => | |
182 | 174 | a | |
183 | 175 | case _ => | |
184 | 176 | this | |
185 | 177 | } | |
186 | 178 | ||
187 | 179 | ||
188 | 180 | func getManagerVaultAddressOrThis () = { | |
189 | 181 | let factoryAddress = match getString(fc()) { | |
190 | 182 | case fca: String => | |
191 | 183 | addressFromStringOrThis(fca) | |
192 | 184 | case _ => | |
193 | 185 | this | |
194 | 186 | } | |
195 | 187 | match getString(factoryAddress, keyManagerVaultAddress()) { | |
196 | 188 | case s: String => | |
197 | 189 | addressFromStringOrThis(s) | |
198 | 190 | case _ => | |
199 | 191 | this | |
200 | 192 | } | |
201 | 193 | } | |
202 | 194 | ||
203 | 195 | ||
204 | 196 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
205 | 197 | ||
206 | 198 | ||
207 | 199 | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
208 | 200 | ||
209 | 201 | ||
210 | 202 | func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " ")) | |
211 | 203 | ||
212 | 204 | ||
213 | 205 | func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ") | |
214 | 206 | ||
215 | 207 | ||
216 | 208 | let fca = addressFromStringValue(strf(this, fc())) | |
217 | 209 | ||
218 | 210 | let inFee = { | |
219 | 211 | let @ = invoke(fca, "getInFeeREADONLY", [toString(this)], nil) | |
220 | 212 | if ($isInstanceOf(@, "Int")) | |
221 | 213 | then @ | |
222 | 214 | else throw(($getType(@) + " couldn't be cast to Int")) | |
223 | 215 | } | |
224 | 216 | ||
225 | 217 | let outFee = { | |
226 | 218 | let @ = invoke(fca, "getOutFeeREADONLY", [toString(this)], nil) | |
227 | 219 | if ($isInstanceOf(@, "Int")) | |
228 | 220 | then @ | |
229 | 221 | else throw(($getType(@) + " couldn't be cast to Int")) | |
230 | 222 | } | |
231 | 223 | ||
232 | - | let A = strf( | |
224 | + | let A = strf(fca, amp()) | |
233 | 225 | ||
234 | 226 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
235 | 227 | ||
236 | 228 | ||
237 | 229 | func mp () = fromBase58String(strf(fca, mtpk())) | |
238 | 230 | ||
239 | 231 | ||
240 | 232 | let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress())) | |
241 | 233 | ||
242 | 234 | func gpc () = { | |
243 | 235 | let amtAs = strf(this, aa()) | |
244 | 236 | let priceAs = strf(this, pa()) | |
245 | 237 | let iPriceAs = intf(fca, mba(priceAs)) | |
246 | 238 | let iAmtAs = intf(fca, mba(amtAs)) | |
247 | 239 | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
248 | 240 | } | |
249 | 241 | ||
250 | 242 | ||
251 | 243 | func parseAssetId (input) = if ((input == wavesString)) | |
252 | 244 | then unit | |
253 | 245 | else fromBase58String(input) | |
254 | 246 | ||
255 | 247 | ||
256 | 248 | func assetIdToString (input) = if ((input == unit)) | |
257 | 249 | then wavesString | |
258 | 250 | else toBase58String(value(input)) | |
259 | 251 | ||
260 | 252 | ||
261 | 253 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm])) | |
262 | 254 | ||
263 | 255 | ||
264 | 256 | let poolConfigParsed = parsePoolConfig(gpc()) | |
265 | 257 | ||
266 | - | let $ | |
258 | + | let $t084928678 = poolConfigParsed | |
267 | 259 | ||
268 | - | let cfgPoolAddress = $ | |
260 | + | let cfgPoolAddress = $t084928678._1 | |
269 | 261 | ||
270 | - | let cfgPoolStatus = $ | |
262 | + | let cfgPoolStatus = $t084928678._2 | |
271 | 263 | ||
272 | - | let cfgLpAssetId = $ | |
264 | + | let cfgLpAssetId = $t084928678._3 | |
273 | 265 | ||
274 | - | let cfgAmountAssetId = $ | |
266 | + | let cfgAmountAssetId = $t084928678._4 | |
275 | 267 | ||
276 | - | let cfgPriceAssetId = $ | |
268 | + | let cfgPriceAssetId = $t084928678._5 | |
277 | 269 | ||
278 | - | let cfgAmountAssetDecimals = $ | |
270 | + | let cfgAmountAssetDecimals = $t084928678._6 | |
279 | 271 | ||
280 | - | let cfgPriceAssetDecimals = $ | |
272 | + | let cfgPriceAssetDecimals = $t084928678._7 | |
281 | 273 | ||
282 | 274 | func gfc () = split(strf(fca, fcfg()), SEP) | |
283 | 275 | ||
284 | 276 | ||
285 | 277 | let factoryConfig = gfc() | |
286 | 278 | ||
287 | 279 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
288 | 280 | ||
289 | 281 | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
290 | 282 | ||
291 | 283 | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
292 | 284 | ||
293 | 285 | let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address") | |
294 | 286 | ||
295 | 287 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP) | |
296 | 288 | ||
297 | 289 | ||
298 | 290 | func dataGetActionInfo (outAmtAssetAmt,outPriceAssetAmt,inLpAmt,price,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d", toString(outAmtAssetAmt), toString(outPriceAssetAmt), toString(inLpAmt), toString(price), toString(txHeight), toString(txTimestamp)], SEP) | |
299 | 291 | ||
300 | 292 | ||
301 | 293 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
302 | 294 | then wavesBalance(this).available | |
303 | 295 | else assetBalance(this, fromBase58String(assetId)) | |
304 | 296 | ||
305 | 297 | ||
306 | 298 | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
307 | 299 | ||
308 | 300 | ||
309 | 301 | func cpbir (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
310 | 302 | ||
311 | 303 | ||
312 | 304 | func vad (A1,A2,slippage) = { | |
313 | 305 | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
314 | 306 | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
315 | 307 | if (!(pass)) | |
316 | 308 | then throw(("Big slpg: " + toString(diff))) | |
317 | 309 | else $Tuple2(pass, min([A1, A2])) | |
318 | 310 | } | |
319 | 311 | ||
320 | 312 | ||
321 | 313 | func vd (D1,D0,slpg) = { | |
322 | 314 | let diff = fraction(D0, scale8BigInt, D1) | |
323 | 315 | let fail = (slpg > diff) | |
324 | 316 | if (if (fail) | |
325 | 317 | then true | |
326 | 318 | else (D0 > D1)) | |
327 | 319 | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
328 | 320 | else fail | |
329 | 321 | } | |
330 | 322 | ||
331 | 323 | ||
332 | 324 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
333 | 325 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
334 | 326 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
335 | 327 | cpbi(prAsAmtX18, amtAsAmtX18) | |
336 | 328 | } | |
337 | 329 | ||
338 | 330 | ||
339 | 331 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
340 | 332 | let amtAsDcm = cfgAmountAssetDecimals | |
341 | 333 | let prAsDcm = cfgPriceAssetDecimals | |
342 | 334 | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
343 | 335 | let amAmtX18 = t1(amAmt, amtAsDcm) | |
344 | 336 | let prAmtX18 = t1(prAmt, prAsDcm) | |
345 | 337 | let lpAmtX18 = t1(lpAmt, scale8) | |
346 | 338 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
347 | 339 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
348 | 340 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
349 | 341 | } | |
350 | 342 | ||
351 | 343 | ||
352 | 344 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
353 | 345 | let p = calcPrices(amAmt, prAmt, lpAmt) | |
354 | 346 | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
355 | 347 | } | |
356 | 348 | ||
357 | 349 | ||
358 | 350 | func takeFee (amount,fee) = { | |
359 | 351 | let feeAmount = if ((fee == 0)) | |
360 | 352 | then 0 | |
361 | 353 | else fraction(amount, fee, scale8) | |
362 | 354 | $Tuple2((amount - feeAmount), feeAmount) | |
363 | 355 | } | |
364 | 356 | ||
365 | 357 | ||
366 | 358 | func getD (xp) = { | |
367 | 359 | let xp0 = xp[0] | |
368 | 360 | let xp1 = xp[1] | |
369 | 361 | let s = (xp0 + xp1) | |
370 | 362 | if ((s == big0)) | |
371 | 363 | then big0 | |
372 | 364 | else { | |
373 | 365 | let a = parseIntValue(A) | |
374 | 366 | let ann = (a * 2) | |
375 | 367 | let p = fraction(xp0, xp1, big1) | |
376 | 368 | let xp0_xp1_n_n = fraction(p, big4, big1) | |
377 | 369 | let ann_s = fraction(toBigInt(ann), s, big1) | |
378 | 370 | let ann_1 = toBigInt((ann - 1)) | |
379 | 371 | func calcDNext (d) = { | |
380 | 372 | let dd = fraction(d, d, big1) | |
381 | 373 | let ddd = fraction(dd, d, big1) | |
382 | 374 | let dp = fraction(ddd, big1, xp0_xp1_n_n) | |
383 | 375 | fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1))) | |
384 | 376 | } | |
385 | 377 | ||
386 | 378 | func calc (acc,i) = if (acc._2) | |
387 | 379 | then acc | |
388 | 380 | else { | |
389 | 381 | let d = acc._1 | |
390 | 382 | let dNext = calcDNext(d) | |
391 | 383 | let dDiffRaw = (dNext - value(d)) | |
392 | 384 | let dDiff = if ((big0 > dDiffRaw)) | |
393 | 385 | then -(dDiffRaw) | |
394 | 386 | else dDiffRaw | |
395 | 387 | if ((big1 >= dDiff)) | |
396 | 388 | then $Tuple2(dNext, true) | |
397 | 389 | else $Tuple2(dNext, false) | |
398 | 390 | } | |
399 | 391 | ||
400 | 392 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
401 | - | let $ | |
393 | + | let $t01318313231 = { | |
402 | 394 | let $l = arr | |
403 | 395 | let $s = size($l) | |
404 | 396 | let $acc0 = $Tuple2(s, false) | |
405 | 397 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
406 | 398 | then $a | |
407 | 399 | else calc($a, $l[$i]) | |
408 | 400 | ||
409 | 401 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
410 | 402 | then $a | |
411 | 403 | else throw("List size exceeds 17") | |
412 | 404 | ||
413 | 405 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
414 | 406 | } | |
415 | - | let d = $ | |
416 | - | let found = $ | |
407 | + | let d = $t01318313231._1 | |
408 | + | let found = $t01318313231._2 | |
417 | 409 | if (found) | |
418 | 410 | then d | |
419 | 411 | else throw(("D calculation error, D = " + toString(d))) | |
420 | 412 | } | |
421 | 413 | } | |
422 | 414 | ||
423 | 415 | ||
424 | 416 | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
425 | 417 | let lpId = cfgLpAssetId | |
426 | 418 | let amId = toBase58String(value(cfgAmountAssetId)) | |
427 | 419 | let prId = toBase58String(value(cfgPriceAssetId)) | |
428 | 420 | let amDcm = cfgAmountAssetDecimals | |
429 | 421 | let prDcm = cfgPriceAssetDecimals | |
430 | 422 | let sts = toString(cfgPoolStatus) | |
431 | 423 | let lpEmiss = valueOrErrorMessage(assetInfo(lpId), "Wrong LP id").quantity | |
432 | 424 | if ((toBase58String(lpId) != pmtAssetId)) | |
433 | 425 | then throw("Wrong pmt asset") | |
434 | 426 | else { | |
435 | 427 | let amBalance = getAccBalance(amId) | |
436 | 428 | let amBalanceX18 = t1(amBalance, amDcm) | |
437 | 429 | let prBalance = getAccBalance(prId) | |
438 | 430 | let prBalanceX18 = t1(prBalance, prDcm) | |
439 | 431 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
440 | 432 | let curPrice = f1(curPriceX18, scale8) | |
441 | 433 | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
442 | 434 | let lpEmissX18 = t1(lpEmiss, scale8) | |
443 | 435 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
444 | 436 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
445 | 437 | let outAmAmt = fromX18Round(outAmAmtX18, amDcm, FLOOR) | |
446 | 438 | let outPrAmt = fromX18Round(outPrAmtX18, prDcm, FLOOR) | |
447 | 439 | let state = if ((txId58 == "")) | |
448 | 440 | then nil | |
449 | 441 | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
450 | 442 | then unit | |
451 | 443 | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
452 | 444 | then unit | |
453 | 445 | else fromBase58String(prId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
454 | 446 | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
455 | 447 | } | |
456 | 448 | } | |
457 | 449 | ||
458 | 450 | ||
459 | 451 | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
460 | 452 | let lpId = cfgLpAssetId | |
461 | 453 | let amIdStr = toBase58String(value(cfgAmountAssetId)) | |
462 | 454 | let prIdStr = toBase58String(value(cfgPriceAssetId)) | |
463 | 455 | let amtDcm = cfgAmountAssetDecimals | |
464 | 456 | let priceDcm = cfgPriceAssetDecimals | |
465 | 457 | let sts = toString(cfgPoolStatus) | |
466 | 458 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
467 | 459 | let amBalance = if (isEval) | |
468 | 460 | then getAccBalance(amIdStr) | |
469 | 461 | else if (if (isOneAsset) | |
470 | 462 | then (pmtId == amIdStr) | |
471 | 463 | else false) | |
472 | 464 | then (getAccBalance(amIdStr) - pmtAmt) | |
473 | 465 | else if (isOneAsset) | |
474 | 466 | then getAccBalance(amIdStr) | |
475 | 467 | else (getAccBalance(amIdStr) - inAmAmt) | |
476 | 468 | let prBalance = if (isEval) | |
477 | 469 | then getAccBalance(prIdStr) | |
478 | 470 | else if (if (isOneAsset) | |
479 | 471 | then (pmtId == prIdStr) | |
480 | 472 | else false) | |
481 | 473 | then (getAccBalance(prIdStr) - pmtAmt) | |
482 | 474 | else if (isOneAsset) | |
483 | 475 | then getAccBalance(prIdStr) | |
484 | 476 | else (getAccBalance(prIdStr) - inPrAmt) | |
485 | 477 | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
486 | 478 | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
487 | 479 | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
488 | 480 | let amBalanceX18 = t1(amBalance, amtDcm) | |
489 | 481 | let prBalanceX18 = t1(prBalance, priceDcm) | |
490 | 482 | let D0 = getD([amBalanceX18, prBalanceX18]) | |
491 | 483 | let r = if ((lpEm == 0)) | |
492 | 484 | then { | |
493 | 485 | let D1 = getD([(amBalanceX18 + inAmAssetAmtX18), (prBalanceX18 + inPrAssetAmtX18)]) | |
494 | 486 | let checkD = if ((D1 > D0)) | |
495 | 487 | then true | |
496 | 488 | else throw("D1 should be greater than D0") | |
497 | 489 | if ((checkD == checkD)) | |
498 | 490 | then { | |
499 | 491 | let curPriceX18 = zeroBigInt | |
500 | 492 | let slippageX18 = zeroBigInt | |
501 | 493 | let lpAmtX18 = D1 | |
502 | 494 | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
503 | 495 | } | |
504 | 496 | else throw("Strict value is not equal to itself.") | |
505 | 497 | } | |
506 | 498 | else { | |
507 | 499 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
508 | 500 | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
509 | 501 | let slippageX18 = t1(slippage, scale8) | |
510 | 502 | if (if (if (validateSlippage) | |
511 | 503 | then (curPriceX18 != zeroBigInt) | |
512 | 504 | else false) | |
513 | 505 | then (slippageRealX18 > slippageX18) | |
514 | 506 | else false) | |
515 | 507 | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
516 | 508 | else { | |
517 | 509 | let lpEmissionX18 = t1(lpEm, scale8) | |
518 | 510 | let prViaAmX18 = fraction(inAmAssetAmtX18, cpbir(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
519 | 511 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, cpbir(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
520 | 512 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
521 | 513 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
522 | 514 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
523 | 515 | let expAmtAssetAmtX18 = expectedAmts._1 | |
524 | 516 | let expPriceAssetAmtX18 = expectedAmts._2 | |
525 | 517 | let D1 = getD([(amBalanceX18 + expAmtAssetAmtX18), (prBalanceX18 + expPriceAssetAmtX18)]) | |
526 | 518 | let checkD = if ((D1 > D0)) | |
527 | 519 | then true | |
528 | 520 | else throw("D1 should be greater than D0") | |
529 | 521 | if ((checkD == checkD)) | |
530 | 522 | then { | |
531 | 523 | let lpAmtX18 = fraction(lpEmissionX18, (D1 - D0), D0) | |
532 | 524 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18) | |
533 | 525 | } | |
534 | 526 | else throw("Strict value is not equal to itself.") | |
535 | 527 | } | |
536 | 528 | } | |
537 | 529 | let calcLpAmt = r._1 | |
538 | 530 | let calcAmAssetPmt = r._2 | |
539 | 531 | let calcPrAssetPmt = r._3 | |
540 | 532 | let curPrice = f1(r._4, scale8) | |
541 | 533 | let slippageCalc = f1(r._5, scale8) | |
542 | 534 | if ((0 >= calcLpAmt)) | |
543 | 535 | then throw("LP <= 0") | |
544 | 536 | else { | |
545 | 537 | let emitLpAmt = if (!(emitLp)) | |
546 | 538 | then 0 | |
547 | 539 | else calcLpAmt | |
548 | 540 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
549 | 541 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
550 | - | let $ | |
542 | + | let $t02099321338 = if (if (isOneAsset) | |
551 | 543 | then (pmtId == amIdStr) | |
552 | 544 | else false) | |
553 | 545 | then $Tuple2(pmtAmt, 0) | |
554 | 546 | else if (if (isOneAsset) | |
555 | 547 | then (pmtId == prIdStr) | |
556 | 548 | else false) | |
557 | 549 | then $Tuple2(0, pmtAmt) | |
558 | 550 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
559 | - | let writeAmAmt = $ | |
560 | - | let writePrAmt = $ | |
551 | + | let writeAmAmt = $t02099321338._1 | |
552 | + | let writePrAmt = $t02099321338._2 | |
561 | 553 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
562 | 554 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
563 | 555 | } | |
564 | 556 | } | |
565 | 557 | ||
566 | 558 | ||
567 | 559 | func getYD (xp,i,D) = { | |
568 | 560 | let n = big2 | |
569 | 561 | let x = xp[if ((i == 0)) | |
570 | 562 | then 1 | |
571 | 563 | else 0] | |
572 | 564 | let aPrecision = parseBigIntValue(Amult) | |
573 | 565 | let a = (parseBigIntValue(A) * aPrecision) | |
574 | 566 | let s = x | |
575 | 567 | let ann = (a * n) | |
576 | 568 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
577 | 569 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
578 | 570 | func calc (acc,cur) = { | |
579 | - | let $ | |
580 | - | let y = $ | |
581 | - | let found = $ | |
571 | + | let $t02253322553 = acc | |
572 | + | let y = $t02253322553._1 | |
573 | + | let found = $t02253322553._2 | |
582 | 574 | if ((found != unit)) | |
583 | 575 | then acc | |
584 | 576 | else { | |
585 | 577 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
586 | 578 | let yDiff = absBigInt((yNext - value(y))) | |
587 | 579 | if ((big1 >= yDiff)) | |
588 | 580 | then $Tuple2(yNext, cur) | |
589 | 581 | else $Tuple2(yNext, unit) | |
590 | 582 | } | |
591 | 583 | } | |
592 | 584 | ||
593 | 585 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
594 | - | let $ | |
586 | + | let $t02286022907 = { | |
595 | 587 | let $l = arr | |
596 | 588 | let $s = size($l) | |
597 | 589 | let $acc0 = $Tuple2(D, unit) | |
598 | 590 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
599 | 591 | then $a | |
600 | 592 | else calc($a, $l[$i]) | |
601 | 593 | ||
602 | 594 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
603 | 595 | then $a | |
604 | 596 | else throw("List size exceeds 15") | |
605 | 597 | ||
606 | 598 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
607 | 599 | } | |
608 | - | let y = $ | |
609 | - | let found = $ | |
600 | + | let y = $t02286022907._1 | |
601 | + | let found = $t02286022907._2 | |
610 | 602 | if ((found != unit)) | |
611 | 603 | then y | |
612 | 604 | else throw(("Y calculation error, Y = " + toString(y))) | |
613 | 605 | } | |
614 | 606 | ||
615 | 607 | ||
616 | 608 | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
617 | 609 | let updatedDLp = fraction(getD([t1BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)), t1BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))]), scale18, lpEmission) | |
618 | 610 | if ((lpEmission == big0)) | |
619 | 611 | then big0 | |
620 | 612 | else updatedDLp | |
621 | 613 | } | |
622 | 614 | ||
623 | 615 | ||
624 | 616 | func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
625 | 617 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
626 | 618 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
627 | 619 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
628 | 620 | let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
629 | 621 | currentDLp | |
630 | 622 | } | |
631 | 623 | ||
632 | 624 | ||
633 | 625 | func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
634 | 626 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
635 | 627 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
636 | 628 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
637 | 629 | let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
638 | 630 | let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))] | |
639 | 631 | $Tuple2(actions, updatedDLp) | |
640 | 632 | } | |
641 | 633 | ||
642 | 634 | ||
643 | 635 | func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp)) | |
644 | 636 | then true | |
645 | 637 | else throwErr("updated DLp lower than current DLp") | |
646 | 638 | ||
647 | 639 | ||
648 | 640 | func validateMatcherOrderAllowed (order) = { | |
649 | 641 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
650 | 642 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
651 | 643 | let amountAssetAmount = order.amount | |
652 | 644 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
653 | - | let $ | |
645 | + | let $t02510525317 = if ((order.orderType == Buy)) | |
654 | 646 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
655 | 647 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
656 | - | let amountAssetBalanceDelta = $ | |
657 | - | let priceAssetBalanceDelta = $ | |
648 | + | let amountAssetBalanceDelta = $t02510525317._1 | |
649 | + | let priceAssetBalanceDelta = $t02510525317._2 | |
658 | 650 | if (if (if (igs()) | |
659 | 651 | then true | |
660 | 652 | else (cfgPoolStatus == PoolMatcherDis)) | |
661 | 653 | then true | |
662 | 654 | else (cfgPoolStatus == PoolShutdown)) | |
663 | 655 | then throw("Admin blocked") | |
664 | 656 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
665 | 657 | then true | |
666 | 658 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
667 | 659 | then throw("Wr assets") | |
668 | 660 | else { | |
669 | 661 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
670 | - | let $ | |
671 | - | let unusedActions = $ | |
672 | - | let dLpNew = $ | |
662 | + | let $t02565925759 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
663 | + | let unusedActions = $t02565925759._1 | |
664 | + | let dLpNew = $t02565925759._2 | |
673 | 665 | let isOrderValid = (dLpNew >= dLp) | |
674 | 666 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
675 | 667 | $Tuple2(isOrderValid, info) | |
676 | 668 | } | |
677 | 669 | } | |
678 | 670 | ||
679 | 671 | ||
680 | 672 | func cg (i) = if ((size(i.payments) != 1)) | |
681 | 673 | then throw("1 pmnt exp") | |
682 | 674 | else { | |
683 | 675 | let pmt = value(i.payments[0]) | |
684 | 676 | let pmtAssetId = value(pmt.assetId) | |
685 | 677 | let pmtAmt = pmt.amount | |
686 | 678 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
687 | 679 | let outAmAmt = r._1 | |
688 | 680 | let outPrAmt = r._2 | |
689 | 681 | let sts = parseIntValue(r._9) | |
690 | 682 | let state = r._10 | |
691 | 683 | if (if (igs()) | |
692 | 684 | then true | |
693 | 685 | else (sts == PoolShutdown)) | |
694 | 686 | then throw(("Admin blocked: " + toString(sts))) | |
695 | 687 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
696 | 688 | } | |
697 | 689 | ||
698 | 690 | ||
699 | 691 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
700 | 692 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
701 | 693 | let sts = parseIntValue(r._8) | |
702 | 694 | if (if (if (igs()) | |
703 | 695 | then true | |
704 | 696 | else (sts == PoolPutDis)) | |
705 | 697 | then true | |
706 | 698 | else (sts == PoolShutdown)) | |
707 | 699 | then throw(("Blocked:" + toString(sts))) | |
708 | 700 | else r | |
709 | 701 | } | |
710 | 702 | ||
711 | 703 | ||
712 | 704 | func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = { | |
713 | 705 | let amId = toBase58String(value(cfgAmountAssetId)) | |
714 | 706 | let prId = toBase58String(value(cfgPriceAssetId)) | |
715 | 707 | let lpId = cfgLpAssetId | |
716 | 708 | let amtDcm = cfgAmountAssetDecimals | |
717 | 709 | let priceDcm = cfgPriceAssetDecimals | |
718 | 710 | let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(lpId), "invalid lp asset").quantity) | |
719 | 711 | let chechEmission = if ((lpAssetEmission > big0)) | |
720 | 712 | then true | |
721 | 713 | else throw("initial deposit requires all coins") | |
722 | 714 | if ((chechEmission == chechEmission)) | |
723 | 715 | then { | |
724 | 716 | let amBalance = getAccBalance(amId) | |
725 | 717 | let prBalance = getAccBalance(prId) | |
726 | - | let $ | |
718 | + | let $t02841528877 = if ((txId == "")) | |
727 | 719 | then $Tuple2(amBalance, prBalance) | |
728 | 720 | else if ((pmtAssetId == amId)) | |
729 | 721 | then if ((pmtAmtRaw > amBalance)) | |
730 | 722 | then throw("invalid payment amount") | |
731 | 723 | else $Tuple2((amBalance - pmtAmtRaw), prBalance) | |
732 | 724 | else if ((pmtAssetId == prId)) | |
733 | 725 | then if ((pmtAmtRaw > prBalance)) | |
734 | 726 | then throw("invalid payment amount") | |
735 | 727 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
736 | 728 | else throw("wrong pmtAssetId") | |
737 | - | let amBalanceOld = $ | |
738 | - | let prBalanceOld = $ | |
739 | - | let $ | |
729 | + | let amBalanceOld = $t02841528877._1 | |
730 | + | let prBalanceOld = $t02841528877._2 | |
731 | + | let $t02888329059 = if ((pmtAssetId == amId)) | |
740 | 732 | then $Tuple2(pmtAmtRaw, 0) | |
741 | 733 | else if ((pmtAssetId == prId)) | |
742 | 734 | then $Tuple2(0, pmtAmtRaw) | |
743 | 735 | else throw("invalid payment") | |
744 | - | let amAmountRaw = $ | |
745 | - | let prAmountRaw = $ | |
746 | - | let $ | |
736 | + | let amAmountRaw = $t02888329059._1 | |
737 | + | let prAmountRaw = $t02888329059._2 | |
738 | + | let $t02906329317 = if (withTakeFee) | |
747 | 739 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
748 | 740 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
749 | - | let amAmount = $ | |
750 | - | let prAmount = $ | |
751 | - | let feeAmount = $ | |
741 | + | let amAmount = $t02906329317._1 | |
742 | + | let prAmount = $t02906329317._2 | |
743 | + | let feeAmount = $t02906329317._3 | |
752 | 744 | let amBalanceNew = (amBalanceOld + amAmount) | |
753 | 745 | let prBalanceNew = (prBalanceOld + prAmount) | |
754 | 746 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
755 | 747 | let D1 = getD([t1(amBalanceNew, cfgAmountAssetDecimals), t1(prBalanceNew, cfgPriceAssetDecimals)]) | |
756 | 748 | let checkD = if ((D1 > D0)) | |
757 | 749 | then true | |
758 | 750 | else throw() | |
759 | 751 | if ((checkD == checkD)) | |
760 | 752 | then { | |
761 | 753 | let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR) | |
762 | 754 | let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8) | |
763 | 755 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmountRaw, prAmountRaw, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
764 | 756 | let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld) | |
765 | 757 | let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8)) | |
766 | 758 | let priceAssetPart = (pmtAmtRaw - amountAssetPart) | |
767 | 759 | let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld)) | |
768 | 760 | let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)) | |
769 | 761 | $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus) | |
770 | 762 | } | |
771 | 763 | else throw("Strict value is not equal to itself.") | |
772 | 764 | } | |
773 | 765 | else throw("Strict value is not equal to itself.") | |
774 | 766 | } | |
775 | 767 | ||
776 | 768 | ||
777 | 769 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = { | |
778 | 770 | let lpId = toBase58String(value(cfgLpAssetId)) | |
779 | 771 | let amId = toBase58String(value(cfgAmountAssetId)) | |
780 | 772 | let prId = toBase58String(value(cfgPriceAssetId)) | |
781 | 773 | let amDecimals = cfgAmountAssetDecimals | |
782 | 774 | let prDecimals = cfgPriceAssetDecimals | |
783 | 775 | let poolStatus = cfgPoolStatus | |
784 | 776 | let userAddress = if ((caller == restContract)) | |
785 | 777 | then originCaller | |
786 | 778 | else caller | |
787 | 779 | let pmt = value(payments[0]) | |
788 | 780 | let pmtAssetId = value(pmt.assetId) | |
789 | 781 | let pmtAmt = pmt.amount | |
790 | 782 | let currentDLp = calcCurrentDLp(big0, big0, big0) | |
791 | 783 | if ((currentDLp == currentDLp)) | |
792 | 784 | then { | |
793 | 785 | let txId58 = toBase58String(transactionId) | |
794 | 786 | if ((lpId != toBase58String(pmtAssetId))) | |
795 | 787 | then throw("Wrong LP") | |
796 | 788 | else { | |
797 | 789 | let amBalance = getAccBalance(amId) | |
798 | 790 | let prBalance = getAccBalance(prId) | |
799 | - | let $ | |
791 | + | let $t03142931540 = { | |
800 | 792 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
801 | 793 | if ($isInstanceOf(@, "(Int, Int)")) | |
802 | 794 | then @ | |
803 | 795 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
804 | 796 | } | |
805 | - | if (($ | |
797 | + | if (($t03142931540 == $t03142931540)) | |
806 | 798 | then { | |
807 | - | let feeAmount = $ | |
808 | - | let totalGet = $ | |
799 | + | let feeAmount = $t03142931540._2 | |
800 | + | let totalGet = $t03142931540._1 | |
809 | 801 | let totalAmount = if (if ((minOutAmount > 0)) | |
810 | 802 | then (minOutAmount > totalGet) | |
811 | 803 | else false) | |
812 | 804 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
813 | 805 | else totalGet | |
814 | - | let $ | |
806 | + | let $t03173032037 = if ((outAssetId == amId)) | |
815 | 807 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
816 | 808 | else if ((outAssetId == prId)) | |
817 | 809 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
818 | 810 | else throw("invalid out asset id") | |
819 | - | let outAm = $ | |
820 | - | let outPr = $ | |
821 | - | let amBalanceNew = $ | |
822 | - | let prBalanceNew = $ | |
811 | + | let outAm = $t03173032037._1 | |
812 | + | let outPr = $t03173032037._2 | |
813 | + | let amBalanceNew = $t03173032037._3 | |
814 | + | let prBalanceNew = $t03173032037._4 | |
823 | 815 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
824 | 816 | let curPr = f1(curPrX18, scale8) | |
825 | 817 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
826 | 818 | then unit | |
827 | 819 | else fromBase58String(outAssetId) | |
828 | 820 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
829 | 821 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
830 | 822 | else nil | |
831 | 823 | let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher) | |
832 | 824 | if ((state == state)) | |
833 | 825 | then { | |
834 | 826 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
835 | 827 | if ((burn == burn)) | |
836 | 828 | then { | |
837 | - | let $ | |
829 | + | let $t03282233172 = { | |
838 | 830 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
839 | 831 | then 0 | |
840 | 832 | else feeAmount | |
841 | 833 | let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId)) | |
842 | 834 | then true | |
843 | 835 | else false | |
844 | 836 | if (outInAmountAsset) | |
845 | 837 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
846 | 838 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
847 | 839 | } | |
848 | - | let amountAssetBalanceDelta = $ | |
849 | - | let priceAssetBalanceDelta = $ | |
850 | - | let $ | |
851 | - | let refreshDLpActions = $ | |
852 | - | let updatedDLp = $ | |
840 | + | let amountAssetBalanceDelta = $t03282233172._1 | |
841 | + | let priceAssetBalanceDelta = $t03282233172._2 | |
842 | + | let $t03317533283 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
843 | + | let refreshDLpActions = $t03317533283._1 | |
844 | + | let updatedDLp = $t03317533283._2 | |
853 | 845 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
854 | 846 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
855 | 847 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
856 | 848 | else throw("Strict value is not equal to itself.") | |
857 | 849 | } | |
858 | 850 | else throw("Strict value is not equal to itself.") | |
859 | 851 | } | |
860 | 852 | else throw("Strict value is not equal to itself.") | |
861 | 853 | } | |
862 | 854 | else throw("Strict value is not equal to itself.") | |
863 | 855 | } | |
864 | 856 | } | |
865 | 857 | else throw("Strict value is not equal to itself.") | |
866 | 858 | } | |
867 | 859 | ||
868 | 860 | ||
869 | 861 | func managerPublicKeyOrUnit () = { | |
870 | 862 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
871 | 863 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
872 | 864 | case s: String => | |
873 | 865 | fromBase58String(s) | |
874 | 866 | case _: Unit => | |
875 | 867 | unit | |
876 | 868 | case _ => | |
877 | 869 | throw("Match error") | |
878 | 870 | } | |
879 | 871 | } | |
880 | 872 | ||
881 | 873 | ||
882 | 874 | let pd = throw("Permission denied") | |
883 | 875 | ||
884 | 876 | func isManager (i) = match managerPublicKeyOrUnit() { | |
885 | 877 | case pk: ByteVector => | |
886 | 878 | (i.callerPublicKey == pk) | |
887 | 879 | case _: Unit => | |
888 | 880 | (i.caller == this) | |
889 | 881 | case _ => | |
890 | 882 | throw("Match error") | |
891 | 883 | } | |
892 | 884 | ||
893 | 885 | ||
894 | 886 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
895 | 887 | case pk: ByteVector => | |
896 | 888 | if ((i.callerPublicKey == pk)) | |
897 | 889 | then true | |
898 | 890 | else pd | |
899 | 891 | case _: Unit => | |
900 | 892 | if ((i.caller == this)) | |
901 | 893 | then true | |
902 | 894 | else pd | |
903 | 895 | case _ => | |
904 | 896 | throw("Match error") | |
905 | 897 | } | |
906 | 898 | ||
907 | 899 | ||
908 | 900 | func getY (isReverse,D,poolAmountInBalance) = { | |
909 | 901 | let poolConfig = gpc() | |
910 | 902 | let amId = poolConfig[idxAmAsId] | |
911 | 903 | let prId = poolConfig[idxPrAsId] | |
912 | 904 | let n = big2 | |
913 | 905 | let aPrecision = parseBigIntValue(Amult) | |
914 | 906 | let a = (parseBigIntValue(A) * aPrecision) | |
915 | 907 | let xp = if ((isReverse == false)) | |
916 | 908 | then [(toBigInt(getAccBalance(amId)) + poolAmountInBalance), toBigInt(getAccBalance(prId))] | |
917 | 909 | else [(toBigInt(getAccBalance(prId)) + poolAmountInBalance), toBigInt(getAccBalance(amId))] | |
918 | 910 | let x = xp[0] | |
919 | 911 | let s = x | |
920 | 912 | let ann = (a * n) | |
921 | 913 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
922 | 914 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
923 | 915 | func calc (acc,cur) = { | |
924 | - | let $ | |
925 | - | let y = $ | |
926 | - | let found = $ | |
916 | + | let $t03477034790 = acc | |
917 | + | let y = $t03477034790._1 | |
918 | + | let found = $t03477034790._2 | |
927 | 919 | if ((found != unit)) | |
928 | 920 | then acc | |
929 | 921 | else { | |
930 | 922 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
931 | 923 | let yDiff = absBigInt((yNext - value(y))) | |
932 | 924 | if ((big1 >= yDiff)) | |
933 | 925 | then $Tuple2(yNext, cur) | |
934 | 926 | else $Tuple2(yNext, unit) | |
935 | 927 | } | |
936 | 928 | } | |
937 | 929 | ||
938 | 930 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
939 | - | let $ | |
931 | + | let $t03512135168 = { | |
940 | 932 | let $l = arr | |
941 | 933 | let $s = size($l) | |
942 | 934 | let $acc0 = $Tuple2(D, unit) | |
943 | 935 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
944 | 936 | then $a | |
945 | 937 | else calc($a, $l[$i]) | |
946 | 938 | ||
947 | 939 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
948 | 940 | then $a | |
949 | 941 | else throw("List size exceeds 15") | |
950 | 942 | ||
951 | 943 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
952 | 944 | } | |
953 | - | let y = $ | |
954 | - | let found = $ | |
945 | + | let y = $t03512135168._1 | |
946 | + | let found = $t03512135168._2 | |
955 | 947 | if ((found != unit)) | |
956 | 948 | then y | |
957 | 949 | else throw(("Y calculation error, Y = " + toString(y))) | |
958 | 950 | } | |
959 | 951 | ||
960 | 952 | ||
961 | 953 | func skipOrderValidation () = valueOrElse(getBoolean(fca, keySkipOrderValidation(toString(this))), false) | |
962 | 954 | ||
963 | 955 | ||
964 | 956 | @Callable(i) | |
965 | 957 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
966 | - | let $ | |
958 | + | let $t03552035944 = if ((isReverse == false)) | |
967 | 959 | then { | |
968 | 960 | let assetOut = strf(this, pa()) | |
969 | 961 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
970 | 962 | $Tuple2(assetOut, poolAmountInBalance) | |
971 | 963 | } | |
972 | 964 | else { | |
973 | 965 | let assetOut = strf(this, aa()) | |
974 | 966 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
975 | 967 | $Tuple2(assetOut, poolAmountInBalance) | |
976 | 968 | } | |
977 | - | let assetOut = $ | |
978 | - | let poolAmountInBalance = $ | |
969 | + | let assetOut = $t03552035944._1 | |
970 | + | let poolAmountInBalance = $t03552035944._2 | |
979 | 971 | let poolConfig = gpc() | |
980 | 972 | let amId = poolConfig[idxAmAsId] | |
981 | 973 | let prId = poolConfig[idxPrAsId] | |
982 | 974 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
983 | 975 | let D = getD(xp) | |
984 | 976 | let y = getY(isReverse, D, toBigInt(cleanAmountIn)) | |
985 | 977 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
986 | 978 | let totalGetRaw = max([0, toInt(dy)]) | |
987 | 979 | let newXp = if ((isReverse == false)) | |
988 | 980 | then [((toBigInt(getAccBalance(amId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
989 | 981 | else [(toBigInt(getAccBalance(amId)) - dy), ((toBigInt(getAccBalance(prId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount))] | |
990 | 982 | let newD = getD(newXp) | |
991 | 983 | let checkD = if ((newD >= D)) | |
992 | 984 | then true | |
993 | 985 | else throw(makeString(["new D is fewer error", toString(D), toString(newD)], "__")) | |
994 | 986 | if ((checkD == checkD)) | |
995 | 987 | then $Tuple2(nil, totalGetRaw) | |
996 | 988 | else throw("Strict value is not equal to itself.") | |
997 | 989 | } | |
998 | 990 | ||
999 | 991 | ||
1000 | 992 | ||
1001 | 993 | @Callable(i) | |
1002 | 994 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
1003 | 995 | let swapContact = { | |
1004 | 996 | let @ = invoke(fca, "getSwapContractREADONLY", nil, nil) | |
1005 | 997 | if ($isInstanceOf(@, "String")) | |
1006 | 998 | then @ | |
1007 | 999 | else throw(($getType(@) + " couldn't be cast to String")) | |
1008 | 1000 | } | |
1009 | 1001 | let isPoolSwapDisabled = { | |
1010 | 1002 | let @ = invoke(fca, "isPoolSwapDisabledREADONLY", [toString(this)], nil) | |
1011 | 1003 | if ($isInstanceOf(@, "Boolean")) | |
1012 | 1004 | then @ | |
1013 | 1005 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1014 | 1006 | } | |
1015 | 1007 | let isSwapDisabled = if (if (igs()) | |
1016 | 1008 | then true | |
1017 | 1009 | else (cfgPoolStatus == PoolShutdown)) | |
1018 | 1010 | then true | |
1019 | 1011 | else isPoolSwapDisabled | |
1020 | 1012 | let checks = [if (if (!(isSwapDisabled)) | |
1021 | 1013 | then true | |
1022 | 1014 | else isManager(i)) | |
1023 | 1015 | then true | |
1024 | 1016 | else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
1025 | 1017 | then true | |
1026 | 1018 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
1027 | 1019 | then true | |
1028 | 1020 | else throwErr("Permission denied")] | |
1029 | 1021 | if ((checks == checks)) | |
1030 | 1022 | then { | |
1031 | 1023 | let pmt = value(i.payments[0]) | |
1032 | 1024 | let assetIn = assetIdToString(pmt.assetId) | |
1033 | - | let $ | |
1025 | + | let $t03767938073 = if ((isReverse == false)) | |
1034 | 1026 | then { | |
1035 | 1027 | let assetOut = strf(this, pa()) | |
1036 | 1028 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1037 | 1029 | $Tuple2(assetOut, poolAmountInBalance) | |
1038 | 1030 | } | |
1039 | 1031 | else { | |
1040 | 1032 | let assetOut = strf(this, aa()) | |
1041 | 1033 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1042 | 1034 | $Tuple2(assetOut, poolAmountInBalance) | |
1043 | 1035 | } | |
1044 | - | let assetOut = $ | |
1045 | - | let poolAmountInBalance = $ | |
1036 | + | let assetOut = $t03767938073._1 | |
1037 | + | let poolAmountInBalance = $t03767938073._2 | |
1046 | 1038 | let poolConfig = gpc() | |
1047 | 1039 | let amId = poolConfig[idxAmAsId] | |
1048 | 1040 | let prId = poolConfig[idxPrAsId] | |
1049 | 1041 | let xp = if ((isReverse == false)) | |
1050 | 1042 | then [(toBigInt(getAccBalance(amId)) - toBigInt(value(i.payments[0]).amount)), toBigInt(getAccBalance(prId))] | |
1051 | 1043 | else [toBigInt(getAccBalance(amId)), (toBigInt(getAccBalance(prId)) - toBigInt(value(i.payments[0]).amount))] | |
1052 | 1044 | let D = getD(xp) | |
1053 | 1045 | let y = getY(isReverse, D, toBigInt(0)) | |
1054 | 1046 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
1055 | 1047 | let totalGetRaw = max([0, toInt(dy)]) | |
1056 | 1048 | let checkMin = if ((totalGetRaw >= amountOutMin)) | |
1057 | 1049 | then true | |
1058 | 1050 | else throw("Exchange result is fewer coins than expected") | |
1059 | 1051 | if ((checkMin == checkMin)) | |
1060 | 1052 | then { | |
1061 | 1053 | let newXp = if ((isReverse == false)) | |
1062 | 1054 | then [(toBigInt(getAccBalance(amId)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
1063 | 1055 | else [(toBigInt(getAccBalance(amId)) - dy), (toBigInt(getAccBalance(prId)) + toBigInt(feePoolAmount))] | |
1064 | 1056 | let newD = getD(newXp) | |
1065 | 1057 | let checkD = if ((newD >= D)) | |
1066 | 1058 | then true | |
1067 | 1059 | else throw("new D is fewer error") | |
1068 | 1060 | if ((checkD == checkD)) | |
1069 | 1061 | then { | |
1070 | 1062 | let amountAssetBalanceDelta = if (isReverse) | |
1071 | 1063 | then -(totalGetRaw) | |
1072 | 1064 | else feePoolAmount | |
1073 | 1065 | let priceAssetBalanceDelta = if (isReverse) | |
1074 | 1066 | then feePoolAmount | |
1075 | 1067 | else -(totalGetRaw) | |
1076 | 1068 | let refreshDLpActions = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1 | |
1077 | 1069 | if ((refreshDLpActions == refreshDLpActions)) | |
1078 | 1070 | then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), totalGetRaw, parseAssetId(assetOut))], totalGetRaw) | |
1079 | 1071 | else throw("Strict value is not equal to itself.") | |
1080 | 1072 | } | |
1081 | 1073 | else throw("Strict value is not equal to itself.") | |
1082 | 1074 | } | |
1083 | 1075 | else throw("Strict value is not equal to itself.") | |
1084 | 1076 | } | |
1085 | 1077 | else throw("Strict value is not equal to itself.") | |
1086 | 1078 | } | |
1087 | 1079 | ||
1088 | 1080 | ||
1089 | 1081 | ||
1090 | 1082 | @Callable(i) | |
1091 | 1083 | func constructor (fc) = { | |
1092 | 1084 | let c = mustManager(i) | |
1093 | 1085 | if ((c == c)) | |
1094 | 1086 | then [StringEntry(fc(), fc)] | |
1095 | 1087 | else throw("Strict value is not equal to itself.") | |
1096 | 1088 | } | |
1097 | 1089 | ||
1098 | 1090 | ||
1099 | 1091 | ||
1100 | 1092 | @Callable(i) | |
1101 | 1093 | func put (slip,autoStake) = { | |
1102 | 1094 | let factCfg = gfc() | |
1103 | 1095 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
1104 | 1096 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
1105 | 1097 | if ((0 > slip)) | |
1106 | 1098 | then throw("Wrong slippage") | |
1107 | 1099 | else if ((size(i.payments) != 2)) | |
1108 | 1100 | then throw("2 pmnts expd") | |
1109 | 1101 | else { | |
1110 | 1102 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1111 | 1103 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1112 | 1104 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt) | |
1113 | 1105 | if ((amountAssetBalance == amountAssetBalance)) | |
1114 | 1106 | then { | |
1115 | 1107 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt) | |
1116 | 1108 | if ((priceAssetBalance == priceAssetBalance)) | |
1117 | 1109 | then { | |
1118 | 1110 | let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity) | |
1119 | 1111 | if ((lpAssetEmission == lpAssetEmission)) | |
1120 | 1112 | then { | |
1121 | 1113 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1122 | 1114 | if ((currentDLp == currentDLp)) | |
1123 | 1115 | then { | |
1124 | 1116 | let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "") | |
1125 | 1117 | let emitLpAmt = e._2 | |
1126 | 1118 | let lpAssetId = e._7 | |
1127 | 1119 | let state = e._9 | |
1128 | 1120 | let amDiff = e._10 | |
1129 | 1121 | let prDiff = e._11 | |
1130 | 1122 | let amId = e._12 | |
1131 | 1123 | let prId = e._13 | |
1132 | 1124 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
1133 | 1125 | if ((r == r)) | |
1134 | 1126 | then { | |
1135 | 1127 | let el = match r { | |
1136 | 1128 | case legacy: Address => | |
1137 | 1129 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1138 | 1130 | case _ => | |
1139 | 1131 | unit | |
1140 | 1132 | } | |
1141 | 1133 | if ((el == el)) | |
1142 | 1134 | then { | |
1143 | 1135 | let sa = if ((amDiff > 0)) | |
1144 | 1136 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1145 | 1137 | else nil | |
1146 | 1138 | if ((sa == sa)) | |
1147 | 1139 | then { | |
1148 | 1140 | let sp = if ((prDiff > 0)) | |
1149 | 1141 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1150 | 1142 | else nil | |
1151 | 1143 | if ((sp == sp)) | |
1152 | 1144 | then { | |
1153 | 1145 | let lpTrnsfr = if (autoStake) | |
1154 | 1146 | then { | |
1155 | 1147 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1156 | 1148 | if ((ss == ss)) | |
1157 | 1149 | then nil | |
1158 | 1150 | else throw("Strict value is not equal to itself.") | |
1159 | 1151 | } | |
1160 | 1152 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1161 | - | let $ | |
1162 | - | let refreshDLpActions = $ | |
1163 | - | let updatedDLp = $ | |
1153 | + | let $t04252842670 = refreshDLpInternal(0, 0, 0) | |
1154 | + | let refreshDLpActions = $t04252842670._1 | |
1155 | + | let updatedDLp = $t04252842670._2 | |
1164 | 1156 | let check = if ((updatedDLp >= currentDLp)) | |
1165 | 1157 | then true | |
1166 | 1158 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1167 | 1159 | if ((check == check)) | |
1168 | 1160 | then { | |
1169 | 1161 | let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity | |
1170 | 1162 | if ((lpAssetEmissionAfter == lpAssetEmissionAfter)) | |
1171 | 1163 | then ((state ++ lpTrnsfr) ++ refreshDLpActions) | |
1172 | 1164 | else throw("Strict value is not equal to itself.") | |
1173 | 1165 | } | |
1174 | 1166 | else throw("Strict value is not equal to itself.") | |
1175 | 1167 | } | |
1176 | 1168 | else throw("Strict value is not equal to itself.") | |
1177 | 1169 | } | |
1178 | 1170 | else throw("Strict value is not equal to itself.") | |
1179 | 1171 | } | |
1180 | 1172 | else throw("Strict value is not equal to itself.") | |
1181 | 1173 | } | |
1182 | 1174 | else throw("Strict value is not equal to itself.") | |
1183 | 1175 | } | |
1184 | 1176 | else throw("Strict value is not equal to itself.") | |
1185 | 1177 | } | |
1186 | 1178 | else throw("Strict value is not equal to itself.") | |
1187 | 1179 | } | |
1188 | 1180 | else throw("Strict value is not equal to itself.") | |
1189 | 1181 | } | |
1190 | 1182 | else throw("Strict value is not equal to itself.") | |
1191 | 1183 | } | |
1192 | 1184 | } | |
1193 | 1185 | ||
1194 | 1186 | ||
1195 | 1187 | ||
1196 | 1188 | @Callable(i) | |
1197 | 1189 | func putOneTknV2 (minOutAmount,autoStake) = { | |
1198 | 1190 | let isPoolOneTokenOperationsDisabled = { | |
1199 | 1191 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1200 | 1192 | if ($isInstanceOf(@, "Boolean")) | |
1201 | 1193 | then @ | |
1202 | 1194 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1203 | 1195 | } | |
1204 | 1196 | let isPutDisabled = if (if (if (igs()) | |
1205 | 1197 | then true | |
1206 | 1198 | else (cfgPoolStatus == PoolPutDis)) | |
1207 | 1199 | then true | |
1208 | 1200 | else (cfgPoolStatus == PoolShutdown)) | |
1209 | 1201 | then true | |
1210 | 1202 | else isPoolOneTokenOperationsDisabled | |
1211 | 1203 | let checks = [if (if (!(isPutDisabled)) | |
1212 | 1204 | then true | |
1213 | 1205 | else isManager(i)) | |
1214 | 1206 | then true | |
1215 | 1207 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1216 | 1208 | then true | |
1217 | 1209 | else throwErr("exactly 1 payment are expected")] | |
1218 | 1210 | if ((checks == checks)) | |
1219 | 1211 | then { | |
1220 | 1212 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1221 | 1213 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1222 | 1214 | let lpId = cfgLpAssetId | |
1223 | 1215 | let amDecimals = cfgAmountAssetDecimals | |
1224 | 1216 | let prDecimals = cfgPriceAssetDecimals | |
1225 | 1217 | let userAddress = if ((i.caller == this)) | |
1226 | 1218 | then i.originCaller | |
1227 | 1219 | else i.caller | |
1228 | 1220 | let pmt = value(i.payments[0]) | |
1229 | 1221 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
1230 | 1222 | let pmtAmt = pmt.amount | |
1231 | 1223 | let currentDLp = if ((pmt.assetId == cfgAmountAssetId)) | |
1232 | 1224 | then calcCurrentDLp(toBigInt(pmtAmt), toBigInt(0), toBigInt(0)) | |
1233 | 1225 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1234 | 1226 | if ((currentDLp == currentDLp)) | |
1235 | 1227 | then { | |
1236 | - | let $ | |
1237 | - | if (($ | |
1228 | + | let $t04431144469 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1229 | + | if (($t04431144469 == $t04431144469)) | |
1238 | 1230 | then { | |
1239 | - | let feeAmount = $ | |
1240 | - | let state = $ | |
1241 | - | let estimLP = $ | |
1231 | + | let feeAmount = $t04431144469._3 | |
1232 | + | let state = $t04431144469._2 | |
1233 | + | let estimLP = $t04431144469._1 | |
1242 | 1234 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1243 | 1235 | then (minOutAmount > estimLP) | |
1244 | 1236 | else false) | |
1245 | 1237 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1246 | 1238 | else estimLP | |
1247 | 1239 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
1248 | 1240 | if ((e == e)) | |
1249 | 1241 | then { | |
1250 | 1242 | let el = match e { | |
1251 | 1243 | case legacy: Address => | |
1252 | 1244 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1253 | 1245 | case _ => | |
1254 | 1246 | unit | |
1255 | 1247 | } | |
1256 | 1248 | if ((el == el)) | |
1257 | 1249 | then { | |
1258 | 1250 | let lpTrnsfr = if (autoStake) | |
1259 | 1251 | then { | |
1260 | 1252 | let ss = invoke(stakingContract, "stakeFor", [toString(i.caller)], [AttachedPayment(lpId, emitLpAmt)]) | |
1261 | 1253 | if ((ss == ss)) | |
1262 | 1254 | then nil | |
1263 | 1255 | else throw("Strict value is not equal to itself.") | |
1264 | 1256 | } | |
1265 | 1257 | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
1266 | 1258 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1267 | 1259 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1268 | 1260 | else nil | |
1269 | - | let $ | |
1261 | + | let $t04535445703 = if ((this == feeCollectorAddress)) | |
1270 | 1262 | then $Tuple2(0, 0) | |
1271 | 1263 | else { | |
1272 | 1264 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1273 | 1265 | then true | |
1274 | 1266 | else false | |
1275 | 1267 | if (paymentInAmountAsset) | |
1276 | 1268 | then $Tuple2(-(feeAmount), 0) | |
1277 | 1269 | else $Tuple2(0, -(feeAmount)) | |
1278 | 1270 | } | |
1279 | - | let amountAssetBalanceDelta = $ | |
1280 | - | let priceAssetBalanceDelta = $ | |
1281 | - | let $ | |
1282 | - | let refreshDLpActions = $ | |
1283 | - | let updatedDLp = $ | |
1271 | + | let amountAssetBalanceDelta = $t04535445703._1 | |
1272 | + | let priceAssetBalanceDelta = $t04535445703._2 | |
1273 | + | let $t04570645814 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1274 | + | let refreshDLpActions = $t04570645814._1 | |
1275 | + | let updatedDLp = $t04570645814._2 | |
1284 | 1276 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1285 | 1277 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1286 | 1278 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1287 | 1279 | else throw("Strict value is not equal to itself.") | |
1288 | 1280 | } | |
1289 | 1281 | else throw("Strict value is not equal to itself.") | |
1290 | 1282 | } | |
1291 | 1283 | else throw("Strict value is not equal to itself.") | |
1292 | 1284 | } | |
1293 | 1285 | else throw("Strict value is not equal to itself.") | |
1294 | 1286 | } | |
1295 | 1287 | else throw("Strict value is not equal to itself.") | |
1296 | 1288 | } | |
1297 | 1289 | else throw("Strict value is not equal to itself.") | |
1298 | 1290 | } | |
1299 | 1291 | ||
1300 | 1292 | ||
1301 | 1293 | ||
1302 | 1294 | @Callable(i) | |
1303 | 1295 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
1304 | 1296 | then throw("Wrong slpg") | |
1305 | 1297 | else if ((size(i.payments) != 2)) | |
1306 | 1298 | then throw("2 pmnts expd") | |
1307 | 1299 | else { | |
1308 | 1300 | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "") | |
1309 | 1301 | let state = estPut._9 | |
1310 | 1302 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1311 | 1303 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1312 | 1304 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1313 | 1305 | if ((currentDLp == currentDLp)) | |
1314 | 1306 | then { | |
1315 | - | let $ | |
1316 | - | let refreshDLpActions = $ | |
1317 | - | let updatedDLp = $ | |
1307 | + | let $t04684446909 = refreshDLpInternal(0, 0, 0) | |
1308 | + | let refreshDLpActions = $t04684446909._1 | |
1309 | + | let updatedDLp = $t04684446909._2 | |
1318 | 1310 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1319 | 1311 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1320 | 1312 | then (state ++ refreshDLpActions) | |
1321 | 1313 | else throw("Strict value is not equal to itself.") | |
1322 | 1314 | } | |
1323 | 1315 | else throw("Strict value is not equal to itself.") | |
1324 | 1316 | } | |
1325 | 1317 | ||
1326 | 1318 | ||
1327 | 1319 | ||
1328 | 1320 | @Callable(i) | |
1329 | 1321 | func get () = { | |
1330 | 1322 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1331 | 1323 | if ((currentDLp == currentDLp)) | |
1332 | 1324 | then { | |
1333 | 1325 | let r = cg(i) | |
1334 | 1326 | let outAmtAmt = r._1 | |
1335 | 1327 | let outPrAmt = r._2 | |
1336 | 1328 | let pmtAmt = r._3 | |
1337 | 1329 | let pmtAssetId = r._4 | |
1338 | 1330 | let state = r._5 | |
1339 | 1331 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1340 | 1332 | if ((b == b)) | |
1341 | 1333 | then { | |
1342 | - | let $ | |
1343 | - | let refreshDLpActions = $ | |
1344 | - | let updatedDLp = $ | |
1334 | + | let $t04808248164 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1335 | + | let refreshDLpActions = $t04808248164._1 | |
1336 | + | let updatedDLp = $t04808248164._2 | |
1345 | 1337 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1346 | 1338 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1347 | 1339 | then (state ++ refreshDLpActions) | |
1348 | 1340 | else throw("Strict value is not equal to itself.") | |
1349 | 1341 | } | |
1350 | 1342 | else throw("Strict value is not equal to itself.") | |
1351 | 1343 | } | |
1352 | 1344 | else throw("Strict value is not equal to itself.") | |
1353 | 1345 | } | |
1354 | 1346 | ||
1355 | 1347 | ||
1356 | 1348 | ||
1357 | 1349 | @Callable(i) | |
1358 | 1350 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1359 | 1351 | let isPoolOneTokenOperationsDisabled = { | |
1360 | 1352 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1361 | 1353 | if ($isInstanceOf(@, "Boolean")) | |
1362 | 1354 | then @ | |
1363 | 1355 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1364 | 1356 | } | |
1365 | 1357 | let isGetDisabled = if (if (igs()) | |
1366 | 1358 | then true | |
1367 | 1359 | else (cfgPoolStatus == PoolShutdown)) | |
1368 | 1360 | then true | |
1369 | 1361 | else isPoolOneTokenOperationsDisabled | |
1370 | 1362 | let checks = [if (if (!(isGetDisabled)) | |
1371 | 1363 | then true | |
1372 | 1364 | else isManager(i)) | |
1373 | 1365 | then true | |
1374 | 1366 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1375 | 1367 | then true | |
1376 | 1368 | else throwErr("exactly 1 payment are expected")] | |
1377 | 1369 | if ((checks == checks)) | |
1378 | 1370 | then { | |
1379 | - | let $ | |
1380 | - | let state = $ | |
1381 | - | let totalAmount = $ | |
1371 | + | let $t04878248937 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1372 | + | let state = $t04878248937._1 | |
1373 | + | let totalAmount = $t04878248937._2 | |
1382 | 1374 | $Tuple2(state, totalAmount) | |
1383 | 1375 | } | |
1384 | 1376 | else throw("Strict value is not equal to itself.") | |
1385 | 1377 | } | |
1386 | 1378 | ||
1387 | 1379 | ||
1388 | 1380 | ||
1389 | 1381 | @Callable(i) | |
1390 | 1382 | func refreshDLp () = { | |
1391 | 1383 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0) | |
1392 | 1384 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay)) | |
1393 | 1385 | then unit | |
1394 | 1386 | else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1395 | 1387 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1396 | 1388 | then { | |
1397 | 1389 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1398 | - | let $ | |
1399 | - | let dLpUpdateActions = $ | |
1400 | - | let updatedDLp = $ | |
1390 | + | let $t04946149525 = refreshDLpInternal(0, 0, 0) | |
1391 | + | let dLpUpdateActions = $t04946149525._1 | |
1392 | + | let updatedDLp = $t04946149525._2 | |
1401 | 1393 | let actions = if ((dLp != updatedDLp)) | |
1402 | 1394 | then dLpUpdateActions | |
1403 | 1395 | else throwErr("nothing to refresh") | |
1404 | 1396 | $Tuple2(actions, toString(updatedDLp)) | |
1405 | 1397 | } | |
1406 | 1398 | else throw("Strict value is not equal to itself.") | |
1407 | 1399 | } | |
1408 | 1400 | ||
1409 | 1401 | ||
1410 | 1402 | ||
1411 | 1403 | @Callable(i) | |
1412 | 1404 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1413 | 1405 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1414 | 1406 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1415 | 1407 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1416 | 1408 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
1417 | 1409 | let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
1418 | 1410 | let D0 = getD(xp) | |
1419 | 1411 | let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission)) | |
1420 | 1412 | let index = if ((outAssetId == amId)) | |
1421 | 1413 | then 0 | |
1422 | 1414 | else if ((outAssetId == prId)) | |
1423 | 1415 | then 1 | |
1424 | 1416 | else throw("invalid out asset id") | |
1425 | 1417 | let newY = getYD(xp, index, D1) | |
1426 | 1418 | let dy = (xp[index] - newY) | |
1427 | 1419 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1428 | - | let $ | |
1429 | - | let totalGet = $ | |
1430 | - | let feeAmount = $ | |
1420 | + | let $t05053550590 = takeFee(totalGetRaw, outFee) | |
1421 | + | let totalGet = $t05053550590._1 | |
1422 | + | let feeAmount = $t05053550590._2 | |
1431 | 1423 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1432 | 1424 | } | |
1433 | 1425 | ||
1434 | 1426 | ||
1435 | 1427 | ||
1436 | 1428 | @Callable(i) | |
1437 | 1429 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1438 | 1430 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1439 | 1431 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1440 | 1432 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1441 | 1433 | let amBalance = getAccBalance(amId) | |
1442 | 1434 | let prBalance = getAccBalance(prId) | |
1443 | - | let $ | |
1435 | + | let $t05096551080 = { | |
1444 | 1436 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1445 | 1437 | if ($isInstanceOf(@, "(Int, Int)")) | |
1446 | 1438 | then @ | |
1447 | 1439 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1448 | 1440 | } | |
1449 | - | let totalGet = $ | |
1450 | - | let feeAmount = $ | |
1441 | + | let totalGet = $t05096551080._1 | |
1442 | + | let feeAmount = $t05096551080._2 | |
1451 | 1443 | let r = ego("", lpId, lpAssetAmount, this) | |
1452 | 1444 | let outAmAmt = r._1 | |
1453 | 1445 | let outPrAmt = r._2 | |
1454 | 1446 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1455 | 1447 | let bonus = if ((sumOfGetAssets == 0)) | |
1456 | 1448 | then if ((totalGet == 0)) | |
1457 | 1449 | then 0 | |
1458 | 1450 | else throw("bonus calculation error") | |
1459 | 1451 | else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1460 | 1452 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1461 | 1453 | } | |
1462 | 1454 | ||
1463 | 1455 | ||
1464 | 1456 | ||
1465 | 1457 | @Callable(i) | |
1466 | 1458 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1467 | 1459 | let r = cg(i) | |
1468 | 1460 | let outAmAmt = r._1 | |
1469 | 1461 | let outPrAmt = r._2 | |
1470 | 1462 | let pmtAmt = r._3 | |
1471 | 1463 | let pmtAssetId = r._4 | |
1472 | 1464 | let state = r._5 | |
1473 | 1465 | if ((noLessThenAmtAsset > outAmAmt)) | |
1474 | 1466 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1475 | 1467 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1476 | 1468 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1477 | 1469 | else { | |
1478 | 1470 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1479 | 1471 | if ((currentDLp == currentDLp)) | |
1480 | 1472 | then { | |
1481 | 1473 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1482 | 1474 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1483 | 1475 | then { | |
1484 | - | let $ | |
1485 | - | let refreshDLpActions = $ | |
1486 | - | let updatedDLp = $ | |
1476 | + | let $t05224652327 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1477 | + | let refreshDLpActions = $t05224652327._1 | |
1478 | + | let updatedDLp = $t05224652327._2 | |
1487 | 1479 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1488 | 1480 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1489 | 1481 | then (state ++ refreshDLpActions) | |
1490 | 1482 | else throw("Strict value is not equal to itself.") | |
1491 | 1483 | } | |
1492 | 1484 | else throw("Strict value is not equal to itself.") | |
1493 | 1485 | } | |
1494 | 1486 | else throw("Strict value is not equal to itself.") | |
1495 | 1487 | } | |
1496 | 1488 | } | |
1497 | 1489 | ||
1498 | 1490 | ||
1499 | 1491 | ||
1500 | 1492 | @Callable(i) | |
1501 | 1493 | func unstakeAndGet (amount) = { | |
1502 | 1494 | let checkPayments = if ((size(i.payments) != 0)) | |
1503 | 1495 | then throw("No pmnts expd") | |
1504 | 1496 | else true | |
1505 | 1497 | if ((checkPayments == checkPayments)) | |
1506 | 1498 | then { | |
1507 | 1499 | let factoryCfg = gfc() | |
1508 | 1500 | let lpAssetId = cfgLpAssetId | |
1509 | 1501 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1510 | 1502 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1511 | 1503 | if ((currentDLp == currentDLp)) | |
1512 | 1504 | then { | |
1513 | 1505 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1514 | 1506 | if ((unstakeInv == unstakeInv)) | |
1515 | 1507 | then { | |
1516 | 1508 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1517 | 1509 | let outAmAmt = r._1 | |
1518 | 1510 | let outPrAmt = r._2 | |
1519 | 1511 | let sts = parseIntValue(r._9) | |
1520 | 1512 | let state = r._10 | |
1521 | 1513 | let v = if (if (igs()) | |
1522 | 1514 | then true | |
1523 | 1515 | else (sts == PoolShutdown)) | |
1524 | 1516 | then throw(("Blocked: " + toString(sts))) | |
1525 | 1517 | else true | |
1526 | 1518 | if ((v == v)) | |
1527 | 1519 | then { | |
1528 | 1520 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1529 | 1521 | if ((burnA == burnA)) | |
1530 | 1522 | then { | |
1531 | - | let $ | |
1532 | - | let refreshDLpActions = $ | |
1533 | - | let updatedDLp = $ | |
1523 | + | let $t05335453435 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1524 | + | let refreshDLpActions = $t05335453435._1 | |
1525 | + | let updatedDLp = $t05335453435._2 | |
1534 | 1526 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1535 | 1527 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1536 | 1528 | then (state ++ refreshDLpActions) | |
1537 | 1529 | else throw("Strict value is not equal to itself.") | |
1538 | 1530 | } | |
1539 | 1531 | else throw("Strict value is not equal to itself.") | |
1540 | 1532 | } | |
1541 | 1533 | else throw("Strict value is not equal to itself.") | |
1542 | 1534 | } | |
1543 | 1535 | else throw("Strict value is not equal to itself.") | |
1544 | 1536 | } | |
1545 | 1537 | else throw("Strict value is not equal to itself.") | |
1546 | 1538 | } | |
1547 | 1539 | else throw("Strict value is not equal to itself.") | |
1548 | 1540 | } | |
1549 | 1541 | ||
1550 | 1542 | ||
1551 | 1543 | ||
1552 | 1544 | @Callable(i) | |
1553 | 1545 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1554 | 1546 | let isGetDisabled = if (igs()) | |
1555 | 1547 | then true | |
1556 | 1548 | else (cfgPoolStatus == PoolShutdown) | |
1557 | 1549 | let checks = [if (!(isGetDisabled)) | |
1558 | 1550 | then true | |
1559 | 1551 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1560 | 1552 | then true | |
1561 | 1553 | else throw("no payments are expected")] | |
1562 | 1554 | if ((checks == checks)) | |
1563 | 1555 | then { | |
1564 | 1556 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1565 | 1557 | if ((currentDLp == currentDLp)) | |
1566 | 1558 | then { | |
1567 | 1559 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1568 | 1560 | if ((unstakeInv == unstakeInv)) | |
1569 | 1561 | then { | |
1570 | 1562 | let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1571 | 1563 | let outAmAmt = res._1 | |
1572 | 1564 | let outPrAmt = res._2 | |
1573 | 1565 | let state = res._10 | |
1574 | 1566 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1575 | 1567 | then true | |
1576 | 1568 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1577 | 1569 | then true | |
1578 | 1570 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1579 | 1571 | if ((checkAmounts == checkAmounts)) | |
1580 | 1572 | then { | |
1581 | 1573 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1582 | 1574 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1583 | 1575 | then { | |
1584 | - | let $ | |
1585 | - | let refreshDLpActions = $ | |
1586 | - | let updatedDLp = $ | |
1576 | + | let $t05468654767 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1577 | + | let refreshDLpActions = $t05468654767._1 | |
1578 | + | let updatedDLp = $t05468654767._2 | |
1587 | 1579 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1588 | 1580 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1589 | 1581 | then (state ++ refreshDLpActions) | |
1590 | 1582 | else throw("Strict value is not equal to itself.") | |
1591 | 1583 | } | |
1592 | 1584 | else throw("Strict value is not equal to itself.") | |
1593 | 1585 | } | |
1594 | 1586 | else throw("Strict value is not equal to itself.") | |
1595 | 1587 | } | |
1596 | 1588 | else throw("Strict value is not equal to itself.") | |
1597 | 1589 | } | |
1598 | 1590 | else throw("Strict value is not equal to itself.") | |
1599 | 1591 | } | |
1600 | 1592 | else throw("Strict value is not equal to itself.") | |
1601 | 1593 | } | |
1602 | 1594 | ||
1603 | 1595 | ||
1604 | 1596 | ||
1605 | 1597 | @Callable(i) | |
1606 | 1598 | func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = { | |
1607 | 1599 | let isPoolOneTokenOperationsDisabled = { | |
1608 | 1600 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1609 | 1601 | if ($isInstanceOf(@, "Boolean")) | |
1610 | 1602 | then @ | |
1611 | 1603 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1612 | 1604 | } | |
1613 | 1605 | let isGetDisabled = if (if (igs()) | |
1614 | 1606 | then true | |
1615 | 1607 | else (cfgPoolStatus == PoolShutdown)) | |
1616 | 1608 | then true | |
1617 | 1609 | else isPoolOneTokenOperationsDisabled | |
1618 | 1610 | let checks = [if (if (!(isGetDisabled)) | |
1619 | 1611 | then true | |
1620 | 1612 | else isManager(i)) | |
1621 | 1613 | then true | |
1622 | 1614 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1623 | 1615 | then true | |
1624 | 1616 | else throwErr("no payments are expected")] | |
1625 | 1617 | if ((checks == checks)) | |
1626 | 1618 | then { | |
1627 | 1619 | let factoryCfg = gfc() | |
1628 | 1620 | let lpAssetId = cfgLpAssetId | |
1629 | 1621 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1630 | 1622 | let userAddress = i.caller | |
1631 | 1623 | let lpAssetRecipientAddress = this | |
1632 | 1624 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1633 | 1625 | if ((unstakeInv == unstakeInv)) | |
1634 | 1626 | then { | |
1635 | - | let $ | |
1636 | - | let state = $ | |
1637 | - | let totalAmount = $ | |
1627 | + | let $t05578955977 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1628 | + | let state = $t05578955977._1 | |
1629 | + | let totalAmount = $t05578955977._2 | |
1638 | 1630 | $Tuple2(state, totalAmount) | |
1639 | 1631 | } | |
1640 | 1632 | else throw("Strict value is not equal to itself.") | |
1641 | 1633 | } | |
1642 | 1634 | else throw("Strict value is not equal to itself.") | |
1643 | 1635 | } | |
1644 | 1636 | ||
1645 | 1637 | ||
1646 | 1638 | ||
1647 | 1639 | @Callable(i) | |
1648 | 1640 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1649 | - | let $ | |
1650 | - | let lpAmount = $ | |
1651 | - | let state = $ | |
1652 | - | let feeAmount = $ | |
1653 | - | let bonus = $ | |
1641 | + | let $t05610556208 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1642 | + | let lpAmount = $t05610556208._1 | |
1643 | + | let state = $t05610556208._2 | |
1644 | + | let feeAmount = $t05610556208._3 | |
1645 | + | let bonus = $t05610556208._4 | |
1654 | 1646 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1655 | 1647 | } | |
1656 | 1648 | ||
1657 | 1649 | ||
1658 | 1650 | ||
1659 | 1651 | @Callable(i) | |
1660 | 1652 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1661 | - | let $ | |
1662 | - | let lpAmount = $ | |
1663 | - | let state = $ | |
1664 | - | let feeAmount = $ | |
1665 | - | let bonus = $ | |
1653 | + | let $t05635656460 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1654 | + | let lpAmount = $t05635656460._1 | |
1655 | + | let state = $t05635656460._2 | |
1656 | + | let feeAmount = $t05635656460._3 | |
1657 | + | let bonus = $t05635656460._4 | |
1666 | 1658 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1667 | 1659 | } | |
1668 | 1660 | ||
1669 | 1661 | ||
1670 | 1662 | ||
1671 | 1663 | @Callable(i) | |
1672 | 1664 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1673 | 1665 | then throw("denied") | |
1674 | - | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr), StringEntry(amp(), toString(ampInitial)), StringEntry(keyAmpHistory(height), toString(ampInitial))], "success") | |
1675 | - | ||
1676 | - | ||
1677 | - | ||
1678 | - | @Callable(i) | |
1679 | - | func invert () = { | |
1680 | - | let checks = [if ((i.caller == fca)) | |
1681 | - | then true | |
1682 | - | else throwErr("invalid caller")] | |
1683 | - | if ((checks == checks)) | |
1684 | - | then $Tuple2([StringEntry(aa(), assetIdToString(cfgPriceAssetId)), StringEntry(pa(), assetIdToString(cfgAmountAssetId))], unit) | |
1685 | - | else throw("Strict value is not equal to itself.") | |
1686 | - | } | |
1666 | + | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1687 | 1667 | ||
1688 | 1668 | ||
1689 | 1669 | ||
1690 | 1670 | @Callable(i) | |
1691 | 1671 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1692 | 1672 | ||
1693 | 1673 | ||
1694 | 1674 | ||
1695 | 1675 | @Callable(i) | |
1696 | 1676 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1697 | 1677 | ||
1698 | 1678 | ||
1699 | 1679 | ||
1700 | 1680 | @Callable(i) | |
1701 | 1681 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1702 | 1682 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1703 | 1683 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1704 | 1684 | } | |
1705 | 1685 | ||
1706 | 1686 | ||
1707 | 1687 | ||
1708 | 1688 | @Callable(i) | |
1709 | 1689 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1710 | 1690 | ||
1711 | 1691 | ||
1712 | 1692 | ||
1713 | 1693 | @Callable(i) | |
1714 | 1694 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1715 | 1695 | ||
1716 | 1696 | ||
1717 | 1697 | ||
1718 | 1698 | @Callable(i) | |
1719 | 1699 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1720 | 1700 | ||
1721 | 1701 | ||
1722 | 1702 | ||
1723 | 1703 | @Callable(i) | |
1724 | 1704 | func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, "")) | |
1725 | 1705 | ||
1726 | 1706 | ||
1727 | 1707 | ||
1728 | 1708 | @Callable(i) | |
1729 | 1709 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1730 | 1710 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1731 | 1711 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1732 | 1712 | } | |
1733 | 1713 | ||
1734 | 1714 | ||
1735 | 1715 | ||
1736 | 1716 | @Callable(i) | |
1737 | 1717 | func changeAmp () = { | |
1738 | - | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1739 | - | let $t05929759496 = match cfg { | |
1740 | - | case list: List[Any] => | |
1741 | - | $Tuple3({ | |
1742 | - | let @ = list[0] | |
1743 | - | if ($isInstanceOf(@, "Int")) | |
1744 | - | then @ | |
1745 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
1746 | - | }, { | |
1747 | - | let @ = list[1] | |
1748 | - | if ($isInstanceOf(@, "Int")) | |
1749 | - | then @ | |
1750 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
1751 | - | }, { | |
1752 | - | let @ = list[2] | |
1753 | - | if ($isInstanceOf(@, "Int")) | |
1754 | - | then @ | |
1755 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
1756 | - | }) | |
1757 | - | case _ => | |
1758 | - | throwErr("invalid entry type") | |
1759 | - | } | |
1760 | - | let delay = $t05929759496._1 | |
1761 | - | let delta = $t05929759496._2 | |
1762 | - | let target = $t05929759496._3 | |
1763 | - | let curAmp = parseIntValue(getStringValue(amp())) | |
1764 | - | let newAmpRaw = (curAmp + delta) | |
1765 | - | let newAmp = if ((0 > delta)) | |
1766 | - | then if ((target > newAmpRaw)) | |
1767 | - | then target | |
1768 | - | else newAmpRaw | |
1769 | - | else if ((newAmpRaw > target)) | |
1770 | - | then target | |
1771 | - | else newAmpRaw | |
1772 | - | let lastCall = valueOrElse(getInteger(keyChangeAmpLastCall()), 0) | |
1773 | - | let wait = (lastCall + delay) | |
1774 | - | let checks = [if ((height > wait)) | |
1775 | - | then true | |
1776 | - | else throwErr("try again in few blocks"), if ((curAmp != newAmp)) | |
1777 | - | then true | |
1778 | - | else throwErr("already reached target")] | |
1779 | - | if ((checks == checks)) | |
1780 | - | then [IntegerEntry(keyChangeAmpLastCall(), height), StringEntry(amp(), toString(newAmp)), StringEntry(keyAmpHistory(height), toString(newAmp))] | |
1718 | + | let fcaInv = invoke(fca, "changeAmp", [toString(this)], nil) | |
1719 | + | if ((fcaInv == fcaInv)) | |
1720 | + | then nil | |
1781 | 1721 | else throw("Strict value is not equal to itself.") | |
1782 | 1722 | } | |
1783 | 1723 | ||
1784 | 1724 | ||
1785 | 1725 | @Verifier(tx) | |
1786 | 1726 | func verify () = { | |
1787 | 1727 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1788 | 1728 | case pk: ByteVector => | |
1789 | 1729 | pk | |
1790 | 1730 | case _: Unit => | |
1791 | 1731 | tx.senderPublicKey | |
1792 | 1732 | case _ => | |
1793 | 1733 | throw("Match error") | |
1794 | 1734 | } | |
1795 | 1735 | match tx { | |
1796 | 1736 | case order: Order => | |
1797 | 1737 | let matcherPub = mp() | |
1798 | - | let $ | |
1738 | + | let $t05904859165 = if (skipOrderValidation()) | |
1799 | 1739 | then $Tuple2(true, "") | |
1800 | 1740 | else validateMatcherOrderAllowed(order) | |
1801 | - | let orderValid = $ | |
1802 | - | let orderValidInfo = $ | |
1741 | + | let orderValid = $t05904859165._1 | |
1742 | + | let orderValidInfo = $t05904859165._2 | |
1803 | 1743 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1804 | 1744 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1805 | 1745 | if (if (if (orderValid) | |
1806 | 1746 | then senderValid | |
1807 | 1747 | else false) | |
1808 | 1748 | then matcherValid | |
1809 | 1749 | else false) | |
1810 | 1750 | then true | |
1811 | 1751 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1812 | 1752 | case s: SetScriptTransaction => | |
1813 | 1753 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1814 | 1754 | then true | |
1815 | 1755 | else { | |
1816 | 1756 | let newHash = blake2b256(value(s.script)) | |
1817 | 1757 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1818 | 1758 | let currentHash = scriptHash(this) | |
1819 | 1759 | if ((allowedHash == newHash)) | |
1820 | 1760 | then (currentHash != newHash) | |
1821 | 1761 | else false | |
1822 | 1762 | } | |
1823 | 1763 | case _ => | |
1824 | 1764 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1825 | 1765 | } | |
1826 | 1766 | } | |
1827 | 1767 |
github/deemru/w8io/026f985 238.08 ms ◑