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