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