tx · 3fKHaHVTGYPkVxTP8GWBHvuLPPAL1AQ2D4TJBiMSe1eZ 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT: -0.04100000 Waves 2023.08.17 16:16 [2714641] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves
{ "type": 13, "id": "3fKHaHVTGYPkVxTP8GWBHvuLPPAL1AQ2D4TJBiMSe1eZ", "fee": 4100000, "feeAssetId": null, "timestamp": 1692278209135, "version": 2, "chainId": 84, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "4AbaRWisZfA16a1L4x5mK58apQJGmh3PtRLYdo2xbDWmDuZofsY9m6CkJp7v6vau4Lh72DqsQ1Sby3V9NJSS9jF" ], "script": "base64:BgKkLQgCEgUKAwEEARIHCgUBBAEIARIDCgEIEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgRiaWczIgRiaWc0IgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIKYW1wSW5pdGlhbCIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFz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plexity": 0 } View: original | compacted Prev: 65qoVFAMX6vmH2AnAPgTMc5nA2eX2aE5Cjmoo2ELiNzN Next: HDMiKaoqU2ru6jWPq76ndumjgbytgTcbiaoaVvLtwA8n Diff:
Old | New | Differences | |
---|---|---|---|
1006 | 1006 | then @ | |
1007 | 1007 | else throw(($getType(@) + " couldn't be cast to String")) | |
1008 | 1008 | } | |
1009 | - | let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
1009 | + | let isPoolSwapDisabled = { | |
1010 | + | let @ = invoke(fca, "isPoolSwapDisabledREADONLY", [toString(this)], nil) | |
1011 | + | if ($isInstanceOf(@, "Boolean")) | |
1012 | + | then @ | |
1013 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1014 | + | } | |
1015 | + | let isSwapDisabled = if (if (igs()) | |
1016 | + | then true | |
1017 | + | else (cfgPoolStatus == PoolShutdown)) | |
1018 | + | then true | |
1019 | + | else isPoolSwapDisabled | |
1020 | + | let checks = [if (if (!(isSwapDisabled)) | |
1021 | + | then true | |
1022 | + | else isManager(i)) | |
1023 | + | then true | |
1024 | + | else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
1010 | 1025 | then true | |
1011 | 1026 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
1012 | 1027 | then true | |
1015 | 1030 | then { | |
1016 | 1031 | let pmt = value(i.payments[0]) | |
1017 | 1032 | let assetIn = assetIdToString(pmt.assetId) | |
1018 | - | let $ | |
1033 | + | let $t03779538189 = if ((isReverse == false)) | |
1019 | 1034 | then { | |
1020 | 1035 | let assetOut = strf(this, pa()) | |
1021 | 1036 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1026 | 1041 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1027 | 1042 | $Tuple2(assetOut, poolAmountInBalance) | |
1028 | 1043 | } | |
1029 | - | let assetOut = $ | |
1030 | - | let poolAmountInBalance = $ | |
1044 | + | let assetOut = $t03779538189._1 | |
1045 | + | let poolAmountInBalance = $t03779538189._2 | |
1031 | 1046 | let poolConfig = gpc() | |
1032 | 1047 | let amId = poolConfig[idxAmAsId] | |
1033 | 1048 | let prId = poolConfig[idxPrAsId] | |
1143 | 1158 | else throw("Strict value is not equal to itself.") | |
1144 | 1159 | } | |
1145 | 1160 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1146 | - | let $ | |
1147 | - | let refreshDLpActions = $ | |
1148 | - | let updatedDLp = $ | |
1161 | + | let $t04264442786 = refreshDLpInternal(0, 0, 0) | |
1162 | + | let refreshDLpActions = $t04264442786._1 | |
1163 | + | let updatedDLp = $t04264442786._2 | |
1149 | 1164 | let check = if ((updatedDLp >= currentDLp)) | |
1150 | 1165 | then true | |
1151 | 1166 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1218 | 1233 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1219 | 1234 | if ((currentDLp == currentDLp)) | |
1220 | 1235 | then { | |
1221 | - | let $ | |
1222 | - | if (($ | |
1236 | + | let $t04442744585 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1237 | + | if (($t04442744585 == $t04442744585)) | |
1223 | 1238 | then { | |
1224 | - | let feeAmount = $ | |
1225 | - | let state = $ | |
1226 | - | let estimLP = $ | |
1239 | + | let feeAmount = $t04442744585._3 | |
1240 | + | let state = $t04442744585._2 | |
1241 | + | let estimLP = $t04442744585._1 | |
1227 | 1242 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1228 | 1243 | then (minOutAmount > estimLP) | |
1229 | 1244 | else false) | |
1251 | 1266 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1252 | 1267 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1253 | 1268 | else nil | |
1254 | - | let $ | |
1269 | + | let $t04547045819 = if ((this == feeCollectorAddress)) | |
1255 | 1270 | then $Tuple2(0, 0) | |
1256 | 1271 | else { | |
1257 | 1272 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1261 | 1276 | then $Tuple2(-(feeAmount), 0) | |
1262 | 1277 | else $Tuple2(0, -(feeAmount)) | |
1263 | 1278 | } | |
1264 | - | let amountAssetBalanceDelta = $ | |
1265 | - | let priceAssetBalanceDelta = $ | |
1266 | - | let $ | |
1267 | - | let refreshDLpActions = $ | |
1268 | - | let updatedDLp = $ | |
1279 | + | let amountAssetBalanceDelta = $t04547045819._1 | |
1280 | + | let priceAssetBalanceDelta = $t04547045819._2 | |
1281 | + | let $t04582245930 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1282 | + | let refreshDLpActions = $t04582245930._1 | |
1283 | + | let updatedDLp = $t04582245930._2 | |
1269 | 1284 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1270 | 1285 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1271 | 1286 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1297 | 1312 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1298 | 1313 | if ((currentDLp == currentDLp)) | |
1299 | 1314 | then { | |
1300 | - | let $ | |
1301 | - | let refreshDLpActions = $ | |
1302 | - | let updatedDLp = $ | |
1315 | + | let $t04696047025 = refreshDLpInternal(0, 0, 0) | |
1316 | + | let refreshDLpActions = $t04696047025._1 | |
1317 | + | let updatedDLp = $t04696047025._2 | |
1303 | 1318 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1304 | 1319 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1305 | 1320 | then (state ++ refreshDLpActions) | |
1324 | 1339 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1325 | 1340 | if ((b == b)) | |
1326 | 1341 | then { | |
1327 | - | let $ | |
1328 | - | let refreshDLpActions = $ | |
1329 | - | let updatedDLp = $ | |
1342 | + | let $t04819848280 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1343 | + | let refreshDLpActions = $t04819848280._1 | |
1344 | + | let updatedDLp = $t04819848280._2 | |
1330 | 1345 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1331 | 1346 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1332 | 1347 | then (state ++ refreshDLpActions) | |
1361 | 1376 | else throwErr("exactly 1 payment are expected")] | |
1362 | 1377 | if ((checks == checks)) | |
1363 | 1378 | then { | |
1364 | - | let $ | |
1365 | - | let state = $ | |
1366 | - | let totalAmount = $ | |
1379 | + | let $t04889849053 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1380 | + | let state = $t04889849053._1 | |
1381 | + | let totalAmount = $t04889849053._2 | |
1367 | 1382 | $Tuple2(state, totalAmount) | |
1368 | 1383 | } | |
1369 | 1384 | else throw("Strict value is not equal to itself.") | |
1380 | 1395 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1381 | 1396 | then { | |
1382 | 1397 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1383 | - | let $ | |
1384 | - | let dLpUpdateActions = $ | |
1385 | - | let updatedDLp = $ | |
1398 | + | let $t04957749641 = refreshDLpInternal(0, 0, 0) | |
1399 | + | let dLpUpdateActions = $t04957749641._1 | |
1400 | + | let updatedDLp = $t04957749641._2 | |
1386 | 1401 | let actions = if ((dLp != updatedDLp)) | |
1387 | 1402 | then dLpUpdateActions | |
1388 | 1403 | else throwErr("nothing to refresh") | |
1410 | 1425 | let newY = getYD(xp, index, D1) | |
1411 | 1426 | let dy = (xp[index] - newY) | |
1412 | 1427 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1413 | - | let $ | |
1414 | - | let totalGet = $ | |
1415 | - | let feeAmount = $ | |
1428 | + | let $t05065150706 = takeFee(totalGetRaw, outFee) | |
1429 | + | let totalGet = $t05065150706._1 | |
1430 | + | let feeAmount = $t05065150706._2 | |
1416 | 1431 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1417 | 1432 | } | |
1418 | 1433 | ||
1425 | 1440 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1426 | 1441 | let amBalance = getAccBalance(amId) | |
1427 | 1442 | let prBalance = getAccBalance(prId) | |
1428 | - | let $ | |
1443 | + | let $t05108151196 = { | |
1429 | 1444 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1430 | 1445 | if ($isInstanceOf(@, "(Int, Int)")) | |
1431 | 1446 | then @ | |
1432 | 1447 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1433 | 1448 | } | |
1434 | - | let totalGet = $ | |
1435 | - | let feeAmount = $ | |
1449 | + | let totalGet = $t05108151196._1 | |
1450 | + | let feeAmount = $t05108151196._2 | |
1436 | 1451 | let r = ego("", lpId, lpAssetAmount, this) | |
1437 | 1452 | let outAmAmt = r._1 | |
1438 | 1453 | let outPrAmt = r._2 | |
1466 | 1481 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1467 | 1482 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1468 | 1483 | then { | |
1469 | - | let $ | |
1470 | - | let refreshDLpActions = $ | |
1471 | - | let updatedDLp = $ | |
1484 | + | let $t05236252443 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1485 | + | let refreshDLpActions = $t05236252443._1 | |
1486 | + | let updatedDLp = $t05236252443._2 | |
1472 | 1487 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1473 | 1488 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1474 | 1489 | then (state ++ refreshDLpActions) | |
1513 | 1528 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1514 | 1529 | if ((burnA == burnA)) | |
1515 | 1530 | then { | |
1516 | - | let $ | |
1517 | - | let refreshDLpActions = $ | |
1518 | - | let updatedDLp = $ | |
1531 | + | let $t05347053551 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1532 | + | let refreshDLpActions = $t05347053551._1 | |
1533 | + | let updatedDLp = $t05347053551._2 | |
1519 | 1534 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1520 | 1535 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1521 | 1536 | then (state ++ refreshDLpActions) | |
1566 | 1581 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1567 | 1582 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1568 | 1583 | then { | |
1569 | - | let $ | |
1570 | - | let refreshDLpActions = $ | |
1571 | - | let updatedDLp = $ | |
1584 | + | let $t05480254883 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1585 | + | let refreshDLpActions = $t05480254883._1 | |
1586 | + | let updatedDLp = $t05480254883._2 | |
1572 | 1587 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1573 | 1588 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1574 | 1589 | then (state ++ refreshDLpActions) | |
1617 | 1632 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1618 | 1633 | if ((unstakeInv == unstakeInv)) | |
1619 | 1634 | then { | |
1620 | - | let $ | |
1621 | - | let state = $ | |
1622 | - | let totalAmount = $ | |
1635 | + | let $t05590556093 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1636 | + | let state = $t05590556093._1 | |
1637 | + | let totalAmount = $t05590556093._2 | |
1623 | 1638 | $Tuple2(state, totalAmount) | |
1624 | 1639 | } | |
1625 | 1640 | else throw("Strict value is not equal to itself.") | |
1631 | 1646 | ||
1632 | 1647 | @Callable(i) | |
1633 | 1648 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1634 | - | let $ | |
1635 | - | let lpAmount = $ | |
1636 | - | let state = $ | |
1637 | - | let feeAmount = $ | |
1638 | - | let bonus = $ | |
1649 | + | let $t05622156324 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1650 | + | let lpAmount = $t05622156324._1 | |
1651 | + | let state = $t05622156324._2 | |
1652 | + | let feeAmount = $t05622156324._3 | |
1653 | + | let bonus = $t05622156324._4 | |
1639 | 1654 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1640 | 1655 | } | |
1641 | 1656 | ||
1643 | 1658 | ||
1644 | 1659 | @Callable(i) | |
1645 | 1660 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1646 | - | let $ | |
1647 | - | let lpAmount = $ | |
1648 | - | let state = $ | |
1649 | - | let feeAmount = $ | |
1650 | - | let bonus = $ | |
1661 | + | let $t05647256576 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1662 | + | let lpAmount = $t05647256576._1 | |
1663 | + | let state = $t05647256576._2 | |
1664 | + | let feeAmount = $t05647256576._3 | |
1665 | + | let bonus = $t05647256576._4 | |
1651 | 1666 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1652 | 1667 | } | |
1653 | 1668 | ||
1709 | 1724 | @Callable(i) | |
1710 | 1725 | func changeAmp () = { | |
1711 | 1726 | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1712 | - | let $ | |
1727 | + | let $t05905659255 = match cfg { | |
1713 | 1728 | case list: List[Any] => | |
1714 | 1729 | $Tuple3({ | |
1715 | 1730 | let @ = list[0] | |
1730 | 1745 | case _ => | |
1731 | 1746 | throwErr("invalid entry type") | |
1732 | 1747 | } | |
1733 | - | let delay = $ | |
1734 | - | let delta = $ | |
1735 | - | let target = $ | |
1748 | + | let delay = $t05905659255._1 | |
1749 | + | let delta = $t05905659255._2 | |
1750 | + | let target = $t05905659255._3 | |
1736 | 1751 | let curAmp = parseIntValue(getStringValue(amp())) | |
1737 | 1752 | let newAmpRaw = (curAmp + delta) | |
1738 | 1753 | let newAmp = if ((0 > delta)) | |
1768 | 1783 | match tx { | |
1769 | 1784 | case order: Order => | |
1770 | 1785 | let matcherPub = mp() | |
1771 | - | let $ | |
1786 | + | let $t06018860305 = if (skipOrderValidation()) | |
1772 | 1787 | then $Tuple2(true, "") | |
1773 | 1788 | else validateMatcherOrderAllowed(order) | |
1774 | - | let orderValid = $ | |
1775 | - | let orderValidInfo = $ | |
1789 | + | let orderValid = $t06018860305._1 | |
1790 | + | let orderValidInfo = $t06018860305._2 | |
1776 | 1791 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1777 | 1792 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1778 | 1793 | if (if (if (orderValid) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let scale8BigInt = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | let scale18 = toBigInt(1000000000000000000) | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let big0 = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | 17 | ||
18 | 18 | let big3 = toBigInt(3) | |
19 | 19 | ||
20 | 20 | let big4 = toBigInt(4) | |
21 | 21 | ||
22 | 22 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
23 | 23 | ||
24 | 24 | let wavesString = "WAVES" | |
25 | 25 | ||
26 | 26 | let ampInitial = 50 | |
27 | 27 | ||
28 | 28 | let Amult = "100" | |
29 | 29 | ||
30 | 30 | let Dconv = "1" | |
31 | 31 | ||
32 | 32 | let SEP = "__" | |
33 | 33 | ||
34 | 34 | let EMPTY = "" | |
35 | 35 | ||
36 | 36 | let PoolActive = 1 | |
37 | 37 | ||
38 | 38 | let PoolPutDis = 2 | |
39 | 39 | ||
40 | 40 | let PoolMatcherDis = 3 | |
41 | 41 | ||
42 | 42 | let PoolShutdown = 4 | |
43 | 43 | ||
44 | 44 | let idxPoolAddress = 1 | |
45 | 45 | ||
46 | 46 | let idxPoolSt = 2 | |
47 | 47 | ||
48 | 48 | let idxLPAsId = 3 | |
49 | 49 | ||
50 | 50 | let idxAmAsId = 4 | |
51 | 51 | ||
52 | 52 | let idxPrAsId = 5 | |
53 | 53 | ||
54 | 54 | let idxAmtAsDcm = 6 | |
55 | 55 | ||
56 | 56 | let idxPriceAsDcm = 7 | |
57 | 57 | ||
58 | 58 | let idxIAmtAsId = 8 | |
59 | 59 | ||
60 | 60 | let idxIPriceAsId = 9 | |
61 | 61 | ||
62 | 62 | let idxFactStakCntr = 1 | |
63 | 63 | ||
64 | 64 | let idxFactoryRestCntr = 6 | |
65 | 65 | ||
66 | 66 | let idxFactSlippCntr = 7 | |
67 | 67 | ||
68 | 68 | let idxFactGwxRewCntr = 10 | |
69 | 69 | ||
70 | 70 | let feeDefault = fraction(10, scale8, 10000) | |
71 | 71 | ||
72 | 72 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func t1BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func t2 (origVal,origScaleMult) = fraction(origVal, scale18, toBigInt(origScaleMult)) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func f2 (val,resultScaleMult) = fraction(val, toBigInt(resultScaleMult), scale18) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func abs (val) = if ((zeroBigInt > val)) | |
94 | 94 | then -(val) | |
95 | 95 | else val | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func absBigInt (val) = if ((zeroBigInt > val)) | |
99 | 99 | then -(val) | |
100 | 100 | else val | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func fc () = "%s__factoryContract" | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func pl () = "%s%s__price__last" | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func aa () = "%s__amountAsset" | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func pa () = "%s__priceAsset" | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func amp () = "%s__amp" | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func keyAmpHistory (heightBlocks) = ("%s%d__amp__" + toString(heightBlocks)) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func keyChangeAmpLastCall () = "%s__changeAmpLastCall" | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | let keyFee = "%s__fee" | |
140 | 140 | ||
141 | 141 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
142 | 142 | ||
143 | 143 | let keyDLp = makeString(["%s", "dLp"], SEP) | |
144 | 144 | ||
145 | 145 | let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP) | |
146 | 146 | ||
147 | 147 | let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP) | |
148 | 148 | ||
149 | 149 | let dLpRefreshDelayDefault = 30 | |
150 | 150 | ||
151 | 151 | let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault) | |
152 | 152 | ||
153 | 153 | func fcfg () = "%s__factoryConfig" | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func mtpk () = "%s%s__matcher__publicKey" | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func aps () = "%s__shutdown" | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func keyFeeCollectorAddress () = "%s__feeCollectorAddress" | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func addressFromStringOrThis (addressString) = match addressFromString(addressString) { | |
181 | 181 | case a: Address => | |
182 | 182 | a | |
183 | 183 | case _ => | |
184 | 184 | this | |
185 | 185 | } | |
186 | 186 | ||
187 | 187 | ||
188 | 188 | func getManagerVaultAddressOrThis () = { | |
189 | 189 | let factoryAddress = match getString(fc()) { | |
190 | 190 | case fca: String => | |
191 | 191 | addressFromStringOrThis(fca) | |
192 | 192 | case _ => | |
193 | 193 | this | |
194 | 194 | } | |
195 | 195 | match getString(factoryAddress, keyManagerVaultAddress()) { | |
196 | 196 | case s: String => | |
197 | 197 | addressFromStringOrThis(s) | |
198 | 198 | case _ => | |
199 | 199 | this | |
200 | 200 | } | |
201 | 201 | } | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " ")) | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ") | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | let fca = addressFromStringValue(strf(this, fc())) | |
217 | 217 | ||
218 | 218 | let inFee = { | |
219 | 219 | let @ = invoke(fca, "getInFeeREADONLY", [toString(this)], nil) | |
220 | 220 | if ($isInstanceOf(@, "Int")) | |
221 | 221 | then @ | |
222 | 222 | else throw(($getType(@) + " couldn't be cast to Int")) | |
223 | 223 | } | |
224 | 224 | ||
225 | 225 | let outFee = { | |
226 | 226 | let @ = invoke(fca, "getOutFeeREADONLY", [toString(this)], nil) | |
227 | 227 | if ($isInstanceOf(@, "Int")) | |
228 | 228 | then @ | |
229 | 229 | else throw(($getType(@) + " couldn't be cast to Int")) | |
230 | 230 | } | |
231 | 231 | ||
232 | 232 | let A = strf(this, amp()) | |
233 | 233 | ||
234 | 234 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
235 | 235 | ||
236 | 236 | ||
237 | 237 | func mp () = fromBase58String(strf(fca, mtpk())) | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress())) | |
241 | 241 | ||
242 | 242 | func gpc () = { | |
243 | 243 | let amtAs = strf(this, aa()) | |
244 | 244 | let priceAs = strf(this, pa()) | |
245 | 245 | let iPriceAs = intf(fca, mba(priceAs)) | |
246 | 246 | let iAmtAs = intf(fca, mba(amtAs)) | |
247 | 247 | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
248 | 248 | } | |
249 | 249 | ||
250 | 250 | ||
251 | 251 | func parseAssetId (input) = if ((input == wavesString)) | |
252 | 252 | then unit | |
253 | 253 | else fromBase58String(input) | |
254 | 254 | ||
255 | 255 | ||
256 | 256 | func assetIdToString (input) = if ((input == unit)) | |
257 | 257 | then wavesString | |
258 | 258 | else toBase58String(value(input)) | |
259 | 259 | ||
260 | 260 | ||
261 | 261 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm])) | |
262 | 262 | ||
263 | 263 | ||
264 | 264 | let poolConfigParsed = parsePoolConfig(gpc()) | |
265 | 265 | ||
266 | 266 | let $t086088794 = poolConfigParsed | |
267 | 267 | ||
268 | 268 | let cfgPoolAddress = $t086088794._1 | |
269 | 269 | ||
270 | 270 | let cfgPoolStatus = $t086088794._2 | |
271 | 271 | ||
272 | 272 | let cfgLpAssetId = $t086088794._3 | |
273 | 273 | ||
274 | 274 | let cfgAmountAssetId = $t086088794._4 | |
275 | 275 | ||
276 | 276 | let cfgPriceAssetId = $t086088794._5 | |
277 | 277 | ||
278 | 278 | let cfgAmountAssetDecimals = $t086088794._6 | |
279 | 279 | ||
280 | 280 | let cfgPriceAssetDecimals = $t086088794._7 | |
281 | 281 | ||
282 | 282 | func gfc () = split(strf(fca, fcfg()), SEP) | |
283 | 283 | ||
284 | 284 | ||
285 | 285 | let factoryConfig = gfc() | |
286 | 286 | ||
287 | 287 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
288 | 288 | ||
289 | 289 | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
290 | 290 | ||
291 | 291 | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
292 | 292 | ||
293 | 293 | let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address") | |
294 | 294 | ||
295 | 295 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP) | |
296 | 296 | ||
297 | 297 | ||
298 | 298 | 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) | |
299 | 299 | ||
300 | 300 | ||
301 | 301 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
302 | 302 | then wavesBalance(this).available | |
303 | 303 | else assetBalance(this, fromBase58String(assetId)) | |
304 | 304 | ||
305 | 305 | ||
306 | 306 | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
307 | 307 | ||
308 | 308 | ||
309 | 309 | func cpbir (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
310 | 310 | ||
311 | 311 | ||
312 | 312 | func vad (A1,A2,slippage) = { | |
313 | 313 | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
314 | 314 | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
315 | 315 | if (!(pass)) | |
316 | 316 | then throw(("Big slpg: " + toString(diff))) | |
317 | 317 | else $Tuple2(pass, min([A1, A2])) | |
318 | 318 | } | |
319 | 319 | ||
320 | 320 | ||
321 | 321 | func vd (D1,D0,slpg) = { | |
322 | 322 | let diff = fraction(D0, scale8BigInt, D1) | |
323 | 323 | let fail = (slpg > diff) | |
324 | 324 | if (if (fail) | |
325 | 325 | then true | |
326 | 326 | else (D0 > D1)) | |
327 | 327 | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
328 | 328 | else fail | |
329 | 329 | } | |
330 | 330 | ||
331 | 331 | ||
332 | 332 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
333 | 333 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
334 | 334 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
335 | 335 | cpbi(prAsAmtX18, amtAsAmtX18) | |
336 | 336 | } | |
337 | 337 | ||
338 | 338 | ||
339 | 339 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
340 | 340 | let amtAsDcm = cfgAmountAssetDecimals | |
341 | 341 | let prAsDcm = cfgPriceAssetDecimals | |
342 | 342 | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
343 | 343 | let amAmtX18 = t1(amAmt, amtAsDcm) | |
344 | 344 | let prAmtX18 = t1(prAmt, prAsDcm) | |
345 | 345 | let lpAmtX18 = t1(lpAmt, scale8) | |
346 | 346 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
347 | 347 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
348 | 348 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
349 | 349 | } | |
350 | 350 | ||
351 | 351 | ||
352 | 352 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
353 | 353 | let p = calcPrices(amAmt, prAmt, lpAmt) | |
354 | 354 | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
355 | 355 | } | |
356 | 356 | ||
357 | 357 | ||
358 | 358 | func takeFee (amount,fee) = { | |
359 | 359 | let feeAmount = if ((fee == 0)) | |
360 | 360 | then 0 | |
361 | 361 | else fraction(amount, fee, scale8) | |
362 | 362 | $Tuple2((amount - feeAmount), feeAmount) | |
363 | 363 | } | |
364 | 364 | ||
365 | 365 | ||
366 | 366 | func getD (xp) = { | |
367 | 367 | let xp0 = xp[0] | |
368 | 368 | let xp1 = xp[1] | |
369 | 369 | let s = (xp0 + xp1) | |
370 | 370 | if ((s == big0)) | |
371 | 371 | then big0 | |
372 | 372 | else { | |
373 | 373 | let a = parseIntValue(A) | |
374 | 374 | let ann = (a * 2) | |
375 | 375 | let p = fraction(xp0, xp1, big1) | |
376 | 376 | let xp0_xp1_n_n = fraction(p, big4, big1) | |
377 | 377 | let ann_s = fraction(toBigInt(ann), s, big1) | |
378 | 378 | let ann_1 = toBigInt((ann - 1)) | |
379 | 379 | func calcDNext (d) = { | |
380 | 380 | let dd = fraction(d, d, big1) | |
381 | 381 | let ddd = fraction(dd, d, big1) | |
382 | 382 | let dp = fraction(ddd, big1, xp0_xp1_n_n) | |
383 | 383 | fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1))) | |
384 | 384 | } | |
385 | 385 | ||
386 | 386 | func calc (acc,i) = if (acc._2) | |
387 | 387 | then acc | |
388 | 388 | else { | |
389 | 389 | let d = acc._1 | |
390 | 390 | let dNext = calcDNext(d) | |
391 | 391 | let dDiffRaw = (dNext - value(d)) | |
392 | 392 | let dDiff = if ((big0 > dDiffRaw)) | |
393 | 393 | then -(dDiffRaw) | |
394 | 394 | else dDiffRaw | |
395 | 395 | if ((big1 >= dDiff)) | |
396 | 396 | then $Tuple2(dNext, true) | |
397 | 397 | else $Tuple2(dNext, false) | |
398 | 398 | } | |
399 | 399 | ||
400 | 400 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
401 | 401 | let $t01329913347 = { | |
402 | 402 | let $l = arr | |
403 | 403 | let $s = size($l) | |
404 | 404 | let $acc0 = $Tuple2(s, false) | |
405 | 405 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
406 | 406 | then $a | |
407 | 407 | else calc($a, $l[$i]) | |
408 | 408 | ||
409 | 409 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
410 | 410 | then $a | |
411 | 411 | else throw("List size exceeds 17") | |
412 | 412 | ||
413 | 413 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
414 | 414 | } | |
415 | 415 | let d = $t01329913347._1 | |
416 | 416 | let found = $t01329913347._2 | |
417 | 417 | if (found) | |
418 | 418 | then d | |
419 | 419 | else throw(("D calculation error, D = " + toString(d))) | |
420 | 420 | } | |
421 | 421 | } | |
422 | 422 | ||
423 | 423 | ||
424 | 424 | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
425 | 425 | let lpId = cfgLpAssetId | |
426 | 426 | let amId = toBase58String(value(cfgAmountAssetId)) | |
427 | 427 | let prId = toBase58String(value(cfgPriceAssetId)) | |
428 | 428 | let amDcm = cfgAmountAssetDecimals | |
429 | 429 | let prDcm = cfgPriceAssetDecimals | |
430 | 430 | let sts = toString(cfgPoolStatus) | |
431 | 431 | let lpEmiss = valueOrErrorMessage(assetInfo(lpId), "Wrong LP id").quantity | |
432 | 432 | if ((toBase58String(lpId) != pmtAssetId)) | |
433 | 433 | then throw("Wrong pmt asset") | |
434 | 434 | else { | |
435 | 435 | let amBalance = getAccBalance(amId) | |
436 | 436 | let amBalanceX18 = t1(amBalance, amDcm) | |
437 | 437 | let prBalance = getAccBalance(prId) | |
438 | 438 | let prBalanceX18 = t1(prBalance, prDcm) | |
439 | 439 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
440 | 440 | let curPrice = f1(curPriceX18, scale8) | |
441 | 441 | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
442 | 442 | let lpEmissX18 = t1(lpEmiss, scale8) | |
443 | 443 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
444 | 444 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
445 | 445 | let outAmAmt = fromX18Round(outAmAmtX18, amDcm, FLOOR) | |
446 | 446 | let outPrAmt = fromX18Round(outPrAmtX18, prDcm, FLOOR) | |
447 | 447 | let state = if ((txId58 == "")) | |
448 | 448 | then nil | |
449 | 449 | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
450 | 450 | then unit | |
451 | 451 | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
452 | 452 | then unit | |
453 | 453 | else fromBase58String(prId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
454 | 454 | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
455 | 455 | } | |
456 | 456 | } | |
457 | 457 | ||
458 | 458 | ||
459 | 459 | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
460 | 460 | let lpId = cfgLpAssetId | |
461 | 461 | let amIdStr = toBase58String(value(cfgAmountAssetId)) | |
462 | 462 | let prIdStr = toBase58String(value(cfgPriceAssetId)) | |
463 | 463 | let amtDcm = cfgAmountAssetDecimals | |
464 | 464 | let priceDcm = cfgPriceAssetDecimals | |
465 | 465 | let sts = toString(cfgPoolStatus) | |
466 | 466 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
467 | 467 | let amBalance = if (isEval) | |
468 | 468 | then getAccBalance(amIdStr) | |
469 | 469 | else if (if (isOneAsset) | |
470 | 470 | then (pmtId == amIdStr) | |
471 | 471 | else false) | |
472 | 472 | then (getAccBalance(amIdStr) - pmtAmt) | |
473 | 473 | else if (isOneAsset) | |
474 | 474 | then getAccBalance(amIdStr) | |
475 | 475 | else (getAccBalance(amIdStr) - inAmAmt) | |
476 | 476 | let prBalance = if (isEval) | |
477 | 477 | then getAccBalance(prIdStr) | |
478 | 478 | else if (if (isOneAsset) | |
479 | 479 | then (pmtId == prIdStr) | |
480 | 480 | else false) | |
481 | 481 | then (getAccBalance(prIdStr) - pmtAmt) | |
482 | 482 | else if (isOneAsset) | |
483 | 483 | then getAccBalance(prIdStr) | |
484 | 484 | else (getAccBalance(prIdStr) - inPrAmt) | |
485 | 485 | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
486 | 486 | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
487 | 487 | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
488 | 488 | let amBalanceX18 = t1(amBalance, amtDcm) | |
489 | 489 | let prBalanceX18 = t1(prBalance, priceDcm) | |
490 | 490 | let D0 = getD([amBalanceX18, prBalanceX18]) | |
491 | 491 | let r = if ((lpEm == 0)) | |
492 | 492 | then { | |
493 | 493 | let D1 = getD([(amBalanceX18 + inAmAssetAmtX18), (prBalanceX18 + inPrAssetAmtX18)]) | |
494 | 494 | let checkD = if ((D1 > D0)) | |
495 | 495 | then true | |
496 | 496 | else throw("D1 should be greater than D0") | |
497 | 497 | if ((checkD == checkD)) | |
498 | 498 | then { | |
499 | 499 | let curPriceX18 = zeroBigInt | |
500 | 500 | let slippageX18 = zeroBigInt | |
501 | 501 | let lpAmtX18 = D1 | |
502 | 502 | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
503 | 503 | } | |
504 | 504 | else throw("Strict value is not equal to itself.") | |
505 | 505 | } | |
506 | 506 | else { | |
507 | 507 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
508 | 508 | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
509 | 509 | let slippageX18 = t1(slippage, scale8) | |
510 | 510 | if (if (if (validateSlippage) | |
511 | 511 | then (curPriceX18 != zeroBigInt) | |
512 | 512 | else false) | |
513 | 513 | then (slippageRealX18 > slippageX18) | |
514 | 514 | else false) | |
515 | 515 | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
516 | 516 | else { | |
517 | 517 | let lpEmissionX18 = t1(lpEm, scale8) | |
518 | 518 | let prViaAmX18 = fraction(inAmAssetAmtX18, cpbir(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
519 | 519 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, cpbir(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
520 | 520 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
521 | 521 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
522 | 522 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
523 | 523 | let expAmtAssetAmtX18 = expectedAmts._1 | |
524 | 524 | let expPriceAssetAmtX18 = expectedAmts._2 | |
525 | 525 | let D1 = getD([(amBalanceX18 + expAmtAssetAmtX18), (prBalanceX18 + expPriceAssetAmtX18)]) | |
526 | 526 | let checkD = if ((D1 > D0)) | |
527 | 527 | then true | |
528 | 528 | else throw("D1 should be greater than D0") | |
529 | 529 | if ((checkD == checkD)) | |
530 | 530 | then { | |
531 | 531 | let lpAmtX18 = fraction(lpEmissionX18, (D1 - D0), D0) | |
532 | 532 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18) | |
533 | 533 | } | |
534 | 534 | else throw("Strict value is not equal to itself.") | |
535 | 535 | } | |
536 | 536 | } | |
537 | 537 | let calcLpAmt = r._1 | |
538 | 538 | let calcAmAssetPmt = r._2 | |
539 | 539 | let calcPrAssetPmt = r._3 | |
540 | 540 | let curPrice = f1(r._4, scale8) | |
541 | 541 | let slippageCalc = f1(r._5, scale8) | |
542 | 542 | if ((0 >= calcLpAmt)) | |
543 | 543 | then throw("LP <= 0") | |
544 | 544 | else { | |
545 | 545 | let emitLpAmt = if (!(emitLp)) | |
546 | 546 | then 0 | |
547 | 547 | else calcLpAmt | |
548 | 548 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
549 | 549 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
550 | 550 | let $t02110921454 = if (if (isOneAsset) | |
551 | 551 | then (pmtId == amIdStr) | |
552 | 552 | else false) | |
553 | 553 | then $Tuple2(pmtAmt, 0) | |
554 | 554 | else if (if (isOneAsset) | |
555 | 555 | then (pmtId == prIdStr) | |
556 | 556 | else false) | |
557 | 557 | then $Tuple2(0, pmtAmt) | |
558 | 558 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
559 | 559 | let writeAmAmt = $t02110921454._1 | |
560 | 560 | let writePrAmt = $t02110921454._2 | |
561 | 561 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
562 | 562 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
563 | 563 | } | |
564 | 564 | } | |
565 | 565 | ||
566 | 566 | ||
567 | 567 | func getYD (xp,i,D) = { | |
568 | 568 | let n = big2 | |
569 | 569 | let x = xp[if ((i == 0)) | |
570 | 570 | then 1 | |
571 | 571 | else 0] | |
572 | 572 | let aPrecision = parseBigIntValue(Amult) | |
573 | 573 | let a = (parseBigIntValue(A) * aPrecision) | |
574 | 574 | let s = x | |
575 | 575 | let ann = (a * n) | |
576 | 576 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
577 | 577 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
578 | 578 | func calc (acc,cur) = { | |
579 | 579 | let $t02264922669 = acc | |
580 | 580 | let y = $t02264922669._1 | |
581 | 581 | let found = $t02264922669._2 | |
582 | 582 | if ((found != unit)) | |
583 | 583 | then acc | |
584 | 584 | else { | |
585 | 585 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
586 | 586 | let yDiff = absBigInt((yNext - value(y))) | |
587 | 587 | if ((big1 >= yDiff)) | |
588 | 588 | then $Tuple2(yNext, cur) | |
589 | 589 | else $Tuple2(yNext, unit) | |
590 | 590 | } | |
591 | 591 | } | |
592 | 592 | ||
593 | 593 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
594 | 594 | let $t02297623023 = { | |
595 | 595 | let $l = arr | |
596 | 596 | let $s = size($l) | |
597 | 597 | let $acc0 = $Tuple2(D, unit) | |
598 | 598 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
599 | 599 | then $a | |
600 | 600 | else calc($a, $l[$i]) | |
601 | 601 | ||
602 | 602 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
603 | 603 | then $a | |
604 | 604 | else throw("List size exceeds 15") | |
605 | 605 | ||
606 | 606 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
607 | 607 | } | |
608 | 608 | let y = $t02297623023._1 | |
609 | 609 | let found = $t02297623023._2 | |
610 | 610 | if ((found != unit)) | |
611 | 611 | then y | |
612 | 612 | else throw(("Y calculation error, Y = " + toString(y))) | |
613 | 613 | } | |
614 | 614 | ||
615 | 615 | ||
616 | 616 | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
617 | 617 | let updatedDLp = fraction(getD([t1BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)), t1BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))]), scale18, lpEmission) | |
618 | 618 | if ((lpEmission == big0)) | |
619 | 619 | then big0 | |
620 | 620 | else updatedDLp | |
621 | 621 | } | |
622 | 622 | ||
623 | 623 | ||
624 | 624 | func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
625 | 625 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
626 | 626 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
627 | 627 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
628 | 628 | let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
629 | 629 | currentDLp | |
630 | 630 | } | |
631 | 631 | ||
632 | 632 | ||
633 | 633 | func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
634 | 634 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
635 | 635 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
636 | 636 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
637 | 637 | let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
638 | 638 | let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))] | |
639 | 639 | $Tuple2(actions, updatedDLp) | |
640 | 640 | } | |
641 | 641 | ||
642 | 642 | ||
643 | 643 | func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp)) | |
644 | 644 | then true | |
645 | 645 | else throwErr("updated DLp lower than current DLp") | |
646 | 646 | ||
647 | 647 | ||
648 | 648 | func validateMatcherOrderAllowed (order) = { | |
649 | 649 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
650 | 650 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
651 | 651 | let amountAssetAmount = order.amount | |
652 | 652 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
653 | 653 | let $t02522125433 = if ((order.orderType == Buy)) | |
654 | 654 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
655 | 655 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
656 | 656 | let amountAssetBalanceDelta = $t02522125433._1 | |
657 | 657 | let priceAssetBalanceDelta = $t02522125433._2 | |
658 | 658 | if (if (if (igs()) | |
659 | 659 | then true | |
660 | 660 | else (cfgPoolStatus == PoolMatcherDis)) | |
661 | 661 | then true | |
662 | 662 | else (cfgPoolStatus == PoolShutdown)) | |
663 | 663 | then throw("Admin blocked") | |
664 | 664 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
665 | 665 | then true | |
666 | 666 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
667 | 667 | then throw("Wr assets") | |
668 | 668 | else { | |
669 | 669 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
670 | 670 | let $t02577525875 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
671 | 671 | let unusedActions = $t02577525875._1 | |
672 | 672 | let dLpNew = $t02577525875._2 | |
673 | 673 | let isOrderValid = (dLpNew >= dLp) | |
674 | 674 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
675 | 675 | $Tuple2(isOrderValid, info) | |
676 | 676 | } | |
677 | 677 | } | |
678 | 678 | ||
679 | 679 | ||
680 | 680 | func cg (i) = if ((size(i.payments) != 1)) | |
681 | 681 | then throw("1 pmnt exp") | |
682 | 682 | else { | |
683 | 683 | let pmt = value(i.payments[0]) | |
684 | 684 | let pmtAssetId = value(pmt.assetId) | |
685 | 685 | let pmtAmt = pmt.amount | |
686 | 686 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
687 | 687 | let outAmAmt = r._1 | |
688 | 688 | let outPrAmt = r._2 | |
689 | 689 | let sts = parseIntValue(r._9) | |
690 | 690 | let state = r._10 | |
691 | 691 | if (if (igs()) | |
692 | 692 | then true | |
693 | 693 | else (sts == PoolShutdown)) | |
694 | 694 | then throw(("Admin blocked: " + toString(sts))) | |
695 | 695 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
696 | 696 | } | |
697 | 697 | ||
698 | 698 | ||
699 | 699 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
700 | 700 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
701 | 701 | let sts = parseIntValue(r._8) | |
702 | 702 | if (if (if (igs()) | |
703 | 703 | then true | |
704 | 704 | else (sts == PoolPutDis)) | |
705 | 705 | then true | |
706 | 706 | else (sts == PoolShutdown)) | |
707 | 707 | then throw(("Blocked:" + toString(sts))) | |
708 | 708 | else r | |
709 | 709 | } | |
710 | 710 | ||
711 | 711 | ||
712 | 712 | func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = { | |
713 | 713 | let amId = toBase58String(value(cfgAmountAssetId)) | |
714 | 714 | let prId = toBase58String(value(cfgPriceAssetId)) | |
715 | 715 | let lpId = cfgLpAssetId | |
716 | 716 | let amtDcm = cfgAmountAssetDecimals | |
717 | 717 | let priceDcm = cfgPriceAssetDecimals | |
718 | 718 | let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(lpId), "invalid lp asset").quantity) | |
719 | 719 | let chechEmission = if ((lpAssetEmission > big0)) | |
720 | 720 | then true | |
721 | 721 | else throw("initial deposit requires all coins") | |
722 | 722 | if ((chechEmission == chechEmission)) | |
723 | 723 | then { | |
724 | 724 | let amBalance = getAccBalance(amId) | |
725 | 725 | let prBalance = getAccBalance(prId) | |
726 | 726 | let $t02853128993 = if ((txId == "")) | |
727 | 727 | then $Tuple2(amBalance, prBalance) | |
728 | 728 | else if ((pmtAssetId == amId)) | |
729 | 729 | then if ((pmtAmtRaw > amBalance)) | |
730 | 730 | then throw("invalid payment amount") | |
731 | 731 | else $Tuple2((amBalance - pmtAmtRaw), prBalance) | |
732 | 732 | else if ((pmtAssetId == prId)) | |
733 | 733 | then if ((pmtAmtRaw > prBalance)) | |
734 | 734 | then throw("invalid payment amount") | |
735 | 735 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
736 | 736 | else throw("wrong pmtAssetId") | |
737 | 737 | let amBalanceOld = $t02853128993._1 | |
738 | 738 | let prBalanceOld = $t02853128993._2 | |
739 | 739 | let $t02899929175 = if ((pmtAssetId == amId)) | |
740 | 740 | then $Tuple2(pmtAmtRaw, 0) | |
741 | 741 | else if ((pmtAssetId == prId)) | |
742 | 742 | then $Tuple2(0, pmtAmtRaw) | |
743 | 743 | else throw("invalid payment") | |
744 | 744 | let amAmountRaw = $t02899929175._1 | |
745 | 745 | let prAmountRaw = $t02899929175._2 | |
746 | 746 | let $t02917929433 = if (withTakeFee) | |
747 | 747 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
748 | 748 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
749 | 749 | let amAmount = $t02917929433._1 | |
750 | 750 | let prAmount = $t02917929433._2 | |
751 | 751 | let feeAmount = $t02917929433._3 | |
752 | 752 | let amBalanceNew = (amBalanceOld + amAmount) | |
753 | 753 | let prBalanceNew = (prBalanceOld + prAmount) | |
754 | 754 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
755 | 755 | let D1 = getD([t1(amBalanceNew, cfgAmountAssetDecimals), t1(prBalanceNew, cfgPriceAssetDecimals)]) | |
756 | 756 | let checkD = if ((D1 > D0)) | |
757 | 757 | then true | |
758 | 758 | else throw() | |
759 | 759 | if ((checkD == checkD)) | |
760 | 760 | then { | |
761 | 761 | let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR) | |
762 | 762 | let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8) | |
763 | 763 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmountRaw, prAmountRaw, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
764 | 764 | let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld) | |
765 | 765 | let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8)) | |
766 | 766 | let priceAssetPart = (pmtAmtRaw - amountAssetPart) | |
767 | 767 | let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld)) | |
768 | 768 | let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)) | |
769 | 769 | $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus) | |
770 | 770 | } | |
771 | 771 | else throw("Strict value is not equal to itself.") | |
772 | 772 | } | |
773 | 773 | else throw("Strict value is not equal to itself.") | |
774 | 774 | } | |
775 | 775 | ||
776 | 776 | ||
777 | 777 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = { | |
778 | 778 | let lpId = toBase58String(value(cfgLpAssetId)) | |
779 | 779 | let amId = toBase58String(value(cfgAmountAssetId)) | |
780 | 780 | let prId = toBase58String(value(cfgPriceAssetId)) | |
781 | 781 | let amDecimals = cfgAmountAssetDecimals | |
782 | 782 | let prDecimals = cfgPriceAssetDecimals | |
783 | 783 | let poolStatus = cfgPoolStatus | |
784 | 784 | let userAddress = if ((caller == restContract)) | |
785 | 785 | then originCaller | |
786 | 786 | else caller | |
787 | 787 | let pmt = value(payments[0]) | |
788 | 788 | let pmtAssetId = value(pmt.assetId) | |
789 | 789 | let pmtAmt = pmt.amount | |
790 | 790 | let currentDLp = calcCurrentDLp(big0, big0, big0) | |
791 | 791 | if ((currentDLp == currentDLp)) | |
792 | 792 | then { | |
793 | 793 | let txId58 = toBase58String(transactionId) | |
794 | 794 | if ((lpId != toBase58String(pmtAssetId))) | |
795 | 795 | then throw("Wrong LP") | |
796 | 796 | else { | |
797 | 797 | let amBalance = getAccBalance(amId) | |
798 | 798 | let prBalance = getAccBalance(prId) | |
799 | 799 | let $t03154531656 = { | |
800 | 800 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
801 | 801 | if ($isInstanceOf(@, "(Int, Int)")) | |
802 | 802 | then @ | |
803 | 803 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
804 | 804 | } | |
805 | 805 | if (($t03154531656 == $t03154531656)) | |
806 | 806 | then { | |
807 | 807 | let feeAmount = $t03154531656._2 | |
808 | 808 | let totalGet = $t03154531656._1 | |
809 | 809 | let totalAmount = if (if ((minOutAmount > 0)) | |
810 | 810 | then (minOutAmount > totalGet) | |
811 | 811 | else false) | |
812 | 812 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
813 | 813 | else totalGet | |
814 | 814 | let $t03184632153 = if ((outAssetId == amId)) | |
815 | 815 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
816 | 816 | else if ((outAssetId == prId)) | |
817 | 817 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
818 | 818 | else throw("invalid out asset id") | |
819 | 819 | let outAm = $t03184632153._1 | |
820 | 820 | let outPr = $t03184632153._2 | |
821 | 821 | let amBalanceNew = $t03184632153._3 | |
822 | 822 | let prBalanceNew = $t03184632153._4 | |
823 | 823 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
824 | 824 | let curPr = f1(curPrX18, scale8) | |
825 | 825 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
826 | 826 | then unit | |
827 | 827 | else fromBase58String(outAssetId) | |
828 | 828 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
829 | 829 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
830 | 830 | else nil | |
831 | 831 | let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher) | |
832 | 832 | if ((state == state)) | |
833 | 833 | then { | |
834 | 834 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
835 | 835 | if ((burn == burn)) | |
836 | 836 | then { | |
837 | 837 | let $t03293833288 = { | |
838 | 838 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
839 | 839 | then 0 | |
840 | 840 | else feeAmount | |
841 | 841 | let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId)) | |
842 | 842 | then true | |
843 | 843 | else false | |
844 | 844 | if (outInAmountAsset) | |
845 | 845 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
846 | 846 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
847 | 847 | } | |
848 | 848 | let amountAssetBalanceDelta = $t03293833288._1 | |
849 | 849 | let priceAssetBalanceDelta = $t03293833288._2 | |
850 | 850 | let $t03329133399 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
851 | 851 | let refreshDLpActions = $t03329133399._1 | |
852 | 852 | let updatedDLp = $t03329133399._2 | |
853 | 853 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
854 | 854 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
855 | 855 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
856 | 856 | else throw("Strict value is not equal to itself.") | |
857 | 857 | } | |
858 | 858 | else throw("Strict value is not equal to itself.") | |
859 | 859 | } | |
860 | 860 | else throw("Strict value is not equal to itself.") | |
861 | 861 | } | |
862 | 862 | else throw("Strict value is not equal to itself.") | |
863 | 863 | } | |
864 | 864 | } | |
865 | 865 | else throw("Strict value is not equal to itself.") | |
866 | 866 | } | |
867 | 867 | ||
868 | 868 | ||
869 | 869 | func managerPublicKeyOrUnit () = { | |
870 | 870 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
871 | 871 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
872 | 872 | case s: String => | |
873 | 873 | fromBase58String(s) | |
874 | 874 | case _: Unit => | |
875 | 875 | unit | |
876 | 876 | case _ => | |
877 | 877 | throw("Match error") | |
878 | 878 | } | |
879 | 879 | } | |
880 | 880 | ||
881 | 881 | ||
882 | 882 | let pd = throw("Permission denied") | |
883 | 883 | ||
884 | 884 | func isManager (i) = match managerPublicKeyOrUnit() { | |
885 | 885 | case pk: ByteVector => | |
886 | 886 | (i.callerPublicKey == pk) | |
887 | 887 | case _: Unit => | |
888 | 888 | (i.caller == this) | |
889 | 889 | case _ => | |
890 | 890 | throw("Match error") | |
891 | 891 | } | |
892 | 892 | ||
893 | 893 | ||
894 | 894 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
895 | 895 | case pk: ByteVector => | |
896 | 896 | if ((i.callerPublicKey == pk)) | |
897 | 897 | then true | |
898 | 898 | else pd | |
899 | 899 | case _: Unit => | |
900 | 900 | if ((i.caller == this)) | |
901 | 901 | then true | |
902 | 902 | else pd | |
903 | 903 | case _ => | |
904 | 904 | throw("Match error") | |
905 | 905 | } | |
906 | 906 | ||
907 | 907 | ||
908 | 908 | func getY (isReverse,D,poolAmountInBalance) = { | |
909 | 909 | let poolConfig = gpc() | |
910 | 910 | let amId = poolConfig[idxAmAsId] | |
911 | 911 | let prId = poolConfig[idxPrAsId] | |
912 | 912 | let n = big2 | |
913 | 913 | let aPrecision = parseBigIntValue(Amult) | |
914 | 914 | let a = (parseBigIntValue(A) * aPrecision) | |
915 | 915 | let xp = if ((isReverse == false)) | |
916 | 916 | then [(toBigInt(getAccBalance(amId)) + poolAmountInBalance), toBigInt(getAccBalance(prId))] | |
917 | 917 | else [(toBigInt(getAccBalance(prId)) + poolAmountInBalance), toBigInt(getAccBalance(amId))] | |
918 | 918 | let x = xp[0] | |
919 | 919 | let s = x | |
920 | 920 | let ann = (a * n) | |
921 | 921 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
922 | 922 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
923 | 923 | func calc (acc,cur) = { | |
924 | 924 | let $t03488634906 = acc | |
925 | 925 | let y = $t03488634906._1 | |
926 | 926 | let found = $t03488634906._2 | |
927 | 927 | if ((found != unit)) | |
928 | 928 | then acc | |
929 | 929 | else { | |
930 | 930 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
931 | 931 | let yDiff = absBigInt((yNext - value(y))) | |
932 | 932 | if ((big1 >= yDiff)) | |
933 | 933 | then $Tuple2(yNext, cur) | |
934 | 934 | else $Tuple2(yNext, unit) | |
935 | 935 | } | |
936 | 936 | } | |
937 | 937 | ||
938 | 938 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
939 | 939 | let $t03523735284 = { | |
940 | 940 | let $l = arr | |
941 | 941 | let $s = size($l) | |
942 | 942 | let $acc0 = $Tuple2(D, unit) | |
943 | 943 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
944 | 944 | then $a | |
945 | 945 | else calc($a, $l[$i]) | |
946 | 946 | ||
947 | 947 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
948 | 948 | then $a | |
949 | 949 | else throw("List size exceeds 15") | |
950 | 950 | ||
951 | 951 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
952 | 952 | } | |
953 | 953 | let y = $t03523735284._1 | |
954 | 954 | let found = $t03523735284._2 | |
955 | 955 | if ((found != unit)) | |
956 | 956 | then y | |
957 | 957 | else throw(("Y calculation error, Y = " + toString(y))) | |
958 | 958 | } | |
959 | 959 | ||
960 | 960 | ||
961 | 961 | func skipOrderValidation () = valueOrElse(getBoolean(fca, keySkipOrderValidation(toString(this))), false) | |
962 | 962 | ||
963 | 963 | ||
964 | 964 | @Callable(i) | |
965 | 965 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
966 | 966 | let $t03563636060 = if ((isReverse == false)) | |
967 | 967 | then { | |
968 | 968 | let assetOut = strf(this, pa()) | |
969 | 969 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
970 | 970 | $Tuple2(assetOut, poolAmountInBalance) | |
971 | 971 | } | |
972 | 972 | else { | |
973 | 973 | let assetOut = strf(this, aa()) | |
974 | 974 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
975 | 975 | $Tuple2(assetOut, poolAmountInBalance) | |
976 | 976 | } | |
977 | 977 | let assetOut = $t03563636060._1 | |
978 | 978 | let poolAmountInBalance = $t03563636060._2 | |
979 | 979 | let poolConfig = gpc() | |
980 | 980 | let amId = poolConfig[idxAmAsId] | |
981 | 981 | let prId = poolConfig[idxPrAsId] | |
982 | 982 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
983 | 983 | let D = getD(xp) | |
984 | 984 | let y = getY(isReverse, D, toBigInt(cleanAmountIn)) | |
985 | 985 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
986 | 986 | let totalGetRaw = max([0, toInt(dy)]) | |
987 | 987 | let newXp = if ((isReverse == false)) | |
988 | 988 | then [((toBigInt(getAccBalance(amId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
989 | 989 | else [(toBigInt(getAccBalance(amId)) - dy), ((toBigInt(getAccBalance(prId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount))] | |
990 | 990 | let newD = getD(newXp) | |
991 | 991 | let checkD = if ((newD >= D)) | |
992 | 992 | then true | |
993 | 993 | else throw(makeString(["new D is fewer error", toString(D), toString(newD)], "__")) | |
994 | 994 | if ((checkD == checkD)) | |
995 | 995 | then $Tuple2(nil, totalGetRaw) | |
996 | 996 | else throw("Strict value is not equal to itself.") | |
997 | 997 | } | |
998 | 998 | ||
999 | 999 | ||
1000 | 1000 | ||
1001 | 1001 | @Callable(i) | |
1002 | 1002 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
1003 | 1003 | let swapContact = { | |
1004 | 1004 | let @ = invoke(fca, "getSwapContractREADONLY", nil, nil) | |
1005 | 1005 | if ($isInstanceOf(@, "String")) | |
1006 | 1006 | then @ | |
1007 | 1007 | else throw(($getType(@) + " couldn't be cast to String")) | |
1008 | 1008 | } | |
1009 | - | let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
1009 | + | let isPoolSwapDisabled = { | |
1010 | + | let @ = invoke(fca, "isPoolSwapDisabledREADONLY", [toString(this)], nil) | |
1011 | + | if ($isInstanceOf(@, "Boolean")) | |
1012 | + | then @ | |
1013 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1014 | + | } | |
1015 | + | let isSwapDisabled = if (if (igs()) | |
1016 | + | then true | |
1017 | + | else (cfgPoolStatus == PoolShutdown)) | |
1018 | + | then true | |
1019 | + | else isPoolSwapDisabled | |
1020 | + | let checks = [if (if (!(isSwapDisabled)) | |
1021 | + | then true | |
1022 | + | else isManager(i)) | |
1023 | + | then true | |
1024 | + | else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
1010 | 1025 | then true | |
1011 | 1026 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
1012 | 1027 | then true | |
1013 | 1028 | else throwErr("Permission denied")] | |
1014 | 1029 | if ((checks == checks)) | |
1015 | 1030 | then { | |
1016 | 1031 | let pmt = value(i.payments[0]) | |
1017 | 1032 | let assetIn = assetIdToString(pmt.assetId) | |
1018 | - | let $ | |
1033 | + | let $t03779538189 = if ((isReverse == false)) | |
1019 | 1034 | then { | |
1020 | 1035 | let assetOut = strf(this, pa()) | |
1021 | 1036 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1022 | 1037 | $Tuple2(assetOut, poolAmountInBalance) | |
1023 | 1038 | } | |
1024 | 1039 | else { | |
1025 | 1040 | let assetOut = strf(this, aa()) | |
1026 | 1041 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1027 | 1042 | $Tuple2(assetOut, poolAmountInBalance) | |
1028 | 1043 | } | |
1029 | - | let assetOut = $ | |
1030 | - | let poolAmountInBalance = $ | |
1044 | + | let assetOut = $t03779538189._1 | |
1045 | + | let poolAmountInBalance = $t03779538189._2 | |
1031 | 1046 | let poolConfig = gpc() | |
1032 | 1047 | let amId = poolConfig[idxAmAsId] | |
1033 | 1048 | let prId = poolConfig[idxPrAsId] | |
1034 | 1049 | let xp = if ((isReverse == false)) | |
1035 | 1050 | then [(toBigInt(getAccBalance(amId)) - toBigInt(value(i.payments[0]).amount)), toBigInt(getAccBalance(prId))] | |
1036 | 1051 | else [toBigInt(getAccBalance(amId)), (toBigInt(getAccBalance(prId)) - toBigInt(value(i.payments[0]).amount))] | |
1037 | 1052 | let D = getD(xp) | |
1038 | 1053 | let y = getY(isReverse, D, toBigInt(0)) | |
1039 | 1054 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
1040 | 1055 | let totalGetRaw = max([0, toInt(dy)]) | |
1041 | 1056 | let checkMin = if ((totalGetRaw >= amountOutMin)) | |
1042 | 1057 | then true | |
1043 | 1058 | else throw("Exchange result is fewer coins than expected") | |
1044 | 1059 | if ((checkMin == checkMin)) | |
1045 | 1060 | then { | |
1046 | 1061 | let newXp = if ((isReverse == false)) | |
1047 | 1062 | then [(toBigInt(getAccBalance(amId)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
1048 | 1063 | else [(toBigInt(getAccBalance(amId)) - dy), (toBigInt(getAccBalance(prId)) + toBigInt(feePoolAmount))] | |
1049 | 1064 | let newD = getD(newXp) | |
1050 | 1065 | let checkD = if ((newD >= D)) | |
1051 | 1066 | then true | |
1052 | 1067 | else throw("new D is fewer error") | |
1053 | 1068 | if ((checkD == checkD)) | |
1054 | 1069 | then { | |
1055 | 1070 | let amountAssetBalanceDelta = if (isReverse) | |
1056 | 1071 | then -(totalGetRaw) | |
1057 | 1072 | else feePoolAmount | |
1058 | 1073 | let priceAssetBalanceDelta = if (isReverse) | |
1059 | 1074 | then feePoolAmount | |
1060 | 1075 | else -(totalGetRaw) | |
1061 | 1076 | let refreshDLpActions = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1 | |
1062 | 1077 | if ((refreshDLpActions == refreshDLpActions)) | |
1063 | 1078 | then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), totalGetRaw, parseAssetId(assetOut))], totalGetRaw) | |
1064 | 1079 | else throw("Strict value is not equal to itself.") | |
1065 | 1080 | } | |
1066 | 1081 | else throw("Strict value is not equal to itself.") | |
1067 | 1082 | } | |
1068 | 1083 | else throw("Strict value is not equal to itself.") | |
1069 | 1084 | } | |
1070 | 1085 | else throw("Strict value is not equal to itself.") | |
1071 | 1086 | } | |
1072 | 1087 | ||
1073 | 1088 | ||
1074 | 1089 | ||
1075 | 1090 | @Callable(i) | |
1076 | 1091 | func constructor (fc) = { | |
1077 | 1092 | let c = mustManager(i) | |
1078 | 1093 | if ((c == c)) | |
1079 | 1094 | then [StringEntry(fc(), fc)] | |
1080 | 1095 | else throw("Strict value is not equal to itself.") | |
1081 | 1096 | } | |
1082 | 1097 | ||
1083 | 1098 | ||
1084 | 1099 | ||
1085 | 1100 | @Callable(i) | |
1086 | 1101 | func put (slip,autoStake) = { | |
1087 | 1102 | let factCfg = gfc() | |
1088 | 1103 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
1089 | 1104 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
1090 | 1105 | if ((0 > slip)) | |
1091 | 1106 | then throw("Wrong slippage") | |
1092 | 1107 | else if ((size(i.payments) != 2)) | |
1093 | 1108 | then throw("2 pmnts expd") | |
1094 | 1109 | else { | |
1095 | 1110 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1096 | 1111 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1097 | 1112 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt) | |
1098 | 1113 | if ((amountAssetBalance == amountAssetBalance)) | |
1099 | 1114 | then { | |
1100 | 1115 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt) | |
1101 | 1116 | if ((priceAssetBalance == priceAssetBalance)) | |
1102 | 1117 | then { | |
1103 | 1118 | let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity) | |
1104 | 1119 | if ((lpAssetEmission == lpAssetEmission)) | |
1105 | 1120 | then { | |
1106 | 1121 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1107 | 1122 | if ((currentDLp == currentDLp)) | |
1108 | 1123 | then { | |
1109 | 1124 | let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "") | |
1110 | 1125 | let emitLpAmt = e._2 | |
1111 | 1126 | let lpAssetId = e._7 | |
1112 | 1127 | let state = e._9 | |
1113 | 1128 | let amDiff = e._10 | |
1114 | 1129 | let prDiff = e._11 | |
1115 | 1130 | let amId = e._12 | |
1116 | 1131 | let prId = e._13 | |
1117 | 1132 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
1118 | 1133 | if ((r == r)) | |
1119 | 1134 | then { | |
1120 | 1135 | let el = match r { | |
1121 | 1136 | case legacy: Address => | |
1122 | 1137 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1123 | 1138 | case _ => | |
1124 | 1139 | unit | |
1125 | 1140 | } | |
1126 | 1141 | if ((el == el)) | |
1127 | 1142 | then { | |
1128 | 1143 | let sa = if ((amDiff > 0)) | |
1129 | 1144 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1130 | 1145 | else nil | |
1131 | 1146 | if ((sa == sa)) | |
1132 | 1147 | then { | |
1133 | 1148 | let sp = if ((prDiff > 0)) | |
1134 | 1149 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1135 | 1150 | else nil | |
1136 | 1151 | if ((sp == sp)) | |
1137 | 1152 | then { | |
1138 | 1153 | let lpTrnsfr = if (autoStake) | |
1139 | 1154 | then { | |
1140 | 1155 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1141 | 1156 | if ((ss == ss)) | |
1142 | 1157 | then nil | |
1143 | 1158 | else throw("Strict value is not equal to itself.") | |
1144 | 1159 | } | |
1145 | 1160 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1146 | - | let $ | |
1147 | - | let refreshDLpActions = $ | |
1148 | - | let updatedDLp = $ | |
1161 | + | let $t04264442786 = refreshDLpInternal(0, 0, 0) | |
1162 | + | let refreshDLpActions = $t04264442786._1 | |
1163 | + | let updatedDLp = $t04264442786._2 | |
1149 | 1164 | let check = if ((updatedDLp >= currentDLp)) | |
1150 | 1165 | then true | |
1151 | 1166 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1152 | 1167 | if ((check == check)) | |
1153 | 1168 | then { | |
1154 | 1169 | let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity | |
1155 | 1170 | if ((lpAssetEmissionAfter == lpAssetEmissionAfter)) | |
1156 | 1171 | then ((state ++ lpTrnsfr) ++ refreshDLpActions) | |
1157 | 1172 | else throw("Strict value is not equal to itself.") | |
1158 | 1173 | } | |
1159 | 1174 | else throw("Strict value is not equal to itself.") | |
1160 | 1175 | } | |
1161 | 1176 | else throw("Strict value is not equal to itself.") | |
1162 | 1177 | } | |
1163 | 1178 | else throw("Strict value is not equal to itself.") | |
1164 | 1179 | } | |
1165 | 1180 | else throw("Strict value is not equal to itself.") | |
1166 | 1181 | } | |
1167 | 1182 | else throw("Strict value is not equal to itself.") | |
1168 | 1183 | } | |
1169 | 1184 | else throw("Strict value is not equal to itself.") | |
1170 | 1185 | } | |
1171 | 1186 | else throw("Strict value is not equal to itself.") | |
1172 | 1187 | } | |
1173 | 1188 | else throw("Strict value is not equal to itself.") | |
1174 | 1189 | } | |
1175 | 1190 | else throw("Strict value is not equal to itself.") | |
1176 | 1191 | } | |
1177 | 1192 | } | |
1178 | 1193 | ||
1179 | 1194 | ||
1180 | 1195 | ||
1181 | 1196 | @Callable(i) | |
1182 | 1197 | func putOneTknV2 (minOutAmount,autoStake) = { | |
1183 | 1198 | let isPoolOneTokenOperationsDisabled = { | |
1184 | 1199 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1185 | 1200 | if ($isInstanceOf(@, "Boolean")) | |
1186 | 1201 | then @ | |
1187 | 1202 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1188 | 1203 | } | |
1189 | 1204 | let isPutDisabled = if (if (if (igs()) | |
1190 | 1205 | then true | |
1191 | 1206 | else (cfgPoolStatus == PoolPutDis)) | |
1192 | 1207 | then true | |
1193 | 1208 | else (cfgPoolStatus == PoolShutdown)) | |
1194 | 1209 | then true | |
1195 | 1210 | else isPoolOneTokenOperationsDisabled | |
1196 | 1211 | let checks = [if (if (!(isPutDisabled)) | |
1197 | 1212 | then true | |
1198 | 1213 | else isManager(i)) | |
1199 | 1214 | then true | |
1200 | 1215 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1201 | 1216 | then true | |
1202 | 1217 | else throwErr("exactly 1 payment are expected")] | |
1203 | 1218 | if ((checks == checks)) | |
1204 | 1219 | then { | |
1205 | 1220 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1206 | 1221 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1207 | 1222 | let lpId = cfgLpAssetId | |
1208 | 1223 | let amDecimals = cfgAmountAssetDecimals | |
1209 | 1224 | let prDecimals = cfgPriceAssetDecimals | |
1210 | 1225 | let userAddress = if ((i.caller == this)) | |
1211 | 1226 | then i.originCaller | |
1212 | 1227 | else i.caller | |
1213 | 1228 | let pmt = value(i.payments[0]) | |
1214 | 1229 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
1215 | 1230 | let pmtAmt = pmt.amount | |
1216 | 1231 | let currentDLp = if ((pmt.assetId == cfgAmountAssetId)) | |
1217 | 1232 | then calcCurrentDLp(toBigInt(pmtAmt), toBigInt(0), toBigInt(0)) | |
1218 | 1233 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1219 | 1234 | if ((currentDLp == currentDLp)) | |
1220 | 1235 | then { | |
1221 | - | let $ | |
1222 | - | if (($ | |
1236 | + | let $t04442744585 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1237 | + | if (($t04442744585 == $t04442744585)) | |
1223 | 1238 | then { | |
1224 | - | let feeAmount = $ | |
1225 | - | let state = $ | |
1226 | - | let estimLP = $ | |
1239 | + | let feeAmount = $t04442744585._3 | |
1240 | + | let state = $t04442744585._2 | |
1241 | + | let estimLP = $t04442744585._1 | |
1227 | 1242 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1228 | 1243 | then (minOutAmount > estimLP) | |
1229 | 1244 | else false) | |
1230 | 1245 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1231 | 1246 | else estimLP | |
1232 | 1247 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
1233 | 1248 | if ((e == e)) | |
1234 | 1249 | then { | |
1235 | 1250 | let el = match e { | |
1236 | 1251 | case legacy: Address => | |
1237 | 1252 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1238 | 1253 | case _ => | |
1239 | 1254 | unit | |
1240 | 1255 | } | |
1241 | 1256 | if ((el == el)) | |
1242 | 1257 | then { | |
1243 | 1258 | let lpTrnsfr = if (autoStake) | |
1244 | 1259 | then { | |
1245 | 1260 | let ss = invoke(stakingContract, "stakeFor", [toString(i.caller)], [AttachedPayment(lpId, emitLpAmt)]) | |
1246 | 1261 | if ((ss == ss)) | |
1247 | 1262 | then nil | |
1248 | 1263 | else throw("Strict value is not equal to itself.") | |
1249 | 1264 | } | |
1250 | 1265 | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
1251 | 1266 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1252 | 1267 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1253 | 1268 | else nil | |
1254 | - | let $ | |
1269 | + | let $t04547045819 = if ((this == feeCollectorAddress)) | |
1255 | 1270 | then $Tuple2(0, 0) | |
1256 | 1271 | else { | |
1257 | 1272 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1258 | 1273 | then true | |
1259 | 1274 | else false | |
1260 | 1275 | if (paymentInAmountAsset) | |
1261 | 1276 | then $Tuple2(-(feeAmount), 0) | |
1262 | 1277 | else $Tuple2(0, -(feeAmount)) | |
1263 | 1278 | } | |
1264 | - | let amountAssetBalanceDelta = $ | |
1265 | - | let priceAssetBalanceDelta = $ | |
1266 | - | let $ | |
1267 | - | let refreshDLpActions = $ | |
1268 | - | let updatedDLp = $ | |
1279 | + | let amountAssetBalanceDelta = $t04547045819._1 | |
1280 | + | let priceAssetBalanceDelta = $t04547045819._2 | |
1281 | + | let $t04582245930 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1282 | + | let refreshDLpActions = $t04582245930._1 | |
1283 | + | let updatedDLp = $t04582245930._2 | |
1269 | 1284 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1270 | 1285 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1271 | 1286 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1272 | 1287 | else throw("Strict value is not equal to itself.") | |
1273 | 1288 | } | |
1274 | 1289 | else throw("Strict value is not equal to itself.") | |
1275 | 1290 | } | |
1276 | 1291 | else throw("Strict value is not equal to itself.") | |
1277 | 1292 | } | |
1278 | 1293 | else throw("Strict value is not equal to itself.") | |
1279 | 1294 | } | |
1280 | 1295 | else throw("Strict value is not equal to itself.") | |
1281 | 1296 | } | |
1282 | 1297 | else throw("Strict value is not equal to itself.") | |
1283 | 1298 | } | |
1284 | 1299 | ||
1285 | 1300 | ||
1286 | 1301 | ||
1287 | 1302 | @Callable(i) | |
1288 | 1303 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
1289 | 1304 | then throw("Wrong slpg") | |
1290 | 1305 | else if ((size(i.payments) != 2)) | |
1291 | 1306 | then throw("2 pmnts expd") | |
1292 | 1307 | else { | |
1293 | 1308 | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "") | |
1294 | 1309 | let state = estPut._9 | |
1295 | 1310 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1296 | 1311 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1297 | 1312 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1298 | 1313 | if ((currentDLp == currentDLp)) | |
1299 | 1314 | then { | |
1300 | - | let $ | |
1301 | - | let refreshDLpActions = $ | |
1302 | - | let updatedDLp = $ | |
1315 | + | let $t04696047025 = refreshDLpInternal(0, 0, 0) | |
1316 | + | let refreshDLpActions = $t04696047025._1 | |
1317 | + | let updatedDLp = $t04696047025._2 | |
1303 | 1318 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1304 | 1319 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1305 | 1320 | then (state ++ refreshDLpActions) | |
1306 | 1321 | else throw("Strict value is not equal to itself.") | |
1307 | 1322 | } | |
1308 | 1323 | else throw("Strict value is not equal to itself.") | |
1309 | 1324 | } | |
1310 | 1325 | ||
1311 | 1326 | ||
1312 | 1327 | ||
1313 | 1328 | @Callable(i) | |
1314 | 1329 | func get () = { | |
1315 | 1330 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1316 | 1331 | if ((currentDLp == currentDLp)) | |
1317 | 1332 | then { | |
1318 | 1333 | let r = cg(i) | |
1319 | 1334 | let outAmtAmt = r._1 | |
1320 | 1335 | let outPrAmt = r._2 | |
1321 | 1336 | let pmtAmt = r._3 | |
1322 | 1337 | let pmtAssetId = r._4 | |
1323 | 1338 | let state = r._5 | |
1324 | 1339 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1325 | 1340 | if ((b == b)) | |
1326 | 1341 | then { | |
1327 | - | let $ | |
1328 | - | let refreshDLpActions = $ | |
1329 | - | let updatedDLp = $ | |
1342 | + | let $t04819848280 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1343 | + | let refreshDLpActions = $t04819848280._1 | |
1344 | + | let updatedDLp = $t04819848280._2 | |
1330 | 1345 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1331 | 1346 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1332 | 1347 | then (state ++ refreshDLpActions) | |
1333 | 1348 | else throw("Strict value is not equal to itself.") | |
1334 | 1349 | } | |
1335 | 1350 | else throw("Strict value is not equal to itself.") | |
1336 | 1351 | } | |
1337 | 1352 | else throw("Strict value is not equal to itself.") | |
1338 | 1353 | } | |
1339 | 1354 | ||
1340 | 1355 | ||
1341 | 1356 | ||
1342 | 1357 | @Callable(i) | |
1343 | 1358 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1344 | 1359 | let isPoolOneTokenOperationsDisabled = { | |
1345 | 1360 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1346 | 1361 | if ($isInstanceOf(@, "Boolean")) | |
1347 | 1362 | then @ | |
1348 | 1363 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1349 | 1364 | } | |
1350 | 1365 | let isGetDisabled = if (if (igs()) | |
1351 | 1366 | then true | |
1352 | 1367 | else (cfgPoolStatus == PoolShutdown)) | |
1353 | 1368 | then true | |
1354 | 1369 | else isPoolOneTokenOperationsDisabled | |
1355 | 1370 | let checks = [if (if (!(isGetDisabled)) | |
1356 | 1371 | then true | |
1357 | 1372 | else isManager(i)) | |
1358 | 1373 | then true | |
1359 | 1374 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1360 | 1375 | then true | |
1361 | 1376 | else throwErr("exactly 1 payment are expected")] | |
1362 | 1377 | if ((checks == checks)) | |
1363 | 1378 | then { | |
1364 | - | let $ | |
1365 | - | let state = $ | |
1366 | - | let totalAmount = $ | |
1379 | + | let $t04889849053 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1380 | + | let state = $t04889849053._1 | |
1381 | + | let totalAmount = $t04889849053._2 | |
1367 | 1382 | $Tuple2(state, totalAmount) | |
1368 | 1383 | } | |
1369 | 1384 | else throw("Strict value is not equal to itself.") | |
1370 | 1385 | } | |
1371 | 1386 | ||
1372 | 1387 | ||
1373 | 1388 | ||
1374 | 1389 | @Callable(i) | |
1375 | 1390 | func refreshDLp () = { | |
1376 | 1391 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0) | |
1377 | 1392 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay)) | |
1378 | 1393 | then unit | |
1379 | 1394 | else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1380 | 1395 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1381 | 1396 | then { | |
1382 | 1397 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1383 | - | let $ | |
1384 | - | let dLpUpdateActions = $ | |
1385 | - | let updatedDLp = $ | |
1398 | + | let $t04957749641 = refreshDLpInternal(0, 0, 0) | |
1399 | + | let dLpUpdateActions = $t04957749641._1 | |
1400 | + | let updatedDLp = $t04957749641._2 | |
1386 | 1401 | let actions = if ((dLp != updatedDLp)) | |
1387 | 1402 | then dLpUpdateActions | |
1388 | 1403 | else throwErr("nothing to refresh") | |
1389 | 1404 | $Tuple2(actions, toString(updatedDLp)) | |
1390 | 1405 | } | |
1391 | 1406 | else throw("Strict value is not equal to itself.") | |
1392 | 1407 | } | |
1393 | 1408 | ||
1394 | 1409 | ||
1395 | 1410 | ||
1396 | 1411 | @Callable(i) | |
1397 | 1412 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1398 | 1413 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1399 | 1414 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1400 | 1415 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1401 | 1416 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
1402 | 1417 | let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
1403 | 1418 | let D0 = getD(xp) | |
1404 | 1419 | let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission)) | |
1405 | 1420 | let index = if ((outAssetId == amId)) | |
1406 | 1421 | then 0 | |
1407 | 1422 | else if ((outAssetId == prId)) | |
1408 | 1423 | then 1 | |
1409 | 1424 | else throw("invalid out asset id") | |
1410 | 1425 | let newY = getYD(xp, index, D1) | |
1411 | 1426 | let dy = (xp[index] - newY) | |
1412 | 1427 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1413 | - | let $ | |
1414 | - | let totalGet = $ | |
1415 | - | let feeAmount = $ | |
1428 | + | let $t05065150706 = takeFee(totalGetRaw, outFee) | |
1429 | + | let totalGet = $t05065150706._1 | |
1430 | + | let feeAmount = $t05065150706._2 | |
1416 | 1431 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1417 | 1432 | } | |
1418 | 1433 | ||
1419 | 1434 | ||
1420 | 1435 | ||
1421 | 1436 | @Callable(i) | |
1422 | 1437 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1423 | 1438 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1424 | 1439 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1425 | 1440 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1426 | 1441 | let amBalance = getAccBalance(amId) | |
1427 | 1442 | let prBalance = getAccBalance(prId) | |
1428 | - | let $ | |
1443 | + | let $t05108151196 = { | |
1429 | 1444 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1430 | 1445 | if ($isInstanceOf(@, "(Int, Int)")) | |
1431 | 1446 | then @ | |
1432 | 1447 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1433 | 1448 | } | |
1434 | - | let totalGet = $ | |
1435 | - | let feeAmount = $ | |
1449 | + | let totalGet = $t05108151196._1 | |
1450 | + | let feeAmount = $t05108151196._2 | |
1436 | 1451 | let r = ego("", lpId, lpAssetAmount, this) | |
1437 | 1452 | let outAmAmt = r._1 | |
1438 | 1453 | let outPrAmt = r._2 | |
1439 | 1454 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1440 | 1455 | let bonus = if ((sumOfGetAssets == 0)) | |
1441 | 1456 | then if ((totalGet == 0)) | |
1442 | 1457 | then 0 | |
1443 | 1458 | else throw("bonus calculation error") | |
1444 | 1459 | else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1445 | 1460 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1446 | 1461 | } | |
1447 | 1462 | ||
1448 | 1463 | ||
1449 | 1464 | ||
1450 | 1465 | @Callable(i) | |
1451 | 1466 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1452 | 1467 | let r = cg(i) | |
1453 | 1468 | let outAmAmt = r._1 | |
1454 | 1469 | let outPrAmt = r._2 | |
1455 | 1470 | let pmtAmt = r._3 | |
1456 | 1471 | let pmtAssetId = r._4 | |
1457 | 1472 | let state = r._5 | |
1458 | 1473 | if ((noLessThenAmtAsset > outAmAmt)) | |
1459 | 1474 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1460 | 1475 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1461 | 1476 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1462 | 1477 | else { | |
1463 | 1478 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1464 | 1479 | if ((currentDLp == currentDLp)) | |
1465 | 1480 | then { | |
1466 | 1481 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1467 | 1482 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1468 | 1483 | then { | |
1469 | - | let $ | |
1470 | - | let refreshDLpActions = $ | |
1471 | - | let updatedDLp = $ | |
1484 | + | let $t05236252443 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1485 | + | let refreshDLpActions = $t05236252443._1 | |
1486 | + | let updatedDLp = $t05236252443._2 | |
1472 | 1487 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1473 | 1488 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1474 | 1489 | then (state ++ refreshDLpActions) | |
1475 | 1490 | else throw("Strict value is not equal to itself.") | |
1476 | 1491 | } | |
1477 | 1492 | else throw("Strict value is not equal to itself.") | |
1478 | 1493 | } | |
1479 | 1494 | else throw("Strict value is not equal to itself.") | |
1480 | 1495 | } | |
1481 | 1496 | } | |
1482 | 1497 | ||
1483 | 1498 | ||
1484 | 1499 | ||
1485 | 1500 | @Callable(i) | |
1486 | 1501 | func unstakeAndGet (amount) = { | |
1487 | 1502 | let checkPayments = if ((size(i.payments) != 0)) | |
1488 | 1503 | then throw("No pmnts expd") | |
1489 | 1504 | else true | |
1490 | 1505 | if ((checkPayments == checkPayments)) | |
1491 | 1506 | then { | |
1492 | 1507 | let factoryCfg = gfc() | |
1493 | 1508 | let lpAssetId = cfgLpAssetId | |
1494 | 1509 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1495 | 1510 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1496 | 1511 | if ((currentDLp == currentDLp)) | |
1497 | 1512 | then { | |
1498 | 1513 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1499 | 1514 | if ((unstakeInv == unstakeInv)) | |
1500 | 1515 | then { | |
1501 | 1516 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1502 | 1517 | let outAmAmt = r._1 | |
1503 | 1518 | let outPrAmt = r._2 | |
1504 | 1519 | let sts = parseIntValue(r._9) | |
1505 | 1520 | let state = r._10 | |
1506 | 1521 | let v = if (if (igs()) | |
1507 | 1522 | then true | |
1508 | 1523 | else (sts == PoolShutdown)) | |
1509 | 1524 | then throw(("Blocked: " + toString(sts))) | |
1510 | 1525 | else true | |
1511 | 1526 | if ((v == v)) | |
1512 | 1527 | then { | |
1513 | 1528 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1514 | 1529 | if ((burnA == burnA)) | |
1515 | 1530 | then { | |
1516 | - | let $ | |
1517 | - | let refreshDLpActions = $ | |
1518 | - | let updatedDLp = $ | |
1531 | + | let $t05347053551 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1532 | + | let refreshDLpActions = $t05347053551._1 | |
1533 | + | let updatedDLp = $t05347053551._2 | |
1519 | 1534 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1520 | 1535 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1521 | 1536 | then (state ++ refreshDLpActions) | |
1522 | 1537 | else throw("Strict value is not equal to itself.") | |
1523 | 1538 | } | |
1524 | 1539 | else throw("Strict value is not equal to itself.") | |
1525 | 1540 | } | |
1526 | 1541 | else throw("Strict value is not equal to itself.") | |
1527 | 1542 | } | |
1528 | 1543 | else throw("Strict value is not equal to itself.") | |
1529 | 1544 | } | |
1530 | 1545 | else throw("Strict value is not equal to itself.") | |
1531 | 1546 | } | |
1532 | 1547 | else throw("Strict value is not equal to itself.") | |
1533 | 1548 | } | |
1534 | 1549 | ||
1535 | 1550 | ||
1536 | 1551 | ||
1537 | 1552 | @Callable(i) | |
1538 | 1553 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1539 | 1554 | let isGetDisabled = if (igs()) | |
1540 | 1555 | then true | |
1541 | 1556 | else (cfgPoolStatus == PoolShutdown) | |
1542 | 1557 | let checks = [if (!(isGetDisabled)) | |
1543 | 1558 | then true | |
1544 | 1559 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1545 | 1560 | then true | |
1546 | 1561 | else throw("no payments are expected")] | |
1547 | 1562 | if ((checks == checks)) | |
1548 | 1563 | then { | |
1549 | 1564 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1550 | 1565 | if ((currentDLp == currentDLp)) | |
1551 | 1566 | then { | |
1552 | 1567 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1553 | 1568 | if ((unstakeInv == unstakeInv)) | |
1554 | 1569 | then { | |
1555 | 1570 | let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1556 | 1571 | let outAmAmt = res._1 | |
1557 | 1572 | let outPrAmt = res._2 | |
1558 | 1573 | let state = res._10 | |
1559 | 1574 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1560 | 1575 | then true | |
1561 | 1576 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1562 | 1577 | then true | |
1563 | 1578 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1564 | 1579 | if ((checkAmounts == checkAmounts)) | |
1565 | 1580 | then { | |
1566 | 1581 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1567 | 1582 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1568 | 1583 | then { | |
1569 | - | let $ | |
1570 | - | let refreshDLpActions = $ | |
1571 | - | let updatedDLp = $ | |
1584 | + | let $t05480254883 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1585 | + | let refreshDLpActions = $t05480254883._1 | |
1586 | + | let updatedDLp = $t05480254883._2 | |
1572 | 1587 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1573 | 1588 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1574 | 1589 | then (state ++ refreshDLpActions) | |
1575 | 1590 | else throw("Strict value is not equal to itself.") | |
1576 | 1591 | } | |
1577 | 1592 | else throw("Strict value is not equal to itself.") | |
1578 | 1593 | } | |
1579 | 1594 | else throw("Strict value is not equal to itself.") | |
1580 | 1595 | } | |
1581 | 1596 | else throw("Strict value is not equal to itself.") | |
1582 | 1597 | } | |
1583 | 1598 | else throw("Strict value is not equal to itself.") | |
1584 | 1599 | } | |
1585 | 1600 | else throw("Strict value is not equal to itself.") | |
1586 | 1601 | } | |
1587 | 1602 | ||
1588 | 1603 | ||
1589 | 1604 | ||
1590 | 1605 | @Callable(i) | |
1591 | 1606 | func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = { | |
1592 | 1607 | let isPoolOneTokenOperationsDisabled = { | |
1593 | 1608 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1594 | 1609 | if ($isInstanceOf(@, "Boolean")) | |
1595 | 1610 | then @ | |
1596 | 1611 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1597 | 1612 | } | |
1598 | 1613 | let isGetDisabled = if (if (igs()) | |
1599 | 1614 | then true | |
1600 | 1615 | else (cfgPoolStatus == PoolShutdown)) | |
1601 | 1616 | then true | |
1602 | 1617 | else isPoolOneTokenOperationsDisabled | |
1603 | 1618 | let checks = [if (if (!(isGetDisabled)) | |
1604 | 1619 | then true | |
1605 | 1620 | else isManager(i)) | |
1606 | 1621 | then true | |
1607 | 1622 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1608 | 1623 | then true | |
1609 | 1624 | else throwErr("no payments are expected")] | |
1610 | 1625 | if ((checks == checks)) | |
1611 | 1626 | then { | |
1612 | 1627 | let factoryCfg = gfc() | |
1613 | 1628 | let lpAssetId = cfgLpAssetId | |
1614 | 1629 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1615 | 1630 | let userAddress = i.caller | |
1616 | 1631 | let lpAssetRecipientAddress = this | |
1617 | 1632 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1618 | 1633 | if ((unstakeInv == unstakeInv)) | |
1619 | 1634 | then { | |
1620 | - | let $ | |
1621 | - | let state = $ | |
1622 | - | let totalAmount = $ | |
1635 | + | let $t05590556093 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1636 | + | let state = $t05590556093._1 | |
1637 | + | let totalAmount = $t05590556093._2 | |
1623 | 1638 | $Tuple2(state, totalAmount) | |
1624 | 1639 | } | |
1625 | 1640 | else throw("Strict value is not equal to itself.") | |
1626 | 1641 | } | |
1627 | 1642 | else throw("Strict value is not equal to itself.") | |
1628 | 1643 | } | |
1629 | 1644 | ||
1630 | 1645 | ||
1631 | 1646 | ||
1632 | 1647 | @Callable(i) | |
1633 | 1648 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1634 | - | let $ | |
1635 | - | let lpAmount = $ | |
1636 | - | let state = $ | |
1637 | - | let feeAmount = $ | |
1638 | - | let bonus = $ | |
1649 | + | let $t05622156324 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1650 | + | let lpAmount = $t05622156324._1 | |
1651 | + | let state = $t05622156324._2 | |
1652 | + | let feeAmount = $t05622156324._3 | |
1653 | + | let bonus = $t05622156324._4 | |
1639 | 1654 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1640 | 1655 | } | |
1641 | 1656 | ||
1642 | 1657 | ||
1643 | 1658 | ||
1644 | 1659 | @Callable(i) | |
1645 | 1660 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1646 | - | let $ | |
1647 | - | let lpAmount = $ | |
1648 | - | let state = $ | |
1649 | - | let feeAmount = $ | |
1650 | - | let bonus = $ | |
1661 | + | let $t05647256576 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1662 | + | let lpAmount = $t05647256576._1 | |
1663 | + | let state = $t05647256576._2 | |
1664 | + | let feeAmount = $t05647256576._3 | |
1665 | + | let bonus = $t05647256576._4 | |
1651 | 1666 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1652 | 1667 | } | |
1653 | 1668 | ||
1654 | 1669 | ||
1655 | 1670 | ||
1656 | 1671 | @Callable(i) | |
1657 | 1672 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1658 | 1673 | then throw("denied") | |
1659 | 1674 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr), StringEntry(amp(), toString(ampInitial)), StringEntry(keyAmpHistory(height), toString(ampInitial))], "success") | |
1660 | 1675 | ||
1661 | 1676 | ||
1662 | 1677 | ||
1663 | 1678 | @Callable(i) | |
1664 | 1679 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1665 | 1680 | ||
1666 | 1681 | ||
1667 | 1682 | ||
1668 | 1683 | @Callable(i) | |
1669 | 1684 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1670 | 1685 | ||
1671 | 1686 | ||
1672 | 1687 | ||
1673 | 1688 | @Callable(i) | |
1674 | 1689 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1675 | 1690 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1676 | 1691 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1677 | 1692 | } | |
1678 | 1693 | ||
1679 | 1694 | ||
1680 | 1695 | ||
1681 | 1696 | @Callable(i) | |
1682 | 1697 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1683 | 1698 | ||
1684 | 1699 | ||
1685 | 1700 | ||
1686 | 1701 | @Callable(i) | |
1687 | 1702 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1688 | 1703 | ||
1689 | 1704 | ||
1690 | 1705 | ||
1691 | 1706 | @Callable(i) | |
1692 | 1707 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1693 | 1708 | ||
1694 | 1709 | ||
1695 | 1710 | ||
1696 | 1711 | @Callable(i) | |
1697 | 1712 | func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, "")) | |
1698 | 1713 | ||
1699 | 1714 | ||
1700 | 1715 | ||
1701 | 1716 | @Callable(i) | |
1702 | 1717 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1703 | 1718 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1704 | 1719 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1705 | 1720 | } | |
1706 | 1721 | ||
1707 | 1722 | ||
1708 | 1723 | ||
1709 | 1724 | @Callable(i) | |
1710 | 1725 | func changeAmp () = { | |
1711 | 1726 | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1712 | - | let $ | |
1727 | + | let $t05905659255 = match cfg { | |
1713 | 1728 | case list: List[Any] => | |
1714 | 1729 | $Tuple3({ | |
1715 | 1730 | let @ = list[0] | |
1716 | 1731 | if ($isInstanceOf(@, "Int")) | |
1717 | 1732 | then @ | |
1718 | 1733 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1719 | 1734 | }, { | |
1720 | 1735 | let @ = list[1] | |
1721 | 1736 | if ($isInstanceOf(@, "Int")) | |
1722 | 1737 | then @ | |
1723 | 1738 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1724 | 1739 | }, { | |
1725 | 1740 | let @ = list[2] | |
1726 | 1741 | if ($isInstanceOf(@, "Int")) | |
1727 | 1742 | then @ | |
1728 | 1743 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1729 | 1744 | }) | |
1730 | 1745 | case _ => | |
1731 | 1746 | throwErr("invalid entry type") | |
1732 | 1747 | } | |
1733 | - | let delay = $ | |
1734 | - | let delta = $ | |
1735 | - | let target = $ | |
1748 | + | let delay = $t05905659255._1 | |
1749 | + | let delta = $t05905659255._2 | |
1750 | + | let target = $t05905659255._3 | |
1736 | 1751 | let curAmp = parseIntValue(getStringValue(amp())) | |
1737 | 1752 | let newAmpRaw = (curAmp + delta) | |
1738 | 1753 | let newAmp = if ((0 > delta)) | |
1739 | 1754 | then if ((target > newAmpRaw)) | |
1740 | 1755 | then target | |
1741 | 1756 | else newAmpRaw | |
1742 | 1757 | else if ((newAmpRaw > target)) | |
1743 | 1758 | then target | |
1744 | 1759 | else newAmpRaw | |
1745 | 1760 | let lastCall = valueOrElse(getInteger(keyChangeAmpLastCall()), 0) | |
1746 | 1761 | let wait = (lastCall + delay) | |
1747 | 1762 | let checks = [if ((height > wait)) | |
1748 | 1763 | then true | |
1749 | 1764 | else throwErr("try again in few blocks"), if ((curAmp != newAmp)) | |
1750 | 1765 | then true | |
1751 | 1766 | else throwErr("already reached target")] | |
1752 | 1767 | if ((checks == checks)) | |
1753 | 1768 | then [IntegerEntry(keyChangeAmpLastCall(), height), StringEntry(amp(), toString(newAmp)), StringEntry(keyAmpHistory(height), toString(newAmp))] | |
1754 | 1769 | else throw("Strict value is not equal to itself.") | |
1755 | 1770 | } | |
1756 | 1771 | ||
1757 | 1772 | ||
1758 | 1773 | @Verifier(tx) | |
1759 | 1774 | func verify () = { | |
1760 | 1775 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1761 | 1776 | case pk: ByteVector => | |
1762 | 1777 | pk | |
1763 | 1778 | case _: Unit => | |
1764 | 1779 | tx.senderPublicKey | |
1765 | 1780 | case _ => | |
1766 | 1781 | throw("Match error") | |
1767 | 1782 | } | |
1768 | 1783 | match tx { | |
1769 | 1784 | case order: Order => | |
1770 | 1785 | let matcherPub = mp() | |
1771 | - | let $ | |
1786 | + | let $t06018860305 = if (skipOrderValidation()) | |
1772 | 1787 | then $Tuple2(true, "") | |
1773 | 1788 | else validateMatcherOrderAllowed(order) | |
1774 | - | let orderValid = $ | |
1775 | - | let orderValidInfo = $ | |
1789 | + | let orderValid = $t06018860305._1 | |
1790 | + | let orderValidInfo = $t06018860305._2 | |
1776 | 1791 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1777 | 1792 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1778 | 1793 | if (if (if (orderValid) | |
1779 | 1794 | then senderValid | |
1780 | 1795 | else false) | |
1781 | 1796 | then matcherValid | |
1782 | 1797 | else false) | |
1783 | 1798 | then true | |
1784 | 1799 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1785 | 1800 | case s: SetScriptTransaction => | |
1786 | 1801 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1787 | 1802 | then true | |
1788 | 1803 | else { | |
1789 | 1804 | let newHash = blake2b256(value(s.script)) | |
1790 | 1805 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1791 | 1806 | let currentHash = scriptHash(this) | |
1792 | 1807 | if ((allowedHash == newHash)) | |
1793 | 1808 | then (currentHash != newHash) | |
1794 | 1809 | else false | |
1795 | 1810 | } | |
1796 | 1811 | case _ => | |
1797 | 1812 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1798 | 1813 | } | |
1799 | 1814 | } | |
1800 | 1815 |
github/deemru/w8io/026f985 195.99 ms ◑