tx · 5B2GFR6f4TRhfJ5VQKTCccn2LRgsrjYU1kzLHNEy1rJw 3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh: -0.03600000 Waves 2023.02.09 15:49 [2442107] smart account 3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh > SELF 0.00000000 Waves
{ "type": 13, "id": "5B2GFR6f4TRhfJ5VQKTCccn2LRgsrjYU1kzLHNEy1rJw", "fee": 3600000, "feeAssetId": null, "timestamp": 1675946944247, "version": 1, "sender": "3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh", "senderPublicKey": "Cr8D7eozSzJh7XHsYTjBinPpo3SS83BrCGiBAJsjGxBo", "proofs": [ "3ihRQmR1fsEYoAVxPqxVVi8earikq88BXMVweTz7MYm9aGETM4jFDauTyhuUDpj5zmzW2z83dt6YVq6EvmHXUFR7" ], "script": "base64:BgKBLggCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiD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YWN0aW9uBAJlWgUCZFYDCQD0AwMIBQJnSQlib2R5Qnl0ZXMJAJEDAggFAmdJBnByb29mcwAABQJnSwYEAmdOCQD2AwEJAQV2YWx1ZQEIBQJlWgZzY3JpcHQEAmdPCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYU4JAQJhegAEAmdQCQDxBwEFBHRoaXMDCQAAAgUCZ08FAmdOCQECIT0CBQJnUAUCZ04HCQD0AwMIBQJnSQlib2R5Qnl0ZXMJAJEDAggFAmdJBnByb29mcwAABQJnS0Hdfx8=", "chainId": 84, "height": 2442107, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2WgjaRzisTBEtqaBbJ5GRHrKKZ4zQjmWHNyXD59sVb7G Next: 5vpTG19KCiioQXqW6f81AtY2psgrono2yJCgz6Ni11ZE Diff:
Old | New | Differences | |
---|---|---|---|
82 | 82 | func absBigInt (val) = if ((zeroBigInt > val)) | |
83 | 83 | then -(val) | |
84 | 84 | else val | |
85 | - | ||
86 | - | ||
87 | - | func swapContract () = "%s__swapContract" | |
88 | 85 | ||
89 | 86 | ||
90 | 87 | func fc () = "%s__factoryContract" | |
219 | 216 | ||
220 | 217 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
221 | 218 | ||
222 | - | let $ | |
219 | + | let $t084088574 = poolConfigParsed | |
223 | 220 | ||
224 | - | let cfgPoolAddress = $ | |
221 | + | let cfgPoolAddress = $t084088574._1 | |
225 | 222 | ||
226 | - | let cfgPoolStatus = $ | |
223 | + | let cfgPoolStatus = $t084088574._2 | |
227 | 224 | ||
228 | - | let cfgLpAssetId = $ | |
225 | + | let cfgLpAssetId = $t084088574._3 | |
229 | 226 | ||
230 | - | let cfgAmountAssetId = $ | |
227 | + | let cfgAmountAssetId = $t084088574._4 | |
231 | 228 | ||
232 | - | let cfgPriceAssetId = $ | |
229 | + | let cfgPriceAssetId = $t084088574._5 | |
233 | 230 | ||
234 | - | let cfgAmountAssetDecimals = $ | |
231 | + | let cfgAmountAssetDecimals = $t084088574._6 | |
235 | 232 | ||
236 | - | let cfgPriceAssetDecimals = $ | |
233 | + | let cfgPriceAssetDecimals = $t084088574._7 | |
237 | 234 | ||
238 | 235 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
239 | 236 | ||
438 | 435 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
439 | 436 | let amountAssetAmount = order.amount | |
440 | 437 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
441 | - | let $ | |
438 | + | let $t02148021692 = if ((order.orderType == Buy)) | |
442 | 439 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
443 | 440 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
444 | - | let amountAssetBalanceDelta = $ | |
445 | - | let priceAssetBalanceDelta = $ | |
441 | + | let amountAssetBalanceDelta = $t02148021692._1 | |
442 | + | let priceAssetBalanceDelta = $t02148021692._2 | |
446 | 443 | if (if (if (isGlobalShutdown()) | |
447 | 444 | then true | |
448 | 445 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
455 | 452 | then throw("Wrong order assets.") | |
456 | 453 | else { | |
457 | 454 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
458 | - | let $ | |
459 | - | let unusedActions = $ | |
460 | - | let kLpNew = $ | |
455 | + | let $t02213222232 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
456 | + | let unusedActions = $t02213222232._1 | |
457 | + | let kLpNew = $t02213222232._2 | |
461 | 458 | let isOrderValid = (kLpNew >= kLp) | |
462 | 459 | let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
463 | 460 | $Tuple2(isOrderValid, info) | |
536 | 533 | else if ((paymentAssetId == cfgPriceAssetId)) | |
537 | 534 | then false | |
538 | 535 | else throwErr("invalid asset") | |
539 | - | let $ | |
536 | + | let $t02534525638 = if (isEval) | |
540 | 537 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
541 | 538 | else if (paymentInAmountAsset) | |
542 | 539 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
543 | 540 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
544 | - | let amountBalanceOld = $ | |
545 | - | let priceBalanceOld = $ | |
546 | - | let $ | |
541 | + | let amountBalanceOld = $t02534525638._1 | |
542 | + | let priceBalanceOld = $t02534525638._2 | |
543 | + | let $t02564225791 = if (paymentInAmountAsset) | |
547 | 544 | then $Tuple2(paymentAmountRaw, 0) | |
548 | 545 | else $Tuple2(0, paymentAmountRaw) | |
549 | - | let amountAssetAmountRaw = $ | |
550 | - | let priceAssetAmountRaw = $ | |
546 | + | let amountAssetAmountRaw = $t02564225791._1 | |
547 | + | let priceAssetAmountRaw = $t02564225791._2 | |
551 | 548 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
552 | 549 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
553 | - | let $ | |
554 | - | let paymentAmount = $ | |
555 | - | let feeAmount = $ | |
550 | + | let $t02592325987 = takeFee(paymentAmountRaw, inFee) | |
551 | + | let paymentAmount = $t02592325987._1 | |
552 | + | let feeAmount = $t02592325987._2 | |
556 | 553 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
557 | 554 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
558 | 555 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
575 | 572 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
576 | 573 | let priceOld = fromX18(priceOldX18, scale8) | |
577 | 574 | let loss = { | |
578 | - | let $ | |
575 | + | let $t02766827835 = if (paymentInAmountAsset) | |
579 | 576 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
580 | 577 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
581 | - | let amount = $ | |
582 | - | let balance = $ | |
578 | + | let amount = $t02766827835._1 | |
579 | + | let balance = $t02766827835._2 | |
583 | 580 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
584 | 581 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
585 | 582 | } | |
619 | 616 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
620 | 617 | let redeemedBigInt = toBigInt(paymentAmount) | |
621 | 618 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
622 | - | let $ | |
623 | - | let totalAmount = $ | |
624 | - | let feeAmount = $ | |
625 | - | let $ | |
619 | + | let $t02991329969 = takeFee(amountRaw, outFee) | |
620 | + | let totalAmount = $t02991329969._1 | |
621 | + | let feeAmount = $t02991329969._2 | |
622 | + | let $t02997330199 = if (outInAmountAsset) | |
626 | 623 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
627 | 624 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
628 | - | let outAmAmount = $ | |
629 | - | let outPrAmount = $ | |
630 | - | let amBalanceNew = $ | |
631 | - | let prBalanceNew = $ | |
625 | + | let outAmAmount = $t02997330199._1 | |
626 | + | let outPrAmount = $t02997330199._2 | |
627 | + | let amBalanceNew = $t02997330199._3 | |
628 | + | let prBalanceNew = $t02997330199._4 | |
632 | 629 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
633 | 630 | let priceNew = fromX18(priceNewX18, scale8) | |
634 | 631 | let commonState = if (isEval) | |
691 | 688 | throw("Match error") | |
692 | 689 | } | |
693 | 690 | } | |
694 | - | ||
695 | - | ||
696 | - | @Callable(i) | |
697 | - | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse) = { | |
698 | - | let $t03195532260 = if ((isReverse == false)) | |
699 | - | then { | |
700 | - | let assetOut = getStringOrFail(this, pa()) | |
701 | - | let assetIn = getStringOrFail(this, aa()) | |
702 | - | $Tuple2(assetOut, assetIn) | |
703 | - | } | |
704 | - | else { | |
705 | - | let assetOut = getStringOrFail(this, aa()) | |
706 | - | let assetIn = getStringOrFail(this, pa()) | |
707 | - | $Tuple2(assetOut, assetIn) | |
708 | - | } | |
709 | - | let assetOut = $t03195532260._1 | |
710 | - | let assetIn = $t03195532260._2 | |
711 | - | let poolAssetInBalance = getAccBalance(assetIn) | |
712 | - | let poolAssetOutBalance = getAccBalance(assetOut) | |
713 | - | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
714 | - | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
715 | - | let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
716 | - | let checkK = if ((newK >= oldK)) | |
717 | - | then true | |
718 | - | else throw("new K is fewer error") | |
719 | - | if ((checkK == checkK)) | |
720 | - | then $Tuple2(nil, amountOut) | |
721 | - | else throw("Strict value is not equal to itself.") | |
722 | - | } | |
723 | - | ||
724 | - | ||
725 | - | ||
726 | - | @Callable(i) | |
727 | - | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo) = { | |
728 | - | let swapContact = { | |
729 | - | let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil) | |
730 | - | if ($isInstanceOf(@, "String")) | |
731 | - | then @ | |
732 | - | else throw(($getType(@) + " couldn't be cast to String")) | |
733 | - | } | |
734 | - | let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
735 | - | then true | |
736 | - | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
737 | - | then true | |
738 | - | else throwErr("Permission denied")] | |
739 | - | if ((checks == checks)) | |
740 | - | then { | |
741 | - | let pmt = value(i.payments[0]) | |
742 | - | let assetIn = if ((pmt.assetId == unit)) | |
743 | - | then toBase58String(toBytes("WAVES")) | |
744 | - | else toBase58String(value(pmt.assetId)) | |
745 | - | let assetOut = if ((isReverse == false)) | |
746 | - | then getStringOrFail(this, pa()) | |
747 | - | else getStringOrFail(this, aa()) | |
748 | - | let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
749 | - | let poolAssetOutBalance = getAccBalance(assetOut) | |
750 | - | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
751 | - | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
752 | - | let newK = (toBigInt(getAccBalance(assetIn)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
753 | - | let checkK = if ((newK >= oldK)) | |
754 | - | then true | |
755 | - | else throw("new K is fewer error") | |
756 | - | if ((checkK == checkK)) | |
757 | - | then { | |
758 | - | let checkMin = if ((amountOut >= amountOutMin)) | |
759 | - | then true | |
760 | - | else throw("Exchange result is fewer coins than expected") | |
761 | - | if ((checkMin == checkMin)) | |
762 | - | then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut) | |
763 | - | else throw("Strict value is not equal to itself.") | |
764 | - | } | |
765 | - | else throw("Strict value is not equal to itself.") | |
766 | - | } | |
767 | - | else throw("Strict value is not equal to itself.") | |
768 | - | } | |
769 | - | ||
770 | 691 | ||
771 | 692 | ||
772 | 693 | @Callable(i) | |
850 | 771 | else throw("Strict value is not equal to itself.") | |
851 | 772 | } | |
852 | 773 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
853 | - | let $ | |
854 | - | if (($ | |
774 | + | let $t03472735189 = refreshKLpInternal(0, 0, 0) | |
775 | + | if (($t03472735189 == $t03472735189)) | |
855 | 776 | then { | |
856 | - | let updatedKLp = $ | |
857 | - | let refreshKLpActions = $ | |
777 | + | let updatedKLp = $t03472735189._2 | |
778 | + | let refreshKLpActions = $t03472735189._1 | |
858 | 779 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
859 | 780 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
860 | 781 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
886 | 807 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
887 | 808 | if ((currentKLp == currentKLp)) | |
888 | 809 | then { | |
889 | - | let $ | |
890 | - | let refreshKLpActions = $ | |
891 | - | let updatedKLp = $ | |
810 | + | let $t03575135816 = refreshKLpInternal(0, 0, 0) | |
811 | + | let refreshKLpActions = $t03575135816._1 | |
812 | + | let updatedKLp = $t03575135816._2 | |
892 | 813 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
893 | 814 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
894 | 815 | then (state ++ refreshKLpActions) | |
935 | 856 | then { | |
936 | 857 | let userAddress = i.caller | |
937 | 858 | let txId = i.transactionId | |
938 | - | let $ | |
939 | - | if (($ | |
859 | + | let $t03700437156 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
860 | + | if (($t03700437156 == $t03700437156)) | |
940 | 861 | then { | |
941 | - | let paymentInAmountAsset = $ | |
942 | - | let bonus = $ | |
943 | - | let feeAmount = $ | |
944 | - | let commonState = $ | |
945 | - | let emitAmountEstimated = $ | |
862 | + | let paymentInAmountAsset = $t03700437156._5 | |
863 | + | let bonus = $t03700437156._4 | |
864 | + | let feeAmount = $t03700437156._3 | |
865 | + | let commonState = $t03700437156._2 | |
866 | + | let emitAmountEstimated = $t03700437156._1 | |
946 | 867 | let emitAmount = if (if ((minOutAmount > 0)) | |
947 | 868 | then (minOutAmount > emitAmountEstimated) | |
948 | 869 | else false) | |
962 | 883 | let sendFee = if ((feeAmount > 0)) | |
963 | 884 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
964 | 885 | else nil | |
965 | - | let $ | |
886 | + | let $t03774237939 = if ((this == feeCollectorAddress)) | |
966 | 887 | then $Tuple2(0, 0) | |
967 | 888 | else if (paymentInAmountAsset) | |
968 | 889 | then $Tuple2(-(feeAmount), 0) | |
969 | 890 | else $Tuple2(0, -(feeAmount)) | |
970 | - | let amountAssetBalanceDelta = $ | |
971 | - | let priceAssetBalanceDelta = $ | |
972 | - | let $ | |
973 | - | let refreshKLpActions = $ | |
974 | - | let updatedKLp = $ | |
891 | + | let amountAssetBalanceDelta = $t03774237939._1 | |
892 | + | let priceAssetBalanceDelta = $t03774237939._2 | |
893 | + | let $t03794238050 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
894 | + | let refreshKLpActions = $t03794238050._1 | |
895 | + | let updatedKLp = $t03794238050._2 | |
975 | 896 | let kLp = value(getString(keyKLp)) | |
976 | 897 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
977 | 898 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
991 | 912 | ||
992 | 913 | @Callable(i) | |
993 | 914 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
994 | - | let $ | |
995 | - | let emitAmountEstimated = $ | |
996 | - | let commonState = $ | |
997 | - | let feeAmount = $ | |
998 | - | let bonus = $ | |
999 | - | let paymentInAmountAsset = $ | |
915 | + | let $t03835638513 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
916 | + | let emitAmountEstimated = $t03835638513._1 | |
917 | + | let commonState = $t03835638513._2 | |
918 | + | let feeAmount = $t03835638513._3 | |
919 | + | let bonus = $t03835638513._4 | |
920 | + | let paymentInAmountAsset = $t03835638513._5 | |
1000 | 921 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1001 | 922 | } | |
1002 | 923 | ||
1033 | 954 | then { | |
1034 | 955 | let userAddress = i.caller | |
1035 | 956 | let txId = i.transactionId | |
1036 | - | let $ | |
1037 | - | if (($ | |
957 | + | let $t03939839551 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
958 | + | if (($t03939839551 == $t03939839551)) | |
1038 | 959 | then { | |
1039 | - | let outInAmountAsset = $ | |
1040 | - | let bonus = $ | |
1041 | - | let feeAmount = $ | |
1042 | - | let commonState = $ | |
1043 | - | let amountEstimated = $ | |
960 | + | let outInAmountAsset = $t03939839551._5 | |
961 | + | let bonus = $t03939839551._4 | |
962 | + | let feeAmount = $t03939839551._3 | |
963 | + | let commonState = $t03939839551._2 | |
964 | + | let amountEstimated = $t03939839551._1 | |
1044 | 965 | let amount = if (if ((minOutAmount > 0)) | |
1045 | 966 | then (minOutAmount > amountEstimated) | |
1046 | 967 | else false) | |
1053 | 974 | let sendFee = if ((feeAmount > 0)) | |
1054 | 975 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1055 | 976 | else nil | |
1056 | - | let $ | |
977 | + | let $t04005140298 = { | |
1057 | 978 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1058 | 979 | then 0 | |
1059 | 980 | else feeAmount | |
1061 | 982 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1062 | 983 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1063 | 984 | } | |
1064 | - | let amountAssetBalanceDelta = $ | |
1065 | - | let priceAssetBalanceDelta = $ | |
1066 | - | let $ | |
1067 | - | let refreshKLpActions = $ | |
1068 | - | let updatedKLp = $ | |
985 | + | let amountAssetBalanceDelta = $t04005140298._1 | |
986 | + | let priceAssetBalanceDelta = $t04005140298._2 | |
987 | + | let $t04030140409 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
988 | + | let refreshKLpActions = $t04030140409._1 | |
989 | + | let updatedKLp = $t04030140409._2 | |
1069 | 990 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1070 | 991 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1071 | 992 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1084 | 1005 | ||
1085 | 1006 | @Callable(i) | |
1086 | 1007 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1087 | - | let $ | |
1088 | - | let amountEstimated = $ | |
1089 | - | let commonState = $ | |
1090 | - | let feeAmount = $ | |
1091 | - | let bonus = $ | |
1092 | - | let outInAmountAsset = $ | |
1008 | + | let $t04066640822 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1009 | + | let amountEstimated = $t04066640822._1 | |
1010 | + | let commonState = $t04066640822._2 | |
1011 | + | let feeAmount = $t04066640822._3 | |
1012 | + | let bonus = $t04066640822._4 | |
1013 | + | let outInAmountAsset = $t04066640822._5 | |
1093 | 1014 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1094 | 1015 | } | |
1095 | 1016 | ||
1126 | 1047 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1127 | 1048 | if ((unstakeInv == unstakeInv)) | |
1128 | 1049 | then { | |
1129 | - | let $ | |
1130 | - | if (($ | |
1050 | + | let $t04172741878 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1051 | + | if (($t04172741878 == $t04172741878)) | |
1131 | 1052 | then { | |
1132 | - | let outInAmountAsset = $ | |
1133 | - | let bonus = $ | |
1134 | - | let feeAmount = $ | |
1135 | - | let commonState = $ | |
1136 | - | let amountEstimated = $ | |
1053 | + | let outInAmountAsset = $t04172741878._5 | |
1054 | + | let bonus = $t04172741878._4 | |
1055 | + | let feeAmount = $t04172741878._3 | |
1056 | + | let commonState = $t04172741878._2 | |
1057 | + | let amountEstimated = $t04172741878._1 | |
1137 | 1058 | let amount = if (if ((minOutAmount > 0)) | |
1138 | 1059 | then (minOutAmount > amountEstimated) | |
1139 | 1060 | else false) | |
1146 | 1067 | let sendFee = if ((feeAmount > 0)) | |
1147 | 1068 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1148 | 1069 | else nil | |
1149 | - | let $ | |
1070 | + | let $t04237342620 = { | |
1150 | 1071 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1151 | 1072 | then 0 | |
1152 | 1073 | else feeAmount | |
1154 | 1075 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1155 | 1076 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1156 | 1077 | } | |
1157 | - | let amountAssetBalanceDelta = $ | |
1158 | - | let priceAssetBalanceDelta = $ | |
1159 | - | let $ | |
1160 | - | let refreshKLpActions = $ | |
1161 | - | let updatedKLp = $ | |
1078 | + | let amountAssetBalanceDelta = $t04237342620._1 | |
1079 | + | let priceAssetBalanceDelta = $t04237342620._2 | |
1080 | + | let $t04262342731 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1081 | + | let refreshKLpActions = $t04262342731._1 | |
1082 | + | let updatedKLp = $t04262342731._2 | |
1162 | 1083 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1163 | 1084 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1164 | 1085 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1191 | 1112 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1192 | 1113 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1193 | 1114 | then { | |
1194 | - | let $ | |
1195 | - | let refreshKLpActions = $ | |
1196 | - | let updatedKLp = $ | |
1115 | + | let $t04367743759 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1116 | + | let refreshKLpActions = $t04367743759._1 | |
1117 | + | let updatedKLp = $t04367743759._2 | |
1197 | 1118 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1198 | 1119 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1199 | 1120 | then (state ++ refreshKLpActions) | |
1225 | 1146 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1226 | 1147 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1227 | 1148 | then { | |
1228 | - | let $ | |
1229 | - | let refreshKLpActions = $ | |
1230 | - | let updatedKLp = $ | |
1149 | + | let $t04470844789 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1150 | + | let refreshKLpActions = $t04470844789._1 | |
1151 | + | let updatedKLp = $t04470844789._2 | |
1231 | 1152 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1232 | 1153 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1233 | 1154 | then (state ++ refreshKLpActions) | |
1271 | 1192 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1272 | 1193 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1273 | 1194 | then { | |
1274 | - | let $ | |
1275 | - | let refreshKLpActions = $ | |
1276 | - | let updatedKLp = $ | |
1195 | + | let $t04591545996 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1196 | + | let refreshKLpActions = $t04591545996._1 | |
1197 | + | let updatedKLp = $t04591545996._2 | |
1277 | 1198 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1278 | 1199 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1279 | 1200 | then (state ++ refreshKLpActions) | |
1324 | 1245 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1325 | 1246 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1326 | 1247 | then { | |
1327 | - | let $ | |
1328 | - | let refreshKLpActions = $ | |
1329 | - | let updatedKLp = $ | |
1248 | + | let $t04729147372 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1249 | + | let refreshKLpActions = $t04729147372._1 | |
1250 | + | let updatedKLp = $t04729147372._2 | |
1330 | 1251 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1331 | 1252 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1332 | 1253 | then (state ++ refreshKLpActions) | |
1361 | 1282 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1362 | 1283 | then { | |
1363 | 1284 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1364 | - | let $ | |
1365 | - | let kLpUpdateActions = $ | |
1366 | - | let updatedKLp = $ | |
1285 | + | let $t04855948623 = refreshKLpInternal(0, 0, 0) | |
1286 | + | let kLpUpdateActions = $t04855948623._1 | |
1287 | + | let updatedKLp = $t04855948623._2 | |
1367 | 1288 | let actions = if ((kLp != updatedKLp)) | |
1368 | 1289 | then kLpUpdateActions | |
1369 | 1290 | else throwErr("nothing to refresh") | |
1538 | 1459 | match tx { | |
1539 | 1460 | case order: Order => | |
1540 | 1461 | let matcherPub = getMatcherPubOrFail() | |
1541 | - | let $ | |
1542 | - | let orderValid = $ | |
1543 | - | let orderValidInfo = $ | |
1462 | + | let $t05728557354 = validateMatcherOrderAllowed(order) | |
1463 | + | let orderValid = $t05728557354._1 | |
1464 | + | let orderValidInfo = $t05728557354._2 | |
1544 | 1465 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1545 | 1466 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1546 | 1467 | if (if (if (orderValid) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lPdecimals = 8 | |
5 | 5 | ||
6 | 6 | let scale8 = 100000000 | |
7 | 7 | ||
8 | 8 | let scale8BigInt = toBigInt(100000000) | |
9 | 9 | ||
10 | 10 | let scale18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let zeroBigInt = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big0 = toBigInt(0) | |
15 | 15 | ||
16 | 16 | let big1 = toBigInt(1) | |
17 | 17 | ||
18 | 18 | let big2 = toBigInt(2) | |
19 | 19 | ||
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | 23 | ||
24 | 24 | let PoolActive = 1 | |
25 | 25 | ||
26 | 26 | let PoolPutDisabled = 2 | |
27 | 27 | ||
28 | 28 | let PoolMatcherDisabled = 3 | |
29 | 29 | ||
30 | 30 | let PoolShutdown = 4 | |
31 | 31 | ||
32 | 32 | let idxPoolAddress = 1 | |
33 | 33 | ||
34 | 34 | let idxPoolStatus = 2 | |
35 | 35 | ||
36 | 36 | let idxPoolLPAssetId = 3 | |
37 | 37 | ||
38 | 38 | let idxAmtAssetId = 4 | |
39 | 39 | ||
40 | 40 | let idxPriceAssetId = 5 | |
41 | 41 | ||
42 | 42 | let idxAmtAssetDcm = 6 | |
43 | 43 | ||
44 | 44 | let idxPriceAssetDcm = 7 | |
45 | 45 | ||
46 | 46 | let idxIAmtAssetId = 8 | |
47 | 47 | ||
48 | 48 | let idxIPriceAssetId = 9 | |
49 | 49 | ||
50 | 50 | let idxLPAssetDcm = 10 | |
51 | 51 | ||
52 | 52 | let idxPoolAmtAssetAmt = 1 | |
53 | 53 | ||
54 | 54 | let idxPoolPriceAssetAmt = 2 | |
55 | 55 | ||
56 | 56 | let idxPoolLPAssetAmt = 3 | |
57 | 57 | ||
58 | 58 | let idxFactoryStakingContract = 1 | |
59 | 59 | ||
60 | 60 | let idxFactorySlippageContract = 7 | |
61 | 61 | ||
62 | 62 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func abs (val) = if ((0 > val)) | |
78 | 78 | then -(val) | |
79 | 79 | else val | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func absBigInt (val) = if ((zeroBigInt > val)) | |
83 | 83 | then -(val) | |
84 | 84 | else val | |
85 | - | ||
86 | - | ||
87 | - | func swapContract () = "%s__swapContract" | |
88 | 85 | ||
89 | 86 | ||
90 | 87 | func fc () = "%s__factoryContract" | |
91 | 88 | ||
92 | 89 | ||
93 | 90 | func mpk () = "%s__managerPublicKey" | |
94 | 91 | ||
95 | 92 | ||
96 | 93 | func pmpk () = "%s__pendingManagerPublicKey" | |
97 | 94 | ||
98 | 95 | ||
99 | 96 | func pl () = "%s%s__price__last" | |
100 | 97 | ||
101 | 98 | ||
102 | 99 | func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP) | |
103 | 100 | ||
104 | 101 | ||
105 | 102 | func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId) | |
106 | 103 | ||
107 | 104 | ||
108 | 105 | func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
109 | 106 | ||
110 | 107 | ||
111 | 108 | func aa () = "%s__amountAsset" | |
112 | 109 | ||
113 | 110 | ||
114 | 111 | func pa () = "%s__priceAsset" | |
115 | 112 | ||
116 | 113 | ||
117 | 114 | let keyFee = "%s__fee" | |
118 | 115 | ||
119 | 116 | let feeDefault = fraction(10, scale8, 10000) | |
120 | 117 | ||
121 | 118 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
122 | 119 | ||
123 | 120 | let keyKLp = makeString(["%s", "kLp"], SEP) | |
124 | 121 | ||
125 | 122 | let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP) | |
126 | 123 | ||
127 | 124 | let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP) | |
128 | 125 | ||
129 | 126 | let kLpRefreshDelayDefault = 30 | |
130 | 127 | ||
131 | 128 | let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault) | |
132 | 129 | ||
133 | 130 | func keyFactoryConfig () = "%s__factoryConfig" | |
134 | 131 | ||
135 | 132 | ||
136 | 133 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
137 | 134 | ||
138 | 135 | ||
139 | 136 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
140 | 137 | ||
141 | 138 | ||
142 | 139 | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
143 | 140 | ||
144 | 141 | ||
145 | 142 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
146 | 143 | ||
147 | 144 | ||
148 | 145 | func keyAllPoolsShutdown () = "%s__shutdown" | |
149 | 146 | ||
150 | 147 | ||
151 | 148 | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
152 | 149 | ||
153 | 150 | ||
154 | 151 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
155 | 152 | ||
156 | 153 | ||
157 | 154 | let keyFeeCollectorAddress = "%s__feeCollectorAddress" | |
158 | 155 | ||
159 | 156 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
160 | 157 | ||
161 | 158 | ||
162 | 159 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
163 | 160 | ||
164 | 161 | ||
165 | 162 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
166 | 163 | ||
167 | 164 | ||
168 | 165 | func throwErr (msg) = throw(makeString(["lp.ride:", msg], " ")) | |
169 | 166 | ||
170 | 167 | ||
171 | 168 | func fmtErr (msg) = makeString(["lp.ride:", msg], " ") | |
172 | 169 | ||
173 | 170 | ||
174 | 171 | let factoryContract = addressFromStringValue(getStringOrFail(this, fc())) | |
175 | 172 | ||
176 | 173 | let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress)) | |
177 | 174 | ||
178 | 175 | let inFee = { | |
179 | 176 | let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil) | |
180 | 177 | if ($isInstanceOf(@, "Int")) | |
181 | 178 | then @ | |
182 | 179 | else throw(($getType(@) + " couldn't be cast to Int")) | |
183 | 180 | } | |
184 | 181 | ||
185 | 182 | let outFee = { | |
186 | 183 | let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil) | |
187 | 184 | if ($isInstanceOf(@, "Int")) | |
188 | 185 | then @ | |
189 | 186 | else throw(($getType(@) + " couldn't be cast to Int")) | |
190 | 187 | } | |
191 | 188 | ||
192 | 189 | func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false) | |
193 | 190 | ||
194 | 191 | ||
195 | 192 | func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub())) | |
196 | 193 | ||
197 | 194 | ||
198 | 195 | func getPoolConfig () = { | |
199 | 196 | let amtAsset = getStringOrFail(this, aa()) | |
200 | 197 | let priceAsset = getStringOrFail(this, pa()) | |
201 | 198 | let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset)) | |
202 | 199 | let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset)) | |
203 | 200 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP) | |
204 | 201 | } | |
205 | 202 | ||
206 | 203 | ||
207 | 204 | func parseAssetId (input) = if ((input == wavesString)) | |
208 | 205 | then unit | |
209 | 206 | else fromBase58String(input) | |
210 | 207 | ||
211 | 208 | ||
212 | 209 | func assetIdToString (input) = if ((input == unit)) | |
213 | 210 | then wavesString | |
214 | 211 | else toBase58String(value(input)) | |
215 | 212 | ||
216 | 213 | ||
217 | 214 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolStatus]), fromBase58String(poolConfig[idxPoolLPAssetId]), parseAssetId(poolConfig[idxAmtAssetId]), parseAssetId(poolConfig[idxPriceAssetId]), parseIntValue(poolConfig[idxAmtAssetDcm]), parseIntValue(poolConfig[idxPriceAssetDcm])) | |
218 | 215 | ||
219 | 216 | ||
220 | 217 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
221 | 218 | ||
222 | - | let $ | |
219 | + | let $t084088574 = poolConfigParsed | |
223 | 220 | ||
224 | - | let cfgPoolAddress = $ | |
221 | + | let cfgPoolAddress = $t084088574._1 | |
225 | 222 | ||
226 | - | let cfgPoolStatus = $ | |
223 | + | let cfgPoolStatus = $t084088574._2 | |
227 | 224 | ||
228 | - | let cfgLpAssetId = $ | |
225 | + | let cfgLpAssetId = $t084088574._3 | |
229 | 226 | ||
230 | - | let cfgAmountAssetId = $ | |
227 | + | let cfgAmountAssetId = $t084088574._4 | |
231 | 228 | ||
232 | - | let cfgPriceAssetId = $ | |
229 | + | let cfgPriceAssetId = $t084088574._5 | |
233 | 230 | ||
234 | - | let cfgAmountAssetDecimals = $ | |
231 | + | let cfgAmountAssetDecimals = $t084088574._6 | |
235 | 232 | ||
236 | - | let cfgPriceAssetDecimals = $ | |
233 | + | let cfgPriceAssetDecimals = $t084088574._7 | |
237 | 234 | ||
238 | 235 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
239 | 236 | ||
240 | 237 | ||
241 | 238 | let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address") | |
242 | 239 | ||
243 | 240 | let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address") | |
244 | 241 | ||
245 | 242 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp,slipageAmtAssetAmt,slipagePriceAssetAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp), toString(slipageAmtAssetAmt), toString(slipagePriceAssetAmt)], SEP) | |
246 | 243 | ||
247 | 244 | ||
248 | 245 | 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) | |
249 | 246 | ||
250 | 247 | ||
251 | 248 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
252 | 249 | then wavesBalance(this).available | |
253 | 250 | else assetBalance(this, fromBase58String(assetId)) | |
254 | 251 | ||
255 | 252 | ||
256 | 253 | func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
257 | 254 | ||
258 | 255 | ||
259 | 256 | func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
260 | 257 | ||
261 | 258 | ||
262 | 259 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
263 | 260 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
264 | 261 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
265 | 262 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
266 | 263 | } | |
267 | 264 | ||
268 | 265 | ||
269 | 266 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
270 | 267 | let cfg = getPoolConfig() | |
271 | 268 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
272 | 269 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
273 | 270 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
274 | 271 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
275 | 272 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
276 | 273 | let lpAmtX18 = toX18(lpAmt, scale8) | |
277 | 274 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
278 | 275 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
279 | 276 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
280 | 277 | } | |
281 | 278 | ||
282 | 279 | ||
283 | 280 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
284 | 281 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
285 | 282 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
286 | 283 | } | |
287 | 284 | ||
288 | 285 | ||
289 | 286 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
290 | 287 | let cfg = getPoolConfig() | |
291 | 288 | let lpAssetId = cfg[idxPoolLPAssetId] | |
292 | 289 | let amAssetId = cfg[idxAmtAssetId] | |
293 | 290 | let prAssetId = cfg[idxPriceAssetId] | |
294 | 291 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
295 | 292 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
296 | 293 | let poolStatus = cfg[idxPoolStatus] | |
297 | 294 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
298 | 295 | if ((lpAssetId != pmtAssetId)) | |
299 | 296 | then throw("Invalid asset passed.") | |
300 | 297 | else { | |
301 | 298 | let amBalance = getAccBalance(amAssetId) | |
302 | 299 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
303 | 300 | let prBalance = getAccBalance(prAssetId) | |
304 | 301 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
305 | 302 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
306 | 303 | let curPrice = fromX18(curPriceX18, scale8) | |
307 | 304 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
308 | 305 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
309 | 306 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
310 | 307 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
311 | 308 | let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR) | |
312 | 309 | let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR) | |
313 | 310 | let state = if ((txId58 == "")) | |
314 | 311 | then nil | |
315 | 312 | else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
316 | 313 | then unit | |
317 | 314 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
318 | 315 | then unit | |
319 | 316 | else fromBase58String(prAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
320 | 317 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
321 | 318 | } | |
322 | 319 | } | |
323 | 320 | ||
324 | 321 | ||
325 | 322 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
326 | 323 | let cfg = getPoolConfig() | |
327 | 324 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
328 | 325 | let amAssetIdStr = cfg[idxAmtAssetId] | |
329 | 326 | let prAssetIdStr = cfg[idxPriceAssetId] | |
330 | 327 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
331 | 328 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
332 | 329 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
333 | 330 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
334 | 331 | let poolStatus = cfg[idxPoolStatus] | |
335 | 332 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
336 | 333 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
337 | 334 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
338 | 335 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
339 | 336 | then true | |
340 | 337 | else (prAssetIdStr != inPrAssetIdStr)) | |
341 | 338 | then throw("Invalid amt or price asset passed.") | |
342 | 339 | else { | |
343 | 340 | let amBalance = if (isEvaluate) | |
344 | 341 | then getAccBalance(amAssetIdStr) | |
345 | 342 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
346 | 343 | let prBalance = if (isEvaluate) | |
347 | 344 | then getAccBalance(prAssetIdStr) | |
348 | 345 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
349 | 346 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
350 | 347 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
351 | 348 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
352 | 349 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
353 | 350 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
354 | 351 | let res = if ((lpEmission == 0)) | |
355 | 352 | then { | |
356 | 353 | let curPriceX18 = zeroBigInt | |
357 | 354 | let slippageX18 = zeroBigInt | |
358 | 355 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
359 | 356 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
360 | 357 | } | |
361 | 358 | else { | |
362 | 359 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
363 | 360 | let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
364 | 361 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
365 | 362 | if (if ((curPriceX18 != zeroBigInt)) | |
366 | 363 | then (slippageX18 > slippageToleranceX18) | |
367 | 364 | else false) | |
368 | 365 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
369 | 366 | else { | |
370 | 367 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
371 | 368 | let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
372 | 369 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
373 | 370 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
374 | 371 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
375 | 372 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
376 | 373 | let expAmtAssetAmtX18 = expectedAmts._1 | |
377 | 374 | let expPriceAssetAmtX18 = expectedAmts._2 | |
378 | 375 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR) | |
379 | 376 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18) | |
380 | 377 | } | |
381 | 378 | } | |
382 | 379 | let calcLpAmt = res._1 | |
383 | 380 | let calcAmAssetPmt = res._2 | |
384 | 381 | let calcPrAssetPmt = res._3 | |
385 | 382 | let curPrice = fromX18(res._4, scale8) | |
386 | 383 | let slippageCalc = fromX18(res._5, scale8) | |
387 | 384 | if ((0 >= calcLpAmt)) | |
388 | 385 | then throw("Invalid calculations. LP calculated is less than zero.") | |
389 | 386 | else { | |
390 | 387 | let emitLpAmt = if (!(emitLp)) | |
391 | 388 | then 0 | |
392 | 389 | else calcLpAmt | |
393 | 390 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
394 | 391 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
395 | 392 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(calcAmAssetPmt, calcPrAssetPmt, emitLpAmt, curPrice, slippageTolerance, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
396 | 393 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
397 | 394 | } | |
398 | 395 | } | |
399 | 396 | } | |
400 | 397 | ||
401 | 398 | ||
402 | 399 | func calcKLp (amountBalance,priceBalance,lpEmission) = { | |
403 | 400 | let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)) | |
404 | 401 | let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals)) | |
405 | 402 | let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
406 | 403 | if ((lpEmission == big0)) | |
407 | 404 | then big0 | |
408 | 405 | else updatedKLp | |
409 | 406 | } | |
410 | 407 | ||
411 | 408 | ||
412 | 409 | func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
413 | 410 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
414 | 411 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
415 | 412 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
416 | 413 | let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
417 | 414 | currentKLp | |
418 | 415 | } | |
419 | 416 | ||
420 | 417 | ||
421 | 418 | func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
422 | 419 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
423 | 420 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
424 | 421 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
425 | 422 | let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
426 | 423 | let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))] | |
427 | 424 | $Tuple2(actions, updatedKLp) | |
428 | 425 | } | |
429 | 426 | ||
430 | 427 | ||
431 | 428 | func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp)) | |
432 | 429 | then true | |
433 | 430 | else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " ")) | |
434 | 431 | ||
435 | 432 | ||
436 | 433 | func validateMatcherOrderAllowed (order) = { | |
437 | 434 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
438 | 435 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
439 | 436 | let amountAssetAmount = order.amount | |
440 | 437 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
441 | - | let $ | |
438 | + | let $t02148021692 = if ((order.orderType == Buy)) | |
442 | 439 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
443 | 440 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
444 | - | let amountAssetBalanceDelta = $ | |
445 | - | let priceAssetBalanceDelta = $ | |
441 | + | let amountAssetBalanceDelta = $t02148021692._1 | |
442 | + | let priceAssetBalanceDelta = $t02148021692._2 | |
446 | 443 | if (if (if (isGlobalShutdown()) | |
447 | 444 | then true | |
448 | 445 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
449 | 446 | then true | |
450 | 447 | else (cfgPoolStatus == PoolShutdown)) | |
451 | 448 | then throw("Exchange operations disabled") | |
452 | 449 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
453 | 450 | then true | |
454 | 451 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
455 | 452 | then throw("Wrong order assets.") | |
456 | 453 | else { | |
457 | 454 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
458 | - | let $ | |
459 | - | let unusedActions = $ | |
460 | - | let kLpNew = $ | |
455 | + | let $t02213222232 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
456 | + | let unusedActions = $t02213222232._1 | |
457 | + | let kLpNew = $t02213222232._2 | |
461 | 458 | let isOrderValid = (kLpNew >= kLp) | |
462 | 459 | let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
463 | 460 | $Tuple2(isOrderValid, info) | |
464 | 461 | } | |
465 | 462 | } | |
466 | 463 | ||
467 | 464 | ||
468 | 465 | func commonGet (i) = if ((size(i.payments) != 1)) | |
469 | 466 | then throw("exactly 1 payment is expected") | |
470 | 467 | else { | |
471 | 468 | let pmt = value(i.payments[0]) | |
472 | 469 | let pmtAssetId = value(pmt.assetId) | |
473 | 470 | let pmtAmt = pmt.amount | |
474 | 471 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
475 | 472 | let outAmAmt = res._1 | |
476 | 473 | let outPrAmt = res._2 | |
477 | 474 | let poolStatus = parseIntValue(res._9) | |
478 | 475 | let state = res._10 | |
479 | 476 | if (if (isGlobalShutdown()) | |
480 | 477 | then true | |
481 | 478 | else (poolStatus == PoolShutdown)) | |
482 | 479 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
483 | 480 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
484 | 481 | } | |
485 | 482 | ||
486 | 483 | ||
487 | 484 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
488 | 485 | then throw("exactly 2 payments are expected") | |
489 | 486 | else { | |
490 | 487 | let amAssetPmt = value(i.payments[0]) | |
491 | 488 | let prAssetPmt = value(i.payments[1]) | |
492 | 489 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
493 | 490 | let poolStatus = parseIntValue(estPut._8) | |
494 | 491 | if (if (if (isGlobalShutdown()) | |
495 | 492 | then true | |
496 | 493 | else (poolStatus == PoolPutDisabled)) | |
497 | 494 | then true | |
498 | 495 | else (poolStatus == PoolShutdown)) | |
499 | 496 | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
500 | 497 | else estPut | |
501 | 498 | } | |
502 | 499 | ||
503 | 500 | ||
504 | 501 | func emit (amount) = { | |
505 | 502 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
506 | 503 | if ((emitInv == emitInv)) | |
507 | 504 | then { | |
508 | 505 | let emitInvLegacy = match emitInv { | |
509 | 506 | case legacyFactoryContract: Address => | |
510 | 507 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
511 | 508 | case _ => | |
512 | 509 | unit | |
513 | 510 | } | |
514 | 511 | if ((emitInvLegacy == emitInvLegacy)) | |
515 | 512 | then amount | |
516 | 513 | else throw("Strict value is not equal to itself.") | |
517 | 514 | } | |
518 | 515 | else throw("Strict value is not equal to itself.") | |
519 | 516 | } | |
520 | 517 | ||
521 | 518 | ||
522 | 519 | func takeFee (amount,fee) = { | |
523 | 520 | let feeAmount = if ((fee == 0)) | |
524 | 521 | then 0 | |
525 | 522 | else fraction(amount, fee, scale8) | |
526 | 523 | $Tuple2((amount - feeAmount), feeAmount) | |
527 | 524 | } | |
528 | 525 | ||
529 | 526 | ||
530 | 527 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
531 | 528 | let isEval = (txId == unit) | |
532 | 529 | let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
533 | 530 | let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
534 | 531 | let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId)) | |
535 | 532 | then true | |
536 | 533 | else if ((paymentAssetId == cfgPriceAssetId)) | |
537 | 534 | then false | |
538 | 535 | else throwErr("invalid asset") | |
539 | - | let $ | |
536 | + | let $t02534525638 = if (isEval) | |
540 | 537 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
541 | 538 | else if (paymentInAmountAsset) | |
542 | 539 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
543 | 540 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
544 | - | let amountBalanceOld = $ | |
545 | - | let priceBalanceOld = $ | |
546 | - | let $ | |
541 | + | let amountBalanceOld = $t02534525638._1 | |
542 | + | let priceBalanceOld = $t02534525638._2 | |
543 | + | let $t02564225791 = if (paymentInAmountAsset) | |
547 | 544 | then $Tuple2(paymentAmountRaw, 0) | |
548 | 545 | else $Tuple2(0, paymentAmountRaw) | |
549 | - | let amountAssetAmountRaw = $ | |
550 | - | let priceAssetAmountRaw = $ | |
546 | + | let amountAssetAmountRaw = $t02564225791._1 | |
547 | + | let priceAssetAmountRaw = $t02564225791._2 | |
551 | 548 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
552 | 549 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
553 | - | let $ | |
554 | - | let paymentAmount = $ | |
555 | - | let feeAmount = $ | |
550 | + | let $t02592325987 = takeFee(paymentAmountRaw, inFee) | |
551 | + | let paymentAmount = $t02592325987._1 | |
552 | + | let feeAmount = $t02592325987._2 | |
556 | 553 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
557 | 554 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
558 | 555 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
559 | 556 | let priceNew = fromX18(priceNewX18, scale8) | |
560 | 557 | let paymentBalance = if (paymentInAmountAsset) | |
561 | 558 | then amountBalanceOld | |
562 | 559 | else priceBalanceOld | |
563 | 560 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
564 | 561 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
565 | 562 | let chechSupply = if ((supplyBigInt > big0)) | |
566 | 563 | then true | |
567 | 564 | else throwErr("initial deposit requires all coins") | |
568 | 565 | if ((chechSupply == chechSupply)) | |
569 | 566 | then { | |
570 | 567 | let depositBigInt = toBigInt(paymentAmount) | |
571 | 568 | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
572 | 569 | let commonState = if (isEval) | |
573 | 570 | then nil | |
574 | 571 | else [IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew), StringEntry(pau(toString(value(userAddress)), toBase58String(value(txId))), dataPutActionInfo(amountAssetAmountRaw, priceAssetAmountRaw, issueAmount, priceNew, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
575 | 572 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
576 | 573 | let priceOld = fromX18(priceOldX18, scale8) | |
577 | 574 | let loss = { | |
578 | - | let $ | |
575 | + | let $t02766827835 = if (paymentInAmountAsset) | |
579 | 576 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
580 | 577 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
581 | - | let amount = $ | |
582 | - | let balance = $ | |
578 | + | let amount = $t02766827835._1 | |
579 | + | let balance = $t02766827835._2 | |
583 | 580 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
584 | 581 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
585 | 582 | } | |
586 | 583 | $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset) | |
587 | 584 | } | |
588 | 585 | else throw("Strict value is not equal to itself.") | |
589 | 586 | } | |
590 | 587 | ||
591 | 588 | ||
592 | 589 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
593 | 590 | let isEval = (txId == unit) | |
594 | 591 | let cfg = getPoolConfig() | |
595 | 592 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
596 | 593 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
597 | 594 | let checks = [if ((paymentAssetId == cfgLpAssetId)) | |
598 | 595 | then true | |
599 | 596 | else throwErr("invalid lp asset")] | |
600 | 597 | if ((checks == checks)) | |
601 | 598 | then { | |
602 | 599 | let outInAmountAsset = if ((outAssetId == cfgAmountAssetId)) | |
603 | 600 | then true | |
604 | 601 | else if ((outAssetId == cfgPriceAssetId)) | |
605 | 602 | then false | |
606 | 603 | else throwErr("invalid asset") | |
607 | 604 | let balanceBigInt = if (outInAmountAsset) | |
608 | 605 | then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) | |
609 | 606 | else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) | |
610 | 607 | let outInAmountAssetDecimals = if (outInAmountAsset) | |
611 | 608 | then amtAssetDcm | |
612 | 609 | else priceAssetDcm | |
613 | 610 | let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
614 | 611 | let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
615 | 612 | let outBalance = if (outInAmountAsset) | |
616 | 613 | then amBalanceOld | |
617 | 614 | else prBalanceOld | |
618 | 615 | let outBalanceBigInt = toBigInt(outBalance) | |
619 | 616 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
620 | 617 | let redeemedBigInt = toBigInt(paymentAmount) | |
621 | 618 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
622 | - | let $ | |
623 | - | let totalAmount = $ | |
624 | - | let feeAmount = $ | |
625 | - | let $ | |
619 | + | let $t02991329969 = takeFee(amountRaw, outFee) | |
620 | + | let totalAmount = $t02991329969._1 | |
621 | + | let feeAmount = $t02991329969._2 | |
622 | + | let $t02997330199 = if (outInAmountAsset) | |
626 | 623 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
627 | 624 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
628 | - | let outAmAmount = $ | |
629 | - | let outPrAmount = $ | |
630 | - | let amBalanceNew = $ | |
631 | - | let prBalanceNew = $ | |
625 | + | let outAmAmount = $t02997330199._1 | |
626 | + | let outPrAmount = $t02997330199._2 | |
627 | + | let amBalanceNew = $t02997330199._3 | |
628 | + | let prBalanceNew = $t02997330199._4 | |
632 | 629 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
633 | 630 | let priceNew = fromX18(priceNewX18, scale8) | |
634 | 631 | let commonState = if (isEval) | |
635 | 632 | then nil | |
636 | 633 | else [StringEntry(gau(toString(value(userAddress)), toBase58String(value(txId))), dataGetActionInfo(outAmAmount, outPrAmount, paymentAmount, priceNew, height, lastBlock.timestamp)), IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew)] | |
637 | 634 | let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals)) | |
638 | 635 | let priceOld = fromX18(priceOldX18, scale8) | |
639 | 636 | let loss = { | |
640 | 637 | let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2) | |
641 | 638 | fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset) | |
642 | 639 | } | |
643 | 640 | $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset) | |
644 | 641 | } | |
645 | 642 | else throw("Strict value is not equal to itself.") | |
646 | 643 | } | |
647 | 644 | ||
648 | 645 | ||
649 | 646 | func managerPublicKeyOrUnit () = match getString(mpk()) { | |
650 | 647 | case s: String => | |
651 | 648 | fromBase58String(s) | |
652 | 649 | case _: Unit => | |
653 | 650 | unit | |
654 | 651 | case _ => | |
655 | 652 | throw("Match error") | |
656 | 653 | } | |
657 | 654 | ||
658 | 655 | ||
659 | 656 | func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) { | |
660 | 657 | case s: String => | |
661 | 658 | fromBase58String(s) | |
662 | 659 | case _: Unit => | |
663 | 660 | unit | |
664 | 661 | case _ => | |
665 | 662 | throw("Match error") | |
666 | 663 | } | |
667 | 664 | ||
668 | 665 | ||
669 | 666 | func isManager (i) = match managerPublicKeyOrUnit() { | |
670 | 667 | case pk: ByteVector => | |
671 | 668 | (i.callerPublicKey == pk) | |
672 | 669 | case _: Unit => | |
673 | 670 | (i.caller == this) | |
674 | 671 | case _ => | |
675 | 672 | throw("Match error") | |
676 | 673 | } | |
677 | 674 | ||
678 | 675 | ||
679 | 676 | func mustManager (i) = { | |
680 | 677 | let pd = throw("Permission denied") | |
681 | 678 | match managerPublicKeyOrUnit() { | |
682 | 679 | case pk: ByteVector => | |
683 | 680 | if ((i.callerPublicKey == pk)) | |
684 | 681 | then true | |
685 | 682 | else pd | |
686 | 683 | case _: Unit => | |
687 | 684 | if ((i.caller == this)) | |
688 | 685 | then true | |
689 | 686 | else pd | |
690 | 687 | case _ => | |
691 | 688 | throw("Match error") | |
692 | 689 | } | |
693 | 690 | } | |
694 | - | ||
695 | - | ||
696 | - | @Callable(i) | |
697 | - | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse) = { | |
698 | - | let $t03195532260 = if ((isReverse == false)) | |
699 | - | then { | |
700 | - | let assetOut = getStringOrFail(this, pa()) | |
701 | - | let assetIn = getStringOrFail(this, aa()) | |
702 | - | $Tuple2(assetOut, assetIn) | |
703 | - | } | |
704 | - | else { | |
705 | - | let assetOut = getStringOrFail(this, aa()) | |
706 | - | let assetIn = getStringOrFail(this, pa()) | |
707 | - | $Tuple2(assetOut, assetIn) | |
708 | - | } | |
709 | - | let assetOut = $t03195532260._1 | |
710 | - | let assetIn = $t03195532260._2 | |
711 | - | let poolAssetInBalance = getAccBalance(assetIn) | |
712 | - | let poolAssetOutBalance = getAccBalance(assetOut) | |
713 | - | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
714 | - | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
715 | - | let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
716 | - | let checkK = if ((newK >= oldK)) | |
717 | - | then true | |
718 | - | else throw("new K is fewer error") | |
719 | - | if ((checkK == checkK)) | |
720 | - | then $Tuple2(nil, amountOut) | |
721 | - | else throw("Strict value is not equal to itself.") | |
722 | - | } | |
723 | - | ||
724 | - | ||
725 | - | ||
726 | - | @Callable(i) | |
727 | - | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo) = { | |
728 | - | let swapContact = { | |
729 | - | let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil) | |
730 | - | if ($isInstanceOf(@, "String")) | |
731 | - | then @ | |
732 | - | else throw(($getType(@) + " couldn't be cast to String")) | |
733 | - | } | |
734 | - | let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
735 | - | then true | |
736 | - | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
737 | - | then true | |
738 | - | else throwErr("Permission denied")] | |
739 | - | if ((checks == checks)) | |
740 | - | then { | |
741 | - | let pmt = value(i.payments[0]) | |
742 | - | let assetIn = if ((pmt.assetId == unit)) | |
743 | - | then toBase58String(toBytes("WAVES")) | |
744 | - | else toBase58String(value(pmt.assetId)) | |
745 | - | let assetOut = if ((isReverse == false)) | |
746 | - | then getStringOrFail(this, pa()) | |
747 | - | else getStringOrFail(this, aa()) | |
748 | - | let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
749 | - | let poolAssetOutBalance = getAccBalance(assetOut) | |
750 | - | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
751 | - | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
752 | - | let newK = (toBigInt(getAccBalance(assetIn)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
753 | - | let checkK = if ((newK >= oldK)) | |
754 | - | then true | |
755 | - | else throw("new K is fewer error") | |
756 | - | if ((checkK == checkK)) | |
757 | - | then { | |
758 | - | let checkMin = if ((amountOut >= amountOutMin)) | |
759 | - | then true | |
760 | - | else throw("Exchange result is fewer coins than expected") | |
761 | - | if ((checkMin == checkMin)) | |
762 | - | then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut) | |
763 | - | else throw("Strict value is not equal to itself.") | |
764 | - | } | |
765 | - | else throw("Strict value is not equal to itself.") | |
766 | - | } | |
767 | - | else throw("Strict value is not equal to itself.") | |
768 | - | } | |
769 | - | ||
770 | 691 | ||
771 | 692 | ||
772 | 693 | @Callable(i) | |
773 | 694 | func setManager (pendingManagerPublicKey) = { | |
774 | 695 | let checkCaller = mustManager(i) | |
775 | 696 | if ((checkCaller == checkCaller)) | |
776 | 697 | then { | |
777 | 698 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
778 | 699 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
779 | 700 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
780 | 701 | else throw("Strict value is not equal to itself.") | |
781 | 702 | } | |
782 | 703 | else throw("Strict value is not equal to itself.") | |
783 | 704 | } | |
784 | 705 | ||
785 | 706 | ||
786 | 707 | ||
787 | 708 | @Callable(i) | |
788 | 709 | func confirmManager () = { | |
789 | 710 | let pm = pendingManagerPublicKeyOrUnit() | |
790 | 711 | let hasPM = if (isDefined(pm)) | |
791 | 712 | then true | |
792 | 713 | else throw("No pending manager") | |
793 | 714 | if ((hasPM == hasPM)) | |
794 | 715 | then { | |
795 | 716 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
796 | 717 | then true | |
797 | 718 | else throw("You are not pending manager") | |
798 | 719 | if ((checkPM == checkPM)) | |
799 | 720 | then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())] | |
800 | 721 | else throw("Strict value is not equal to itself.") | |
801 | 722 | } | |
802 | 723 | else throw("Strict value is not equal to itself.") | |
803 | 724 | } | |
804 | 725 | ||
805 | 726 | ||
806 | 727 | ||
807 | 728 | @Callable(i) | |
808 | 729 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
809 | 730 | then throw("Invalid slippageTolerance passed") | |
810 | 731 | else { | |
811 | 732 | let estPut = commonPut(i, slippageTolerance, true) | |
812 | 733 | let emitLpAmt = estPut._2 | |
813 | 734 | let lpAssetId = estPut._7 | |
814 | 735 | let state = estPut._9 | |
815 | 736 | let amDiff = estPut._10 | |
816 | 737 | let prDiff = estPut._11 | |
817 | 738 | let amId = estPut._12 | |
818 | 739 | let prId = estPut._13 | |
819 | 740 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
820 | 741 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
821 | 742 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
822 | 743 | if ((currentKLp == currentKLp)) | |
823 | 744 | then { | |
824 | 745 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
825 | 746 | if ((emitInv == emitInv)) | |
826 | 747 | then { | |
827 | 748 | let emitInvLegacy = match emitInv { | |
828 | 749 | case legacyFactoryContract: Address => | |
829 | 750 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
830 | 751 | case _ => | |
831 | 752 | unit | |
832 | 753 | } | |
833 | 754 | if ((emitInvLegacy == emitInvLegacy)) | |
834 | 755 | then { | |
835 | 756 | let slippageAInv = if ((amDiff > 0)) | |
836 | 757 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
837 | 758 | else nil | |
838 | 759 | if ((slippageAInv == slippageAInv)) | |
839 | 760 | then { | |
840 | 761 | let slippagePInv = if ((prDiff > 0)) | |
841 | 762 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
842 | 763 | else nil | |
843 | 764 | if ((slippagePInv == slippagePInv)) | |
844 | 765 | then { | |
845 | 766 | let lpTransfer = if (shouldAutoStake) | |
846 | 767 | then { | |
847 | 768 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
848 | 769 | if ((slpStakeInv == slpStakeInv)) | |
849 | 770 | then nil | |
850 | 771 | else throw("Strict value is not equal to itself.") | |
851 | 772 | } | |
852 | 773 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
853 | - | let $ | |
854 | - | if (($ | |
774 | + | let $t03472735189 = refreshKLpInternal(0, 0, 0) | |
775 | + | if (($t03472735189 == $t03472735189)) | |
855 | 776 | then { | |
856 | - | let updatedKLp = $ | |
857 | - | let refreshKLpActions = $ | |
777 | + | let updatedKLp = $t03472735189._2 | |
778 | + | let refreshKLpActions = $t03472735189._1 | |
858 | 779 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
859 | 780 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
860 | 781 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
861 | 782 | else throw("Strict value is not equal to itself.") | |
862 | 783 | } | |
863 | 784 | else throw("Strict value is not equal to itself.") | |
864 | 785 | } | |
865 | 786 | else throw("Strict value is not equal to itself.") | |
866 | 787 | } | |
867 | 788 | else throw("Strict value is not equal to itself.") | |
868 | 789 | } | |
869 | 790 | else throw("Strict value is not equal to itself.") | |
870 | 791 | } | |
871 | 792 | else throw("Strict value is not equal to itself.") | |
872 | 793 | } | |
873 | 794 | else throw("Strict value is not equal to itself.") | |
874 | 795 | } | |
875 | 796 | ||
876 | 797 | ||
877 | 798 | ||
878 | 799 | @Callable(i) | |
879 | 800 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
880 | 801 | then throw("Invalid value passed") | |
881 | 802 | else { | |
882 | 803 | let estPut = commonPut(i, maxSlippage, false) | |
883 | 804 | let state = estPut._9 | |
884 | 805 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
885 | 806 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
886 | 807 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
887 | 808 | if ((currentKLp == currentKLp)) | |
888 | 809 | then { | |
889 | - | let $ | |
890 | - | let refreshKLpActions = $ | |
891 | - | let updatedKLp = $ | |
810 | + | let $t03575135816 = refreshKLpInternal(0, 0, 0) | |
811 | + | let refreshKLpActions = $t03575135816._1 | |
812 | + | let updatedKLp = $t03575135816._2 | |
892 | 813 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
893 | 814 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
894 | 815 | then (state ++ refreshKLpActions) | |
895 | 816 | else throw("Strict value is not equal to itself.") | |
896 | 817 | } | |
897 | 818 | else throw("Strict value is not equal to itself.") | |
898 | 819 | } | |
899 | 820 | ||
900 | 821 | ||
901 | 822 | ||
902 | 823 | @Callable(i) | |
903 | 824 | func putOneTkn (minOutAmount,autoStake) = { | |
904 | 825 | let isPoolOneTokenOperationsDisabled = { | |
905 | 826 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
906 | 827 | if ($isInstanceOf(@, "Boolean")) | |
907 | 828 | then @ | |
908 | 829 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
909 | 830 | } | |
910 | 831 | let isPutDisabled = if (if (if (isGlobalShutdown()) | |
911 | 832 | then true | |
912 | 833 | else (cfgPoolStatus == PoolPutDisabled)) | |
913 | 834 | then true | |
914 | 835 | else (cfgPoolStatus == PoolShutdown)) | |
915 | 836 | then true | |
916 | 837 | else isPoolOneTokenOperationsDisabled | |
917 | 838 | let checks = [if (if (!(isPutDisabled)) | |
918 | 839 | then true | |
919 | 840 | else isManager(i)) | |
920 | 841 | then true | |
921 | 842 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
922 | 843 | then true | |
923 | 844 | else throwErr("exactly 1 payment are expected")] | |
924 | 845 | if ((checks == checks)) | |
925 | 846 | then { | |
926 | 847 | let payment = i.payments[0] | |
927 | 848 | let paymentAssetId = payment.assetId | |
928 | 849 | let paymentAmountRaw = payment.amount | |
929 | 850 | let currentKLp = if ((paymentAssetId == cfgAmountAssetId)) | |
930 | 851 | then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0)) | |
931 | 852 | else if ((paymentAssetId == cfgPriceAssetId)) | |
932 | 853 | then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0)) | |
933 | 854 | else throwErr("payment asset is not supported") | |
934 | 855 | if ((currentKLp == currentKLp)) | |
935 | 856 | then { | |
936 | 857 | let userAddress = i.caller | |
937 | 858 | let txId = i.transactionId | |
938 | - | let $ | |
939 | - | if (($ | |
859 | + | let $t03700437156 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
860 | + | if (($t03700437156 == $t03700437156)) | |
940 | 861 | then { | |
941 | - | let paymentInAmountAsset = $ | |
942 | - | let bonus = $ | |
943 | - | let feeAmount = $ | |
944 | - | let commonState = $ | |
945 | - | let emitAmountEstimated = $ | |
862 | + | let paymentInAmountAsset = $t03700437156._5 | |
863 | + | let bonus = $t03700437156._4 | |
864 | + | let feeAmount = $t03700437156._3 | |
865 | + | let commonState = $t03700437156._2 | |
866 | + | let emitAmountEstimated = $t03700437156._1 | |
946 | 867 | let emitAmount = if (if ((minOutAmount > 0)) | |
947 | 868 | then (minOutAmount > emitAmountEstimated) | |
948 | 869 | else false) | |
949 | 870 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
950 | 871 | else emitAmountEstimated | |
951 | 872 | let emitInv = emit(emitAmount) | |
952 | 873 | if ((emitInv == emitInv)) | |
953 | 874 | then { | |
954 | 875 | let lpTransfer = if (autoStake) | |
955 | 876 | then { | |
956 | 877 | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
957 | 878 | if ((stakeInv == stakeInv)) | |
958 | 879 | then nil | |
959 | 880 | else throw("Strict value is not equal to itself.") | |
960 | 881 | } | |
961 | 882 | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
962 | 883 | let sendFee = if ((feeAmount > 0)) | |
963 | 884 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
964 | 885 | else nil | |
965 | - | let $ | |
886 | + | let $t03774237939 = if ((this == feeCollectorAddress)) | |
966 | 887 | then $Tuple2(0, 0) | |
967 | 888 | else if (paymentInAmountAsset) | |
968 | 889 | then $Tuple2(-(feeAmount), 0) | |
969 | 890 | else $Tuple2(0, -(feeAmount)) | |
970 | - | let amountAssetBalanceDelta = $ | |
971 | - | let priceAssetBalanceDelta = $ | |
972 | - | let $ | |
973 | - | let refreshKLpActions = $ | |
974 | - | let updatedKLp = $ | |
891 | + | let amountAssetBalanceDelta = $t03774237939._1 | |
892 | + | let priceAssetBalanceDelta = $t03774237939._2 | |
893 | + | let $t03794238050 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
894 | + | let refreshKLpActions = $t03794238050._1 | |
895 | + | let updatedKLp = $t03794238050._2 | |
975 | 896 | let kLp = value(getString(keyKLp)) | |
976 | 897 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
977 | 898 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
978 | 899 | then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount) | |
979 | 900 | else throw("Strict value is not equal to itself.") | |
980 | 901 | } | |
981 | 902 | else throw("Strict value is not equal to itself.") | |
982 | 903 | } | |
983 | 904 | else throw("Strict value is not equal to itself.") | |
984 | 905 | } | |
985 | 906 | else throw("Strict value is not equal to itself.") | |
986 | 907 | } | |
987 | 908 | else throw("Strict value is not equal to itself.") | |
988 | 909 | } | |
989 | 910 | ||
990 | 911 | ||
991 | 912 | ||
992 | 913 | @Callable(i) | |
993 | 914 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
994 | - | let $ | |
995 | - | let emitAmountEstimated = $ | |
996 | - | let commonState = $ | |
997 | - | let feeAmount = $ | |
998 | - | let bonus = $ | |
999 | - | let paymentInAmountAsset = $ | |
915 | + | let $t03835638513 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
916 | + | let emitAmountEstimated = $t03835638513._1 | |
917 | + | let commonState = $t03835638513._2 | |
918 | + | let feeAmount = $t03835638513._3 | |
919 | + | let bonus = $t03835638513._4 | |
920 | + | let paymentInAmountAsset = $t03835638513._5 | |
1000 | 921 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1001 | 922 | } | |
1002 | 923 | ||
1003 | 924 | ||
1004 | 925 | ||
1005 | 926 | @Callable(i) | |
1006 | 927 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
1007 | 928 | let isPoolOneTokenOperationsDisabled = { | |
1008 | 929 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1009 | 930 | if ($isInstanceOf(@, "Boolean")) | |
1010 | 931 | then @ | |
1011 | 932 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1012 | 933 | } | |
1013 | 934 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1014 | 935 | then true | |
1015 | 936 | else (cfgPoolStatus == PoolShutdown)) | |
1016 | 937 | then true | |
1017 | 938 | else isPoolOneTokenOperationsDisabled | |
1018 | 939 | let checks = [if (if (!(isGetDisabled)) | |
1019 | 940 | then true | |
1020 | 941 | else isManager(i)) | |
1021 | 942 | then true | |
1022 | 943 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1023 | 944 | then true | |
1024 | 945 | else throwErr("exactly 1 payment are expected")] | |
1025 | 946 | if ((checks == checks)) | |
1026 | 947 | then { | |
1027 | 948 | let outAssetId = parseAssetId(outAssetIdStr) | |
1028 | 949 | let payment = i.payments[0] | |
1029 | 950 | let paymentAssetId = payment.assetId | |
1030 | 951 | let paymentAmount = payment.amount | |
1031 | 952 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1032 | 953 | if ((currentKLp == currentKLp)) | |
1033 | 954 | then { | |
1034 | 955 | let userAddress = i.caller | |
1035 | 956 | let txId = i.transactionId | |
1036 | - | let $ | |
1037 | - | if (($ | |
957 | + | let $t03939839551 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
958 | + | if (($t03939839551 == $t03939839551)) | |
1038 | 959 | then { | |
1039 | - | let outInAmountAsset = $ | |
1040 | - | let bonus = $ | |
1041 | - | let feeAmount = $ | |
1042 | - | let commonState = $ | |
1043 | - | let amountEstimated = $ | |
960 | + | let outInAmountAsset = $t03939839551._5 | |
961 | + | let bonus = $t03939839551._4 | |
962 | + | let feeAmount = $t03939839551._3 | |
963 | + | let commonState = $t03939839551._2 | |
964 | + | let amountEstimated = $t03939839551._1 | |
1044 | 965 | let amount = if (if ((minOutAmount > 0)) | |
1045 | 966 | then (minOutAmount > amountEstimated) | |
1046 | 967 | else false) | |
1047 | 968 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1048 | 969 | else amountEstimated | |
1049 | 970 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
1050 | 971 | if ((burnInv == burnInv)) | |
1051 | 972 | then { | |
1052 | 973 | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
1053 | 974 | let sendFee = if ((feeAmount > 0)) | |
1054 | 975 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1055 | 976 | else nil | |
1056 | - | let $ | |
977 | + | let $t04005140298 = { | |
1057 | 978 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1058 | 979 | then 0 | |
1059 | 980 | else feeAmount | |
1060 | 981 | if (outInAmountAsset) | |
1061 | 982 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1062 | 983 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1063 | 984 | } | |
1064 | - | let amountAssetBalanceDelta = $ | |
1065 | - | let priceAssetBalanceDelta = $ | |
1066 | - | let $ | |
1067 | - | let refreshKLpActions = $ | |
1068 | - | let updatedKLp = $ | |
985 | + | let amountAssetBalanceDelta = $t04005140298._1 | |
986 | + | let priceAssetBalanceDelta = $t04005140298._2 | |
987 | + | let $t04030140409 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
988 | + | let refreshKLpActions = $t04030140409._1 | |
989 | + | let updatedKLp = $t04030140409._2 | |
1069 | 990 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1070 | 991 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1071 | 992 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1072 | 993 | else throw("Strict value is not equal to itself.") | |
1073 | 994 | } | |
1074 | 995 | else throw("Strict value is not equal to itself.") | |
1075 | 996 | } | |
1076 | 997 | else throw("Strict value is not equal to itself.") | |
1077 | 998 | } | |
1078 | 999 | else throw("Strict value is not equal to itself.") | |
1079 | 1000 | } | |
1080 | 1001 | else throw("Strict value is not equal to itself.") | |
1081 | 1002 | } | |
1082 | 1003 | ||
1083 | 1004 | ||
1084 | 1005 | ||
1085 | 1006 | @Callable(i) | |
1086 | 1007 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1087 | - | let $ | |
1088 | - | let amountEstimated = $ | |
1089 | - | let commonState = $ | |
1090 | - | let feeAmount = $ | |
1091 | - | let bonus = $ | |
1092 | - | let outInAmountAsset = $ | |
1008 | + | let $t04066640822 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1009 | + | let amountEstimated = $t04066640822._1 | |
1010 | + | let commonState = $t04066640822._2 | |
1011 | + | let feeAmount = $t04066640822._3 | |
1012 | + | let bonus = $t04066640822._4 | |
1013 | + | let outInAmountAsset = $t04066640822._5 | |
1093 | 1014 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1094 | 1015 | } | |
1095 | 1016 | ||
1096 | 1017 | ||
1097 | 1018 | ||
1098 | 1019 | @Callable(i) | |
1099 | 1020 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
1100 | 1021 | let isPoolOneTokenOperationsDisabled = { | |
1101 | 1022 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1102 | 1023 | if ($isInstanceOf(@, "Boolean")) | |
1103 | 1024 | then @ | |
1104 | 1025 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1105 | 1026 | } | |
1106 | 1027 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1107 | 1028 | then true | |
1108 | 1029 | else (cfgPoolStatus == PoolShutdown)) | |
1109 | 1030 | then true | |
1110 | 1031 | else isPoolOneTokenOperationsDisabled | |
1111 | 1032 | let checks = [if (if (!(isGetDisabled)) | |
1112 | 1033 | then true | |
1113 | 1034 | else isManager(i)) | |
1114 | 1035 | then true | |
1115 | 1036 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1116 | 1037 | then true | |
1117 | 1038 | else throwErr("no payments are expected")] | |
1118 | 1039 | if ((checks == checks)) | |
1119 | 1040 | then { | |
1120 | 1041 | let outAssetId = parseAssetId(outAssetIdStr) | |
1121 | 1042 | let userAddress = i.caller | |
1122 | 1043 | let txId = i.transactionId | |
1123 | 1044 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1124 | 1045 | if ((currentKLp == currentKLp)) | |
1125 | 1046 | then { | |
1126 | 1047 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1127 | 1048 | if ((unstakeInv == unstakeInv)) | |
1128 | 1049 | then { | |
1129 | - | let $ | |
1130 | - | if (($ | |
1050 | + | let $t04172741878 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1051 | + | if (($t04172741878 == $t04172741878)) | |
1131 | 1052 | then { | |
1132 | - | let outInAmountAsset = $ | |
1133 | - | let bonus = $ | |
1134 | - | let feeAmount = $ | |
1135 | - | let commonState = $ | |
1136 | - | let amountEstimated = $ | |
1053 | + | let outInAmountAsset = $t04172741878._5 | |
1054 | + | let bonus = $t04172741878._4 | |
1055 | + | let feeAmount = $t04172741878._3 | |
1056 | + | let commonState = $t04172741878._2 | |
1057 | + | let amountEstimated = $t04172741878._1 | |
1137 | 1058 | let amount = if (if ((minOutAmount > 0)) | |
1138 | 1059 | then (minOutAmount > amountEstimated) | |
1139 | 1060 | else false) | |
1140 | 1061 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1141 | 1062 | else amountEstimated | |
1142 | 1063 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1143 | 1064 | if ((burnInv == burnInv)) | |
1144 | 1065 | then { | |
1145 | 1066 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
1146 | 1067 | let sendFee = if ((feeAmount > 0)) | |
1147 | 1068 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1148 | 1069 | else nil | |
1149 | - | let $ | |
1070 | + | let $t04237342620 = { | |
1150 | 1071 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1151 | 1072 | then 0 | |
1152 | 1073 | else feeAmount | |
1153 | 1074 | if (outInAmountAsset) | |
1154 | 1075 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1155 | 1076 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1156 | 1077 | } | |
1157 | - | let amountAssetBalanceDelta = $ | |
1158 | - | let priceAssetBalanceDelta = $ | |
1159 | - | let $ | |
1160 | - | let refreshKLpActions = $ | |
1161 | - | let updatedKLp = $ | |
1078 | + | let amountAssetBalanceDelta = $t04237342620._1 | |
1079 | + | let priceAssetBalanceDelta = $t04237342620._2 | |
1080 | + | let $t04262342731 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1081 | + | let refreshKLpActions = $t04262342731._1 | |
1082 | + | let updatedKLp = $t04262342731._2 | |
1162 | 1083 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1163 | 1084 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1164 | 1085 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1165 | 1086 | else throw("Strict value is not equal to itself.") | |
1166 | 1087 | } | |
1167 | 1088 | else throw("Strict value is not equal to itself.") | |
1168 | 1089 | } | |
1169 | 1090 | else throw("Strict value is not equal to itself.") | |
1170 | 1091 | } | |
1171 | 1092 | else throw("Strict value is not equal to itself.") | |
1172 | 1093 | } | |
1173 | 1094 | else throw("Strict value is not equal to itself.") | |
1174 | 1095 | } | |
1175 | 1096 | else throw("Strict value is not equal to itself.") | |
1176 | 1097 | } | |
1177 | 1098 | ||
1178 | 1099 | ||
1179 | 1100 | ||
1180 | 1101 | @Callable(i) | |
1181 | 1102 | func get () = { | |
1182 | 1103 | let res = commonGet(i) | |
1183 | 1104 | let outAmtAmt = res._1 | |
1184 | 1105 | let outPrAmt = res._2 | |
1185 | 1106 | let pmtAmt = res._3 | |
1186 | 1107 | let pmtAssetId = res._4 | |
1187 | 1108 | let state = res._5 | |
1188 | 1109 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1189 | 1110 | if ((currentKLp == currentKLp)) | |
1190 | 1111 | then { | |
1191 | 1112 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1192 | 1113 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1193 | 1114 | then { | |
1194 | - | let $ | |
1195 | - | let refreshKLpActions = $ | |
1196 | - | let updatedKLp = $ | |
1115 | + | let $t04367743759 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1116 | + | let refreshKLpActions = $t04367743759._1 | |
1117 | + | let updatedKLp = $t04367743759._2 | |
1197 | 1118 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1198 | 1119 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1199 | 1120 | then (state ++ refreshKLpActions) | |
1200 | 1121 | else throw("Strict value is not equal to itself.") | |
1201 | 1122 | } | |
1202 | 1123 | else throw("Strict value is not equal to itself.") | |
1203 | 1124 | } | |
1204 | 1125 | else throw("Strict value is not equal to itself.") | |
1205 | 1126 | } | |
1206 | 1127 | ||
1207 | 1128 | ||
1208 | 1129 | ||
1209 | 1130 | @Callable(i) | |
1210 | 1131 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1211 | 1132 | let res = commonGet(i) | |
1212 | 1133 | let outAmAmt = res._1 | |
1213 | 1134 | let outPrAmt = res._2 | |
1214 | 1135 | let pmtAmt = res._3 | |
1215 | 1136 | let pmtAssetId = res._4 | |
1216 | 1137 | let state = res._5 | |
1217 | 1138 | if ((noLessThenAmtAsset > outAmAmt)) | |
1218 | 1139 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1219 | 1140 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1220 | 1141 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1221 | 1142 | else { | |
1222 | 1143 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1223 | 1144 | if ((currentKLp == currentKLp)) | |
1224 | 1145 | then { | |
1225 | 1146 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1226 | 1147 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1227 | 1148 | then { | |
1228 | - | let $ | |
1229 | - | let refreshKLpActions = $ | |
1230 | - | let updatedKLp = $ | |
1149 | + | let $t04470844789 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1150 | + | let refreshKLpActions = $t04470844789._1 | |
1151 | + | let updatedKLp = $t04470844789._2 | |
1231 | 1152 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1232 | 1153 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1233 | 1154 | then (state ++ refreshKLpActions) | |
1234 | 1155 | else throw("Strict value is not equal to itself.") | |
1235 | 1156 | } | |
1236 | 1157 | else throw("Strict value is not equal to itself.") | |
1237 | 1158 | } | |
1238 | 1159 | else throw("Strict value is not equal to itself.") | |
1239 | 1160 | } | |
1240 | 1161 | } | |
1241 | 1162 | ||
1242 | 1163 | ||
1243 | 1164 | ||
1244 | 1165 | @Callable(i) | |
1245 | 1166 | func unstakeAndGet (amount) = { | |
1246 | 1167 | let checkPayments = if ((size(i.payments) != 0)) | |
1247 | 1168 | then throw("No payments are expected") | |
1248 | 1169 | else true | |
1249 | 1170 | if ((checkPayments == checkPayments)) | |
1250 | 1171 | then { | |
1251 | 1172 | let cfg = getPoolConfig() | |
1252 | 1173 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1253 | 1174 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1254 | 1175 | if ((currentKLp == currentKLp)) | |
1255 | 1176 | then { | |
1256 | 1177 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1257 | 1178 | if ((unstakeInv == unstakeInv)) | |
1258 | 1179 | then { | |
1259 | 1180 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1260 | 1181 | let outAmAmt = res._1 | |
1261 | 1182 | let outPrAmt = res._2 | |
1262 | 1183 | let poolStatus = parseIntValue(res._9) | |
1263 | 1184 | let state = res._10 | |
1264 | 1185 | let checkPoolStatus = if (if (isGlobalShutdown()) | |
1265 | 1186 | then true | |
1266 | 1187 | else (poolStatus == PoolShutdown)) | |
1267 | 1188 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
1268 | 1189 | else true | |
1269 | 1190 | if ((checkPoolStatus == checkPoolStatus)) | |
1270 | 1191 | then { | |
1271 | 1192 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1272 | 1193 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1273 | 1194 | then { | |
1274 | - | let $ | |
1275 | - | let refreshKLpActions = $ | |
1276 | - | let updatedKLp = $ | |
1195 | + | let $t04591545996 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1196 | + | let refreshKLpActions = $t04591545996._1 | |
1197 | + | let updatedKLp = $t04591545996._2 | |
1277 | 1198 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1278 | 1199 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1279 | 1200 | then (state ++ refreshKLpActions) | |
1280 | 1201 | else throw("Strict value is not equal to itself.") | |
1281 | 1202 | } | |
1282 | 1203 | else throw("Strict value is not equal to itself.") | |
1283 | 1204 | } | |
1284 | 1205 | else throw("Strict value is not equal to itself.") | |
1285 | 1206 | } | |
1286 | 1207 | else throw("Strict value is not equal to itself.") | |
1287 | 1208 | } | |
1288 | 1209 | else throw("Strict value is not equal to itself.") | |
1289 | 1210 | } | |
1290 | 1211 | else throw("Strict value is not equal to itself.") | |
1291 | 1212 | } | |
1292 | 1213 | ||
1293 | 1214 | ||
1294 | 1215 | ||
1295 | 1216 | @Callable(i) | |
1296 | 1217 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1297 | 1218 | let isGetDisabled = if (isGlobalShutdown()) | |
1298 | 1219 | then true | |
1299 | 1220 | else (cfgPoolStatus == PoolShutdown) | |
1300 | 1221 | let checks = [if (!(isGetDisabled)) | |
1301 | 1222 | then true | |
1302 | 1223 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1303 | 1224 | then true | |
1304 | 1225 | else throw("no payments are expected")] | |
1305 | 1226 | if ((checks == checks)) | |
1306 | 1227 | then { | |
1307 | 1228 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1308 | 1229 | if ((currentKLp == currentKLp)) | |
1309 | 1230 | then { | |
1310 | 1231 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1311 | 1232 | if ((unstakeInv == unstakeInv)) | |
1312 | 1233 | then { | |
1313 | 1234 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1314 | 1235 | let outAmAmt = res._1 | |
1315 | 1236 | let outPrAmt = res._2 | |
1316 | 1237 | let state = res._10 | |
1317 | 1238 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1318 | 1239 | then true | |
1319 | 1240 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1320 | 1241 | then true | |
1321 | 1242 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1322 | 1243 | if ((checkAmounts == checkAmounts)) | |
1323 | 1244 | then { | |
1324 | 1245 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1325 | 1246 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1326 | 1247 | then { | |
1327 | - | let $ | |
1328 | - | let refreshKLpActions = $ | |
1329 | - | let updatedKLp = $ | |
1248 | + | let $t04729147372 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1249 | + | let refreshKLpActions = $t04729147372._1 | |
1250 | + | let updatedKLp = $t04729147372._2 | |
1330 | 1251 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1331 | 1252 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1332 | 1253 | then (state ++ refreshKLpActions) | |
1333 | 1254 | else throw("Strict value is not equal to itself.") | |
1334 | 1255 | } | |
1335 | 1256 | else throw("Strict value is not equal to itself.") | |
1336 | 1257 | } | |
1337 | 1258 | else throw("Strict value is not equal to itself.") | |
1338 | 1259 | } | |
1339 | 1260 | else throw("Strict value is not equal to itself.") | |
1340 | 1261 | } | |
1341 | 1262 | else throw("Strict value is not equal to itself.") | |
1342 | 1263 | } | |
1343 | 1264 | else throw("Strict value is not equal to itself.") | |
1344 | 1265 | } | |
1345 | 1266 | ||
1346 | 1267 | ||
1347 | 1268 | ||
1348 | 1269 | @Callable(i) | |
1349 | 1270 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
1350 | 1271 | then throw("permissions denied") | |
1351 | 1272 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
1352 | 1273 | ||
1353 | 1274 | ||
1354 | 1275 | ||
1355 | 1276 | @Callable(i) | |
1356 | 1277 | func refreshKLp () = { | |
1357 | 1278 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0) | |
1358 | 1279 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay)) | |
1359 | 1280 | then unit | |
1360 | 1281 | else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1361 | 1282 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1362 | 1283 | then { | |
1363 | 1284 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1364 | - | let $ | |
1365 | - | let kLpUpdateActions = $ | |
1366 | - | let updatedKLp = $ | |
1285 | + | let $t04855948623 = refreshKLpInternal(0, 0, 0) | |
1286 | + | let kLpUpdateActions = $t04855948623._1 | |
1287 | + | let updatedKLp = $t04855948623._2 | |
1367 | 1288 | let actions = if ((kLp != updatedKLp)) | |
1368 | 1289 | then kLpUpdateActions | |
1369 | 1290 | else throwErr("nothing to refresh") | |
1370 | 1291 | $Tuple2(actions, toString(updatedKLp)) | |
1371 | 1292 | } | |
1372 | 1293 | else throw("Strict value is not equal to itself.") | |
1373 | 1294 | } | |
1374 | 1295 | ||
1375 | 1296 | ||
1376 | 1297 | ||
1377 | 1298 | @Callable(i) | |
1378 | 1299 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
1379 | 1300 | ||
1380 | 1301 | ||
1381 | 1302 | ||
1382 | 1303 | @Callable(i) | |
1383 | 1304 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1384 | 1305 | ||
1385 | 1306 | ||
1386 | 1307 | ||
1387 | 1308 | @Callable(i) | |
1388 | 1309 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1389 | 1310 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
1390 | 1311 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
1391 | 1312 | } | |
1392 | 1313 | ||
1393 | 1314 | ||
1394 | 1315 | ||
1395 | 1316 | @Callable(i) | |
1396 | 1317 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
1397 | 1318 | ||
1398 | 1319 | ||
1399 | 1320 | ||
1400 | 1321 | @Callable(i) | |
1401 | 1322 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
1402 | 1323 | ||
1403 | 1324 | ||
1404 | 1325 | ||
1405 | 1326 | @Callable(i) | |
1406 | 1327 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1407 | 1328 | ||
1408 | 1329 | ||
1409 | 1330 | ||
1410 | 1331 | @Callable(i) | |
1411 | 1332 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1412 | 1333 | ||
1413 | 1334 | ||
1414 | 1335 | ||
1415 | 1336 | @Callable(i) | |
1416 | 1337 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1417 | 1338 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1418 | 1339 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1419 | 1340 | } | |
1420 | 1341 | ||
1421 | 1342 | ||
1422 | 1343 | ||
1423 | 1344 | @Callable(i) | |
1424 | 1345 | func statsREADONLY () = { | |
1425 | 1346 | let cfg = getPoolConfig() | |
1426 | 1347 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1427 | 1348 | let amtAssetId = cfg[idxAmtAssetId] | |
1428 | 1349 | let priceAssetId = cfg[idxPriceAssetId] | |
1429 | 1350 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1430 | 1351 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1431 | 1352 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1432 | 1353 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1433 | 1354 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1434 | 1355 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1435 | 1356 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1436 | 1357 | let pricesList = if ((poolLPBalance == 0)) | |
1437 | 1358 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1438 | 1359 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1439 | 1360 | let curPrice = 0 | |
1440 | 1361 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1441 | 1362 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1442 | 1363 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1443 | 1364 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP)) | |
1444 | 1365 | } | |
1445 | 1366 | ||
1446 | 1367 | ||
1447 | 1368 | ||
1448 | 1369 | @Callable(i) | |
1449 | 1370 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1450 | 1371 | let cfg = getPoolConfig() | |
1451 | 1372 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1452 | 1373 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1453 | 1374 | let amAssetId = fromBase58String(amAssetIdStr) | |
1454 | 1375 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1455 | 1376 | let prAssetId = fromBase58String(prAssetIdStr) | |
1456 | 1377 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1457 | 1378 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1458 | 1379 | let poolStatus = cfg[idxPoolStatus] | |
1459 | 1380 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1460 | 1381 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1461 | 1382 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1462 | 1383 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1463 | 1384 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1464 | 1385 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1465 | 1386 | then zeroBigInt | |
1466 | 1387 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1467 | 1388 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1468 | 1389 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1469 | 1390 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1470 | 1391 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1471 | 1392 | let calcLpAmt = estPut._1 | |
1472 | 1393 | let curPriceCalc = estPut._3 | |
1473 | 1394 | let amBalance = estPut._4 | |
1474 | 1395 | let prBalance = estPut._5 | |
1475 | 1396 | let lpEmission = estPut._6 | |
1476 | 1397 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1477 | 1398 | } | |
1478 | 1399 | ||
1479 | 1400 | ||
1480 | 1401 | ||
1481 | 1402 | @Callable(i) | |
1482 | 1403 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1483 | 1404 | let cfg = getPoolConfig() | |
1484 | 1405 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1485 | 1406 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1486 | 1407 | let amAssetId = fromBase58String(amAssetIdStr) | |
1487 | 1408 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1488 | 1409 | let prAssetId = fromBase58String(prAssetIdStr) | |
1489 | 1410 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1490 | 1411 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1491 | 1412 | let poolStatus = cfg[idxPoolStatus] | |
1492 | 1413 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1493 | 1414 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1494 | 1415 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1495 | 1416 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1496 | 1417 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1497 | 1418 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1498 | 1419 | then zeroBigInt | |
1499 | 1420 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1500 | 1421 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1501 | 1422 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1502 | 1423 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1503 | 1424 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1504 | 1425 | let calcLpAmt = estPut._1 | |
1505 | 1426 | let curPriceCalc = estPut._3 | |
1506 | 1427 | let amBalance = estPut._4 | |
1507 | 1428 | let prBalance = estPut._5 | |
1508 | 1429 | let lpEmission = estPut._6 | |
1509 | 1430 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1510 | 1431 | } | |
1511 | 1432 | ||
1512 | 1433 | ||
1513 | 1434 | ||
1514 | 1435 | @Callable(i) | |
1515 | 1436 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1516 | 1437 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1517 | 1438 | let outAmAmt = res._1 | |
1518 | 1439 | let outPrAmt = res._2 | |
1519 | 1440 | let amBalance = res._5 | |
1520 | 1441 | let prBalance = res._6 | |
1521 | 1442 | let lpEmission = res._7 | |
1522 | 1443 | let curPrice = res._8 | |
1523 | 1444 | let poolStatus = parseIntValue(res._9) | |
1524 | 1445 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), toString(curPrice), toString(poolStatus)], SEP)) | |
1525 | 1446 | } | |
1526 | 1447 | ||
1527 | 1448 | ||
1528 | 1449 | @Verifier(tx) | |
1529 | 1450 | func verify () = { | |
1530 | 1451 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1531 | 1452 | case pk: ByteVector => | |
1532 | 1453 | pk | |
1533 | 1454 | case _: Unit => | |
1534 | 1455 | tx.senderPublicKey | |
1535 | 1456 | case _ => | |
1536 | 1457 | throw("Match error") | |
1537 | 1458 | } | |
1538 | 1459 | match tx { | |
1539 | 1460 | case order: Order => | |
1540 | 1461 | let matcherPub = getMatcherPubOrFail() | |
1541 | - | let $ | |
1542 | - | let orderValid = $ | |
1543 | - | let orderValidInfo = $ | |
1462 | + | let $t05728557354 = validateMatcherOrderAllowed(order) | |
1463 | + | let orderValid = $t05728557354._1 | |
1464 | + | let orderValidInfo = $t05728557354._2 | |
1544 | 1465 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1545 | 1466 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1546 | 1467 | if (if (if (orderValid) | |
1547 | 1468 | then senderValid | |
1548 | 1469 | else false) | |
1549 | 1470 | then matcherValid | |
1550 | 1471 | else false) | |
1551 | 1472 | then true | |
1552 | 1473 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1553 | 1474 | case s: SetScriptTransaction => | |
1554 | 1475 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1555 | 1476 | then true | |
1556 | 1477 | else { | |
1557 | 1478 | let newHash = blake2b256(value(s.script)) | |
1558 | 1479 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1559 | 1480 | let currentHash = scriptHash(this) | |
1560 | 1481 | if ((allowedHash == newHash)) | |
1561 | 1482 | then (currentHash != newHash) | |
1562 | 1483 | else false | |
1563 | 1484 | } | |
1564 | 1485 | case _ => | |
1565 | 1486 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1566 | 1487 | } | |
1567 | 1488 | } | |
1568 | 1489 |
github/deemru/w8io/026f985 307.78 ms ◑