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