tx · FUtq2cmhKZCprvCBGDaet1u2kChY1xsBnMDH1VDT6Hxd 3N8iNNRC4UfDK4aJctSvHajiZ81fzSumCeP: -0.04300000 Waves 2023.04.03 16:15 [2518443] smart account 3N8iNNRC4UfDK4aJctSvHajiZ81fzSumCeP > SELF 0.00000000 Waves
{ "type": 13, "id": "FUtq2cmhKZCprvCBGDaet1u2kChY1xsBnMDH1VDT6Hxd", "fee": 4300000, "feeAssetId": null, "timestamp": 1680527744409, "version": 2, "chainId": 84, "sender": "3N8iNNRC4UfDK4aJctSvHajiZ81fzSumCeP", "senderPublicKey": "F7NZd812aXMUyDcj1XaB3wgMJXJfUsq3RhPhrEZ9b6ND", "proofs": [ "3xecWfQ48tHEugM8dw222VfPoVdMZrXKQ4XySk39kpjLucEtJq5wwSNb6AzqwwvDtV4fpJqTHCoTqW6b2t6jFS6n" ], "script": "base64:BgLsNggCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeEl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GgFA25pbAUBagECaWkBAmlqAAQCaWsEAmJWCQECZlYAAwkAAQIFAmJWAgpCeXRlVmVjdG9yBAJmWgUCYlYFAmZaAwkAAQIFAmJWAgRVbml0CAUCaWkPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IEAmJWBQJpaQMJAAECBQJiVgIFT3JkZXIEAmV5BQJiVgQCaWwJAQJiZAAEAmltCQECZXgBBQJleQQCYUsIBQJpbQJfMQQCYUwIBQJpbQJfMgQCYU0JAPQDAwgFAmV5CWJvZHlCeXRlcwkAkQMCCAUCZXkGcHJvb2ZzAAAIBQJleQ9zZW5kZXJQdWJsaWNLZXkEAmFOCQD0AwMIBQJleQlib2R5Qnl0ZXMJAJEDAggFAmV5BnByb29mcwABBQJpbAMDAwUCYUsFAmFNBwUCYU4HBgkBAmFKBAUCYUsFAmFMBQJhTQUCYU4DCQABAgUCYlYCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJmVwUCYlYDCQD0AwMIBQJpaQlib2R5Qnl0ZXMJAJEDAggFAmlpBnByb29mcwAABQJpawYEAmluCQD2AwEJAQV2YWx1ZQEIBQJmVwZzY3JpcHQEAmlvCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYVYJAQJhSAAEAmlwCQDxBwEFBHRoaXMDCQAAAgUCaW8FAmluCQECIT0CBQJpcAUCaW4HCQD0AwMIBQJpaQlib2R5Qnl0ZXMJAJEDAggFAmlpBnByb29mcwAABQJpa9O2yUQ=", "height": 2518443, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5tcvpgpyo2WVmNSYrVmxwnsEa6ydkquaBK3TBkb4nCf7 Next: AZmWJFPk5wRftJmysZdwsXH6YosxsfgARzZ8NyLPXSYE Diff:
Old | New | Differences | |
---|---|---|---|
872 | 872 | ||
873 | 873 | ||
874 | 874 | @Callable(i) | |
875 | - | func rebalance () = (rebalanceAsset(aa()) ++ rebalanceAsset(pa())) | |
875 | + | func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa()))) | |
876 | 876 | ||
877 | 877 | ||
878 | 878 | ||
879 | 879 | @Callable(i) | |
880 | 880 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
881 | - | let $ | |
881 | + | let $t03775038055 = if ((isReverse == false)) | |
882 | 882 | then { | |
883 | 883 | let assetOut = getStringOrFail(this, pa()) | |
884 | 884 | let assetIn = getStringOrFail(this, aa()) | |
889 | 889 | let assetIn = getStringOrFail(this, pa()) | |
890 | 890 | $Tuple2(assetOut, assetIn) | |
891 | 891 | } | |
892 | - | let assetOut = $ | |
893 | - | let assetIn = $ | |
892 | + | let assetOut = $t03775038055._1 | |
893 | + | let assetIn = $t03775038055._2 | |
894 | 894 | let poolAssetInBalance = getAccBalance(assetIn) | |
895 | 895 | let poolAssetOutBalance = getAccBalance(assetOut) | |
896 | 896 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
947 | 947 | case _ => | |
948 | 948 | throw("error lease config") | |
949 | 949 | } | |
950 | - | let $ | |
951 | - | let isLeasable = $ | |
952 | - | let leasedRatio = $ | |
953 | - | let minBalance = $ | |
954 | - | let proxyAddress = $ | |
955 | - | let proxyAssetId = $ | |
956 | - | let proxyRateMul = $ | |
957 | - | let stakingProfitAddress = $ | |
950 | + | let $t04006140175 = lsConf | |
951 | + | let isLeasable = $t04006140175._1 | |
952 | + | let leasedRatio = $t04006140175._2 | |
953 | + | let minBalance = $t04006140175._3 | |
954 | + | let proxyAddress = $t04006140175._4 | |
955 | + | let proxyAssetId = $t04006140175._5 | |
956 | + | let proxyRateMul = $t04006140175._6 | |
957 | + | let stakingProfitAddress = $t04006140175._7 | |
958 | 958 | let assetOnPool = assetBalance(this, fromBase58String(assetOut)) | |
959 | 959 | let amountOfProfit = if (if ((assetOut == "WAVES")) | |
960 | 960 | then (amountOut > assetOnPool) | |
1068 | 1068 | else throw("Strict value is not equal to itself.") | |
1069 | 1069 | } | |
1070 | 1070 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1071 | - | let $ | |
1072 | - | if (($ | |
1071 | + | let $t04398644448 = refreshKLpInternal(0, 0, 0) | |
1072 | + | if (($t04398644448 == $t04398644448)) | |
1073 | 1073 | then { | |
1074 | - | let updatedKLp = $ | |
1075 | - | let refreshKLpActions = $ | |
1074 | + | let updatedKLp = $t04398644448._2 | |
1075 | + | let refreshKLpActions = $t04398644448._1 | |
1076 | 1076 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1077 | 1077 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1078 | 1078 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
1104 | 1104 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1105 | 1105 | if ((currentKLp == currentKLp)) | |
1106 | 1106 | then { | |
1107 | - | let $ | |
1108 | - | let refreshKLpActions = $ | |
1109 | - | let updatedKLp = $ | |
1107 | + | let $t04501045075 = refreshKLpInternal(0, 0, 0) | |
1108 | + | let refreshKLpActions = $t04501045075._1 | |
1109 | + | let updatedKLp = $t04501045075._2 | |
1110 | 1110 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1111 | 1111 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1112 | 1112 | then (state ++ refreshKLpActions) | |
1153 | 1153 | then { | |
1154 | 1154 | let userAddress = i.caller | |
1155 | 1155 | let txId = i.transactionId | |
1156 | - | let $ | |
1157 | - | if (($ | |
1156 | + | let $t04626346415 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
1157 | + | if (($t04626346415 == $t04626346415)) | |
1158 | 1158 | then { | |
1159 | - | let paymentInAmountAsset = $ | |
1160 | - | let bonus = $ | |
1161 | - | let feeAmount = $ | |
1162 | - | let commonState = $ | |
1163 | - | let emitAmountEstimated = $ | |
1159 | + | let paymentInAmountAsset = $t04626346415._5 | |
1160 | + | let bonus = $t04626346415._4 | |
1161 | + | let feeAmount = $t04626346415._3 | |
1162 | + | let commonState = $t04626346415._2 | |
1163 | + | let emitAmountEstimated = $t04626346415._1 | |
1164 | 1164 | let emitAmount = if (if ((minOutAmount > 0)) | |
1165 | 1165 | then (minOutAmount > emitAmountEstimated) | |
1166 | 1166 | else false) | |
1180 | 1180 | let sendFee = if ((feeAmount > 0)) | |
1181 | 1181 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
1182 | 1182 | else nil | |
1183 | - | let $ | |
1183 | + | let $t04700147198 = if ((this == feeCollectorAddress)) | |
1184 | 1184 | then $Tuple2(0, 0) | |
1185 | 1185 | else if (paymentInAmountAsset) | |
1186 | 1186 | then $Tuple2(-(feeAmount), 0) | |
1187 | 1187 | else $Tuple2(0, -(feeAmount)) | |
1188 | - | let amountAssetBalanceDelta = $ | |
1189 | - | let priceAssetBalanceDelta = $ | |
1190 | - | let $ | |
1191 | - | let refreshKLpActions = $ | |
1192 | - | let updatedKLp = $ | |
1188 | + | let amountAssetBalanceDelta = $t04700147198._1 | |
1189 | + | let priceAssetBalanceDelta = $t04700147198._2 | |
1190 | + | let $t04720147309 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1191 | + | let refreshKLpActions = $t04720147309._1 | |
1192 | + | let updatedKLp = $t04720147309._2 | |
1193 | 1193 | let kLp = value(getString(keyKLp)) | |
1194 | 1194 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1195 | 1195 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1214 | 1214 | ||
1215 | 1215 | @Callable(i) | |
1216 | 1216 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
1217 | - | let $ | |
1218 | - | let emitAmountEstimated = $ | |
1219 | - | let commonState = $ | |
1220 | - | let feeAmount = $ | |
1221 | - | let bonus = $ | |
1222 | - | let paymentInAmountAsset = $ | |
1217 | + | let $t04766447821 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
1218 | + | let emitAmountEstimated = $t04766447821._1 | |
1219 | + | let commonState = $t04766447821._2 | |
1220 | + | let feeAmount = $t04766447821._3 | |
1221 | + | let bonus = $t04766447821._4 | |
1222 | + | let paymentInAmountAsset = $t04766447821._5 | |
1223 | 1223 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1224 | 1224 | } | |
1225 | 1225 | ||
1256 | 1256 | then { | |
1257 | 1257 | let userAddress = i.caller | |
1258 | 1258 | let txId = i.transactionId | |
1259 | - | let $ | |
1260 | - | if (($ | |
1259 | + | let $t04870648859 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
1260 | + | if (($t04870648859 == $t04870648859)) | |
1261 | 1261 | then { | |
1262 | - | let outInAmountAsset = $ | |
1263 | - | let bonus = $ | |
1264 | - | let feeAmount = $ | |
1265 | - | let commonState = $ | |
1266 | - | let amountEstimated = $ | |
1262 | + | let outInAmountAsset = $t04870648859._5 | |
1263 | + | let bonus = $t04870648859._4 | |
1264 | + | let feeAmount = $t04870648859._3 | |
1265 | + | let commonState = $t04870648859._2 | |
1266 | + | let amountEstimated = $t04870648859._1 | |
1267 | 1267 | let amount = if (if ((minOutAmount > 0)) | |
1268 | 1268 | then (minOutAmount > amountEstimated) | |
1269 | 1269 | else false) | |
1275 | 1275 | case _ => | |
1276 | 1276 | throw("error lease config") | |
1277 | 1277 | } | |
1278 | - | let $ | |
1279 | - | let isLeasable = $ | |
1280 | - | let leasedRatio = $ | |
1281 | - | let minBalance = $ | |
1282 | - | let proxyAddress = $ | |
1283 | - | let proxyAssetId = $ | |
1284 | - | let proxyRateMul = $ | |
1285 | - | let stakingProfitAddress = $ | |
1278 | + | let $t04924349357 = lsConf | |
1279 | + | let isLeasable = $t04924349357._1 | |
1280 | + | let leasedRatio = $t04924349357._2 | |
1281 | + | let minBalance = $t04924349357._3 | |
1282 | + | let proxyAddress = $t04924349357._4 | |
1283 | + | let proxyAssetId = $t04924349357._5 | |
1284 | + | let proxyRateMul = $t04924349357._6 | |
1285 | + | let stakingProfitAddress = $t04924349357._7 | |
1286 | 1286 | let assetOnPool = assetBalance(this, fromBase58String(outAssetIdStr)) | |
1287 | 1287 | let amountOfProfit = if (if ((outAssetIdStr == "WAVES")) | |
1288 | 1288 | then (amount > assetOnPool) | |
1309 | 1309 | let sendFee = if ((feeAmount > 0)) | |
1310 | 1310 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1311 | 1311 | else nil | |
1312 | - | let $ | |
1312 | + | let $t05039650643 = { | |
1313 | 1313 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1314 | 1314 | then 0 | |
1315 | 1315 | else feeAmount | |
1317 | 1317 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1318 | 1318 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1319 | 1319 | } | |
1320 | - | let amountAssetBalanceDelta = $ | |
1321 | - | let priceAssetBalanceDelta = $ | |
1322 | - | let $ | |
1323 | - | let refreshKLpActions = $ | |
1324 | - | let updatedKLp = $ | |
1320 | + | let amountAssetBalanceDelta = $t05039650643._1 | |
1321 | + | let priceAssetBalanceDelta = $t05039650643._2 | |
1322 | + | let $t05064650754 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1323 | + | let refreshKLpActions = $t05064650754._1 | |
1324 | + | let updatedKLp = $t05064650754._2 | |
1325 | 1325 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1326 | 1326 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1327 | 1327 | then { | |
1345 | 1345 | ||
1346 | 1346 | @Callable(i) | |
1347 | 1347 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1348 | - | let $ | |
1349 | - | let amountEstimated = $ | |
1350 | - | let commonState = $ | |
1351 | - | let feeAmount = $ | |
1352 | - | let bonus = $ | |
1353 | - | let outInAmountAsset = $ | |
1348 | + | let $t05108151237 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1349 | + | let amountEstimated = $t05108151237._1 | |
1350 | + | let commonState = $t05108151237._2 | |
1351 | + | let feeAmount = $t05108151237._3 | |
1352 | + | let bonus = $t05108151237._4 | |
1353 | + | let outInAmountAsset = $t05108151237._5 | |
1354 | 1354 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1355 | 1355 | } | |
1356 | 1356 | ||
1387 | 1387 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1388 | 1388 | if ((unstakeInv == unstakeInv)) | |
1389 | 1389 | then { | |
1390 | - | let $ | |
1391 | - | if (($ | |
1390 | + | let $t05214252293 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1391 | + | if (($t05214252293 == $t05214252293)) | |
1392 | 1392 | then { | |
1393 | - | let outInAmountAsset = $ | |
1394 | - | let bonus = $ | |
1395 | - | let feeAmount = $ | |
1396 | - | let commonState = $ | |
1397 | - | let amountEstimated = $ | |
1393 | + | let outInAmountAsset = $t05214252293._5 | |
1394 | + | let bonus = $t05214252293._4 | |
1395 | + | let feeAmount = $t05214252293._3 | |
1396 | + | let commonState = $t05214252293._2 | |
1397 | + | let amountEstimated = $t05214252293._1 | |
1398 | 1398 | let amount = if (if ((minOutAmount > 0)) | |
1399 | 1399 | then (minOutAmount > amountEstimated) | |
1400 | 1400 | else false) | |
1407 | 1407 | let sendFee = if ((feeAmount > 0)) | |
1408 | 1408 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1409 | 1409 | else nil | |
1410 | - | let $ | |
1410 | + | let $t05278853035 = { | |
1411 | 1411 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1412 | 1412 | then 0 | |
1413 | 1413 | else feeAmount | |
1415 | 1415 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1416 | 1416 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1417 | 1417 | } | |
1418 | - | let amountAssetBalanceDelta = $ | |
1419 | - | let priceAssetBalanceDelta = $ | |
1420 | - | let $ | |
1421 | - | let refreshKLpActions = $ | |
1422 | - | let updatedKLp = $ | |
1418 | + | let amountAssetBalanceDelta = $t05278853035._1 | |
1419 | + | let priceAssetBalanceDelta = $t05278853035._2 | |
1420 | + | let $t05303853146 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1421 | + | let refreshKLpActions = $t05303853146._1 | |
1422 | + | let updatedKLp = $t05303853146._2 | |
1423 | 1423 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1424 | 1424 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1425 | 1425 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1452 | 1452 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1453 | 1453 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1454 | 1454 | then { | |
1455 | - | let $ | |
1456 | - | let refreshKLpActions = $ | |
1457 | - | let updatedKLp = $ | |
1455 | + | let $t05409254174 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1456 | + | let refreshKLpActions = $t05409254174._1 | |
1457 | + | let updatedKLp = $t05409254174._2 | |
1458 | 1458 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1459 | 1459 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1460 | 1460 | then (state ++ refreshKLpActions) | |
1486 | 1486 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1487 | 1487 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1488 | 1488 | then { | |
1489 | - | let $ | |
1490 | - | let refreshKLpActions = $ | |
1491 | - | let updatedKLp = $ | |
1489 | + | let $t05512355204 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1490 | + | let refreshKLpActions = $t05512355204._1 | |
1491 | + | let updatedKLp = $t05512355204._2 | |
1492 | 1492 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1493 | 1493 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1494 | 1494 | then (state ++ refreshKLpActions) | |
1532 | 1532 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1533 | 1533 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1534 | 1534 | then { | |
1535 | - | let $ | |
1536 | - | let refreshKLpActions = $ | |
1537 | - | let updatedKLp = $ | |
1535 | + | let $t05633056411 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1536 | + | let refreshKLpActions = $t05633056411._1 | |
1537 | + | let updatedKLp = $t05633056411._2 | |
1538 | 1538 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1539 | 1539 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1540 | 1540 | then (state ++ refreshKLpActions) | |
1585 | 1585 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1586 | 1586 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1587 | 1587 | then { | |
1588 | - | let $ | |
1589 | - | let refreshKLpActions = $ | |
1590 | - | let updatedKLp = $ | |
1588 | + | let $t05770657787 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1589 | + | let refreshKLpActions = $t05770657787._1 | |
1590 | + | let updatedKLp = $t05770657787._2 | |
1591 | 1591 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1592 | 1592 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1593 | 1593 | then (state ++ refreshKLpActions) | |
1622 | 1622 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1623 | 1623 | then { | |
1624 | 1624 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1625 | - | let $ | |
1626 | - | let kLpUpdateActions = $ | |
1627 | - | let updatedKLp = $ | |
1625 | + | let $t05897459038 = refreshKLpInternal(0, 0, 0) | |
1626 | + | let kLpUpdateActions = $t05897459038._1 | |
1627 | + | let updatedKLp = $t05897459038._2 | |
1628 | 1628 | let actions = if ((kLp != updatedKLp)) | |
1629 | 1629 | then kLpUpdateActions | |
1630 | 1630 | else throwErr("nothing to refresh") | |
1799 | 1799 | match tx { | |
1800 | 1800 | case order: Order => | |
1801 | 1801 | let matcherPub = getMatcherPubOrFail() | |
1802 | - | let $ | |
1803 | - | let orderValid = $ | |
1804 | - | let orderValidInfo = $ | |
1802 | + | let $t06770067769 = validateMatcherOrderAllowed(order) | |
1803 | + | let orderValid = $t06770067769._1 | |
1804 | + | let orderValidInfo = $t06770067769._2 | |
1805 | 1805 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1806 | 1806 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1807 | 1807 | 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 keySWavesAssetId () = "%s__sWavesAssetId" | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func keySWavesProxyAddress () = "%s__sWavesProxyAddress" | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func keyAdditionalBalance (assetId) = makeString(["%s%s", "additionalBalance", assetId], SEP) | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func keyStakingAssetBalance (assetId) = makeString(["%s%s", "stakingAssetBalance", assetId], SEP) | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func getAdditionalBalance (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0) | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func getStakingAssetBalance (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0) | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func keyFactoryConfig () = "%s__factoryConfig" | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func keyAllPoolsShutdown () = "%s__shutdown" | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
170 | 170 | ||
171 | 171 | ||
172 | 172 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
173 | 173 | ||
174 | 174 | ||
175 | 175 | let keyFeeCollectorAddress = "%s__feeCollectorAddress" | |
176 | 176 | ||
177 | 177 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
181 | 181 | ||
182 | 182 | ||
183 | 183 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func throwErr (msg) = throw(makeString(["lp.ride:", msg], " ")) | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func fmtErr (msg) = makeString(["lp.ride:", msg], " ") | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | let factoryContract = addressFromStringValue(getStringOrFail(this, fc())) | |
193 | 193 | ||
194 | 194 | let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress)) | |
195 | 195 | ||
196 | 196 | let inFee = { | |
197 | 197 | let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil) | |
198 | 198 | if ($isInstanceOf(@, "Int")) | |
199 | 199 | then @ | |
200 | 200 | else throw(($getType(@) + " couldn't be cast to Int")) | |
201 | 201 | } | |
202 | 202 | ||
203 | 203 | let outFee = { | |
204 | 204 | let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil) | |
205 | 205 | if ($isInstanceOf(@, "Int")) | |
206 | 206 | then @ | |
207 | 207 | else throw(($getType(@) + " couldn't be cast to Int")) | |
208 | 208 | } | |
209 | 209 | ||
210 | 210 | func sWavesId () = getStringOrFail(factoryContract, keySWavesAssetId()) | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func sWavesProxy () = getStringOrFail(factoryContract, keySWavesProxyAddress()) | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false) | |
217 | 217 | ||
218 | 218 | ||
219 | 219 | func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub())) | |
220 | 220 | ||
221 | 221 | ||
222 | 222 | func getPoolConfig () = { | |
223 | 223 | let amtAsset = getStringOrFail(this, aa()) | |
224 | 224 | let priceAsset = getStringOrFail(this, pa()) | |
225 | 225 | let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset)) | |
226 | 226 | let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset)) | |
227 | 227 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP) | |
228 | 228 | } | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | func parseAssetId (input) = if ((input == wavesString)) | |
232 | 232 | then unit | |
233 | 233 | else fromBase58String(input) | |
234 | 234 | ||
235 | 235 | ||
236 | 236 | func assetIdToString (input) = if ((input == unit)) | |
237 | 237 | then wavesString | |
238 | 238 | else toBase58String(value(input)) | |
239 | 239 | ||
240 | 240 | ||
241 | 241 | 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])) | |
242 | 242 | ||
243 | 243 | ||
244 | 244 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
245 | 245 | ||
246 | 246 | let $t092129378 = poolConfigParsed | |
247 | 247 | ||
248 | 248 | let cfgPoolAddress = $t092129378._1 | |
249 | 249 | ||
250 | 250 | let cfgPoolStatus = $t092129378._2 | |
251 | 251 | ||
252 | 252 | let cfgLpAssetId = $t092129378._3 | |
253 | 253 | ||
254 | 254 | let cfgAmountAssetId = $t092129378._4 | |
255 | 255 | ||
256 | 256 | let cfgPriceAssetId = $t092129378._5 | |
257 | 257 | ||
258 | 258 | let cfgAmountAssetDecimals = $t092129378._6 | |
259 | 259 | ||
260 | 260 | let cfgPriceAssetDecimals = $t092129378._7 | |
261 | 261 | ||
262 | 262 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address") | |
266 | 266 | ||
267 | 267 | let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address") | |
268 | 268 | ||
269 | 269 | 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) | |
270 | 270 | ||
271 | 271 | ||
272 | 272 | 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) | |
273 | 273 | ||
274 | 274 | ||
275 | 275 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
276 | 276 | then (wavesBalance(this).available + getAdditionalBalance(assetId)) | |
277 | 277 | else if ((assetId == sWavesId())) | |
278 | 278 | then { | |
279 | 279 | let amtAsset = getStringOrFail(this, aa()) | |
280 | 280 | let priceAsset = getStringOrFail(this, pa()) | |
281 | 281 | if (if (if ((amtAsset == "WAVES")) | |
282 | 282 | then (priceAsset == sWavesId()) | |
283 | 283 | else false) | |
284 | 284 | then true | |
285 | 285 | else if ((priceAsset == "WAVES")) | |
286 | 286 | then (amtAsset == sWavesId()) | |
287 | 287 | else false) | |
288 | 288 | then assetBalance(this, fromBase58String(assetId)) | |
289 | 289 | else (assetBalance(this, fromBase58String(assetId)) + getStakingAssetBalance(assetId)) | |
290 | 290 | } | |
291 | 291 | else assetBalance(this, fromBase58String(assetId)) | |
292 | 292 | ||
293 | 293 | ||
294 | 294 | func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
295 | 295 | ||
296 | 296 | ||
297 | 297 | func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
298 | 298 | ||
299 | 299 | ||
300 | 300 | func getRate (proxy) = { | |
301 | 301 | let inv = invoke(proxy, "getRate", nil, nil) | |
302 | 302 | if ((inv == inv)) | |
303 | 303 | then match inv { | |
304 | 304 | case r: Int => | |
305 | 305 | r | |
306 | 306 | case _ => | |
307 | 307 | throwErr("proxy.getRate() unexpected value") | |
308 | 308 | } | |
309 | 309 | else throw("Strict value is not equal to itself.") | |
310 | 310 | } | |
311 | 311 | ||
312 | 312 | ||
313 | 313 | func deposit (assetId,amount,stakingAssetId,proxy) = { | |
314 | 314 | let currentAdditionalBalance = getAdditionalBalance(assetId) | |
315 | 315 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
316 | 316 | then { | |
317 | 317 | let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId) | |
318 | 318 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
319 | 319 | then { | |
320 | 320 | let asset = parseAssetId(assetId) | |
321 | 321 | if ((amount > 0)) | |
322 | 322 | then { | |
323 | 323 | let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)]) | |
324 | 324 | if ((depositInvoke == depositInvoke)) | |
325 | 325 | then match depositInvoke { | |
326 | 326 | case receivedStakingAsset: Int => | |
327 | 327 | let newAdditionalBalance = (currentAdditionalBalance + amount) | |
328 | 328 | let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset) | |
329 | 329 | [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)] | |
330 | 330 | case _ => | |
331 | 331 | nil | |
332 | 332 | } | |
333 | 333 | else throw("Strict value is not equal to itself.") | |
334 | 334 | } | |
335 | 335 | else nil | |
336 | 336 | } | |
337 | 337 | else throw("Strict value is not equal to itself.") | |
338 | 338 | } | |
339 | 339 | else throw("Strict value is not equal to itself.") | |
340 | 340 | } | |
341 | 341 | ||
342 | 342 | ||
343 | 343 | func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul) = { | |
344 | 344 | let currentAdditionalBalance = getAdditionalBalance(assetId) | |
345 | 345 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
346 | 346 | then { | |
347 | 347 | let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId) | |
348 | 348 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
349 | 349 | then { | |
350 | 350 | let currentProxyRate = getRate(proxy) | |
351 | 351 | if ((currentProxyRate == currentProxyRate)) | |
352 | 352 | then { | |
353 | 353 | let stakingAsset = parseAssetId(stakingAssetId) | |
354 | 354 | let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate) | |
355 | 355 | if ((sendStakingAssetAmount > 0)) | |
356 | 356 | then { | |
357 | 357 | let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)]) | |
358 | 358 | if ((withdrawInvoke == withdrawInvoke)) | |
359 | 359 | then match withdrawInvoke { | |
360 | 360 | case receivedAssets: Int => | |
361 | 361 | let newAdditionalBalance = (currentAdditionalBalance - receivedAssets) | |
362 | 362 | let newStakingAssetBalance = (currentStakingAssetBalance - sendStakingAssetAmount) | |
363 | 363 | [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)] | |
364 | 364 | case _ => | |
365 | 365 | nil | |
366 | 366 | } | |
367 | 367 | else throw("Strict value is not equal to itself.") | |
368 | 368 | } | |
369 | 369 | else nil | |
370 | 370 | } | |
371 | 371 | else throw("Strict value is not equal to itself.") | |
372 | 372 | } | |
373 | 373 | else throw("Strict value is not equal to itself.") | |
374 | 374 | } | |
375 | 375 | else throw("Strict value is not equal to itself.") | |
376 | 376 | } | |
377 | 377 | ||
378 | 378 | ||
379 | 379 | func getLeaseProxyConfig (assetId) = invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) | |
380 | 380 | ||
381 | 381 | ||
382 | 382 | func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul) = { | |
383 | 383 | let currentAdditionalBalance = getAdditionalBalance(assetId) | |
384 | 384 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
385 | 385 | then { | |
386 | 386 | let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId) | |
387 | 387 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
388 | 388 | then { | |
389 | 389 | let availableBalance = match parseAssetId(assetId) { | |
390 | 390 | case b: ByteVector => | |
391 | 391 | assetBalance(this, b) | |
392 | 392 | case u: Unit => | |
393 | 393 | wavesBalance(this).available | |
394 | 394 | case _ => | |
395 | 395 | throw("Match error") | |
396 | 396 | } | |
397 | 397 | if ((availableBalance == availableBalance)) | |
398 | 398 | then { | |
399 | 399 | let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)]) | |
400 | 400 | let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100) | |
401 | 401 | let diff = (currentAdditionalBalance - targetAdditionalBalance) | |
402 | 402 | if ((diff == 0)) | |
403 | 403 | then nil | |
404 | 404 | else if ((0 > diff)) | |
405 | 405 | then { | |
406 | 406 | let sendAssetAmount = -(diff) | |
407 | 407 | deposit(assetId, sendAssetAmount, stakingAssetId, proxy) | |
408 | 408 | } | |
409 | 409 | else { | |
410 | 410 | let getAssetAmount = diff | |
411 | 411 | withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul) | |
412 | 412 | } | |
413 | 413 | } | |
414 | 414 | else throw("Strict value is not equal to itself.") | |
415 | 415 | } | |
416 | 416 | else throw("Strict value is not equal to itself.") | |
417 | 417 | } | |
418 | 418 | else throw("Strict value is not equal to itself.") | |
419 | 419 | } | |
420 | 420 | ||
421 | 421 | ||
422 | 422 | func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) { | |
423 | 423 | case a: (Boolean, Int, Int, String, String, Int, String) => | |
424 | 424 | let $t01551515624 = a | |
425 | 425 | let isLeasable = $t01551515624._1 | |
426 | 426 | let leasedRatio = $t01551515624._2 | |
427 | 427 | let minBalance = $t01551515624._3 | |
428 | 428 | let proxyAddress = $t01551515624._4 | |
429 | 429 | let proxyAssetId = $t01551515624._5 | |
430 | 430 | let proxyRateMul = $t01551515624._6 | |
431 | 431 | let stakingProfitAddress = $t01551515624._7 | |
432 | 432 | if (isLeasable) | |
433 | 433 | then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul) | |
434 | 434 | else nil | |
435 | 435 | case _ => | |
436 | 436 | throwErr((("[" + assetId) + "] Rebalance error")) | |
437 | 437 | } | |
438 | 438 | ||
439 | 439 | ||
440 | 440 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
441 | 441 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
442 | 442 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
443 | 443 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
444 | 444 | } | |
445 | 445 | ||
446 | 446 | ||
447 | 447 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
448 | 448 | let cfg = getPoolConfig() | |
449 | 449 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
450 | 450 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
451 | 451 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
452 | 452 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
453 | 453 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
454 | 454 | let lpAmtX18 = toX18(lpAmt, scale8) | |
455 | 455 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
456 | 456 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
457 | 457 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
458 | 458 | } | |
459 | 459 | ||
460 | 460 | ||
461 | 461 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
462 | 462 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
463 | 463 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
464 | 464 | } | |
465 | 465 | ||
466 | 466 | ||
467 | 467 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
468 | 468 | let cfg = getPoolConfig() | |
469 | 469 | let lpAssetId = cfg[idxPoolLPAssetId] | |
470 | 470 | let amAssetId = cfg[idxAmtAssetId] | |
471 | 471 | let prAssetId = cfg[idxPriceAssetId] | |
472 | 472 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
473 | 473 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
474 | 474 | let poolStatus = cfg[idxPoolStatus] | |
475 | 475 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
476 | 476 | if ((lpAssetId != pmtAssetId)) | |
477 | 477 | then throw("Invalid asset passed.") | |
478 | 478 | else { | |
479 | 479 | let amBalance = getAccBalance(amAssetId) | |
480 | 480 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
481 | 481 | let prBalance = getAccBalance(prAssetId) | |
482 | 482 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
483 | 483 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
484 | 484 | let curPrice = fromX18(curPriceX18, scale8) | |
485 | 485 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
486 | 486 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
487 | 487 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
488 | 488 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
489 | 489 | let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR) | |
490 | 490 | let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR) | |
491 | 491 | let state = if ((txId58 == "")) | |
492 | 492 | then nil | |
493 | 493 | else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
494 | 494 | then unit | |
495 | 495 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
496 | 496 | then unit | |
497 | 497 | 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)] | |
498 | 498 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
499 | 499 | } | |
500 | 500 | } | |
501 | 501 | ||
502 | 502 | ||
503 | 503 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
504 | 504 | let cfg = getPoolConfig() | |
505 | 505 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
506 | 506 | let amAssetIdStr = cfg[idxAmtAssetId] | |
507 | 507 | let prAssetIdStr = cfg[idxPriceAssetId] | |
508 | 508 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
509 | 509 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
510 | 510 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
511 | 511 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
512 | 512 | let poolStatus = cfg[idxPoolStatus] | |
513 | 513 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
514 | 514 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
515 | 515 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
516 | 516 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
517 | 517 | then true | |
518 | 518 | else (prAssetIdStr != inPrAssetIdStr)) | |
519 | 519 | then throw("Invalid amt or price asset passed.") | |
520 | 520 | else { | |
521 | 521 | let amBalance = if (isEvaluate) | |
522 | 522 | then getAccBalance(amAssetIdStr) | |
523 | 523 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
524 | 524 | let prBalance = if (isEvaluate) | |
525 | 525 | then getAccBalance(prAssetIdStr) | |
526 | 526 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
527 | 527 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
528 | 528 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
529 | 529 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
530 | 530 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
531 | 531 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
532 | 532 | let res = if ((lpEmission == 0)) | |
533 | 533 | then { | |
534 | 534 | let curPriceX18 = zeroBigInt | |
535 | 535 | let slippageX18 = zeroBigInt | |
536 | 536 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
537 | 537 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
538 | 538 | } | |
539 | 539 | else { | |
540 | 540 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
541 | 541 | let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
542 | 542 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
543 | 543 | if (if ((curPriceX18 != zeroBigInt)) | |
544 | 544 | then (slippageX18 > slippageToleranceX18) | |
545 | 545 | else false) | |
546 | 546 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
547 | 547 | else { | |
548 | 548 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
549 | 549 | let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
550 | 550 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
551 | 551 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
552 | 552 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
553 | 553 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
554 | 554 | let expAmtAssetAmtX18 = expectedAmts._1 | |
555 | 555 | let expPriceAssetAmtX18 = expectedAmts._2 | |
556 | 556 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR) | |
557 | 557 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18) | |
558 | 558 | } | |
559 | 559 | } | |
560 | 560 | let calcLpAmt = res._1 | |
561 | 561 | let calcAmAssetPmt = res._2 | |
562 | 562 | let calcPrAssetPmt = res._3 | |
563 | 563 | let curPrice = fromX18(res._4, scale8) | |
564 | 564 | let slippageCalc = fromX18(res._5, scale8) | |
565 | 565 | if ((0 >= calcLpAmt)) | |
566 | 566 | then throw("Invalid calculations. LP calculated is less than zero.") | |
567 | 567 | else { | |
568 | 568 | let emitLpAmt = if (!(emitLp)) | |
569 | 569 | then 0 | |
570 | 570 | else calcLpAmt | |
571 | 571 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
572 | 572 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
573 | 573 | 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))] | |
574 | 574 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
575 | 575 | } | |
576 | 576 | } | |
577 | 577 | } | |
578 | 578 | ||
579 | 579 | ||
580 | 580 | func calcKLp (amountBalance,priceBalance,lpEmission) = { | |
581 | 581 | let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)) | |
582 | 582 | let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals)) | |
583 | 583 | let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
584 | 584 | if ((lpEmission == big0)) | |
585 | 585 | then big0 | |
586 | 586 | else updatedKLp | |
587 | 587 | } | |
588 | 588 | ||
589 | 589 | ||
590 | 590 | func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
591 | 591 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
592 | 592 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
593 | 593 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
594 | 594 | let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
595 | 595 | currentKLp | |
596 | 596 | } | |
597 | 597 | ||
598 | 598 | ||
599 | 599 | func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
600 | 600 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
601 | 601 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
602 | 602 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
603 | 603 | let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
604 | 604 | let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))] | |
605 | 605 | $Tuple2(actions, updatedKLp) | |
606 | 606 | } | |
607 | 607 | ||
608 | 608 | ||
609 | 609 | func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp)) | |
610 | 610 | then true | |
611 | 611 | else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " ")) | |
612 | 612 | ||
613 | 613 | ||
614 | 614 | func validateMatcherOrderAllowed (order) = { | |
615 | 615 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
616 | 616 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
617 | 617 | let amountAssetAmount = order.amount | |
618 | 618 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
619 | 619 | let $t02714527357 = if ((order.orderType == Buy)) | |
620 | 620 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
621 | 621 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
622 | 622 | let amountAssetBalanceDelta = $t02714527357._1 | |
623 | 623 | let priceAssetBalanceDelta = $t02714527357._2 | |
624 | 624 | if (if (if (isGlobalShutdown()) | |
625 | 625 | then true | |
626 | 626 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
627 | 627 | then true | |
628 | 628 | else (cfgPoolStatus == PoolShutdown)) | |
629 | 629 | then throw("Exchange operations disabled") | |
630 | 630 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
631 | 631 | then true | |
632 | 632 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
633 | 633 | then throw("Wrong order assets.") | |
634 | 634 | else { | |
635 | 635 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
636 | 636 | let $t02779727897 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
637 | 637 | let unusedActions = $t02779727897._1 | |
638 | 638 | let kLpNew = $t02779727897._2 | |
639 | 639 | let isOrderValid = (kLpNew >= kLp) | |
640 | 640 | let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
641 | 641 | $Tuple2(isOrderValid, info) | |
642 | 642 | } | |
643 | 643 | } | |
644 | 644 | ||
645 | 645 | ||
646 | 646 | func commonGet (i) = if ((size(i.payments) != 1)) | |
647 | 647 | then throw("exactly 1 payment is expected") | |
648 | 648 | else { | |
649 | 649 | let pmt = value(i.payments[0]) | |
650 | 650 | let pmtAssetId = value(pmt.assetId) | |
651 | 651 | let pmtAmt = pmt.amount | |
652 | 652 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
653 | 653 | let outAmAmt = res._1 | |
654 | 654 | let outPrAmt = res._2 | |
655 | 655 | let poolStatus = parseIntValue(res._9) | |
656 | 656 | let state = res._10 | |
657 | 657 | if (if (isGlobalShutdown()) | |
658 | 658 | then true | |
659 | 659 | else (poolStatus == PoolShutdown)) | |
660 | 660 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
661 | 661 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
662 | 662 | } | |
663 | 663 | ||
664 | 664 | ||
665 | 665 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
666 | 666 | then throw("exactly 2 payments are expected") | |
667 | 667 | else { | |
668 | 668 | let amAssetPmt = value(i.payments[0]) | |
669 | 669 | let prAssetPmt = value(i.payments[1]) | |
670 | 670 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
671 | 671 | let poolStatus = parseIntValue(estPut._8) | |
672 | 672 | if (if (if (isGlobalShutdown()) | |
673 | 673 | then true | |
674 | 674 | else (poolStatus == PoolPutDisabled)) | |
675 | 675 | then true | |
676 | 676 | else (poolStatus == PoolShutdown)) | |
677 | 677 | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
678 | 678 | else estPut | |
679 | 679 | } | |
680 | 680 | ||
681 | 681 | ||
682 | 682 | func emit (amount) = { | |
683 | 683 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
684 | 684 | if ((emitInv == emitInv)) | |
685 | 685 | then { | |
686 | 686 | let emitInvLegacy = match emitInv { | |
687 | 687 | case legacyFactoryContract: Address => | |
688 | 688 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
689 | 689 | case _ => | |
690 | 690 | unit | |
691 | 691 | } | |
692 | 692 | if ((emitInvLegacy == emitInvLegacy)) | |
693 | 693 | then amount | |
694 | 694 | else throw("Strict value is not equal to itself.") | |
695 | 695 | } | |
696 | 696 | else throw("Strict value is not equal to itself.") | |
697 | 697 | } | |
698 | 698 | ||
699 | 699 | ||
700 | 700 | func takeFee (amount,fee) = { | |
701 | 701 | let feeAmount = if ((fee == 0)) | |
702 | 702 | then 0 | |
703 | 703 | else fraction(amount, fee, scale8) | |
704 | 704 | $Tuple2((amount - feeAmount), feeAmount) | |
705 | 705 | } | |
706 | 706 | ||
707 | 707 | ||
708 | 708 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
709 | 709 | let isEval = (txId == unit) | |
710 | 710 | let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
711 | 711 | let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
712 | 712 | let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId)) | |
713 | 713 | then true | |
714 | 714 | else if ((paymentAssetId == cfgPriceAssetId)) | |
715 | 715 | then false | |
716 | 716 | else throwErr("invalid asset") | |
717 | 717 | let $t03101031303 = if (isEval) | |
718 | 718 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
719 | 719 | else if (paymentInAmountAsset) | |
720 | 720 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
721 | 721 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
722 | 722 | let amountBalanceOld = $t03101031303._1 | |
723 | 723 | let priceBalanceOld = $t03101031303._2 | |
724 | 724 | let $t03130731456 = if (paymentInAmountAsset) | |
725 | 725 | then $Tuple2(paymentAmountRaw, 0) | |
726 | 726 | else $Tuple2(0, paymentAmountRaw) | |
727 | 727 | let amountAssetAmountRaw = $t03130731456._1 | |
728 | 728 | let priceAssetAmountRaw = $t03130731456._2 | |
729 | 729 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
730 | 730 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
731 | 731 | let $t03158831652 = takeFee(paymentAmountRaw, inFee) | |
732 | 732 | let paymentAmount = $t03158831652._1 | |
733 | 733 | let feeAmount = $t03158831652._2 | |
734 | 734 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
735 | 735 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
736 | 736 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
737 | 737 | let priceNew = fromX18(priceNewX18, scale8) | |
738 | 738 | let paymentBalance = if (paymentInAmountAsset) | |
739 | 739 | then amountBalanceOld | |
740 | 740 | else priceBalanceOld | |
741 | 741 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
742 | 742 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
743 | 743 | let chechSupply = if ((supplyBigInt > big0)) | |
744 | 744 | then true | |
745 | 745 | else throwErr("initial deposit requires all coins") | |
746 | 746 | if ((chechSupply == chechSupply)) | |
747 | 747 | then { | |
748 | 748 | let depositBigInt = toBigInt(paymentAmount) | |
749 | 749 | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
750 | 750 | let commonState = if (isEval) | |
751 | 751 | then nil | |
752 | 752 | 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))] | |
753 | 753 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
754 | 754 | let priceOld = fromX18(priceOldX18, scale8) | |
755 | 755 | let loss = { | |
756 | 756 | let $t03333333500 = if (paymentInAmountAsset) | |
757 | 757 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
758 | 758 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
759 | 759 | let amount = $t03333333500._1 | |
760 | 760 | let balance = $t03333333500._2 | |
761 | 761 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
762 | 762 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
763 | 763 | } | |
764 | 764 | $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset) | |
765 | 765 | } | |
766 | 766 | else throw("Strict value is not equal to itself.") | |
767 | 767 | } | |
768 | 768 | ||
769 | 769 | ||
770 | 770 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
771 | 771 | let isEval = (txId == unit) | |
772 | 772 | let cfg = getPoolConfig() | |
773 | 773 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
774 | 774 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
775 | 775 | let checks = [if ((paymentAssetId == cfgLpAssetId)) | |
776 | 776 | then true | |
777 | 777 | else throwErr("invalid lp asset")] | |
778 | 778 | if ((checks == checks)) | |
779 | 779 | then { | |
780 | 780 | let outInAmountAsset = if ((outAssetId == cfgAmountAssetId)) | |
781 | 781 | then true | |
782 | 782 | else if ((outAssetId == cfgPriceAssetId)) | |
783 | 783 | then false | |
784 | 784 | else throwErr("invalid asset") | |
785 | 785 | let balanceBigInt = if (outInAmountAsset) | |
786 | 786 | then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) | |
787 | 787 | else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) | |
788 | 788 | let outInAmountAssetDecimals = if (outInAmountAsset) | |
789 | 789 | then amtAssetDcm | |
790 | 790 | else priceAssetDcm | |
791 | 791 | let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
792 | 792 | let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
793 | 793 | let outBalance = if (outInAmountAsset) | |
794 | 794 | then amBalanceOld | |
795 | 795 | else prBalanceOld | |
796 | 796 | let outBalanceBigInt = toBigInt(outBalance) | |
797 | 797 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
798 | 798 | let redeemedBigInt = toBigInt(paymentAmount) | |
799 | 799 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
800 | 800 | let $t03557835634 = takeFee(amountRaw, outFee) | |
801 | 801 | let totalAmount = $t03557835634._1 | |
802 | 802 | let feeAmount = $t03557835634._2 | |
803 | 803 | let $t03563835864 = if (outInAmountAsset) | |
804 | 804 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
805 | 805 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
806 | 806 | let outAmAmount = $t03563835864._1 | |
807 | 807 | let outPrAmount = $t03563835864._2 | |
808 | 808 | let amBalanceNew = $t03563835864._3 | |
809 | 809 | let prBalanceNew = $t03563835864._4 | |
810 | 810 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
811 | 811 | let priceNew = fromX18(priceNewX18, scale8) | |
812 | 812 | let commonState = if (isEval) | |
813 | 813 | then nil | |
814 | 814 | 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)] | |
815 | 815 | let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals)) | |
816 | 816 | let priceOld = fromX18(priceOldX18, scale8) | |
817 | 817 | let loss = { | |
818 | 818 | let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2) | |
819 | 819 | fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset) | |
820 | 820 | } | |
821 | 821 | $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset) | |
822 | 822 | } | |
823 | 823 | else throw("Strict value is not equal to itself.") | |
824 | 824 | } | |
825 | 825 | ||
826 | 826 | ||
827 | 827 | func managerPublicKeyOrUnit () = match getString(mpk()) { | |
828 | 828 | case s: String => | |
829 | 829 | fromBase58String(s) | |
830 | 830 | case _: Unit => | |
831 | 831 | unit | |
832 | 832 | case _ => | |
833 | 833 | throw("Match error") | |
834 | 834 | } | |
835 | 835 | ||
836 | 836 | ||
837 | 837 | func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) { | |
838 | 838 | case s: String => | |
839 | 839 | fromBase58String(s) | |
840 | 840 | case _: Unit => | |
841 | 841 | unit | |
842 | 842 | case _ => | |
843 | 843 | throw("Match error") | |
844 | 844 | } | |
845 | 845 | ||
846 | 846 | ||
847 | 847 | func isManager (i) = match managerPublicKeyOrUnit() { | |
848 | 848 | case pk: ByteVector => | |
849 | 849 | (i.callerPublicKey == pk) | |
850 | 850 | case _: Unit => | |
851 | 851 | (i.caller == this) | |
852 | 852 | case _ => | |
853 | 853 | throw("Match error") | |
854 | 854 | } | |
855 | 855 | ||
856 | 856 | ||
857 | 857 | func mustManager (i) = { | |
858 | 858 | let pd = throw("Permission denied") | |
859 | 859 | match managerPublicKeyOrUnit() { | |
860 | 860 | case pk: ByteVector => | |
861 | 861 | if ((i.callerPublicKey == pk)) | |
862 | 862 | then true | |
863 | 863 | else pd | |
864 | 864 | case _: Unit => | |
865 | 865 | if ((i.caller == this)) | |
866 | 866 | then true | |
867 | 867 | else pd | |
868 | 868 | case _ => | |
869 | 869 | throw("Match error") | |
870 | 870 | } | |
871 | 871 | } | |
872 | 872 | ||
873 | 873 | ||
874 | 874 | @Callable(i) | |
875 | - | func rebalance () = (rebalanceAsset(aa()) ++ rebalanceAsset(pa())) | |
875 | + | func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa()))) | |
876 | 876 | ||
877 | 877 | ||
878 | 878 | ||
879 | 879 | @Callable(i) | |
880 | 880 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
881 | - | let $ | |
881 | + | let $t03775038055 = if ((isReverse == false)) | |
882 | 882 | then { | |
883 | 883 | let assetOut = getStringOrFail(this, pa()) | |
884 | 884 | let assetIn = getStringOrFail(this, aa()) | |
885 | 885 | $Tuple2(assetOut, assetIn) | |
886 | 886 | } | |
887 | 887 | else { | |
888 | 888 | let assetOut = getStringOrFail(this, aa()) | |
889 | 889 | let assetIn = getStringOrFail(this, pa()) | |
890 | 890 | $Tuple2(assetOut, assetIn) | |
891 | 891 | } | |
892 | - | let assetOut = $ | |
893 | - | let assetIn = $ | |
892 | + | let assetOut = $t03775038055._1 | |
893 | + | let assetIn = $t03775038055._2 | |
894 | 894 | let poolAssetInBalance = getAccBalance(assetIn) | |
895 | 895 | let poolAssetOutBalance = getAccBalance(assetOut) | |
896 | 896 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
897 | 897 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
898 | 898 | let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
899 | 899 | let checkK = if ((newK >= oldK)) | |
900 | 900 | then true | |
901 | 901 | else throw("new K is fewer error") | |
902 | 902 | if ((checkK == checkK)) | |
903 | 903 | then $Tuple2(nil, amountOut) | |
904 | 904 | else throw("Strict value is not equal to itself.") | |
905 | 905 | } | |
906 | 906 | ||
907 | 907 | ||
908 | 908 | ||
909 | 909 | @Callable(i) | |
910 | 910 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
911 | 911 | let swapContact = { | |
912 | 912 | let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil) | |
913 | 913 | if ($isInstanceOf(@, "String")) | |
914 | 914 | then @ | |
915 | 915 | else throw(($getType(@) + " couldn't be cast to String")) | |
916 | 916 | } | |
917 | 917 | let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
918 | 918 | then true | |
919 | 919 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
920 | 920 | then true | |
921 | 921 | else throwErr("Permission denied")] | |
922 | 922 | if ((checks == checks)) | |
923 | 923 | then { | |
924 | 924 | let pmt = value(i.payments[0]) | |
925 | 925 | let assetIn = assetIdToString(pmt.assetId) | |
926 | 926 | let assetOut = if ((isReverse == false)) | |
927 | 927 | then getStringOrFail(this, pa()) | |
928 | 928 | else getStringOrFail(this, aa()) | |
929 | 929 | let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
930 | 930 | let poolAssetOutBalance = getAccBalance(assetOut) | |
931 | 931 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
932 | 932 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
933 | 933 | let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
934 | 934 | let checkK = if ((newK >= oldK)) | |
935 | 935 | then true | |
936 | 936 | else throw("new K is fewer error") | |
937 | 937 | if ((checkK == checkK)) | |
938 | 938 | then { | |
939 | 939 | let checkMin = if ((amountOut >= amountOutMin)) | |
940 | 940 | then true | |
941 | 941 | else throw("Exchange result is fewer coins than expected") | |
942 | 942 | if ((checkMin == checkMin)) | |
943 | 943 | then { | |
944 | 944 | let lsConf = match getLeaseProxyConfig(assetOut) { | |
945 | 945 | case a: (Boolean, Int, Int, String, String, Int, String) => | |
946 | 946 | a | |
947 | 947 | case _ => | |
948 | 948 | throw("error lease config") | |
949 | 949 | } | |
950 | - | let $ | |
951 | - | let isLeasable = $ | |
952 | - | let leasedRatio = $ | |
953 | - | let minBalance = $ | |
954 | - | let proxyAddress = $ | |
955 | - | let proxyAssetId = $ | |
956 | - | let proxyRateMul = $ | |
957 | - | let stakingProfitAddress = $ | |
950 | + | let $t04006140175 = lsConf | |
951 | + | let isLeasable = $t04006140175._1 | |
952 | + | let leasedRatio = $t04006140175._2 | |
953 | + | let minBalance = $t04006140175._3 | |
954 | + | let proxyAddress = $t04006140175._4 | |
955 | + | let proxyAssetId = $t04006140175._5 | |
956 | + | let proxyRateMul = $t04006140175._6 | |
957 | + | let stakingProfitAddress = $t04006140175._7 | |
958 | 958 | let assetOnPool = assetBalance(this, fromBase58String(assetOut)) | |
959 | 959 | let amountOfProfit = if (if ((assetOut == "WAVES")) | |
960 | 960 | then (amountOut > assetOnPool) | |
961 | 961 | else false) | |
962 | 962 | then { | |
963 | 963 | let amountDiff = (amountOut - assetOnPool) | |
964 | 964 | let oldRatio = (getAdditionalBalance(assetOut) / getStakingAssetBalance(sWavesId())) | |
965 | 965 | let oldWavesRoughBalane = wavesBalance(this).available | |
966 | 966 | let wd = invoke(this, "withdraw", [assetOut, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil) | |
967 | 967 | if ((wd == wd)) | |
968 | 968 | then { | |
969 | 969 | let newWavesRoughBalane = wavesBalance(this).available | |
970 | 970 | let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane) | |
971 | 971 | (wavesDiff - amountDiff) | |
972 | 972 | } | |
973 | 973 | else throw("Strict value is not equal to itself.") | |
974 | 974 | } | |
975 | 975 | else 0 | |
976 | 976 | let reb = invoke(this, "rebalance", nil, nil) | |
977 | 977 | if ((reb == reb)) | |
978 | 978 | then $Tuple2([ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit), ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut) | |
979 | 979 | else throw("Strict value is not equal to itself.") | |
980 | 980 | } | |
981 | 981 | else throw("Strict value is not equal to itself.") | |
982 | 982 | } | |
983 | 983 | else throw("Strict value is not equal to itself.") | |
984 | 984 | } | |
985 | 985 | else throw("Strict value is not equal to itself.") | |
986 | 986 | } | |
987 | 987 | ||
988 | 988 | ||
989 | 989 | ||
990 | 990 | @Callable(i) | |
991 | 991 | func setManager (pendingManagerPublicKey) = { | |
992 | 992 | let checkCaller = mustManager(i) | |
993 | 993 | if ((checkCaller == checkCaller)) | |
994 | 994 | then { | |
995 | 995 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
996 | 996 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
997 | 997 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
998 | 998 | else throw("Strict value is not equal to itself.") | |
999 | 999 | } | |
1000 | 1000 | else throw("Strict value is not equal to itself.") | |
1001 | 1001 | } | |
1002 | 1002 | ||
1003 | 1003 | ||
1004 | 1004 | ||
1005 | 1005 | @Callable(i) | |
1006 | 1006 | func confirmManager () = { | |
1007 | 1007 | let pm = pendingManagerPublicKeyOrUnit() | |
1008 | 1008 | let hasPM = if (isDefined(pm)) | |
1009 | 1009 | then true | |
1010 | 1010 | else throw("No pending manager") | |
1011 | 1011 | if ((hasPM == hasPM)) | |
1012 | 1012 | then { | |
1013 | 1013 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
1014 | 1014 | then true | |
1015 | 1015 | else throw("You are not pending manager") | |
1016 | 1016 | if ((checkPM == checkPM)) | |
1017 | 1017 | then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())] | |
1018 | 1018 | else throw("Strict value is not equal to itself.") | |
1019 | 1019 | } | |
1020 | 1020 | else throw("Strict value is not equal to itself.") | |
1021 | 1021 | } | |
1022 | 1022 | ||
1023 | 1023 | ||
1024 | 1024 | ||
1025 | 1025 | @Callable(i) | |
1026 | 1026 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
1027 | 1027 | then throw("Invalid slippageTolerance passed") | |
1028 | 1028 | else { | |
1029 | 1029 | let estPut = commonPut(i, slippageTolerance, true) | |
1030 | 1030 | let emitLpAmt = estPut._2 | |
1031 | 1031 | let lpAssetId = estPut._7 | |
1032 | 1032 | let state = estPut._9 | |
1033 | 1033 | let amDiff = estPut._10 | |
1034 | 1034 | let prDiff = estPut._11 | |
1035 | 1035 | let amId = estPut._12 | |
1036 | 1036 | let prId = estPut._13 | |
1037 | 1037 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1038 | 1038 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1039 | 1039 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1040 | 1040 | if ((currentKLp == currentKLp)) | |
1041 | 1041 | then { | |
1042 | 1042 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
1043 | 1043 | if ((emitInv == emitInv)) | |
1044 | 1044 | then { | |
1045 | 1045 | let emitInvLegacy = match emitInv { | |
1046 | 1046 | case legacyFactoryContract: Address => | |
1047 | 1047 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
1048 | 1048 | case _ => | |
1049 | 1049 | unit | |
1050 | 1050 | } | |
1051 | 1051 | if ((emitInvLegacy == emitInvLegacy)) | |
1052 | 1052 | then { | |
1053 | 1053 | let slippageAInv = if ((amDiff > 0)) | |
1054 | 1054 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1055 | 1055 | else nil | |
1056 | 1056 | if ((slippageAInv == slippageAInv)) | |
1057 | 1057 | then { | |
1058 | 1058 | let slippagePInv = if ((prDiff > 0)) | |
1059 | 1059 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1060 | 1060 | else nil | |
1061 | 1061 | if ((slippagePInv == slippagePInv)) | |
1062 | 1062 | then { | |
1063 | 1063 | let lpTransfer = if (shouldAutoStake) | |
1064 | 1064 | then { | |
1065 | 1065 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1066 | 1066 | if ((slpStakeInv == slpStakeInv)) | |
1067 | 1067 | then nil | |
1068 | 1068 | else throw("Strict value is not equal to itself.") | |
1069 | 1069 | } | |
1070 | 1070 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1071 | - | let $ | |
1072 | - | if (($ | |
1071 | + | let $t04398644448 = refreshKLpInternal(0, 0, 0) | |
1072 | + | if (($t04398644448 == $t04398644448)) | |
1073 | 1073 | then { | |
1074 | - | let updatedKLp = $ | |
1075 | - | let refreshKLpActions = $ | |
1074 | + | let updatedKLp = $t04398644448._2 | |
1075 | + | let refreshKLpActions = $t04398644448._1 | |
1076 | 1076 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1077 | 1077 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1078 | 1078 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
1079 | 1079 | else throw("Strict value is not equal to itself.") | |
1080 | 1080 | } | |
1081 | 1081 | else throw("Strict value is not equal to itself.") | |
1082 | 1082 | } | |
1083 | 1083 | else throw("Strict value is not equal to itself.") | |
1084 | 1084 | } | |
1085 | 1085 | else throw("Strict value is not equal to itself.") | |
1086 | 1086 | } | |
1087 | 1087 | else throw("Strict value is not equal to itself.") | |
1088 | 1088 | } | |
1089 | 1089 | else throw("Strict value is not equal to itself.") | |
1090 | 1090 | } | |
1091 | 1091 | else throw("Strict value is not equal to itself.") | |
1092 | 1092 | } | |
1093 | 1093 | ||
1094 | 1094 | ||
1095 | 1095 | ||
1096 | 1096 | @Callable(i) | |
1097 | 1097 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
1098 | 1098 | then throw("Invalid value passed") | |
1099 | 1099 | else { | |
1100 | 1100 | let estPut = commonPut(i, maxSlippage, false) | |
1101 | 1101 | let state = estPut._9 | |
1102 | 1102 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1103 | 1103 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1104 | 1104 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1105 | 1105 | if ((currentKLp == currentKLp)) | |
1106 | 1106 | then { | |
1107 | - | let $ | |
1108 | - | let refreshKLpActions = $ | |
1109 | - | let updatedKLp = $ | |
1107 | + | let $t04501045075 = refreshKLpInternal(0, 0, 0) | |
1108 | + | let refreshKLpActions = $t04501045075._1 | |
1109 | + | let updatedKLp = $t04501045075._2 | |
1110 | 1110 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1111 | 1111 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1112 | 1112 | then (state ++ refreshKLpActions) | |
1113 | 1113 | else throw("Strict value is not equal to itself.") | |
1114 | 1114 | } | |
1115 | 1115 | else throw("Strict value is not equal to itself.") | |
1116 | 1116 | } | |
1117 | 1117 | ||
1118 | 1118 | ||
1119 | 1119 | ||
1120 | 1120 | @Callable(i) | |
1121 | 1121 | func putOneTkn (minOutAmount,autoStake) = { | |
1122 | 1122 | let isPoolOneTokenOperationsDisabled = { | |
1123 | 1123 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1124 | 1124 | if ($isInstanceOf(@, "Boolean")) | |
1125 | 1125 | then @ | |
1126 | 1126 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1127 | 1127 | } | |
1128 | 1128 | let isPutDisabled = if (if (if (isGlobalShutdown()) | |
1129 | 1129 | then true | |
1130 | 1130 | else (cfgPoolStatus == PoolPutDisabled)) | |
1131 | 1131 | then true | |
1132 | 1132 | else (cfgPoolStatus == PoolShutdown)) | |
1133 | 1133 | then true | |
1134 | 1134 | else isPoolOneTokenOperationsDisabled | |
1135 | 1135 | let checks = [if (if (!(isPutDisabled)) | |
1136 | 1136 | then true | |
1137 | 1137 | else isManager(i)) | |
1138 | 1138 | then true | |
1139 | 1139 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1140 | 1140 | then true | |
1141 | 1141 | else throwErr("exactly 1 payment are expected")] | |
1142 | 1142 | if ((checks == checks)) | |
1143 | 1143 | then { | |
1144 | 1144 | let payment = i.payments[0] | |
1145 | 1145 | let paymentAssetId = payment.assetId | |
1146 | 1146 | let paymentAmountRaw = payment.amount | |
1147 | 1147 | let currentKLp = if ((paymentAssetId == cfgAmountAssetId)) | |
1148 | 1148 | then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0)) | |
1149 | 1149 | else if ((paymentAssetId == cfgPriceAssetId)) | |
1150 | 1150 | then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0)) | |
1151 | 1151 | else throwErr("payment asset is not supported") | |
1152 | 1152 | if ((currentKLp == currentKLp)) | |
1153 | 1153 | then { | |
1154 | 1154 | let userAddress = i.caller | |
1155 | 1155 | let txId = i.transactionId | |
1156 | - | let $ | |
1157 | - | if (($ | |
1156 | + | let $t04626346415 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
1157 | + | if (($t04626346415 == $t04626346415)) | |
1158 | 1158 | then { | |
1159 | - | let paymentInAmountAsset = $ | |
1160 | - | let bonus = $ | |
1161 | - | let feeAmount = $ | |
1162 | - | let commonState = $ | |
1163 | - | let emitAmountEstimated = $ | |
1159 | + | let paymentInAmountAsset = $t04626346415._5 | |
1160 | + | let bonus = $t04626346415._4 | |
1161 | + | let feeAmount = $t04626346415._3 | |
1162 | + | let commonState = $t04626346415._2 | |
1163 | + | let emitAmountEstimated = $t04626346415._1 | |
1164 | 1164 | let emitAmount = if (if ((minOutAmount > 0)) | |
1165 | 1165 | then (minOutAmount > emitAmountEstimated) | |
1166 | 1166 | else false) | |
1167 | 1167 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1168 | 1168 | else emitAmountEstimated | |
1169 | 1169 | let emitInv = emit(emitAmount) | |
1170 | 1170 | if ((emitInv == emitInv)) | |
1171 | 1171 | then { | |
1172 | 1172 | let lpTransfer = if (autoStake) | |
1173 | 1173 | then { | |
1174 | 1174 | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
1175 | 1175 | if ((stakeInv == stakeInv)) | |
1176 | 1176 | then nil | |
1177 | 1177 | else throw("Strict value is not equal to itself.") | |
1178 | 1178 | } | |
1179 | 1179 | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
1180 | 1180 | let sendFee = if ((feeAmount > 0)) | |
1181 | 1181 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
1182 | 1182 | else nil | |
1183 | - | let $ | |
1183 | + | let $t04700147198 = if ((this == feeCollectorAddress)) | |
1184 | 1184 | then $Tuple2(0, 0) | |
1185 | 1185 | else if (paymentInAmountAsset) | |
1186 | 1186 | then $Tuple2(-(feeAmount), 0) | |
1187 | 1187 | else $Tuple2(0, -(feeAmount)) | |
1188 | - | let amountAssetBalanceDelta = $ | |
1189 | - | let priceAssetBalanceDelta = $ | |
1190 | - | let $ | |
1191 | - | let refreshKLpActions = $ | |
1192 | - | let updatedKLp = $ | |
1188 | + | let amountAssetBalanceDelta = $t04700147198._1 | |
1189 | + | let priceAssetBalanceDelta = $t04700147198._2 | |
1190 | + | let $t04720147309 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1191 | + | let refreshKLpActions = $t04720147309._1 | |
1192 | + | let updatedKLp = $t04720147309._2 | |
1193 | 1193 | let kLp = value(getString(keyKLp)) | |
1194 | 1194 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1195 | 1195 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1196 | 1196 | then { | |
1197 | 1197 | let reb = invoke(this, "rebalance", nil, nil) | |
1198 | 1198 | if ((reb == reb)) | |
1199 | 1199 | then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount) | |
1200 | 1200 | else throw("Strict value is not equal to itself.") | |
1201 | 1201 | } | |
1202 | 1202 | else throw("Strict value is not equal to itself.") | |
1203 | 1203 | } | |
1204 | 1204 | else throw("Strict value is not equal to itself.") | |
1205 | 1205 | } | |
1206 | 1206 | else throw("Strict value is not equal to itself.") | |
1207 | 1207 | } | |
1208 | 1208 | else throw("Strict value is not equal to itself.") | |
1209 | 1209 | } | |
1210 | 1210 | else throw("Strict value is not equal to itself.") | |
1211 | 1211 | } | |
1212 | 1212 | ||
1213 | 1213 | ||
1214 | 1214 | ||
1215 | 1215 | @Callable(i) | |
1216 | 1216 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
1217 | - | let $ | |
1218 | - | let emitAmountEstimated = $ | |
1219 | - | let commonState = $ | |
1220 | - | let feeAmount = $ | |
1221 | - | let bonus = $ | |
1222 | - | let paymentInAmountAsset = $ | |
1217 | + | let $t04766447821 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
1218 | + | let emitAmountEstimated = $t04766447821._1 | |
1219 | + | let commonState = $t04766447821._2 | |
1220 | + | let feeAmount = $t04766447821._3 | |
1221 | + | let bonus = $t04766447821._4 | |
1222 | + | let paymentInAmountAsset = $t04766447821._5 | |
1223 | 1223 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1224 | 1224 | } | |
1225 | 1225 | ||
1226 | 1226 | ||
1227 | 1227 | ||
1228 | 1228 | @Callable(i) | |
1229 | 1229 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
1230 | 1230 | let isPoolOneTokenOperationsDisabled = { | |
1231 | 1231 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1232 | 1232 | if ($isInstanceOf(@, "Boolean")) | |
1233 | 1233 | then @ | |
1234 | 1234 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1235 | 1235 | } | |
1236 | 1236 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1237 | 1237 | then true | |
1238 | 1238 | else (cfgPoolStatus == PoolShutdown)) | |
1239 | 1239 | then true | |
1240 | 1240 | else isPoolOneTokenOperationsDisabled | |
1241 | 1241 | let checks = [if (if (!(isGetDisabled)) | |
1242 | 1242 | then true | |
1243 | 1243 | else isManager(i)) | |
1244 | 1244 | then true | |
1245 | 1245 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1246 | 1246 | then true | |
1247 | 1247 | else throwErr("exactly 1 payment are expected")] | |
1248 | 1248 | if ((checks == checks)) | |
1249 | 1249 | then { | |
1250 | 1250 | let outAssetId = parseAssetId(outAssetIdStr) | |
1251 | 1251 | let payment = i.payments[0] | |
1252 | 1252 | let paymentAssetId = payment.assetId | |
1253 | 1253 | let paymentAmount = payment.amount | |
1254 | 1254 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1255 | 1255 | if ((currentKLp == currentKLp)) | |
1256 | 1256 | then { | |
1257 | 1257 | let userAddress = i.caller | |
1258 | 1258 | let txId = i.transactionId | |
1259 | - | let $ | |
1260 | - | if (($ | |
1259 | + | let $t04870648859 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
1260 | + | if (($t04870648859 == $t04870648859)) | |
1261 | 1261 | then { | |
1262 | - | let outInAmountAsset = $ | |
1263 | - | let bonus = $ | |
1264 | - | let feeAmount = $ | |
1265 | - | let commonState = $ | |
1266 | - | let amountEstimated = $ | |
1262 | + | let outInAmountAsset = $t04870648859._5 | |
1263 | + | let bonus = $t04870648859._4 | |
1264 | + | let feeAmount = $t04870648859._3 | |
1265 | + | let commonState = $t04870648859._2 | |
1266 | + | let amountEstimated = $t04870648859._1 | |
1267 | 1267 | let amount = if (if ((minOutAmount > 0)) | |
1268 | 1268 | then (minOutAmount > amountEstimated) | |
1269 | 1269 | else false) | |
1270 | 1270 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1271 | 1271 | else amountEstimated | |
1272 | 1272 | let lsConf = match getLeaseProxyConfig(outAssetIdStr) { | |
1273 | 1273 | case a: (Boolean, Int, Int, String, String, Int, String) => | |
1274 | 1274 | a | |
1275 | 1275 | case _ => | |
1276 | 1276 | throw("error lease config") | |
1277 | 1277 | } | |
1278 | - | let $ | |
1279 | - | let isLeasable = $ | |
1280 | - | let leasedRatio = $ | |
1281 | - | let minBalance = $ | |
1282 | - | let proxyAddress = $ | |
1283 | - | let proxyAssetId = $ | |
1284 | - | let proxyRateMul = $ | |
1285 | - | let stakingProfitAddress = $ | |
1278 | + | let $t04924349357 = lsConf | |
1279 | + | let isLeasable = $t04924349357._1 | |
1280 | + | let leasedRatio = $t04924349357._2 | |
1281 | + | let minBalance = $t04924349357._3 | |
1282 | + | let proxyAddress = $t04924349357._4 | |
1283 | + | let proxyAssetId = $t04924349357._5 | |
1284 | + | let proxyRateMul = $t04924349357._6 | |
1285 | + | let stakingProfitAddress = $t04924349357._7 | |
1286 | 1286 | let assetOnPool = assetBalance(this, fromBase58String(outAssetIdStr)) | |
1287 | 1287 | let amountOfProfit = if (if ((outAssetIdStr == "WAVES")) | |
1288 | 1288 | then (amount > assetOnPool) | |
1289 | 1289 | else false) | |
1290 | 1290 | then { | |
1291 | 1291 | let amountDiff = (amount - assetOnPool) | |
1292 | 1292 | let oldRatio = (getAdditionalBalance(outAssetIdStr) / getStakingAssetBalance(sWavesId())) | |
1293 | 1293 | let oldWavesRoughBalane = wavesBalance(this).available | |
1294 | 1294 | let wd = invoke(this, "withdraw", [outAssetIdStr, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil) | |
1295 | 1295 | if ((wd == wd)) | |
1296 | 1296 | then { | |
1297 | 1297 | let newWavesRoughBalane = wavesBalance(this).available | |
1298 | 1298 | let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane) | |
1299 | 1299 | (wavesDiff - amountDiff) | |
1300 | 1300 | } | |
1301 | 1301 | else throw("Strict value is not equal to itself.") | |
1302 | 1302 | } | |
1303 | 1303 | else 0 | |
1304 | 1304 | let profitTransfer = [ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit)] | |
1305 | 1305 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
1306 | 1306 | if ((burnInv == burnInv)) | |
1307 | 1307 | then { | |
1308 | 1308 | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
1309 | 1309 | let sendFee = if ((feeAmount > 0)) | |
1310 | 1310 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1311 | 1311 | else nil | |
1312 | - | let $ | |
1312 | + | let $t05039650643 = { | |
1313 | 1313 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1314 | 1314 | then 0 | |
1315 | 1315 | else feeAmount | |
1316 | 1316 | if (outInAmountAsset) | |
1317 | 1317 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1318 | 1318 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1319 | 1319 | } | |
1320 | - | let amountAssetBalanceDelta = $ | |
1321 | - | let priceAssetBalanceDelta = $ | |
1322 | - | let $ | |
1323 | - | let refreshKLpActions = $ | |
1324 | - | let updatedKLp = $ | |
1320 | + | let amountAssetBalanceDelta = $t05039650643._1 | |
1321 | + | let priceAssetBalanceDelta = $t05039650643._2 | |
1322 | + | let $t05064650754 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1323 | + | let refreshKLpActions = $t05064650754._1 | |
1324 | + | let updatedKLp = $t05064650754._2 | |
1325 | 1325 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1326 | 1326 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1327 | 1327 | then { | |
1328 | 1328 | let reb = invoke(this, "rebalance", nil, nil) | |
1329 | 1329 | if ((reb == reb)) | |
1330 | 1330 | then $Tuple2(((((commonState ++ assetTransfer) ++ profitTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1331 | 1331 | else throw("Strict value is not equal to itself.") | |
1332 | 1332 | } | |
1333 | 1333 | else throw("Strict value is not equal to itself.") | |
1334 | 1334 | } | |
1335 | 1335 | else throw("Strict value is not equal to itself.") | |
1336 | 1336 | } | |
1337 | 1337 | else throw("Strict value is not equal to itself.") | |
1338 | 1338 | } | |
1339 | 1339 | else throw("Strict value is not equal to itself.") | |
1340 | 1340 | } | |
1341 | 1341 | else throw("Strict value is not equal to itself.") | |
1342 | 1342 | } | |
1343 | 1343 | ||
1344 | 1344 | ||
1345 | 1345 | ||
1346 | 1346 | @Callable(i) | |
1347 | 1347 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1348 | - | let $ | |
1349 | - | let amountEstimated = $ | |
1350 | - | let commonState = $ | |
1351 | - | let feeAmount = $ | |
1352 | - | let bonus = $ | |
1353 | - | let outInAmountAsset = $ | |
1348 | + | let $t05108151237 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1349 | + | let amountEstimated = $t05108151237._1 | |
1350 | + | let commonState = $t05108151237._2 | |
1351 | + | let feeAmount = $t05108151237._3 | |
1352 | + | let bonus = $t05108151237._4 | |
1353 | + | let outInAmountAsset = $t05108151237._5 | |
1354 | 1354 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1355 | 1355 | } | |
1356 | 1356 | ||
1357 | 1357 | ||
1358 | 1358 | ||
1359 | 1359 | @Callable(i) | |
1360 | 1360 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
1361 | 1361 | let isPoolOneTokenOperationsDisabled = { | |
1362 | 1362 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1363 | 1363 | if ($isInstanceOf(@, "Boolean")) | |
1364 | 1364 | then @ | |
1365 | 1365 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1366 | 1366 | } | |
1367 | 1367 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1368 | 1368 | then true | |
1369 | 1369 | else (cfgPoolStatus == PoolShutdown)) | |
1370 | 1370 | then true | |
1371 | 1371 | else isPoolOneTokenOperationsDisabled | |
1372 | 1372 | let checks = [if (if (!(isGetDisabled)) | |
1373 | 1373 | then true | |
1374 | 1374 | else isManager(i)) | |
1375 | 1375 | then true | |
1376 | 1376 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1377 | 1377 | then true | |
1378 | 1378 | else throwErr("no payments are expected")] | |
1379 | 1379 | if ((checks == checks)) | |
1380 | 1380 | then { | |
1381 | 1381 | let outAssetId = parseAssetId(outAssetIdStr) | |
1382 | 1382 | let userAddress = i.caller | |
1383 | 1383 | let txId = i.transactionId | |
1384 | 1384 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1385 | 1385 | if ((currentKLp == currentKLp)) | |
1386 | 1386 | then { | |
1387 | 1387 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1388 | 1388 | if ((unstakeInv == unstakeInv)) | |
1389 | 1389 | then { | |
1390 | - | let $ | |
1391 | - | if (($ | |
1390 | + | let $t05214252293 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1391 | + | if (($t05214252293 == $t05214252293)) | |
1392 | 1392 | then { | |
1393 | - | let outInAmountAsset = $ | |
1394 | - | let bonus = $ | |
1395 | - | let feeAmount = $ | |
1396 | - | let commonState = $ | |
1397 | - | let amountEstimated = $ | |
1393 | + | let outInAmountAsset = $t05214252293._5 | |
1394 | + | let bonus = $t05214252293._4 | |
1395 | + | let feeAmount = $t05214252293._3 | |
1396 | + | let commonState = $t05214252293._2 | |
1397 | + | let amountEstimated = $t05214252293._1 | |
1398 | 1398 | let amount = if (if ((minOutAmount > 0)) | |
1399 | 1399 | then (minOutAmount > amountEstimated) | |
1400 | 1400 | else false) | |
1401 | 1401 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1402 | 1402 | else amountEstimated | |
1403 | 1403 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1404 | 1404 | if ((burnInv == burnInv)) | |
1405 | 1405 | then { | |
1406 | 1406 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
1407 | 1407 | let sendFee = if ((feeAmount > 0)) | |
1408 | 1408 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1409 | 1409 | else nil | |
1410 | - | let $ | |
1410 | + | let $t05278853035 = { | |
1411 | 1411 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1412 | 1412 | then 0 | |
1413 | 1413 | else feeAmount | |
1414 | 1414 | if (outInAmountAsset) | |
1415 | 1415 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1416 | 1416 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1417 | 1417 | } | |
1418 | - | let amountAssetBalanceDelta = $ | |
1419 | - | let priceAssetBalanceDelta = $ | |
1420 | - | let $ | |
1421 | - | let refreshKLpActions = $ | |
1422 | - | let updatedKLp = $ | |
1418 | + | let amountAssetBalanceDelta = $t05278853035._1 | |
1419 | + | let priceAssetBalanceDelta = $t05278853035._2 | |
1420 | + | let $t05303853146 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1421 | + | let refreshKLpActions = $t05303853146._1 | |
1422 | + | let updatedKLp = $t05303853146._2 | |
1423 | 1423 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1424 | 1424 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1425 | 1425 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1426 | 1426 | else throw("Strict value is not equal to itself.") | |
1427 | 1427 | } | |
1428 | 1428 | else throw("Strict value is not equal to itself.") | |
1429 | 1429 | } | |
1430 | 1430 | else throw("Strict value is not equal to itself.") | |
1431 | 1431 | } | |
1432 | 1432 | else throw("Strict value is not equal to itself.") | |
1433 | 1433 | } | |
1434 | 1434 | else throw("Strict value is not equal to itself.") | |
1435 | 1435 | } | |
1436 | 1436 | else throw("Strict value is not equal to itself.") | |
1437 | 1437 | } | |
1438 | 1438 | ||
1439 | 1439 | ||
1440 | 1440 | ||
1441 | 1441 | @Callable(i) | |
1442 | 1442 | func get () = { | |
1443 | 1443 | let res = commonGet(i) | |
1444 | 1444 | let outAmtAmt = res._1 | |
1445 | 1445 | let outPrAmt = res._2 | |
1446 | 1446 | let pmtAmt = res._3 | |
1447 | 1447 | let pmtAssetId = res._4 | |
1448 | 1448 | let state = res._5 | |
1449 | 1449 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1450 | 1450 | if ((currentKLp == currentKLp)) | |
1451 | 1451 | then { | |
1452 | 1452 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1453 | 1453 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1454 | 1454 | then { | |
1455 | - | let $ | |
1456 | - | let refreshKLpActions = $ | |
1457 | - | let updatedKLp = $ | |
1455 | + | let $t05409254174 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1456 | + | let refreshKLpActions = $t05409254174._1 | |
1457 | + | let updatedKLp = $t05409254174._2 | |
1458 | 1458 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1459 | 1459 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1460 | 1460 | then (state ++ refreshKLpActions) | |
1461 | 1461 | else throw("Strict value is not equal to itself.") | |
1462 | 1462 | } | |
1463 | 1463 | else throw("Strict value is not equal to itself.") | |
1464 | 1464 | } | |
1465 | 1465 | else throw("Strict value is not equal to itself.") | |
1466 | 1466 | } | |
1467 | 1467 | ||
1468 | 1468 | ||
1469 | 1469 | ||
1470 | 1470 | @Callable(i) | |
1471 | 1471 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1472 | 1472 | let res = commonGet(i) | |
1473 | 1473 | let outAmAmt = res._1 | |
1474 | 1474 | let outPrAmt = res._2 | |
1475 | 1475 | let pmtAmt = res._3 | |
1476 | 1476 | let pmtAssetId = res._4 | |
1477 | 1477 | let state = res._5 | |
1478 | 1478 | if ((noLessThenAmtAsset > outAmAmt)) | |
1479 | 1479 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1480 | 1480 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1481 | 1481 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1482 | 1482 | else { | |
1483 | 1483 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1484 | 1484 | if ((currentKLp == currentKLp)) | |
1485 | 1485 | then { | |
1486 | 1486 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1487 | 1487 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1488 | 1488 | then { | |
1489 | - | let $ | |
1490 | - | let refreshKLpActions = $ | |
1491 | - | let updatedKLp = $ | |
1489 | + | let $t05512355204 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1490 | + | let refreshKLpActions = $t05512355204._1 | |
1491 | + | let updatedKLp = $t05512355204._2 | |
1492 | 1492 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1493 | 1493 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1494 | 1494 | then (state ++ refreshKLpActions) | |
1495 | 1495 | else throw("Strict value is not equal to itself.") | |
1496 | 1496 | } | |
1497 | 1497 | else throw("Strict value is not equal to itself.") | |
1498 | 1498 | } | |
1499 | 1499 | else throw("Strict value is not equal to itself.") | |
1500 | 1500 | } | |
1501 | 1501 | } | |
1502 | 1502 | ||
1503 | 1503 | ||
1504 | 1504 | ||
1505 | 1505 | @Callable(i) | |
1506 | 1506 | func unstakeAndGet (amount) = { | |
1507 | 1507 | let checkPayments = if ((size(i.payments) != 0)) | |
1508 | 1508 | then throw("No payments are expected") | |
1509 | 1509 | else true | |
1510 | 1510 | if ((checkPayments == checkPayments)) | |
1511 | 1511 | then { | |
1512 | 1512 | let cfg = getPoolConfig() | |
1513 | 1513 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1514 | 1514 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1515 | 1515 | if ((currentKLp == currentKLp)) | |
1516 | 1516 | then { | |
1517 | 1517 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1518 | 1518 | if ((unstakeInv == unstakeInv)) | |
1519 | 1519 | then { | |
1520 | 1520 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1521 | 1521 | let outAmAmt = res._1 | |
1522 | 1522 | let outPrAmt = res._2 | |
1523 | 1523 | let poolStatus = parseIntValue(res._9) | |
1524 | 1524 | let state = res._10 | |
1525 | 1525 | let checkPoolStatus = if (if (isGlobalShutdown()) | |
1526 | 1526 | then true | |
1527 | 1527 | else (poolStatus == PoolShutdown)) | |
1528 | 1528 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
1529 | 1529 | else true | |
1530 | 1530 | if ((checkPoolStatus == checkPoolStatus)) | |
1531 | 1531 | then { | |
1532 | 1532 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1533 | 1533 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1534 | 1534 | then { | |
1535 | - | let $ | |
1536 | - | let refreshKLpActions = $ | |
1537 | - | let updatedKLp = $ | |
1535 | + | let $t05633056411 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1536 | + | let refreshKLpActions = $t05633056411._1 | |
1537 | + | let updatedKLp = $t05633056411._2 | |
1538 | 1538 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1539 | 1539 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1540 | 1540 | then (state ++ refreshKLpActions) | |
1541 | 1541 | else throw("Strict value is not equal to itself.") | |
1542 | 1542 | } | |
1543 | 1543 | else throw("Strict value is not equal to itself.") | |
1544 | 1544 | } | |
1545 | 1545 | else throw("Strict value is not equal to itself.") | |
1546 | 1546 | } | |
1547 | 1547 | else throw("Strict value is not equal to itself.") | |
1548 | 1548 | } | |
1549 | 1549 | else throw("Strict value is not equal to itself.") | |
1550 | 1550 | } | |
1551 | 1551 | else throw("Strict value is not equal to itself.") | |
1552 | 1552 | } | |
1553 | 1553 | ||
1554 | 1554 | ||
1555 | 1555 | ||
1556 | 1556 | @Callable(i) | |
1557 | 1557 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1558 | 1558 | let isGetDisabled = if (isGlobalShutdown()) | |
1559 | 1559 | then true | |
1560 | 1560 | else (cfgPoolStatus == PoolShutdown) | |
1561 | 1561 | let checks = [if (!(isGetDisabled)) | |
1562 | 1562 | then true | |
1563 | 1563 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1564 | 1564 | then true | |
1565 | 1565 | else throw("no payments are expected")] | |
1566 | 1566 | if ((checks == checks)) | |
1567 | 1567 | then { | |
1568 | 1568 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1569 | 1569 | if ((currentKLp == currentKLp)) | |
1570 | 1570 | then { | |
1571 | 1571 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1572 | 1572 | if ((unstakeInv == unstakeInv)) | |
1573 | 1573 | then { | |
1574 | 1574 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1575 | 1575 | let outAmAmt = res._1 | |
1576 | 1576 | let outPrAmt = res._2 | |
1577 | 1577 | let state = res._10 | |
1578 | 1578 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1579 | 1579 | then true | |
1580 | 1580 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1581 | 1581 | then true | |
1582 | 1582 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1583 | 1583 | if ((checkAmounts == checkAmounts)) | |
1584 | 1584 | then { | |
1585 | 1585 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1586 | 1586 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1587 | 1587 | then { | |
1588 | - | let $ | |
1589 | - | let refreshKLpActions = $ | |
1590 | - | let updatedKLp = $ | |
1588 | + | let $t05770657787 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1589 | + | let refreshKLpActions = $t05770657787._1 | |
1590 | + | let updatedKLp = $t05770657787._2 | |
1591 | 1591 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1592 | 1592 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1593 | 1593 | then (state ++ refreshKLpActions) | |
1594 | 1594 | else throw("Strict value is not equal to itself.") | |
1595 | 1595 | } | |
1596 | 1596 | else throw("Strict value is not equal to itself.") | |
1597 | 1597 | } | |
1598 | 1598 | else throw("Strict value is not equal to itself.") | |
1599 | 1599 | } | |
1600 | 1600 | else throw("Strict value is not equal to itself.") | |
1601 | 1601 | } | |
1602 | 1602 | else throw("Strict value is not equal to itself.") | |
1603 | 1603 | } | |
1604 | 1604 | else throw("Strict value is not equal to itself.") | |
1605 | 1605 | } | |
1606 | 1606 | ||
1607 | 1607 | ||
1608 | 1608 | ||
1609 | 1609 | @Callable(i) | |
1610 | 1610 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
1611 | 1611 | then throw("permissions denied") | |
1612 | 1612 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
1613 | 1613 | ||
1614 | 1614 | ||
1615 | 1615 | ||
1616 | 1616 | @Callable(i) | |
1617 | 1617 | func refreshKLp () = { | |
1618 | 1618 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0) | |
1619 | 1619 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay)) | |
1620 | 1620 | then unit | |
1621 | 1621 | else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1622 | 1622 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1623 | 1623 | then { | |
1624 | 1624 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1625 | - | let $ | |
1626 | - | let kLpUpdateActions = $ | |
1627 | - | let updatedKLp = $ | |
1625 | + | let $t05897459038 = refreshKLpInternal(0, 0, 0) | |
1626 | + | let kLpUpdateActions = $t05897459038._1 | |
1627 | + | let updatedKLp = $t05897459038._2 | |
1628 | 1628 | let actions = if ((kLp != updatedKLp)) | |
1629 | 1629 | then kLpUpdateActions | |
1630 | 1630 | else throwErr("nothing to refresh") | |
1631 | 1631 | $Tuple2(actions, toString(updatedKLp)) | |
1632 | 1632 | } | |
1633 | 1633 | else throw("Strict value is not equal to itself.") | |
1634 | 1634 | } | |
1635 | 1635 | ||
1636 | 1636 | ||
1637 | 1637 | ||
1638 | 1638 | @Callable(i) | |
1639 | 1639 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
1640 | 1640 | ||
1641 | 1641 | ||
1642 | 1642 | ||
1643 | 1643 | @Callable(i) | |
1644 | 1644 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1645 | 1645 | ||
1646 | 1646 | ||
1647 | 1647 | ||
1648 | 1648 | @Callable(i) | |
1649 | 1649 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1650 | 1650 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
1651 | 1651 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
1652 | 1652 | } | |
1653 | 1653 | ||
1654 | 1654 | ||
1655 | 1655 | ||
1656 | 1656 | @Callable(i) | |
1657 | 1657 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
1658 | 1658 | ||
1659 | 1659 | ||
1660 | 1660 | ||
1661 | 1661 | @Callable(i) | |
1662 | 1662 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
1663 | 1663 | ||
1664 | 1664 | ||
1665 | 1665 | ||
1666 | 1666 | @Callable(i) | |
1667 | 1667 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1668 | 1668 | ||
1669 | 1669 | ||
1670 | 1670 | ||
1671 | 1671 | @Callable(i) | |
1672 | 1672 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1673 | 1673 | ||
1674 | 1674 | ||
1675 | 1675 | ||
1676 | 1676 | @Callable(i) | |
1677 | 1677 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1678 | 1678 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1679 | 1679 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1680 | 1680 | } | |
1681 | 1681 | ||
1682 | 1682 | ||
1683 | 1683 | ||
1684 | 1684 | @Callable(i) | |
1685 | 1685 | func statsREADONLY () = { | |
1686 | 1686 | let cfg = getPoolConfig() | |
1687 | 1687 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1688 | 1688 | let amtAssetId = cfg[idxAmtAssetId] | |
1689 | 1689 | let priceAssetId = cfg[idxPriceAssetId] | |
1690 | 1690 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1691 | 1691 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1692 | 1692 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1693 | 1693 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1694 | 1694 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1695 | 1695 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1696 | 1696 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1697 | 1697 | let pricesList = if ((poolLPBalance == 0)) | |
1698 | 1698 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1699 | 1699 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1700 | 1700 | let curPrice = 0 | |
1701 | 1701 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1702 | 1702 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1703 | 1703 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1704 | 1704 | $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)) | |
1705 | 1705 | } | |
1706 | 1706 | ||
1707 | 1707 | ||
1708 | 1708 | ||
1709 | 1709 | @Callable(i) | |
1710 | 1710 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1711 | 1711 | let cfg = getPoolConfig() | |
1712 | 1712 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1713 | 1713 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1714 | 1714 | let amAssetId = fromBase58String(amAssetIdStr) | |
1715 | 1715 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1716 | 1716 | let prAssetId = fromBase58String(prAssetIdStr) | |
1717 | 1717 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1718 | 1718 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1719 | 1719 | let poolStatus = cfg[idxPoolStatus] | |
1720 | 1720 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1721 | 1721 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1722 | 1722 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1723 | 1723 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1724 | 1724 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1725 | 1725 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1726 | 1726 | then zeroBigInt | |
1727 | 1727 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1728 | 1728 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1729 | 1729 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1730 | 1730 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1731 | 1731 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1732 | 1732 | let calcLpAmt = estPut._1 | |
1733 | 1733 | let curPriceCalc = estPut._3 | |
1734 | 1734 | let amBalance = estPut._4 | |
1735 | 1735 | let prBalance = estPut._5 | |
1736 | 1736 | let lpEmission = estPut._6 | |
1737 | 1737 | $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)) | |
1738 | 1738 | } | |
1739 | 1739 | ||
1740 | 1740 | ||
1741 | 1741 | ||
1742 | 1742 | @Callable(i) | |
1743 | 1743 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1744 | 1744 | let cfg = getPoolConfig() | |
1745 | 1745 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1746 | 1746 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1747 | 1747 | let amAssetId = fromBase58String(amAssetIdStr) | |
1748 | 1748 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1749 | 1749 | let prAssetId = fromBase58String(prAssetIdStr) | |
1750 | 1750 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1751 | 1751 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1752 | 1752 | let poolStatus = cfg[idxPoolStatus] | |
1753 | 1753 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1754 | 1754 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1755 | 1755 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1756 | 1756 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1757 | 1757 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1758 | 1758 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1759 | 1759 | then zeroBigInt | |
1760 | 1760 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1761 | 1761 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1762 | 1762 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1763 | 1763 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1764 | 1764 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1765 | 1765 | let calcLpAmt = estPut._1 | |
1766 | 1766 | let curPriceCalc = estPut._3 | |
1767 | 1767 | let amBalance = estPut._4 | |
1768 | 1768 | let prBalance = estPut._5 | |
1769 | 1769 | let lpEmission = estPut._6 | |
1770 | 1770 | $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)) | |
1771 | 1771 | } | |
1772 | 1772 | ||
1773 | 1773 | ||
1774 | 1774 | ||
1775 | 1775 | @Callable(i) | |
1776 | 1776 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1777 | 1777 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1778 | 1778 | let outAmAmt = res._1 | |
1779 | 1779 | let outPrAmt = res._2 | |
1780 | 1780 | let amBalance = res._5 | |
1781 | 1781 | let prBalance = res._6 | |
1782 | 1782 | let lpEmission = res._7 | |
1783 | 1783 | let curPrice = res._8 | |
1784 | 1784 | let poolStatus = parseIntValue(res._9) | |
1785 | 1785 | $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)) | |
1786 | 1786 | } | |
1787 | 1787 | ||
1788 | 1788 | ||
1789 | 1789 | @Verifier(tx) | |
1790 | 1790 | func verify () = { | |
1791 | 1791 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1792 | 1792 | case pk: ByteVector => | |
1793 | 1793 | pk | |
1794 | 1794 | case _: Unit => | |
1795 | 1795 | tx.senderPublicKey | |
1796 | 1796 | case _ => | |
1797 | 1797 | throw("Match error") | |
1798 | 1798 | } | |
1799 | 1799 | match tx { | |
1800 | 1800 | case order: Order => | |
1801 | 1801 | let matcherPub = getMatcherPubOrFail() | |
1802 | - | let $ | |
1803 | - | let orderValid = $ | |
1804 | - | let orderValidInfo = $ | |
1802 | + | let $t06770067769 = validateMatcherOrderAllowed(order) | |
1803 | + | let orderValid = $t06770067769._1 | |
1804 | + | let orderValidInfo = $t06770067769._2 | |
1805 | 1805 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1806 | 1806 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1807 | 1807 | if (if (if (orderValid) | |
1808 | 1808 | then senderValid | |
1809 | 1809 | else false) | |
1810 | 1810 | then matcherValid | |
1811 | 1811 | else false) | |
1812 | 1812 | then true | |
1813 | 1813 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1814 | 1814 | case s: SetScriptTransaction => | |
1815 | 1815 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1816 | 1816 | then true | |
1817 | 1817 | else { | |
1818 | 1818 | let newHash = blake2b256(value(s.script)) | |
1819 | 1819 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1820 | 1820 | let currentHash = scriptHash(this) | |
1821 | 1821 | if ((allowedHash == newHash)) | |
1822 | 1822 | then (currentHash != newHash) | |
1823 | 1823 | else false | |
1824 | 1824 | } | |
1825 | 1825 | case _ => | |
1826 | 1826 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1827 | 1827 | } | |
1828 | 1828 | } | |
1829 | 1829 |
github/deemru/w8io/026f985 256.86 ms ◑