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