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