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