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