tx · CXa7ijUxMrogU36kEWUHkwGJhtYH1D7zDx7PvVk54piF

3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x:  -0.04200000 Waves

2023.07.10 10:32 [2659515] smart account 3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x > SELF 0.00000000 Waves

{ "type": 13, "id": "CXa7ijUxMrogU36kEWUHkwGJhtYH1D7zDx7PvVk54piF", "fee": 4200000, "feeAssetId": null, "timestamp": 1688974392811, "version": 2, "chainId": 84, "sender": "3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x", "senderPublicKey": "HNMWjb4Vq8JwETf7kHV57gaKXLvsdCS5KPTaHKa4XKa6", "proofs": [ "5Y4mYn4nTUQ1TxAoQoi5q8g7Xr8XN8Zj1DzAwDZ2JyC9FnAWNKUWyNF8FRnHyFjhWe6A3Z9qBStjjVvUWdLEGzBr" ], "script": "base64:BgKSOAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXNz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kDbqbHCJbaVJNhPLgmbwtFZmF Diff:
OldNewDifferences
646646 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
647647
648648
649-func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
649+func validateUpdatedKLp (oldKLp,updatedKLp) = if (if ((updatedKLp == big0))
650+ then true
651+ else (updatedKLp >= oldKLp))
650652 then true
651653 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
652654
656658 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
657659 let amountAssetAmount = order.amount
658660 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
659- let $t02899129203 = if ((order.orderType == Buy))
661+ let $t02901329225 = if ((order.orderType == Buy))
660662 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
661663 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
662- let amountAssetBalanceDelta = $t02899129203._1
663- let priceAssetBalanceDelta = $t02899129203._2
664+ let amountAssetBalanceDelta = $t02901329225._1
665+ let priceAssetBalanceDelta = $t02901329225._2
664666 if (if (if (isGlobalShutdown())
665667 then true
666668 else (cfgPoolStatus == PoolMatcherDisabled))
673675 then throw("Wrong order assets.")
674676 else {
675677 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
676- let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677- let unusedActions = $t02964329743._1
678- let kLpNew = $t02964329743._2
678+ let $t02966529765 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
679+ let unusedActions = $t02966529765._1
680+ let kLpNew = $t02966529765._2
679681 let isOrderValid = (kLpNew >= kLp)
680682 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
681683 $Tuple2(isOrderValid, info)
754756 else if ((paymentAssetId == cfgPriceAssetId))
755757 then false
756758 else throwErr("invalid asset")
757- let $t03285633149 = if (isEval)
759+ let $t03287833171 = if (isEval)
758760 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
759761 else if (paymentInAmountAsset)
760762 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
761763 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
762- let amountBalanceOld = $t03285633149._1
763- let priceBalanceOld = $t03285633149._2
764- let $t03315333302 = if (paymentInAmountAsset)
764+ let amountBalanceOld = $t03287833171._1
765+ let priceBalanceOld = $t03287833171._2
766+ let $t03317533324 = if (paymentInAmountAsset)
765767 then $Tuple2(paymentAmountRaw, 0)
766768 else $Tuple2(0, paymentAmountRaw)
767- let amountAssetAmountRaw = $t03315333302._1
768- let priceAssetAmountRaw = $t03315333302._2
769+ let amountAssetAmountRaw = $t03317533324._1
770+ let priceAssetAmountRaw = $t03317533324._2
769771 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
770772 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
771- let $t03343433498 = takeFee(paymentAmountRaw, inFee)
772- let paymentAmount = $t03343433498._1
773- let feeAmount = $t03343433498._2
773+ let $t03345633520 = takeFee(paymentAmountRaw, inFee)
774+ let paymentAmount = $t03345633520._1
775+ let feeAmount = $t03345633520._2
774776 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
775777 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
776778 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
793795 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
794796 let priceOld = fromX18(priceOldX18, scale8)
795797 let loss = {
796- let $t03517935346 = if (paymentInAmountAsset)
798+ let $t03520135368 = if (paymentInAmountAsset)
797799 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
798800 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
799- let amount = $t03517935346._1
800- let balance = $t03517935346._2
801+ let amount = $t03520135368._1
802+ let balance = $t03520135368._2
801803 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
802804 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
803805 }
837839 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
838840 let redeemedBigInt = toBigInt(paymentAmount)
839841 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
840- let $t03742437480 = takeFee(amountRaw, outFee)
841- let totalAmount = $t03742437480._1
842- let feeAmount = $t03742437480._2
843- let $t03748437710 = if (outInAmountAsset)
842+ let $t03744637502 = takeFee(amountRaw, outFee)
843+ let totalAmount = $t03744637502._1
844+ let feeAmount = $t03744637502._2
845+ let $t03750637732 = if (outInAmountAsset)
844846 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
845847 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
846- let outAmAmount = $t03748437710._1
847- let outPrAmount = $t03748437710._2
848- let amBalanceNew = $t03748437710._3
849- let prBalanceNew = $t03748437710._4
848+ let outAmAmount = $t03750637732._1
849+ let outPrAmount = $t03750637732._2
850+ let amBalanceNew = $t03750637732._3
851+ let prBalanceNew = $t03750637732._4
850852 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
851853 let priceNew = fromX18(priceNewX18, scale8)
852854 let commonState = if (isEval)
911913
912914 @Callable(i)
913915 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
914- let $t03956839873 = if ((isReverse == false))
916+ let $t03959039895 = if ((isReverse == false))
915917 then {
916918 let assetOut = getStringOrFail(this, pa())
917919 let assetIn = getStringOrFail(this, aa())
922924 let assetIn = getStringOrFail(this, pa())
923925 $Tuple2(assetOut, assetIn)
924926 }
925- let assetOut = $t03956839873._1
926- let assetIn = $t03956839873._2
927+ let assetOut = $t03959039895._1
928+ let assetIn = $t03959039895._2
927929 let poolAssetInBalance = getAccBalance(assetIn)
928930 let poolAssetOutBalance = getAccBalance(assetOut)
929931 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10391041 else throw("Strict value is not equal to itself.")
10401042 }
10411043 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1042- let $t04437644838 = refreshKLpInternal(0, 0, 0)
1043- if (($t04437644838 == $t04437644838))
1044+ let $t04439844860 = refreshKLpInternal(0, 0, 0)
1045+ if (($t04439844860 == $t04439844860))
10441046 then {
1045- let updatedKLp = $t04437644838._2
1046- let refreshKLpActions = $t04437644838._1
1047+ let updatedKLp = $t04439844860._2
1048+ let refreshKLpActions = $t04439844860._1
10471049 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10481050 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10491051 then {
10801082 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10811083 if ((currentKLp == currentKLp))
10821084 then {
1083- let $t04545045515 = refreshKLpInternal(0, 0, 0)
1084- let refreshKLpActions = $t04545045515._1
1085- let updatedKLp = $t04545045515._2
1085+ let $t04547245537 = refreshKLpInternal(0, 0, 0)
1086+ let refreshKLpActions = $t04547245537._1
1087+ let updatedKLp = $t04547245537._2
10861088 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10871089 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10881090 then (state ++ refreshKLpActions)
11291131 then {
11301132 let userAddress = i.caller
11311133 let txId = i.transactionId
1132- let $t04670346855 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133- if (($t04670346855 == $t04670346855))
1134+ let $t04672546877 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1135+ if (($t04672546877 == $t04672546877))
11341136 then {
1135- let paymentInAmountAsset = $t04670346855._5
1136- let bonus = $t04670346855._4
1137- let feeAmount = $t04670346855._3
1138- let commonState = $t04670346855._2
1139- let emitAmountEstimated = $t04670346855._1
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
11401142 let emitAmount = if (if ((minOutAmount > 0))
11411143 then (minOutAmount > emitAmountEstimated)
11421144 else false)
11561158 let sendFee = if ((feeAmount > 0))
11571159 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11581160 else nil
1159- let $t04744147638 = if ((this == feeCollectorAddress))
1161+ let $t04746347660 = if ((this == feeCollectorAddress))
11601162 then $Tuple2(0, 0)
11611163 else if (paymentInAmountAsset)
11621164 then $Tuple2(-(feeAmount), 0)
11631165 else $Tuple2(0, -(feeAmount))
1164- let amountAssetBalanceDelta = $t04744147638._1
1165- let priceAssetBalanceDelta = $t04744147638._2
1166- let $t04764147749 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167- let refreshKLpActions = $t04764147749._1
1168- let updatedKLp = $t04764147749._2
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
11691171 let kLp = value(getString(keyKLp))
11701172 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11711173 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11901192
11911193 @Callable(i)
11921194 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1193- let $t04810448261 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194- let emitAmountEstimated = $t04810448261._1
1195- let commonState = $t04810448261._2
1196- let feeAmount = $t04810448261._3
1197- let bonus = $t04810448261._4
1198- let paymentInAmountAsset = $t04810448261._5
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
11991201 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12001202 }
12011203
12321234 then {
12331235 let userAddress = i.caller
12341236 let txId = i.transactionId
1235- let $t04914649299 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236- if (($t04914649299 == $t04914649299))
1237+ let $t04916849321 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1238+ if (($t04916849321 == $t04916849321))
12371239 then {
1238- let outInAmountAsset = $t04914649299._5
1239- let bonus = $t04914649299._4
1240- let feeAmount = $t04914649299._3
1241- let commonState = $t04914649299._2
1242- let amountEstimated = $t04914649299._1
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
12431245 let amount = if (if ((minOutAmount > 0))
12441246 then (minOutAmount > amountEstimated)
12451247 else false)
12531255 let sendFee = if ((feeAmount > 0))
12541256 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12551257 else nil
1256- let $t04996350210 = {
1258+ let $t04998550232 = {
12571259 let feeAmountForCalc = if ((this == feeCollectorAddress))
12581260 then 0
12591261 else feeAmount
12611263 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12621264 else $Tuple2(0, -((amount + feeAmountForCalc)))
12631265 }
1264- let amountAssetBalanceDelta = $t04996350210._1
1265- let priceAssetBalanceDelta = $t04996350210._2
1266- let $t05021350321 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267- let refreshKLpActions = $t05021350321._1
1268- let updatedKLp = $t05021350321._2
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
12691271 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12701272 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12711273 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12841286
12851287 @Callable(i)
12861288 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1287- let $t05059950755 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288- let amountEstimated = $t05059950755._1
1289- let commonState = $t05059950755._2
1290- let feeAmount = $t05059950755._3
1291- let bonus = $t05059950755._4
1292- let outInAmountAsset = $t05059950755._5
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
12931295 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12941296 }
12951297
13261328 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13271329 if ((unstakeInv == unstakeInv))
13281330 then {
1329- let $t05166051811 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330- if (($t05166051811 == $t05166051811))
1331+ let $t05168251833 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1332+ if (($t05168251833 == $t05168251833))
13311333 then {
1332- let outInAmountAsset = $t05166051811._5
1333- let bonus = $t05166051811._4
1334- let feeAmount = $t05166051811._3
1335- let commonState = $t05166051811._2
1336- let amountEstimated = $t05166051811._1
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
13371339 let amount = if (if ((minOutAmount > 0))
13381340 then (minOutAmount > amountEstimated)
13391341 else false)
13471349 let sendFee = if ((feeAmount > 0))
13481350 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13491351 else nil
1350- let $t05247052717 = {
1352+ let $t05249252739 = {
13511353 let feeAmountForCalc = if ((this == feeCollectorAddress))
13521354 then 0
13531355 else feeAmount
13551357 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13561358 else $Tuple2(0, -((amount + feeAmountForCalc)))
13571359 }
1358- let amountAssetBalanceDelta = $t05247052717._1
1359- let priceAssetBalanceDelta = $t05247052717._2
1360- let $t05272052828 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361- let refreshKLpActions = $t05272052828._1
1362- let updatedKLp = $t05272052828._2
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
13631365 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13641366 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13651367 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13931395 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13941396 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13951397 then {
1396- let $t05392354004 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397- let refreshKLpActions = $t05392354004._1
1398- let updatedKLp = $t05392354004._2
1398+ let $t05394554026 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1399+ let refreshKLpActions = $t05394554026._1
1400+ let updatedKLp = $t05394554026._2
13991401 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14001402 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14011403 then ((withdrawState ++ state) ++ refreshKLpActions)
14281430 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14291431 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14301432 then {
1431- let $t05509955180 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432- let refreshKLpActions = $t05509955180._1
1433- let updatedKLp = $t05509955180._2
1433+ let $t05512155202 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1434+ let refreshKLpActions = $t05512155202._1
1435+ let updatedKLp = $t05512155202._2
14341436 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14351437 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14361438 then ((withdrawState ++ state) ++ refreshKLpActions)
14751477 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14761478 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14771479 then {
1478- let $t05645256533 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479- let refreshKLpActions = $t05645256533._1
1480- let updatedKLp = $t05645256533._2
1480+ let $t05647456555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1481+ let refreshKLpActions = $t05647456555._1
1482+ let updatedKLp = $t05647456555._2
14811483 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14821484 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14831485 then ((withdrawState ++ state) ++ refreshKLpActions)
15291531 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15301532 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15311533 then {
1532- let $t05797458055 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533- let refreshKLpActions = $t05797458055._1
1534- let updatedKLp = $t05797458055._2
1534+ let $t05799658077 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1535+ let refreshKLpActions = $t05799658077._1
1536+ let updatedKLp = $t05799658077._2
15351537 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15361538 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15371539 then ((withdrawState ++ state) ++ refreshKLpActions)
15661568 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15671569 then {
15681570 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1569- let $t05925959323 = refreshKLpInternal(0, 0, 0)
1570- let kLpUpdateActions = $t05925959323._1
1571- let updatedKLp = $t05925959323._2
1571+ let $t05928159345 = refreshKLpInternal(0, 0, 0)
1572+ let kLpUpdateActions = $t05928159345._1
1573+ let updatedKLp = $t05928159345._2
15721574 let actions = if ((kLp != updatedKLp))
15731575 then kLpUpdateActions
15741576 else throwErr("nothing to refresh")
17431745 match tx {
17441746 case order: Order =>
17451747 let matcherPub = getMatcherPubOrFail()
1746- let $t06798568102 = if (skipOrderValidation())
1748+ let $t06800768124 = if (skipOrderValidation())
17471749 then $Tuple2(true, "")
17481750 else validateMatcherOrderAllowed(order)
1749- let orderValid = $t06798568102._1
1750- let orderValidInfo = $t06798568102._2
1751+ let orderValid = $t06800768124._1
1752+ let orderValidInfo = $t06800768124._2
17511753 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17521754 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17531755 if (if (if (orderValid)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lPdecimals = 8
55
66 let scale8 = 100000000
77
88 let scale8BigInt = toBigInt(100000000)
99
1010 let scale18 = toBigInt(1000000000000000000)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let big0 = toBigInt(0)
1515
1616 let big1 = toBigInt(1)
1717
1818 let big2 = toBigInt(2)
1919
2020 let wavesString = "WAVES"
2121
2222 let SEP = "__"
2323
2424 let PoolActive = 1
2525
2626 let PoolPutDisabled = 2
2727
2828 let PoolMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
3232 let idxPoolAddress = 1
3333
3434 let idxPoolStatus = 2
3535
3636 let idxPoolLPAssetId = 3
3737
3838 let idxAmtAssetId = 4
3939
4040 let idxPriceAssetId = 5
4141
4242 let idxAmtAssetDcm = 6
4343
4444 let idxPriceAssetDcm = 7
4545
4646 let idxIAmtAssetId = 8
4747
4848 let idxIPriceAssetId = 9
4949
5050 let idxLPAssetDcm = 10
5151
5252 let idxPoolAmtAssetAmt = 1
5353
5454 let idxPoolPriceAssetAmt = 2
5555
5656 let idxPoolLPAssetAmt = 3
5757
5858 let idxFactoryStakingContract = 1
5959
6060 let idxFactorySlippageContract = 7
6161
6262 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult)
6666
6767
6868 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6969
7070
7171 func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
7272
7373
7474 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7575
7676
7777 func abs (val) = if ((0 > val))
7878 then -(val)
7979 else val
8080
8181
8282 func absBigInt (val) = if ((zeroBigInt > val))
8383 then -(val)
8484 else val
8585
8686
8787 func swapContract () = "%s__swapContract"
8888
8989
9090 func fc () = "%s__factoryContract"
9191
9292
9393 func keyManagerPublicKey () = "%s__managerPublicKey"
9494
9595
9696 func keyManagerVaultAddress () = "%s__managerVaultAddress"
9797
9898
9999 func pl () = "%s%s__price__last"
100100
101101
102102 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
103103
104104
105105 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
106106
107107
108108 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
109109
110110
111111 func aa () = "%s__amountAsset"
112112
113113
114114 func pa () = "%s__priceAsset"
115115
116116
117117 let keyFee = "%s__fee"
118118
119119 let feeDefault = fraction(10, scale8, 10000)
120120
121121 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
122122
123123 let keyKLp = makeString(["%s", "kLp"], SEP)
124124
125125 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
126126
127127 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
128128
129129 let kLpRefreshDelayDefault = 30
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133133 func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134134
135135
136136 func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137137
138138
139139 func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
140140
141141
142142 func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
143143
144144
145145 func keyFactoryConfig () = "%s__factoryConfig"
146146
147147
148148 func keyMatcherPub () = "%s%s__matcher__publicKey"
149149
150150
151151 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
152152
153153
154154 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
155155
156156
157157 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
158158
159159
160160 func keyAllPoolsShutdown () = "%s__shutdown"
161161
162162
163163 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
164164
165165
166166 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
167167
168168
169169 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
170170
171171 func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress)
172172
173173
174174 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
175175
176176
177177 func addressFromStringOrThis (addressString) = match addressFromString(addressString) {
178178 case a: Address =>
179179 a
180180 case _ =>
181181 this
182182 }
183183
184184
185185 func getManagerVaultAddressOrThis () = {
186186 let factoryAddress = match getString(fc()) {
187187 case fca: String =>
188188 addressFromStringOrThis(fca)
189189 case _ =>
190190 this
191191 }
192192 match getString(factoryAddress, keyManagerVaultAddress()) {
193193 case s: String =>
194194 addressFromStringOrThis(s)
195195 case _ =>
196196 this
197197 }
198198 }
199199
200200
201201 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
202202
203203
204204 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
205205
206206
207207 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
208208
209209
210210 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
211211
212212
213213 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
214214
215215 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
216216
217217 let inFee = {
218218 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
219219 if ($isInstanceOf(@, "Int"))
220220 then @
221221 else throw(($getType(@) + " couldn't be cast to Int"))
222222 }
223223
224224 let outFee = {
225225 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
226226 if ($isInstanceOf(@, "Int"))
227227 then @
228228 else throw(($getType(@) + " couldn't be cast to Int"))
229229 }
230230
231231 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
232232
233233
234234 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
235235
236236
237237 func getPoolConfig () = {
238238 let amtAsset = getStringOrFail(this, aa())
239239 let priceAsset = getStringOrFail(this, pa())
240240 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
241241 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
242242 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
243243 }
244244
245245
246246 func parseAssetId (input) = if ((input == wavesString))
247247 then unit
248248 else fromBase58String(input)
249249
250250
251251 func assetIdToString (input) = if ((input == unit))
252252 then wavesString
253253 else toBase58String(value(input))
254254
255255
256256 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]))
257257
258258
259259 let poolConfigParsed = parsePoolConfig(getPoolConfig())
260260
261261 let $t095299695 = poolConfigParsed
262262
263263 let cfgPoolAddress = $t095299695._1
264264
265265 let cfgPoolStatus = $t095299695._2
266266
267267 let cfgLpAssetId = $t095299695._3
268268
269269 let cfgAmountAssetId = $t095299695._4
270270
271271 let cfgPriceAssetId = $t095299695._5
272272
273273 let cfgAmountAssetDecimals = $t095299695._6
274274
275275 let cfgPriceAssetDecimals = $t095299695._7
276276
277277 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
278278
279279
280280 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
281281
282282 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
283283
284284 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)
285285
286286
287287 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)
288288
289289
290290 func getAccBalance (assetId) = {
291291 let balanceOnPool = if ((assetId == "WAVES"))
292292 then wavesBalance(this).available
293293 else assetBalance(this, fromBase58String(assetId))
294294 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
295295 max([0, totalBalance])
296296 }
297297
298298
299299 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
300300
301301
302302 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
303303
304304
305305 func getRate (proxy) = {
306306 let inv = invoke(proxy, "getRate", nil, nil)
307307 if ((inv == inv))
308308 then match inv {
309309 case r: Int =>
310310 r
311311 case _ =>
312312 throwErr("proxy.getRate() unexpected value")
313313 }
314314 else throw("Strict value is not equal to itself.")
315315 }
316316
317317
318318 func deposit (assetId,amount,stakingAssetId,proxy) = {
319319 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
320320 if ((currentAdditionalBalance == currentAdditionalBalance))
321321 then {
322322 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
323323 if ((currentStakingAssetBalance == currentStakingAssetBalance))
324324 then {
325325 let asset = parseAssetId(assetId)
326326 if ((amount > 0))
327327 then {
328328 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
329329 if ((depositInvoke == depositInvoke))
330330 then match depositInvoke {
331331 case receivedStakingAsset: Int =>
332332 let newAdditionalBalance = (currentAdditionalBalance + amount)
333333 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
334334 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
335335 case _ =>
336336 nil
337337 }
338338 else throw("Strict value is not equal to itself.")
339339 }
340340 else nil
341341 }
342342 else throw("Strict value is not equal to itself.")
343343 }
344344 else throw("Strict value is not equal to itself.")
345345 }
346346
347347
348348 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
349349 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
350350 if ((currentAdditionalBalance == currentAdditionalBalance))
351351 then {
352352 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
353353 if ((currentStakingAssetBalance == currentStakingAssetBalance))
354354 then {
355355 let currentProxyRate = getRate(proxy)
356356 if ((currentProxyRate == currentProxyRate))
357357 then {
358358 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
359359 let stakingAsset = parseAssetId(stakingAssetId)
360360 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
361361 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362362 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
363363 if ((sendStakingAssetAmount > 0))
364364 then {
365365 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
366366 if ((withdrawInvoke == withdrawInvoke))
367367 then match withdrawInvoke {
368368 case receivedAssets: Int =>
369369 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
370370 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
371371 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
372372 case _ =>
373373 nil
374374 }
375375 else throw("Strict value is not equal to itself.")
376376 }
377377 else nil
378378 }
379379 else throw("Strict value is not equal to itself.")
380380 }
381381 else throw("Strict value is not equal to itself.")
382382 }
383383 else throw("Strict value is not equal to itself.")
384384 }
385385
386386
387387 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
388388 case a: (Boolean, Int, Int, String, String, Int, String) =>
389389 a
390390 case _ =>
391391 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
392392 }
393393
394394
395395 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
396396 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
397397 if ((currentAdditionalBalance == currentAdditionalBalance))
398398 then {
399399 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
400400 if ((currentStakingAssetBalance == currentStakingAssetBalance))
401401 then {
402402 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
403403 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
404404 let diff = (currentAdditionalBalance - targetAdditionalBalance)
405405 if ((diff == 0))
406406 then nil
407407 else if ((0 > diff))
408408 then {
409409 let sendAssetAmount = -(diff)
410410 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
411411 }
412412 else {
413413 let getAssetAmount = diff
414414 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
415415 }
416416 }
417417 else throw("Strict value is not equal to itself.")
418418 }
419419 else throw("Strict value is not equal to itself.")
420420 }
421421
422422
423423 func rebalanceAsset (assetId) = {
424424 let $t01593116067 = getLeaseProxyConfig(assetId)
425425 let isLeasable = $t01593116067._1
426426 let leasedRatio = $t01593116067._2
427427 let minBalance = $t01593116067._3
428428 let proxyAddress = $t01593116067._4
429429 let proxyAssetId = $t01593116067._5
430430 let proxyRateMul = $t01593116067._6
431431 let stakingProfitAddress = $t01593116067._7
432432 if (isLeasable)
433433 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434434 else nil
435435 }
436436
437437
438438 func withdrawAndRebalanceAsset (assetId,getAmount) = {
439439 let $t01646616602 = getLeaseProxyConfig(assetId)
440440 let isLeasable = $t01646616602._1
441441 let leasedRatio = $t01646616602._2
442442 let minBalance = $t01646616602._3
443443 let proxyAddress = $t01646616602._4
444444 let proxyAssetId = $t01646616602._5
445445 let proxyRateMul = $t01646616602._6
446446 let stakingProfitAddress = $t01646616602._7
447447 if (isLeasable)
448448 then {
449449 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
450450 if ((newTotalLeasableBalance == newTotalLeasableBalance))
451451 then {
452452 let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
453453 if ((newAdditionalBalance == newAdditionalBalance))
454454 then {
455455 let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
456456 if ((withdrawAmount == withdrawAmount))
457457 then if ((0 > withdrawAmount))
458458 then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
459459 else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
460460 else throw("Strict value is not equal to itself.")
461461 }
462462 else throw("Strict value is not equal to itself.")
463463 }
464464 else throw("Strict value is not equal to itself.")
465465 }
466466 else nil
467467 }
468468
469469
470470 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
471471 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
472472 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
473473 (AmAmtWithdrawState ++ PrAmtWithdrawState)
474474 }
475475
476476
477477 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
478478 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
479479 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
480480 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
481481 }
482482
483483
484484 func calcPrices (amAmt,prAmt,lpAmt) = {
485485 let cfg = getPoolConfig()
486486 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
487487 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
488488 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
489489 let amAmtX18 = toX18(amAmt, amtAssetDcm)
490490 let prAmtX18 = toX18(prAmt, priceAssetDcm)
491491 let lpAmtX18 = toX18(lpAmt, scale8)
492492 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
493493 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
494494 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
495495 }
496496
497497
498498 func calculatePrices (amAmt,prAmt,lpAmt) = {
499499 let prices = calcPrices(amAmt, prAmt, lpAmt)
500500 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
501501 }
502502
503503
504504 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
505505 let cfg = getPoolConfig()
506506 let lpAssetId = cfg[idxPoolLPAssetId]
507507 let amAssetId = cfg[idxAmtAssetId]
508508 let prAssetId = cfg[idxPriceAssetId]
509509 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
510510 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
511511 let poolStatus = cfg[idxPoolStatus]
512512 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
513513 if ((lpAssetId != pmtAssetId))
514514 then throw("Invalid asset passed.")
515515 else {
516516 let amBalance = getAccBalance(amAssetId)
517517 let amBalanceX18 = toX18(amBalance, amAssetDcm)
518518 let prBalance = getAccBalance(prAssetId)
519519 let prBalanceX18 = toX18(prBalance, prAssetDcm)
520520 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
521521 let curPrice = fromX18(curPriceX18, scale8)
522522 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
523523 let lpEmissionX18 = toX18(lpEmission, scale8)
524524 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
525525 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
526526 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
527527 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
528528 let state = if ((txId58 == ""))
529529 then nil
530530 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
531531 then unit
532532 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
533533 then unit
534534 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)]
535535 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
536536 }
537537 }
538538
539539
540540 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
541541 let cfg = getPoolConfig()
542542 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
543543 let amAssetIdStr = cfg[idxAmtAssetId]
544544 let prAssetIdStr = cfg[idxPriceAssetId]
545545 let iAmtAssetId = cfg[idxIAmtAssetId]
546546 let iPriceAssetId = cfg[idxIPriceAssetId]
547547 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
548548 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
549549 let poolStatus = cfg[idxPoolStatus]
550550 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
551551 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
552552 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
553553 if (if ((amAssetIdStr != inAmAssetIdStr))
554554 then true
555555 else (prAssetIdStr != inPrAssetIdStr))
556556 then throw("Invalid amt or price asset passed.")
557557 else {
558558 let amBalance = if (isEvaluate)
559559 then getAccBalance(amAssetIdStr)
560560 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
561561 let prBalance = if (isEvaluate)
562562 then getAccBalance(prAssetIdStr)
563563 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
564564 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
565565 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
566566 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
567567 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
568568 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
569569 let res = if ((lpEmission == 0))
570570 then {
571571 let curPriceX18 = zeroBigInt
572572 let slippageX18 = zeroBigInt
573573 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
574574 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
575575 }
576576 else {
577577 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
578578 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
579579 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
580580 if (if ((curPriceX18 != zeroBigInt))
581581 then (slippageX18 > slippageToleranceX18)
582582 else false)
583583 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
584584 else {
585585 let lpEmissionX18 = toX18(lpEmission, scale8)
586586 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
587587 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
588588 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
589589 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
590590 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
591591 let expAmtAssetAmtX18 = expectedAmts._1
592592 let expPriceAssetAmtX18 = expectedAmts._2
593593 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
594594 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
595595 }
596596 }
597597 let calcLpAmt = res._1
598598 let calcAmAssetPmt = res._2
599599 let calcPrAssetPmt = res._3
600600 let curPrice = fromX18(res._4, scale8)
601601 let slippageCalc = fromX18(res._5, scale8)
602602 if ((0 >= calcLpAmt))
603603 then throw("Invalid calculations. LP calculated is less than zero.")
604604 else {
605605 let emitLpAmt = if (!(emitLp))
606606 then 0
607607 else calcLpAmt
608608 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
609609 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
610610 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))]
611611 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
612612 }
613613 }
614614 }
615615
616616
617617 func calcKLp (amountBalance,priceBalance,lpEmission) = {
618618 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
619619 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
620620 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
621621 if ((lpEmission == big0))
622622 then big0
623623 else updatedKLp
624624 }
625625
626626
627627 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
628628 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
629629 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
630630 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
631631 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
632632 currentKLp
633633 }
634634
635635
636636 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
637637 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
638638 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
639639 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
640640 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
641641 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
642642 $Tuple2(actions, updatedKLp)
643643 }
644644
645645
646646 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
647647
648648
649-func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
649+func validateUpdatedKLp (oldKLp,updatedKLp) = if (if ((updatedKLp == big0))
650+ then true
651+ else (updatedKLp >= oldKLp))
650652 then true
651653 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
652654
653655
654656 func validateMatcherOrderAllowed (order) = {
655657 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
656658 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
657659 let amountAssetAmount = order.amount
658660 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
659- let $t02899129203 = if ((order.orderType == Buy))
661+ let $t02901329225 = if ((order.orderType == Buy))
660662 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
661663 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
662- let amountAssetBalanceDelta = $t02899129203._1
663- let priceAssetBalanceDelta = $t02899129203._2
664+ let amountAssetBalanceDelta = $t02901329225._1
665+ let priceAssetBalanceDelta = $t02901329225._2
664666 if (if (if (isGlobalShutdown())
665667 then true
666668 else (cfgPoolStatus == PoolMatcherDisabled))
667669 then true
668670 else (cfgPoolStatus == PoolShutdown))
669671 then throw("Exchange operations disabled")
670672 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
671673 then true
672674 else (order.assetPair.priceAsset != cfgPriceAssetId))
673675 then throw("Wrong order assets.")
674676 else {
675677 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
676- let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677- let unusedActions = $t02964329743._1
678- let kLpNew = $t02964329743._2
678+ let $t02966529765 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
679+ let unusedActions = $t02966529765._1
680+ let kLpNew = $t02966529765._2
679681 let isOrderValid = (kLpNew >= kLp)
680682 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
681683 $Tuple2(isOrderValid, info)
682684 }
683685 }
684686
685687
686688 func commonGet (i) = if ((size(i.payments) != 1))
687689 then throw("exactly 1 payment is expected")
688690 else {
689691 let pmt = value(i.payments[0])
690692 let pmtAssetId = value(pmt.assetId)
691693 let pmtAmt = pmt.amount
692694 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
693695 let outAmAmt = res._1
694696 let outPrAmt = res._2
695697 let poolStatus = parseIntValue(res._9)
696698 let state = res._10
697699 if (if (isGlobalShutdown())
698700 then true
699701 else (poolStatus == PoolShutdown))
700702 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
701703 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
702704 }
703705
704706
705707 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
706708 then throw("exactly 2 payments are expected")
707709 else {
708710 let amAssetPmt = value(i.payments[0])
709711 let prAssetPmt = value(i.payments[1])
710712 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
711713 let poolStatus = parseIntValue(estPut._8)
712714 if (if (if (isGlobalShutdown())
713715 then true
714716 else (poolStatus == PoolPutDisabled))
715717 then true
716718 else (poolStatus == PoolShutdown))
717719 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
718720 else estPut
719721 }
720722
721723
722724 func emit (amount) = {
723725 let emitInv = invoke(factoryContract, "emit", [amount], nil)
724726 if ((emitInv == emitInv))
725727 then {
726728 let emitInvLegacy = match emitInv {
727729 case legacyFactoryContract: Address =>
728730 invoke(legacyFactoryContract, "emit", [amount], nil)
729731 case _ =>
730732 unit
731733 }
732734 if ((emitInvLegacy == emitInvLegacy))
733735 then amount
734736 else throw("Strict value is not equal to itself.")
735737 }
736738 else throw("Strict value is not equal to itself.")
737739 }
738740
739741
740742 func takeFee (amount,fee) = {
741743 let feeAmount = if ((fee == 0))
742744 then 0
743745 else fraction(amount, fee, scale8)
744746 $Tuple2((amount - feeAmount), feeAmount)
745747 }
746748
747749
748750 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
749751 let isEval = (txId == unit)
750752 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
751753 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
752754 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
753755 then true
754756 else if ((paymentAssetId == cfgPriceAssetId))
755757 then false
756758 else throwErr("invalid asset")
757- let $t03285633149 = if (isEval)
759+ let $t03287833171 = if (isEval)
758760 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
759761 else if (paymentInAmountAsset)
760762 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
761763 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
762- let amountBalanceOld = $t03285633149._1
763- let priceBalanceOld = $t03285633149._2
764- let $t03315333302 = if (paymentInAmountAsset)
764+ let amountBalanceOld = $t03287833171._1
765+ let priceBalanceOld = $t03287833171._2
766+ let $t03317533324 = if (paymentInAmountAsset)
765767 then $Tuple2(paymentAmountRaw, 0)
766768 else $Tuple2(0, paymentAmountRaw)
767- let amountAssetAmountRaw = $t03315333302._1
768- let priceAssetAmountRaw = $t03315333302._2
769+ let amountAssetAmountRaw = $t03317533324._1
770+ let priceAssetAmountRaw = $t03317533324._2
769771 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
770772 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
771- let $t03343433498 = takeFee(paymentAmountRaw, inFee)
772- let paymentAmount = $t03343433498._1
773- let feeAmount = $t03343433498._2
773+ let $t03345633520 = takeFee(paymentAmountRaw, inFee)
774+ let paymentAmount = $t03345633520._1
775+ let feeAmount = $t03345633520._2
774776 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
775777 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
776778 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
777779 let priceNew = fromX18(priceNewX18, scale8)
778780 let paymentBalance = if (paymentInAmountAsset)
779781 then amountBalanceOld
780782 else priceBalanceOld
781783 let paymentBalanceBigInt = toBigInt(paymentBalance)
782784 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
783785 let chechSupply = if ((supplyBigInt > big0))
784786 then true
785787 else throwErr("initial deposit requires all coins")
786788 if ((chechSupply == chechSupply))
787789 then {
788790 let depositBigInt = toBigInt(paymentAmount)
789791 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
790792 let commonState = if (isEval)
791793 then nil
792794 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))]
793795 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
794796 let priceOld = fromX18(priceOldX18, scale8)
795797 let loss = {
796- let $t03517935346 = if (paymentInAmountAsset)
798+ let $t03520135368 = if (paymentInAmountAsset)
797799 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
798800 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
799- let amount = $t03517935346._1
800- let balance = $t03517935346._2
801+ let amount = $t03520135368._1
802+ let balance = $t03520135368._2
801803 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
802804 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
803805 }
804806 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
805807 }
806808 else throw("Strict value is not equal to itself.")
807809 }
808810
809811
810812 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
811813 let isEval = (txId == unit)
812814 let cfg = getPoolConfig()
813815 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
814816 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
815817 let checks = [if ((paymentAssetId == cfgLpAssetId))
816818 then true
817819 else throwErr("invalid lp asset")]
818820 if ((checks == checks))
819821 then {
820822 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
821823 then true
822824 else if ((outAssetId == cfgPriceAssetId))
823825 then false
824826 else throwErr("invalid asset")
825827 let balanceBigInt = if (outInAmountAsset)
826828 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
827829 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
828830 let outInAmountAssetDecimals = if (outInAmountAsset)
829831 then amtAssetDcm
830832 else priceAssetDcm
831833 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
832834 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
833835 let outBalance = if (outInAmountAsset)
834836 then amBalanceOld
835837 else prBalanceOld
836838 let outBalanceBigInt = toBigInt(outBalance)
837839 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
838840 let redeemedBigInt = toBigInt(paymentAmount)
839841 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
840- let $t03742437480 = takeFee(amountRaw, outFee)
841- let totalAmount = $t03742437480._1
842- let feeAmount = $t03742437480._2
843- let $t03748437710 = if (outInAmountAsset)
842+ let $t03744637502 = takeFee(amountRaw, outFee)
843+ let totalAmount = $t03744637502._1
844+ let feeAmount = $t03744637502._2
845+ let $t03750637732 = if (outInAmountAsset)
844846 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
845847 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
846- let outAmAmount = $t03748437710._1
847- let outPrAmount = $t03748437710._2
848- let amBalanceNew = $t03748437710._3
849- let prBalanceNew = $t03748437710._4
848+ let outAmAmount = $t03750637732._1
849+ let outPrAmount = $t03750637732._2
850+ let amBalanceNew = $t03750637732._3
851+ let prBalanceNew = $t03750637732._4
850852 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
851853 let priceNew = fromX18(priceNewX18, scale8)
852854 let commonState = if (isEval)
853855 then nil
854856 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)]
855857 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
856858 let priceOld = fromX18(priceOldX18, scale8)
857859 let loss = {
858860 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
859861 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
860862 }
861863 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
862864 }
863865 else throw("Strict value is not equal to itself.")
864866 }
865867
866868
867869 func managerPublicKeyOrUnit () = {
868870 let managerVaultAddress = getManagerVaultAddressOrThis()
869871 match getString(managerVaultAddress, keyManagerPublicKey()) {
870872 case s: String =>
871873 fromBase58String(s)
872874 case _: Unit =>
873875 unit
874876 case _ =>
875877 throw("Match error")
876878 }
877879 }
878880
879881
880882 func isManager (i) = match managerPublicKeyOrUnit() {
881883 case pk: ByteVector =>
882884 (i.callerPublicKey == pk)
883885 case _: Unit =>
884886 (i.caller == this)
885887 case _ =>
886888 throw("Match error")
887889 }
888890
889891
890892 func mustManager (i) = {
891893 let pd = throw("Permission denied")
892894 match managerPublicKeyOrUnit() {
893895 case pk: ByteVector =>
894896 if ((i.callerPublicKey == pk))
895897 then true
896898 else pd
897899 case _: Unit =>
898900 if ((i.caller == this))
899901 then true
900902 else pd
901903 case _ =>
902904 throw("Match error")
903905 }
904906 }
905907
906908
907909 @Callable(i)
908910 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
909911
910912
911913
912914 @Callable(i)
913915 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
914- let $t03956839873 = if ((isReverse == false))
916+ let $t03959039895 = if ((isReverse == false))
915917 then {
916918 let assetOut = getStringOrFail(this, pa())
917919 let assetIn = getStringOrFail(this, aa())
918920 $Tuple2(assetOut, assetIn)
919921 }
920922 else {
921923 let assetOut = getStringOrFail(this, aa())
922924 let assetIn = getStringOrFail(this, pa())
923925 $Tuple2(assetOut, assetIn)
924926 }
925- let assetOut = $t03956839873._1
926- let assetIn = $t03956839873._2
927+ let assetOut = $t03959039895._1
928+ let assetIn = $t03959039895._2
927929 let poolAssetInBalance = getAccBalance(assetIn)
928930 let poolAssetOutBalance = getAccBalance(assetOut)
929931 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
930932 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
931933 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
932934 let checkK = if ((newK >= oldK))
933935 then true
934936 else throw("new K is fewer error")
935937 if ((checkK == checkK))
936938 then $Tuple2(nil, amountOut)
937939 else throw("Strict value is not equal to itself.")
938940 }
939941
940942
941943
942944 @Callable(i)
943945 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
944946 let swapContact = {
945947 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
946948 if ($isInstanceOf(@, "String"))
947949 then @
948950 else throw(($getType(@) + " couldn't be cast to String"))
949951 }
950952 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
951953 then true
952954 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
953955 then true
954956 else throwErr("Permission denied")]
955957 if ((checks == checks))
956958 then {
957959 let pmt = value(i.payments[0])
958960 let assetIn = assetIdToString(pmt.assetId)
959961 let assetOut = if ((isReverse == false))
960962 then getStringOrFail(this, pa())
961963 else getStringOrFail(this, aa())
962964 let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount)
963965 let poolAssetOutBalance = getAccBalance(assetOut)
964966 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
965967 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
966968 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
967969 let checkK = if ((newK >= oldK))
968970 then true
969971 else throw("new K is fewer error")
970972 if ((checkK == checkK))
971973 then {
972974 let checkMin = if ((amountOut >= amountOutMin))
973975 then true
974976 else throw("Exchange result is fewer coins than expected")
975977 if ((checkMin == checkMin))
976978 then {
977979 let rebalanceState = rebalanceAsset(assetIn)
978980 if ((rebalanceState == rebalanceState))
979981 then {
980982 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
981983 if ((withdrawState == withdrawState))
982984 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
983985 else throw("Strict value is not equal to itself.")
984986 }
985987 else throw("Strict value is not equal to itself.")
986988 }
987989 else throw("Strict value is not equal to itself.")
988990 }
989991 else throw("Strict value is not equal to itself.")
990992 }
991993 else throw("Strict value is not equal to itself.")
992994 }
993995
994996
995997
996998 @Callable(i)
997999 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
9981000 then throw("Invalid slippageTolerance passed")
9991001 else {
10001002 let estPut = commonPut(i, slippageTolerance, true)
10011003 let emitLpAmt = estPut._2
10021004 let lpAssetId = estPut._7
10031005 let state = estPut._9
10041006 let amDiff = estPut._10
10051007 let prDiff = estPut._11
10061008 let amId = estPut._12
10071009 let prId = estPut._13
10081010 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10091011 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10101012 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10111013 if ((currentKLp == currentKLp))
10121014 then {
10131015 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10141016 if ((emitInv == emitInv))
10151017 then {
10161018 let emitInvLegacy = match emitInv {
10171019 case legacyFactoryContract: Address =>
10181020 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10191021 case _ =>
10201022 unit
10211023 }
10221024 if ((emitInvLegacy == emitInvLegacy))
10231025 then {
10241026 let slippageAInv = if ((amDiff > 0))
10251027 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10261028 else nil
10271029 if ((slippageAInv == slippageAInv))
10281030 then {
10291031 let slippagePInv = if ((prDiff > 0))
10301032 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10311033 else nil
10321034 if ((slippagePInv == slippagePInv))
10331035 then {
10341036 let lpTransfer = if (shouldAutoStake)
10351037 then {
10361038 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10371039 if ((slpStakeInv == slpStakeInv))
10381040 then nil
10391041 else throw("Strict value is not equal to itself.")
10401042 }
10411043 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1042- let $t04437644838 = refreshKLpInternal(0, 0, 0)
1043- if (($t04437644838 == $t04437644838))
1044+ let $t04439844860 = refreshKLpInternal(0, 0, 0)
1045+ if (($t04439844860 == $t04439844860))
10441046 then {
1045- let updatedKLp = $t04437644838._2
1046- let refreshKLpActions = $t04437644838._1
1047+ let updatedKLp = $t04439844860._2
1048+ let refreshKLpActions = $t04439844860._1
10471049 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10481050 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10491051 then {
10501052 let reb = invoke(this, "rebalance", nil, nil)
10511053 if ((reb == reb))
10521054 then ((state ++ lpTransfer) ++ refreshKLpActions)
10531055 else throw("Strict value is not equal to itself.")
10541056 }
10551057 else throw("Strict value is not equal to itself.")
10561058 }
10571059 else throw("Strict value is not equal to itself.")
10581060 }
10591061 else throw("Strict value is not equal to itself.")
10601062 }
10611063 else throw("Strict value is not equal to itself.")
10621064 }
10631065 else throw("Strict value is not equal to itself.")
10641066 }
10651067 else throw("Strict value is not equal to itself.")
10661068 }
10671069 else throw("Strict value is not equal to itself.")
10681070 }
10691071
10701072
10711073
10721074 @Callable(i)
10731075 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10741076 then throw("Invalid value passed")
10751077 else {
10761078 let estPut = commonPut(i, maxSlippage, false)
10771079 let state = estPut._9
10781080 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10791081 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10801082 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10811083 if ((currentKLp == currentKLp))
10821084 then {
1083- let $t04545045515 = refreshKLpInternal(0, 0, 0)
1084- let refreshKLpActions = $t04545045515._1
1085- let updatedKLp = $t04545045515._2
1085+ let $t04547245537 = refreshKLpInternal(0, 0, 0)
1086+ let refreshKLpActions = $t04547245537._1
1087+ let updatedKLp = $t04547245537._2
10861088 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10871089 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10881090 then (state ++ refreshKLpActions)
10891091 else throw("Strict value is not equal to itself.")
10901092 }
10911093 else throw("Strict value is not equal to itself.")
10921094 }
10931095
10941096
10951097
10961098 @Callable(i)
10971099 func putOneTkn (minOutAmount,autoStake) = {
10981100 let isPoolOneTokenOperationsDisabled = {
10991101 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11001102 if ($isInstanceOf(@, "Boolean"))
11011103 then @
11021104 else throw(($getType(@) + " couldn't be cast to Boolean"))
11031105 }
11041106 let isPutDisabled = if (if (if (isGlobalShutdown())
11051107 then true
11061108 else (cfgPoolStatus == PoolPutDisabled))
11071109 then true
11081110 else (cfgPoolStatus == PoolShutdown))
11091111 then true
11101112 else isPoolOneTokenOperationsDisabled
11111113 let checks = [if (if (!(isPutDisabled))
11121114 then true
11131115 else isManager(i))
11141116 then true
11151117 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11161118 then true
11171119 else throwErr("exactly 1 payment are expected")]
11181120 if ((checks == checks))
11191121 then {
11201122 let payment = i.payments[0]
11211123 let paymentAssetId = payment.assetId
11221124 let paymentAmountRaw = payment.amount
11231125 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11241126 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11251127 else if ((paymentAssetId == cfgPriceAssetId))
11261128 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11271129 else throwErr("payment asset is not supported")
11281130 if ((currentKLp == currentKLp))
11291131 then {
11301132 let userAddress = i.caller
11311133 let txId = i.transactionId
1132- let $t04670346855 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133- if (($t04670346855 == $t04670346855))
1134+ let $t04672546877 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1135+ if (($t04672546877 == $t04672546877))
11341136 then {
1135- let paymentInAmountAsset = $t04670346855._5
1136- let bonus = $t04670346855._4
1137- let feeAmount = $t04670346855._3
1138- let commonState = $t04670346855._2
1139- let emitAmountEstimated = $t04670346855._1
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
11401142 let emitAmount = if (if ((minOutAmount > 0))
11411143 then (minOutAmount > emitAmountEstimated)
11421144 else false)
11431145 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11441146 else emitAmountEstimated
11451147 let emitInv = emit(emitAmount)
11461148 if ((emitInv == emitInv))
11471149 then {
11481150 let lpTransfer = if (autoStake)
11491151 then {
11501152 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11511153 if ((stakeInv == stakeInv))
11521154 then nil
11531155 else throw("Strict value is not equal to itself.")
11541156 }
11551157 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11561158 let sendFee = if ((feeAmount > 0))
11571159 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11581160 else nil
1159- let $t04744147638 = if ((this == feeCollectorAddress))
1161+ let $t04746347660 = if ((this == feeCollectorAddress))
11601162 then $Tuple2(0, 0)
11611163 else if (paymentInAmountAsset)
11621164 then $Tuple2(-(feeAmount), 0)
11631165 else $Tuple2(0, -(feeAmount))
1164- let amountAssetBalanceDelta = $t04744147638._1
1165- let priceAssetBalanceDelta = $t04744147638._2
1166- let $t04764147749 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167- let refreshKLpActions = $t04764147749._1
1168- let updatedKLp = $t04764147749._2
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
11691171 let kLp = value(getString(keyKLp))
11701172 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11711173 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11721174 then {
11731175 let reb = invoke(this, "rebalance", nil, nil)
11741176 if ((reb == reb))
11751177 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11761178 else throw("Strict value is not equal to itself.")
11771179 }
11781180 else throw("Strict value is not equal to itself.")
11791181 }
11801182 else throw("Strict value is not equal to itself.")
11811183 }
11821184 else throw("Strict value is not equal to itself.")
11831185 }
11841186 else throw("Strict value is not equal to itself.")
11851187 }
11861188 else throw("Strict value is not equal to itself.")
11871189 }
11881190
11891191
11901192
11911193 @Callable(i)
11921194 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1193- let $t04810448261 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194- let emitAmountEstimated = $t04810448261._1
1195- let commonState = $t04810448261._2
1196- let feeAmount = $t04810448261._3
1197- let bonus = $t04810448261._4
1198- let paymentInAmountAsset = $t04810448261._5
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
11991201 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12001202 }
12011203
12021204
12031205
12041206 @Callable(i)
12051207 func getOneTkn (outAssetIdStr,minOutAmount) = {
12061208 let isPoolOneTokenOperationsDisabled = {
12071209 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12081210 if ($isInstanceOf(@, "Boolean"))
12091211 then @
12101212 else throw(($getType(@) + " couldn't be cast to Boolean"))
12111213 }
12121214 let isGetDisabled = if (if (isGlobalShutdown())
12131215 then true
12141216 else (cfgPoolStatus == PoolShutdown))
12151217 then true
12161218 else isPoolOneTokenOperationsDisabled
12171219 let checks = [if (if (!(isGetDisabled))
12181220 then true
12191221 else isManager(i))
12201222 then true
12211223 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12221224 then true
12231225 else throwErr("exactly 1 payment are expected")]
12241226 if ((checks == checks))
12251227 then {
12261228 let outAssetId = parseAssetId(outAssetIdStr)
12271229 let payment = i.payments[0]
12281230 let paymentAssetId = payment.assetId
12291231 let paymentAmount = payment.amount
12301232 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12311233 if ((currentKLp == currentKLp))
12321234 then {
12331235 let userAddress = i.caller
12341236 let txId = i.transactionId
1235- let $t04914649299 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236- if (($t04914649299 == $t04914649299))
1237+ let $t04916849321 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1238+ if (($t04916849321 == $t04916849321))
12371239 then {
1238- let outInAmountAsset = $t04914649299._5
1239- let bonus = $t04914649299._4
1240- let feeAmount = $t04914649299._3
1241- let commonState = $t04914649299._2
1242- let amountEstimated = $t04914649299._1
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
12431245 let amount = if (if ((minOutAmount > 0))
12441246 then (minOutAmount > amountEstimated)
12451247 else false)
12461248 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12471249 else amountEstimated
12481250 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12491251 if ((burnInv == burnInv))
12501252 then {
12511253 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12521254 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12531255 let sendFee = if ((feeAmount > 0))
12541256 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12551257 else nil
1256- let $t04996350210 = {
1258+ let $t04998550232 = {
12571259 let feeAmountForCalc = if ((this == feeCollectorAddress))
12581260 then 0
12591261 else feeAmount
12601262 if (outInAmountAsset)
12611263 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12621264 else $Tuple2(0, -((amount + feeAmountForCalc)))
12631265 }
1264- let amountAssetBalanceDelta = $t04996350210._1
1265- let priceAssetBalanceDelta = $t04996350210._2
1266- let $t05021350321 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267- let refreshKLpActions = $t05021350321._1
1268- let updatedKLp = $t05021350321._2
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
12691271 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12701272 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12711273 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12721274 else throw("Strict value is not equal to itself.")
12731275 }
12741276 else throw("Strict value is not equal to itself.")
12751277 }
12761278 else throw("Strict value is not equal to itself.")
12771279 }
12781280 else throw("Strict value is not equal to itself.")
12791281 }
12801282 else throw("Strict value is not equal to itself.")
12811283 }
12821284
12831285
12841286
12851287 @Callable(i)
12861288 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1287- let $t05059950755 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288- let amountEstimated = $t05059950755._1
1289- let commonState = $t05059950755._2
1290- let feeAmount = $t05059950755._3
1291- let bonus = $t05059950755._4
1292- let outInAmountAsset = $t05059950755._5
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
12931295 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12941296 }
12951297
12961298
12971299
12981300 @Callable(i)
12991301 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13001302 let isPoolOneTokenOperationsDisabled = {
13011303 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13021304 if ($isInstanceOf(@, "Boolean"))
13031305 then @
13041306 else throw(($getType(@) + " couldn't be cast to Boolean"))
13051307 }
13061308 let isGetDisabled = if (if (isGlobalShutdown())
13071309 then true
13081310 else (cfgPoolStatus == PoolShutdown))
13091311 then true
13101312 else isPoolOneTokenOperationsDisabled
13111313 let checks = [if (if (!(isGetDisabled))
13121314 then true
13131315 else isManager(i))
13141316 then true
13151317 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13161318 then true
13171319 else throwErr("no payments are expected")]
13181320 if ((checks == checks))
13191321 then {
13201322 let outAssetId = parseAssetId(outAssetIdStr)
13211323 let userAddress = i.caller
13221324 let txId = i.transactionId
13231325 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13241326 if ((currentKLp == currentKLp))
13251327 then {
13261328 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13271329 if ((unstakeInv == unstakeInv))
13281330 then {
1329- let $t05166051811 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330- if (($t05166051811 == $t05166051811))
1331+ let $t05168251833 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1332+ if (($t05168251833 == $t05168251833))
13311333 then {
1332- let outInAmountAsset = $t05166051811._5
1333- let bonus = $t05166051811._4
1334- let feeAmount = $t05166051811._3
1335- let commonState = $t05166051811._2
1336- let amountEstimated = $t05166051811._1
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
13371339 let amount = if (if ((minOutAmount > 0))
13381340 then (minOutAmount > amountEstimated)
13391341 else false)
13401342 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13411343 else amountEstimated
13421344 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13431345 if ((burnInv == burnInv))
13441346 then {
13451347 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13461348 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13471349 let sendFee = if ((feeAmount > 0))
13481350 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13491351 else nil
1350- let $t05247052717 = {
1352+ let $t05249252739 = {
13511353 let feeAmountForCalc = if ((this == feeCollectorAddress))
13521354 then 0
13531355 else feeAmount
13541356 if (outInAmountAsset)
13551357 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13561358 else $Tuple2(0, -((amount + feeAmountForCalc)))
13571359 }
1358- let amountAssetBalanceDelta = $t05247052717._1
1359- let priceAssetBalanceDelta = $t05247052717._2
1360- let $t05272052828 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361- let refreshKLpActions = $t05272052828._1
1362- let updatedKLp = $t05272052828._2
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
13631365 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13641366 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13651367 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13661368 else throw("Strict value is not equal to itself.")
13671369 }
13681370 else throw("Strict value is not equal to itself.")
13691371 }
13701372 else throw("Strict value is not equal to itself.")
13711373 }
13721374 else throw("Strict value is not equal to itself.")
13731375 }
13741376 else throw("Strict value is not equal to itself.")
13751377 }
13761378 else throw("Strict value is not equal to itself.")
13771379 }
13781380
13791381
13801382
13811383 @Callable(i)
13821384 func get () = {
13831385 let res = commonGet(i)
13841386 let outAmAmt = res._1
13851387 let outPrAmt = res._2
13861388 let pmtAmt = res._3
13871389 let pmtAssetId = res._4
13881390 let state = res._5
13891391 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
13901392 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13911393 if ((currentKLp == currentKLp))
13921394 then {
13931395 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13941396 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13951397 then {
1396- let $t05392354004 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397- let refreshKLpActions = $t05392354004._1
1398- let updatedKLp = $t05392354004._2
1398+ let $t05394554026 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1399+ let refreshKLpActions = $t05394554026._1
1400+ let updatedKLp = $t05394554026._2
13991401 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14001402 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14011403 then ((withdrawState ++ state) ++ refreshKLpActions)
14021404 else throw("Strict value is not equal to itself.")
14031405 }
14041406 else throw("Strict value is not equal to itself.")
14051407 }
14061408 else throw("Strict value is not equal to itself.")
14071409 }
14081410
14091411
14101412
14111413 @Callable(i)
14121414 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14131415 let res = commonGet(i)
14141416 let outAmAmt = res._1
14151417 let outPrAmt = res._2
14161418 let pmtAmt = res._3
14171419 let pmtAssetId = res._4
14181420 let state = res._5
14191421 if ((noLessThenAmtAsset > outAmAmt))
14201422 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14211423 else if ((noLessThenPriceAsset > outPrAmt))
14221424 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14231425 else {
14241426 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14251427 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14261428 if ((currentKLp == currentKLp))
14271429 then {
14281430 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14291431 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14301432 then {
1431- let $t05509955180 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432- let refreshKLpActions = $t05509955180._1
1433- let updatedKLp = $t05509955180._2
1433+ let $t05512155202 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1434+ let refreshKLpActions = $t05512155202._1
1435+ let updatedKLp = $t05512155202._2
14341436 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14351437 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14361438 then ((withdrawState ++ state) ++ refreshKLpActions)
14371439 else throw("Strict value is not equal to itself.")
14381440 }
14391441 else throw("Strict value is not equal to itself.")
14401442 }
14411443 else throw("Strict value is not equal to itself.")
14421444 }
14431445 }
14441446
14451447
14461448
14471449 @Callable(i)
14481450 func unstakeAndGet (amount) = {
14491451 let checkPayments = if ((size(i.payments) != 0))
14501452 then throw("No payments are expected")
14511453 else true
14521454 if ((checkPayments == checkPayments))
14531455 then {
14541456 let cfg = getPoolConfig()
14551457 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14561458 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14571459 if ((currentKLp == currentKLp))
14581460 then {
14591461 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14601462 if ((unstakeInv == unstakeInv))
14611463 then {
14621464 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14631465 let outAmAmt = res._1
14641466 let outPrAmt = res._2
14651467 let poolStatus = parseIntValue(res._9)
14661468 let state = res._10
14671469 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14681470 let checkPoolStatus = if (if (isGlobalShutdown())
14691471 then true
14701472 else (poolStatus == PoolShutdown))
14711473 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14721474 else true
14731475 if ((checkPoolStatus == checkPoolStatus))
14741476 then {
14751477 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14761478 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14771479 then {
1478- let $t05645256533 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479- let refreshKLpActions = $t05645256533._1
1480- let updatedKLp = $t05645256533._2
1480+ let $t05647456555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1481+ let refreshKLpActions = $t05647456555._1
1482+ let updatedKLp = $t05647456555._2
14811483 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14821484 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14831485 then ((withdrawState ++ state) ++ refreshKLpActions)
14841486 else throw("Strict value is not equal to itself.")
14851487 }
14861488 else throw("Strict value is not equal to itself.")
14871489 }
14881490 else throw("Strict value is not equal to itself.")
14891491 }
14901492 else throw("Strict value is not equal to itself.")
14911493 }
14921494 else throw("Strict value is not equal to itself.")
14931495 }
14941496 else throw("Strict value is not equal to itself.")
14951497 }
14961498
14971499
14981500
14991501 @Callable(i)
15001502 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15011503 let isGetDisabled = if (isGlobalShutdown())
15021504 then true
15031505 else (cfgPoolStatus == PoolShutdown)
15041506 let checks = [if (!(isGetDisabled))
15051507 then true
15061508 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15071509 then true
15081510 else throw("no payments are expected")]
15091511 if ((checks == checks))
15101512 then {
15111513 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15121514 if ((currentKLp == currentKLp))
15131515 then {
15141516 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15151517 if ((unstakeInv == unstakeInv))
15161518 then {
15171519 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15181520 let outAmAmt = res._1
15191521 let outPrAmt = res._2
15201522 let state = res._10
15211523 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15221524 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15231525 then true
15241526 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15251527 then true
15261528 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15271529 if ((checkAmounts == checkAmounts))
15281530 then {
15291531 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15301532 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15311533 then {
1532- let $t05797458055 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533- let refreshKLpActions = $t05797458055._1
1534- let updatedKLp = $t05797458055._2
1534+ let $t05799658077 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1535+ let refreshKLpActions = $t05799658077._1
1536+ let updatedKLp = $t05799658077._2
15351537 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15361538 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15371539 then ((withdrawState ++ state) ++ refreshKLpActions)
15381540 else throw("Strict value is not equal to itself.")
15391541 }
15401542 else throw("Strict value is not equal to itself.")
15411543 }
15421544 else throw("Strict value is not equal to itself.")
15431545 }
15441546 else throw("Strict value is not equal to itself.")
15451547 }
15461548 else throw("Strict value is not equal to itself.")
15471549 }
15481550 else throw("Strict value is not equal to itself.")
15491551 }
15501552
15511553
15521554
15531555 @Callable(i)
15541556 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15551557 then throw("permissions denied")
15561558 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15571559
15581560
15591561
15601562 @Callable(i)
15611563 func refreshKLp () = {
15621564 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15631565 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15641566 then unit
15651567 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15661568 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15671569 then {
15681570 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1569- let $t05925959323 = refreshKLpInternal(0, 0, 0)
1570- let kLpUpdateActions = $t05925959323._1
1571- let updatedKLp = $t05925959323._2
1571+ let $t05928159345 = refreshKLpInternal(0, 0, 0)
1572+ let kLpUpdateActions = $t05928159345._1
1573+ let updatedKLp = $t05928159345._2
15721574 let actions = if ((kLp != updatedKLp))
15731575 then kLpUpdateActions
15741576 else throwErr("nothing to refresh")
15751577 $Tuple2(actions, toString(updatedKLp))
15761578 }
15771579 else throw("Strict value is not equal to itself.")
15781580 }
15791581
15801582
15811583
15821584 @Callable(i)
15831585 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
15841586
15851587
15861588
15871589 @Callable(i)
15881590 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
15891591
15901592
15911593
15921594 @Callable(i)
15931595 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
15941596 let prices = calcPrices(amAmt, prAmt, lpAmt)
15951597 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
15961598 }
15971599
15981600
15991601
16001602 @Callable(i)
16011603 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16021604
16031605
16041606
16051607 @Callable(i)
16061608 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16071609
16081610
16091611
16101612 @Callable(i)
16111613 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16121614
16131615
16141616
16151617 @Callable(i)
16161618 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16171619
16181620
16191621
16201622 @Callable(i)
16211623 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16221624 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16231625 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16241626 }
16251627
16261628
16271629
16281630 @Callable(i)
16291631 func statsREADONLY () = {
16301632 let cfg = getPoolConfig()
16311633 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16321634 let amtAssetId = cfg[idxAmtAssetId]
16331635 let priceAssetId = cfg[idxPriceAssetId]
16341636 let iAmtAssetId = cfg[idxIAmtAssetId]
16351637 let iPriceAssetId = cfg[idxIPriceAssetId]
16361638 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16371639 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16381640 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16391641 let accAmtAssetBalance = getAccBalance(amtAssetId)
16401642 let accPriceAssetBalance = getAccBalance(priceAssetId)
16411643 let pricesList = if ((poolLPBalance == 0))
16421644 then [zeroBigInt, zeroBigInt, zeroBigInt]
16431645 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16441646 let curPrice = 0
16451647 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16461648 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16471649 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16481650 $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))
16491651 }
16501652
16511653
16521654
16531655 @Callable(i)
16541656 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16551657 let cfg = getPoolConfig()
16561658 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16571659 let amAssetIdStr = cfg[idxAmtAssetId]
16581660 let amAssetId = fromBase58String(amAssetIdStr)
16591661 let prAssetIdStr = cfg[idxPriceAssetId]
16601662 let prAssetId = fromBase58String(prAssetIdStr)
16611663 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16621664 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16631665 let poolStatus = cfg[idxPoolStatus]
16641666 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16651667 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16661668 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16671669 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16681670 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16691671 let curPriceX18 = if ((poolLPBalance == 0))
16701672 then zeroBigInt
16711673 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16721674 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16731675 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16741676 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16751677 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16761678 let calcLpAmt = estPut._1
16771679 let curPriceCalc = estPut._3
16781680 let amBalance = estPut._4
16791681 let prBalance = estPut._5
16801682 let lpEmission = estPut._6
16811683 $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))
16821684 }
16831685
16841686
16851687
16861688 @Callable(i)
16871689 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
16881690 let cfg = getPoolConfig()
16891691 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16901692 let amAssetIdStr = cfg[idxAmtAssetId]
16911693 let amAssetId = fromBase58String(amAssetIdStr)
16921694 let prAssetIdStr = cfg[idxPriceAssetId]
16931695 let prAssetId = fromBase58String(prAssetIdStr)
16941696 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16951697 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16961698 let poolStatus = cfg[idxPoolStatus]
16971699 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16981700 let amBalanceRaw = getAccBalance(amAssetIdStr)
16991701 let prBalanceRaw = getAccBalance(prAssetIdStr)
17001702 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17011703 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17021704 let curPriceX18 = if ((poolLPBalance == 0))
17031705 then zeroBigInt
17041706 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17051707 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17061708 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17071709 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17081710 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17091711 let calcLpAmt = estPut._1
17101712 let curPriceCalc = estPut._3
17111713 let amBalance = estPut._4
17121714 let prBalance = estPut._5
17131715 let lpEmission = estPut._6
17141716 $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))
17151717 }
17161718
17171719
17181720
17191721 @Callable(i)
17201722 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17211723 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17221724 let outAmAmt = res._1
17231725 let outPrAmt = res._2
17241726 let amBalance = res._5
17251727 let prBalance = res._6
17261728 let lpEmission = res._7
17271729 let curPrice = res._8
17281730 let poolStatus = parseIntValue(res._9)
17291731 $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))
17301732 }
17311733
17321734
17331735 @Verifier(tx)
17341736 func verify () = {
17351737 let targetPublicKey = match managerPublicKeyOrUnit() {
17361738 case pk: ByteVector =>
17371739 pk
17381740 case _: Unit =>
17391741 tx.senderPublicKey
17401742 case _ =>
17411743 throw("Match error")
17421744 }
17431745 match tx {
17441746 case order: Order =>
17451747 let matcherPub = getMatcherPubOrFail()
1746- let $t06798568102 = if (skipOrderValidation())
1748+ let $t06800768124 = if (skipOrderValidation())
17471749 then $Tuple2(true, "")
17481750 else validateMatcherOrderAllowed(order)
1749- let orderValid = $t06798568102._1
1750- let orderValidInfo = $t06798568102._2
1751+ let orderValid = $t06800768124._1
1752+ let orderValidInfo = $t06800768124._2
17511753 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17521754 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17531755 if (if (if (orderValid)
17541756 then senderValid
17551757 else false)
17561758 then matcherValid
17571759 else false)
17581760 then true
17591761 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17601762 case s: SetScriptTransaction =>
17611763 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17621764 then true
17631765 else {
17641766 let newHash = blake2b256(value(s.script))
17651767 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17661768 let currentHash = scriptHash(this)
17671769 if ((allowedHash == newHash))
17681770 then (currentHash != newHash)
17691771 else false
17701772 }
17711773 case _ =>
17721774 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17731775 }
17741776 }
17751777

github/deemru/w8io/026f985 
213.99 ms