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