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