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