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