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