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