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