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