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