tx · D8uxvjoEmPTrgimWJ4cyQ6a3KGw4KH1we9s4mWsvoqDk

3N4vUDe3oc1YPNwMyQi2h8f2tmGoA7wBZp2:  -0.04300000 Waves

2024.04.17 09:32 [3066418] smart account 3N4vUDe3oc1YPNwMyQi2h8f2tmGoA7wBZp2 > SELF 0.00000000 Waves

{ "type": 13, "id": "D8uxvjoEmPTrgimWJ4cyQ6a3KGw4KH1we9s4mWsvoqDk", "fee": 4300000, "feeAssetId": null, "timestamp": 1713335552669, "version": 2, "chainId": 84, "sender": "3N4vUDe3oc1YPNwMyQi2h8f2tmGoA7wBZp2", "senderPublicKey": "6MuWw1pkme7UgQX2hZh8yTZyoWVkz8A4rmHZ1acrsrVm", "proofs": [ "3UWqGtbeyeqgHNE6AeGM8AzwSwVD8JXGzejxBRrq7HBttkxbuHxT4t9CSgVRWKukGEeigVp5iv4EzNsHPzT1Twps" ], "script": "base64:BgLjOAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW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nByb29mcwAABQJpb6uQlhc=", "height": 3066418, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7Kjym8WVeoSUpaGvSF5bVaZS6u6G8CfTg19g83hVa4cD Next: tEDh3rNWtafsXjwqkxk6KSq7RkhxZJny9VsjEMAJYJW Diff:
OldNewDifferences
399399
400400
401401 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
402- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
403- if ((currentAdditionalBalance == currentAdditionalBalance))
402+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
403+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
404404 then {
405- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
406- if ((currentStakingAssetBalance == currentStakingAssetBalance))
405+ let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
406+ then getAdditionalBalanceOrZero(assetId)
407+ else 0
408+ if ((currentAdditionalBalance == currentAdditionalBalance))
407409 then {
408410 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
409411 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
427429
428430
429431 func rebalanceAsset (assetId) = {
430- let $t01617116307 = getLeaseProxyConfig(assetId)
431- let isLeasable = $t01617116307._1
432- let leasedRatio = $t01617116307._2
433- let minBalance = $t01617116307._3
434- let proxyAddress = $t01617116307._4
435- let proxyAssetId = $t01617116307._5
436- let proxyRateMul = $t01617116307._6
437- let stakingProfitAddress = $t01617116307._7
432+ let $t01622016356 = getLeaseProxyConfig(assetId)
433+ let isLeasable = $t01622016356._1
434+ let leasedRatio = $t01622016356._2
435+ let minBalance = $t01622016356._3
436+ let proxyAddress = $t01622016356._4
437+ let proxyAssetId = $t01622016356._5
438+ let proxyRateMul = $t01622016356._6
439+ let stakingProfitAddress = $t01622016356._7
438440 if (isLeasable)
439441 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
440442 else nil
442444
443445
444446 func withdrawAndRebalanceAsset (assetId,getAmount) = {
445- let $t01670616842 = getLeaseProxyConfig(assetId)
446- let isLeasable = $t01670616842._1
447- let leasedRatio = $t01670616842._2
448- let minBalance = $t01670616842._3
449- let proxyAddress = $t01670616842._4
450- let proxyAssetId = $t01670616842._5
451- let proxyRateMul = $t01670616842._6
452- let stakingProfitAddress = $t01670616842._7
447+ let $t01675516891 = getLeaseProxyConfig(assetId)
448+ let isLeasable = $t01675516891._1
449+ let leasedRatio = $t01675516891._2
450+ let minBalance = $t01675516891._3
451+ let proxyAddress = $t01675516891._4
452+ let proxyAssetId = $t01675516891._5
453+ let proxyRateMul = $t01675516891._6
454+ let stakingProfitAddress = $t01675516891._7
453455 if (isLeasable)
454456 then {
455- let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
456- if ((newTotalLeasableBalance == newTotalLeasableBalance))
457+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(proxyAssetId)
458+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
457459 then {
458- let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
459- if ((newAdditionalBalance == newAdditionalBalance))
460+ let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
461+ then getAdditionalBalanceOrZero(assetId)
462+ else 0
463+ if ((currentAdditionalBalance == currentAdditionalBalance))
460464 then {
461- let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
462- if ((withdrawAmount == withdrawAmount))
463- then if ((0 > withdrawAmount))
464- then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
465- else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
465+ let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
466+ if ((newTotalLeasableBalance == newTotalLeasableBalance))
467+ then {
468+ let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
469+ if ((newAdditionalBalance == newAdditionalBalance))
470+ then {
471+ let withdrawAmount = (currentAdditionalBalance - newAdditionalBalance)
472+ if ((withdrawAmount == withdrawAmount))
473+ then if ((withdrawAmount == 0))
474+ then nil
475+ else if ((0 > withdrawAmount))
476+ then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
477+ else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
478+ else throw("Strict value is not equal to itself.")
479+ }
480+ else throw("Strict value is not equal to itself.")
481+ }
466482 else throw("Strict value is not equal to itself.")
467483 }
468484 else throw("Strict value is not equal to itself.")
662678 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
663679 let amountAssetAmount = order.amount
664680 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
665- let $t02923129443 = if ((order.orderType == Buy))
681+ let $t02951729729 = if ((order.orderType == Buy))
666682 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
667683 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
668- let amountAssetBalanceDelta = $t02923129443._1
669- let priceAssetBalanceDelta = $t02923129443._2
684+ let amountAssetBalanceDelta = $t02951729729._1
685+ let priceAssetBalanceDelta = $t02951729729._2
670686 if (if (if (isGlobalShutdown())
671687 then true
672688 else (cfgPoolStatus == PoolMatcherDisabled))
679695 then throw("Wrong order assets.")
680696 else {
681697 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
682- let $t02988329983 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
683- let unusedActions = $t02988329983._1
684- let kLpNew = $t02988329983._2
698+ let $t03016930269 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
699+ let unusedActions = $t03016930269._1
700+ let kLpNew = $t03016930269._2
685701 let isOrderValid = (kLpNew >= kLp)
686702 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
687703 $Tuple2(isOrderValid, info)
764780 else if ((paymentAssetId == cfgPriceAssetId))
765781 then false
766782 else throwErr("invalid asset")
767- let $t03316933462 = if (isEval)
783+ let $t03345533748 = if (isEval)
768784 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
769785 else if (paymentInAmountAsset)
770786 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
771787 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
772- let amountBalanceOld = $t03316933462._1
773- let priceBalanceOld = $t03316933462._2
774- let $t03346633615 = if (paymentInAmountAsset)
788+ let amountBalanceOld = $t03345533748._1
789+ let priceBalanceOld = $t03345533748._2
790+ let $t03375233901 = if (paymentInAmountAsset)
775791 then $Tuple2(paymentAmountRaw, 0)
776792 else $Tuple2(0, paymentAmountRaw)
777- let amountAssetAmountRaw = $t03346633615._1
778- let priceAssetAmountRaw = $t03346633615._2
793+ let amountAssetAmountRaw = $t03375233901._1
794+ let priceAssetAmountRaw = $t03375233901._2
779795 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
780796 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
781- let $t03374733811 = takeFee(paymentAmountRaw, inFee)
782- let paymentAmount = $t03374733811._1
783- let feeAmount = $t03374733811._2
797+ let $t03403334097 = takeFee(paymentAmountRaw, inFee)
798+ let paymentAmount = $t03403334097._1
799+ let feeAmount = $t03403334097._2
784800 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
785801 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
786802 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
803819 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
804820 let priceOld = fromX18(priceOldX18, scale8)
805821 let loss = {
806- let $t03549235659 = if (paymentInAmountAsset)
822+ let $t03577835945 = if (paymentInAmountAsset)
807823 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
808824 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
809- let amount = $t03549235659._1
810- let balance = $t03549235659._2
825+ let amount = $t03577835945._1
826+ let balance = $t03577835945._2
811827 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
812828 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
813829 }
847863 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
848864 let redeemedBigInt = toBigInt(paymentAmount)
849865 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
850- let $t03773737793 = takeFee(amountRaw, outFee)
851- let totalAmount = $t03773737793._1
852- let feeAmount = $t03773737793._2
853- let $t03779738023 = if (outInAmountAsset)
866+ let $t03802338079 = takeFee(amountRaw, outFee)
867+ let totalAmount = $t03802338079._1
868+ let feeAmount = $t03802338079._2
869+ let $t03808338309 = if (outInAmountAsset)
854870 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
855871 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
856- let outAmAmount = $t03779738023._1
857- let outPrAmount = $t03779738023._2
858- let amBalanceNew = $t03779738023._3
859- let prBalanceNew = $t03779738023._4
872+ let outAmAmount = $t03808338309._1
873+ let outPrAmount = $t03808338309._2
874+ let amBalanceNew = $t03808338309._3
875+ let prBalanceNew = $t03808338309._4
860876 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
861877 let priceNew = fromX18(priceNewX18, scale8)
862878 let commonState = if (isEval)
921937
922938 @Callable(i)
923939 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
924- let $t03988140186 = if ((isReverse == false))
940+ let $t04016740472 = if ((isReverse == false))
925941 then {
926942 let assetOut = getStringOrFail(this, pa())
927943 let assetIn = getStringOrFail(this, aa())
932948 let assetIn = getStringOrFail(this, pa())
933949 $Tuple2(assetOut, assetIn)
934950 }
935- let assetOut = $t03988140186._1
936- let assetIn = $t03988140186._2
951+ let assetOut = $t04016740472._1
952+ let assetIn = $t04016740472._2
937953 let poolAssetInBalance = getAccBalance(assetIn)
938954 let poolAssetOutBalance = getAccBalance(assetOut)
939955 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10771093 else throw("Strict value is not equal to itself.")
10781094 }
10791095 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1080- let $t04536245824 = refreshKLpInternal(0, 0, 0)
1081- if (($t04536245824 == $t04536245824))
1096+ let $t04564846110 = refreshKLpInternal(0, 0, 0)
1097+ if (($t04564846110 == $t04564846110))
10821098 then {
1083- let updatedKLp = $t04536245824._2
1084- let refreshKLpActions = $t04536245824._1
1099+ let updatedKLp = $t04564846110._2
1100+ let refreshKLpActions = $t04564846110._1
10851101 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10861102 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10871103 then {
11181134 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11191135 if ((currentKLp == currentKLp))
11201136 then {
1121- let $t04643646501 = refreshKLpInternal(0, 0, 0)
1122- let refreshKLpActions = $t04643646501._1
1123- let updatedKLp = $t04643646501._2
1137+ let $t04672246787 = refreshKLpInternal(0, 0, 0)
1138+ let refreshKLpActions = $t04672246787._1
1139+ let updatedKLp = $t04672246787._2
11241140 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11251141 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11261142 then (state ++ refreshKLpActions)
11691185 then {
11701186 let userAddress = i.caller
11711187 let txId = i.transactionId
1172- let $t04773047882 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1173- if (($t04773047882 == $t04773047882))
1188+ let $t04801648168 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1189+ if (($t04801648168 == $t04801648168))
11741190 then {
1175- let paymentInAmountAsset = $t04773047882._5
1176- let bonus = $t04773047882._4
1177- let feeAmount = $t04773047882._3
1178- let commonState = $t04773047882._2
1179- let emitAmountEstimated = $t04773047882._1
1191+ let paymentInAmountAsset = $t04801648168._5
1192+ let bonus = $t04801648168._4
1193+ let feeAmount = $t04801648168._3
1194+ let commonState = $t04801648168._2
1195+ let emitAmountEstimated = $t04801648168._1
11801196 let emitAmount = if (if ((minOutAmount > 0))
11811197 then (minOutAmount > emitAmountEstimated)
11821198 else false)
11961212 let sendFee = if ((feeAmount > 0))
11971213 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11981214 else nil
1199- let $t04846848665 = if ((this == feeCollectorAddress))
1215+ let $t04875448951 = if ((this == feeCollectorAddress))
12001216 then $Tuple2(0, 0)
12011217 else if (paymentInAmountAsset)
12021218 then $Tuple2(-(feeAmount), 0)
12031219 else $Tuple2(0, -(feeAmount))
1204- let amountAssetBalanceDelta = $t04846848665._1
1205- let priceAssetBalanceDelta = $t04846848665._2
1206- let $t04866848776 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1207- let refreshKLpActions = $t04866848776._1
1208- let updatedKLp = $t04866848776._2
1220+ let amountAssetBalanceDelta = $t04875448951._1
1221+ let priceAssetBalanceDelta = $t04875448951._2
1222+ let $t04895449062 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1223+ let refreshKLpActions = $t04895449062._1
1224+ let updatedKLp = $t04895449062._2
12091225 let kLp = value(getString(keyKLp))
12101226 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12111227 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12301246
12311247 @Callable(i)
12321248 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1233- let $t04913149288 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1234- let emitAmountEstimated = $t04913149288._1
1235- let commonState = $t04913149288._2
1236- let feeAmount = $t04913149288._3
1237- let bonus = $t04913149288._4
1238- let paymentInAmountAsset = $t04913149288._5
1249+ let $t04941749574 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1250+ let emitAmountEstimated = $t04941749574._1
1251+ let commonState = $t04941749574._2
1252+ let feeAmount = $t04941749574._3
1253+ let bonus = $t04941749574._4
1254+ let paymentInAmountAsset = $t04941749574._5
12391255 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12401256 }
12411257
12741290 then {
12751291 let userAddress = i.caller
12761292 let txId = i.transactionId
1277- let $t05021050363 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1278- if (($t05021050363 == $t05021050363))
1293+ let $t05049650649 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1294+ if (($t05049650649 == $t05049650649))
12791295 then {
1280- let outInAmountAsset = $t05021050363._5
1281- let bonus = $t05021050363._4
1282- let feeAmount = $t05021050363._3
1283- let commonState = $t05021050363._2
1284- let amountEstimated = $t05021050363._1
1296+ let outInAmountAsset = $t05049650649._5
1297+ let bonus = $t05049650649._4
1298+ let feeAmount = $t05049650649._3
1299+ let commonState = $t05049650649._2
1300+ let amountEstimated = $t05049650649._1
12851301 let amount = if (if ((minOutAmount > 0))
12861302 then (minOutAmount > amountEstimated)
12871303 else false)
12951311 let sendFee = if ((feeAmount > 0))
12961312 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12971313 else nil
1298- let $t05102751274 = {
1314+ let $t05131351560 = {
12991315 let feeAmountForCalc = if ((this == feeCollectorAddress))
13001316 then 0
13011317 else feeAmount
13031319 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13041320 else $Tuple2(0, -((amount + feeAmountForCalc)))
13051321 }
1306- let amountAssetBalanceDelta = $t05102751274._1
1307- let priceAssetBalanceDelta = $t05102751274._2
1308- let $t05127751385 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1309- let refreshKLpActions = $t05127751385._1
1310- let updatedKLp = $t05127751385._2
1322+ let amountAssetBalanceDelta = $t05131351560._1
1323+ let priceAssetBalanceDelta = $t05131351560._2
1324+ let $t05156351671 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1325+ let refreshKLpActions = $t05156351671._1
1326+ let updatedKLp = $t05156351671._2
13111327 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13121328 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13131329 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13261342
13271343 @Callable(i)
13281344 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1329- let $t05166351819 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1330- let amountEstimated = $t05166351819._1
1331- let commonState = $t05166351819._2
1332- let feeAmount = $t05166351819._3
1333- let bonus = $t05166351819._4
1334- let outInAmountAsset = $t05166351819._5
1345+ let $t05194952105 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1346+ let amountEstimated = $t05194952105._1
1347+ let commonState = $t05194952105._2
1348+ let feeAmount = $t05194952105._3
1349+ let bonus = $t05194952105._4
1350+ let outInAmountAsset = $t05194952105._5
13351351 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13361352 }
13371353
13701386 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13711387 if ((unstakeInv == unstakeInv))
13721388 then {
1373- let $t05276152912 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1374- if (($t05276152912 == $t05276152912))
1389+ let $t05304753198 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1390+ if (($t05304753198 == $t05304753198))
13751391 then {
1376- let outInAmountAsset = $t05276152912._5
1377- let bonus = $t05276152912._4
1378- let feeAmount = $t05276152912._3
1379- let commonState = $t05276152912._2
1380- let amountEstimated = $t05276152912._1
1392+ let outInAmountAsset = $t05304753198._5
1393+ let bonus = $t05304753198._4
1394+ let feeAmount = $t05304753198._3
1395+ let commonState = $t05304753198._2
1396+ let amountEstimated = $t05304753198._1
13811397 let amount = if (if ((minOutAmount > 0))
13821398 then (minOutAmount > amountEstimated)
13831399 else false)
13911407 let sendFee = if ((feeAmount > 0))
13921408 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13931409 else nil
1394- let $t05357153818 = {
1410+ let $t05385754104 = {
13951411 let feeAmountForCalc = if ((this == feeCollectorAddress))
13961412 then 0
13971413 else feeAmount
13991415 then $Tuple2(-((amount + feeAmountForCalc)), 0)
14001416 else $Tuple2(0, -((amount + feeAmountForCalc)))
14011417 }
1402- let amountAssetBalanceDelta = $t05357153818._1
1403- let priceAssetBalanceDelta = $t05357153818._2
1404- let $t05382153929 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1405- let refreshKLpActions = $t05382153929._1
1406- let updatedKLp = $t05382153929._2
1418+ let amountAssetBalanceDelta = $t05385754104._1
1419+ let priceAssetBalanceDelta = $t05385754104._2
1420+ let $t05410754215 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1421+ let refreshKLpActions = $t05410754215._1
1422+ let updatedKLp = $t05410754215._2
14071423 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14081424 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14091425 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14371453 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14381454 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14391455 then {
1440- let $t05502455105 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1441- let refreshKLpActions = $t05502455105._1
1442- let updatedKLp = $t05502455105._2
1456+ let $t05531055391 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1457+ let refreshKLpActions = $t05531055391._1
1458+ let updatedKLp = $t05531055391._2
14431459 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14441460 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14451461 then ((withdrawState ++ state) ++ refreshKLpActions)
14721488 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14731489 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14741490 then {
1475- let $t05620056281 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1476- let refreshKLpActions = $t05620056281._1
1477- let updatedKLp = $t05620056281._2
1491+ let $t05648656567 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1492+ let refreshKLpActions = $t05648656567._1
1493+ let updatedKLp = $t05648656567._2
14781494 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14791495 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14801496 then ((withdrawState ++ state) ++ refreshKLpActions)
15221538 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15231539 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15241540 then {
1525- let $t05762957710 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1526- let refreshKLpActions = $t05762957710._1
1527- let updatedKLp = $t05762957710._2
1541+ let $t05791557996 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1542+ let refreshKLpActions = $t05791557996._1
1543+ let updatedKLp = $t05791557996._2
15281544 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15291545 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15301546 then ((withdrawState ++ state) ++ refreshKLpActions)
15781594 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15791595 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15801596 then {
1581- let $t05918859269 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1582- let refreshKLpActions = $t05918859269._1
1583- let updatedKLp = $t05918859269._2
1597+ let $t05947459555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1598+ let refreshKLpActions = $t05947459555._1
1599+ let updatedKLp = $t05947459555._2
15841600 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15851601 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15861602 then ((withdrawState ++ state) ++ refreshKLpActions)
16151631 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
16161632 then {
16171633 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1618- let $t06047360537 = refreshKLpInternal(0, 0, 0)
1619- let kLpUpdateActions = $t06047360537._1
1620- let updatedKLp = $t06047360537._2
1634+ let $t06075960823 = refreshKLpInternal(0, 0, 0)
1635+ let kLpUpdateActions = $t06075960823._1
1636+ let updatedKLp = $t06075960823._2
16211637 let actions = if ((kLp != updatedKLp))
16221638 then kLpUpdateActions
16231639 else throwErr("nothing to refresh")
17921808 match tx {
17931809 case order: Order =>
17941810 let matcherPub = getMatcherPubOrFail()
1795- let $t06919969316 = if (skipOrderValidation())
1811+ let $t06948569602 = if (skipOrderValidation())
17961812 then $Tuple2(true, "")
17971813 else validateMatcherOrderAllowed(order)
1798- let orderValid = $t06919969316._1
1799- let orderValidInfo = $t06919969316._2
1814+ let orderValid = $t06948569602._1
1815+ let orderValidInfo = $t06948569602._2
18001816 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
18011817 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
18021818 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 keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP)
232232
233233
234234 func isAddressWhitelisted (address) = valueOrElse(getBoolean(factoryContract, keyAddressWhitelisted(address)), false)
235235
236236
237237 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
238238
239239
240240 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
241241
242242
243243 func getPoolConfig () = {
244244 let amtAsset = getStringOrFail(this, aa())
245245 let priceAsset = getStringOrFail(this, pa())
246246 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
247247 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
248248 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
249249 }
250250
251251
252252 func parseAssetId (input) = if ((input == wavesString))
253253 then unit
254254 else fromBase58String(input)
255255
256256
257257 func assetIdToString (input) = if ((input == unit))
258258 then wavesString
259259 else toBase58String(value(input))
260260
261261
262262 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]))
263263
264264
265265 let poolConfigParsed = parsePoolConfig(getPoolConfig())
266266
267267 let $t097699935 = poolConfigParsed
268268
269269 let cfgPoolAddress = $t097699935._1
270270
271271 let cfgPoolStatus = $t097699935._2
272272
273273 let cfgLpAssetId = $t097699935._3
274274
275275 let cfgAmountAssetId = $t097699935._4
276276
277277 let cfgPriceAssetId = $t097699935._5
278278
279279 let cfgAmountAssetDecimals = $t097699935._6
280280
281281 let cfgPriceAssetDecimals = $t097699935._7
282282
283283 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
284284
285285
286286 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
287287
288288 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
289289
290290 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)
291291
292292
293293 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)
294294
295295
296296 func getAccBalance (assetId) = {
297297 let balanceOnPool = if ((assetId == "WAVES"))
298298 then wavesBalance(this).available
299299 else assetBalance(this, fromBase58String(assetId))
300300 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
301301 max([0, totalBalance])
302302 }
303303
304304
305305 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
306306
307307
308308 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
309309
310310
311311 func getRate (proxy) = {
312312 let inv = invoke(proxy, "getRate", nil, nil)
313313 if ((inv == inv))
314314 then match inv {
315315 case r: Int =>
316316 r
317317 case _ =>
318318 throwErr("proxy.getRate() unexpected value")
319319 }
320320 else throw("Strict value is not equal to itself.")
321321 }
322322
323323
324324 func deposit (assetId,amount,stakingAssetId,proxy) = {
325325 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
326326 if ((currentAdditionalBalance == currentAdditionalBalance))
327327 then {
328328 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
329329 if ((currentStakingAssetBalance == currentStakingAssetBalance))
330330 then {
331331 let asset = parseAssetId(assetId)
332332 if ((amount > 0))
333333 then {
334334 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
335335 if ((depositInvoke == depositInvoke))
336336 then match depositInvoke {
337337 case receivedStakingAsset: Int =>
338338 let newAdditionalBalance = (currentAdditionalBalance + amount)
339339 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
340340 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
341341 case _ =>
342342 nil
343343 }
344344 else throw("Strict value is not equal to itself.")
345345 }
346346 else nil
347347 }
348348 else throw("Strict value is not equal to itself.")
349349 }
350350 else throw("Strict value is not equal to itself.")
351351 }
352352
353353
354354 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
355355 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
356356 if ((currentAdditionalBalance == currentAdditionalBalance))
357357 then {
358358 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
359359 if ((currentStakingAssetBalance == currentStakingAssetBalance))
360360 then {
361361 let currentProxyRate = getRate(proxy)
362362 if ((currentProxyRate == currentProxyRate))
363363 then {
364364 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
365365 let stakingAsset = parseAssetId(stakingAssetId)
366366 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
367367 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
368368 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
369369 if ((sendStakingAssetAmount > 0))
370370 then {
371371 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
372372 if ((withdrawInvoke == withdrawInvoke))
373373 then match withdrawInvoke {
374374 case receivedAssets: Int =>
375375 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
376376 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
377377 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
378378 case _ =>
379379 nil
380380 }
381381 else throw("Strict value is not equal to itself.")
382382 }
383383 else nil
384384 }
385385 else throw("Strict value is not equal to itself.")
386386 }
387387 else throw("Strict value is not equal to itself.")
388388 }
389389 else throw("Strict value is not equal to itself.")
390390 }
391391
392392
393393 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
394394 case a: (Boolean, Int, Int, String, String, Int, String) =>
395395 a
396396 case _ =>
397397 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
398398 }
399399
400400
401401 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
402- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
403- if ((currentAdditionalBalance == currentAdditionalBalance))
402+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
403+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
404404 then {
405- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
406- if ((currentStakingAssetBalance == currentStakingAssetBalance))
405+ let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
406+ then getAdditionalBalanceOrZero(assetId)
407+ else 0
408+ if ((currentAdditionalBalance == currentAdditionalBalance))
407409 then {
408410 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
409411 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
410412 let diff = (currentAdditionalBalance - targetAdditionalBalance)
411413 if ((diff == 0))
412414 then nil
413415 else if ((0 > diff))
414416 then {
415417 let sendAssetAmount = -(diff)
416418 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
417419 }
418420 else {
419421 let getAssetAmount = diff
420422 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
421423 }
422424 }
423425 else throw("Strict value is not equal to itself.")
424426 }
425427 else throw("Strict value is not equal to itself.")
426428 }
427429
428430
429431 func rebalanceAsset (assetId) = {
430- let $t01617116307 = getLeaseProxyConfig(assetId)
431- let isLeasable = $t01617116307._1
432- let leasedRatio = $t01617116307._2
433- let minBalance = $t01617116307._3
434- let proxyAddress = $t01617116307._4
435- let proxyAssetId = $t01617116307._5
436- let proxyRateMul = $t01617116307._6
437- let stakingProfitAddress = $t01617116307._7
432+ let $t01622016356 = getLeaseProxyConfig(assetId)
433+ let isLeasable = $t01622016356._1
434+ let leasedRatio = $t01622016356._2
435+ let minBalance = $t01622016356._3
436+ let proxyAddress = $t01622016356._4
437+ let proxyAssetId = $t01622016356._5
438+ let proxyRateMul = $t01622016356._6
439+ let stakingProfitAddress = $t01622016356._7
438440 if (isLeasable)
439441 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
440442 else nil
441443 }
442444
443445
444446 func withdrawAndRebalanceAsset (assetId,getAmount) = {
445- let $t01670616842 = getLeaseProxyConfig(assetId)
446- let isLeasable = $t01670616842._1
447- let leasedRatio = $t01670616842._2
448- let minBalance = $t01670616842._3
449- let proxyAddress = $t01670616842._4
450- let proxyAssetId = $t01670616842._5
451- let proxyRateMul = $t01670616842._6
452- let stakingProfitAddress = $t01670616842._7
447+ let $t01675516891 = getLeaseProxyConfig(assetId)
448+ let isLeasable = $t01675516891._1
449+ let leasedRatio = $t01675516891._2
450+ let minBalance = $t01675516891._3
451+ let proxyAddress = $t01675516891._4
452+ let proxyAssetId = $t01675516891._5
453+ let proxyRateMul = $t01675516891._6
454+ let stakingProfitAddress = $t01675516891._7
453455 if (isLeasable)
454456 then {
455- let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
456- if ((newTotalLeasableBalance == newTotalLeasableBalance))
457+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(proxyAssetId)
458+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
457459 then {
458- let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
459- if ((newAdditionalBalance == newAdditionalBalance))
460+ let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
461+ then getAdditionalBalanceOrZero(assetId)
462+ else 0
463+ if ((currentAdditionalBalance == currentAdditionalBalance))
460464 then {
461- let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
462- if ((withdrawAmount == withdrawAmount))
463- then if ((0 > withdrawAmount))
464- then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
465- else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
465+ let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
466+ if ((newTotalLeasableBalance == newTotalLeasableBalance))
467+ then {
468+ let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
469+ if ((newAdditionalBalance == newAdditionalBalance))
470+ then {
471+ let withdrawAmount = (currentAdditionalBalance - newAdditionalBalance)
472+ if ((withdrawAmount == withdrawAmount))
473+ then if ((withdrawAmount == 0))
474+ then nil
475+ else if ((0 > withdrawAmount))
476+ then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
477+ else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
478+ else throw("Strict value is not equal to itself.")
479+ }
480+ else throw("Strict value is not equal to itself.")
481+ }
466482 else throw("Strict value is not equal to itself.")
467483 }
468484 else throw("Strict value is not equal to itself.")
469485 }
470486 else throw("Strict value is not equal to itself.")
471487 }
472488 else nil
473489 }
474490
475491
476492 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
477493 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
478494 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
479495 (AmAmtWithdrawState ++ PrAmtWithdrawState)
480496 }
481497
482498
483499 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
484500 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
485501 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
486502 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
487503 }
488504
489505
490506 func calcPrices (amAmt,prAmt,lpAmt) = {
491507 let cfg = getPoolConfig()
492508 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
493509 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
494510 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
495511 let amAmtX18 = toX18(amAmt, amtAssetDcm)
496512 let prAmtX18 = toX18(prAmt, priceAssetDcm)
497513 let lpAmtX18 = toX18(lpAmt, scale8)
498514 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
499515 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
500516 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
501517 }
502518
503519
504520 func calculatePrices (amAmt,prAmt,lpAmt) = {
505521 let prices = calcPrices(amAmt, prAmt, lpAmt)
506522 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
507523 }
508524
509525
510526 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
511527 let cfg = getPoolConfig()
512528 let lpAssetId = cfg[idxPoolLPAssetId]
513529 let amAssetId = cfg[idxAmtAssetId]
514530 let prAssetId = cfg[idxPriceAssetId]
515531 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
516532 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
517533 let poolStatus = cfg[idxPoolStatus]
518534 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
519535 if ((lpAssetId != pmtAssetId))
520536 then throw("Invalid asset passed.")
521537 else {
522538 let amBalance = getAccBalance(amAssetId)
523539 let amBalanceX18 = toX18(amBalance, amAssetDcm)
524540 let prBalance = getAccBalance(prAssetId)
525541 let prBalanceX18 = toX18(prBalance, prAssetDcm)
526542 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
527543 let curPrice = fromX18(curPriceX18, scale8)
528544 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
529545 let lpEmissionX18 = toX18(lpEmission, scale8)
530546 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
531547 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
532548 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
533549 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
534550 let state = if ((txId58 == ""))
535551 then nil
536552 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
537553 then unit
538554 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
539555 then unit
540556 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)]
541557 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
542558 }
543559 }
544560
545561
546562 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
547563 let cfg = getPoolConfig()
548564 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
549565 let amAssetIdStr = cfg[idxAmtAssetId]
550566 let prAssetIdStr = cfg[idxPriceAssetId]
551567 let iAmtAssetId = cfg[idxIAmtAssetId]
552568 let iPriceAssetId = cfg[idxIPriceAssetId]
553569 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
554570 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
555571 let poolStatus = cfg[idxPoolStatus]
556572 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
557573 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
558574 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
559575 if (if ((amAssetIdStr != inAmAssetIdStr))
560576 then true
561577 else (prAssetIdStr != inPrAssetIdStr))
562578 then throw("Invalid amt or price asset passed.")
563579 else {
564580 let amBalance = if (isEvaluate)
565581 then getAccBalance(amAssetIdStr)
566582 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
567583 let prBalance = if (isEvaluate)
568584 then getAccBalance(prAssetIdStr)
569585 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
570586 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
571587 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
572588 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
573589 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
574590 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
575591 let res = if ((lpEmission == 0))
576592 then {
577593 let curPriceX18 = zeroBigInt
578594 let slippageX18 = zeroBigInt
579595 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
580596 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
581597 }
582598 else {
583599 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
584600 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
585601 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
586602 if (if ((curPriceX18 != zeroBigInt))
587603 then (slippageX18 > slippageToleranceX18)
588604 else false)
589605 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
590606 else {
591607 let lpEmissionX18 = toX18(lpEmission, scale8)
592608 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
593609 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
594610 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
595611 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
596612 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
597613 let expAmtAssetAmtX18 = expectedAmts._1
598614 let expPriceAssetAmtX18 = expectedAmts._2
599615 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
600616 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
601617 }
602618 }
603619 let calcLpAmt = res._1
604620 let calcAmAssetPmt = res._2
605621 let calcPrAssetPmt = res._3
606622 let curPrice = fromX18(res._4, scale8)
607623 let slippageCalc = fromX18(res._5, scale8)
608624 if ((0 >= calcLpAmt))
609625 then throw("Invalid calculations. LP calculated is less than zero.")
610626 else {
611627 let emitLpAmt = if (!(emitLp))
612628 then 0
613629 else calcLpAmt
614630 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
615631 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
616632 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))]
617633 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
618634 }
619635 }
620636 }
621637
622638
623639 func calcKLp (amountBalance,priceBalance,lpEmission) = {
624640 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
625641 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
626642 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
627643 if ((lpEmission == big0))
628644 then big0
629645 else updatedKLp
630646 }
631647
632648
633649 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
634650 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
635651 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
636652 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
637653 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
638654 currentKLp
639655 }
640656
641657
642658 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
643659 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
644660 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
645661 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
646662 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
647663 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
648664 $Tuple2(actions, updatedKLp)
649665 }
650666
651667
652668 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
653669
654670
655671 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
656672 then true
657673 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
658674
659675
660676 func validateMatcherOrderAllowed (order) = {
661677 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
662678 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
663679 let amountAssetAmount = order.amount
664680 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
665- let $t02923129443 = if ((order.orderType == Buy))
681+ let $t02951729729 = if ((order.orderType == Buy))
666682 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
667683 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
668- let amountAssetBalanceDelta = $t02923129443._1
669- let priceAssetBalanceDelta = $t02923129443._2
684+ let amountAssetBalanceDelta = $t02951729729._1
685+ let priceAssetBalanceDelta = $t02951729729._2
670686 if (if (if (isGlobalShutdown())
671687 then true
672688 else (cfgPoolStatus == PoolMatcherDisabled))
673689 then true
674690 else (cfgPoolStatus == PoolShutdown))
675691 then throw("Exchange operations disabled")
676692 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
677693 then true
678694 else (order.assetPair.priceAsset != cfgPriceAssetId))
679695 then throw("Wrong order assets.")
680696 else {
681697 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
682- let $t02988329983 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
683- let unusedActions = $t02988329983._1
684- let kLpNew = $t02988329983._2
698+ let $t03016930269 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
699+ let unusedActions = $t03016930269._1
700+ let kLpNew = $t03016930269._2
685701 let isOrderValid = (kLpNew >= kLp)
686702 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
687703 $Tuple2(isOrderValid, info)
688704 }
689705 }
690706
691707
692708 func commonGet (i) = if ((size(i.payments) != 1))
693709 then throw("exactly 1 payment is expected")
694710 else {
695711 let pmt = value(i.payments[0])
696712 let pmtAssetId = value(pmt.assetId)
697713 let pmtAmt = pmt.amount
698714 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
699715 let outAmAmt = res._1
700716 let outPrAmt = res._2
701717 let state = res._10
702718 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
703719 then if (isGlobalShutdown())
704720 then true
705721 else (cfgPoolStatus == PoolShutdown)
706722 else false
707723 if (isGetDisabled)
708724 then throw(("Get operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
709725 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
710726 }
711727
712728
713729 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
714730 then throw("exactly 2 payments are expected")
715731 else {
716732 let amAssetPmt = value(i.payments[0])
717733 let prAssetPmt = value(i.payments[1])
718734 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
719735 let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
720736 then if (if (isGlobalShutdown())
721737 then true
722738 else (cfgPoolStatus == PoolPutDisabled))
723739 then true
724740 else (cfgPoolStatus == PoolShutdown)
725741 else false
726742 if (isPutDisabled)
727743 then throw(("Put operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
728744 else estPut
729745 }
730746
731747
732748 func emit (amount) = {
733749 let emitInv = invoke(factoryContract, "emit", [amount], nil)
734750 if ((emitInv == emitInv))
735751 then {
736752 let emitInvLegacy = match emitInv {
737753 case legacyFactoryContract: Address =>
738754 invoke(legacyFactoryContract, "emit", [amount], nil)
739755 case _ =>
740756 unit
741757 }
742758 if ((emitInvLegacy == emitInvLegacy))
743759 then amount
744760 else throw("Strict value is not equal to itself.")
745761 }
746762 else throw("Strict value is not equal to itself.")
747763 }
748764
749765
750766 func takeFee (amount,fee) = {
751767 let feeAmount = if ((fee == 0))
752768 then 0
753769 else fraction(amount, fee, scale8)
754770 $Tuple2((amount - feeAmount), feeAmount)
755771 }
756772
757773
758774 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
759775 let isEval = (txId == unit)
760776 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
761777 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
762778 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
763779 then true
764780 else if ((paymentAssetId == cfgPriceAssetId))
765781 then false
766782 else throwErr("invalid asset")
767- let $t03316933462 = if (isEval)
783+ let $t03345533748 = if (isEval)
768784 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
769785 else if (paymentInAmountAsset)
770786 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
771787 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
772- let amountBalanceOld = $t03316933462._1
773- let priceBalanceOld = $t03316933462._2
774- let $t03346633615 = if (paymentInAmountAsset)
788+ let amountBalanceOld = $t03345533748._1
789+ let priceBalanceOld = $t03345533748._2
790+ let $t03375233901 = if (paymentInAmountAsset)
775791 then $Tuple2(paymentAmountRaw, 0)
776792 else $Tuple2(0, paymentAmountRaw)
777- let amountAssetAmountRaw = $t03346633615._1
778- let priceAssetAmountRaw = $t03346633615._2
793+ let amountAssetAmountRaw = $t03375233901._1
794+ let priceAssetAmountRaw = $t03375233901._2
779795 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
780796 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
781- let $t03374733811 = takeFee(paymentAmountRaw, inFee)
782- let paymentAmount = $t03374733811._1
783- let feeAmount = $t03374733811._2
797+ let $t03403334097 = takeFee(paymentAmountRaw, inFee)
798+ let paymentAmount = $t03403334097._1
799+ let feeAmount = $t03403334097._2
784800 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
785801 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
786802 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
787803 let priceNew = fromX18(priceNewX18, scale8)
788804 let paymentBalance = if (paymentInAmountAsset)
789805 then amountBalanceOld
790806 else priceBalanceOld
791807 let paymentBalanceBigInt = toBigInt(paymentBalance)
792808 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
793809 let chechSupply = if ((supplyBigInt > big0))
794810 then true
795811 else throwErr("initial deposit requires all coins")
796812 if ((chechSupply == chechSupply))
797813 then {
798814 let depositBigInt = toBigInt(paymentAmount)
799815 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
800816 let commonState = if (isEval)
801817 then nil
802818 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))]
803819 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
804820 let priceOld = fromX18(priceOldX18, scale8)
805821 let loss = {
806- let $t03549235659 = if (paymentInAmountAsset)
822+ let $t03577835945 = if (paymentInAmountAsset)
807823 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
808824 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
809- let amount = $t03549235659._1
810- let balance = $t03549235659._2
825+ let amount = $t03577835945._1
826+ let balance = $t03577835945._2
811827 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
812828 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
813829 }
814830 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
815831 }
816832 else throw("Strict value is not equal to itself.")
817833 }
818834
819835
820836 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
821837 let isEval = (txId == unit)
822838 let cfg = getPoolConfig()
823839 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
824840 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
825841 let checks = [if ((paymentAssetId == cfgLpAssetId))
826842 then true
827843 else throwErr("invalid lp asset")]
828844 if ((checks == checks))
829845 then {
830846 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
831847 then true
832848 else if ((outAssetId == cfgPriceAssetId))
833849 then false
834850 else throwErr("invalid asset")
835851 let balanceBigInt = if (outInAmountAsset)
836852 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
837853 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
838854 let outInAmountAssetDecimals = if (outInAmountAsset)
839855 then amtAssetDcm
840856 else priceAssetDcm
841857 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
842858 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
843859 let outBalance = if (outInAmountAsset)
844860 then amBalanceOld
845861 else prBalanceOld
846862 let outBalanceBigInt = toBigInt(outBalance)
847863 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
848864 let redeemedBigInt = toBigInt(paymentAmount)
849865 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
850- let $t03773737793 = takeFee(amountRaw, outFee)
851- let totalAmount = $t03773737793._1
852- let feeAmount = $t03773737793._2
853- let $t03779738023 = if (outInAmountAsset)
866+ let $t03802338079 = takeFee(amountRaw, outFee)
867+ let totalAmount = $t03802338079._1
868+ let feeAmount = $t03802338079._2
869+ let $t03808338309 = if (outInAmountAsset)
854870 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
855871 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
856- let outAmAmount = $t03779738023._1
857- let outPrAmount = $t03779738023._2
858- let amBalanceNew = $t03779738023._3
859- let prBalanceNew = $t03779738023._4
872+ let outAmAmount = $t03808338309._1
873+ let outPrAmount = $t03808338309._2
874+ let amBalanceNew = $t03808338309._3
875+ let prBalanceNew = $t03808338309._4
860876 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
861877 let priceNew = fromX18(priceNewX18, scale8)
862878 let commonState = if (isEval)
863879 then nil
864880 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)]
865881 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
866882 let priceOld = fromX18(priceOldX18, scale8)
867883 let loss = {
868884 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
869885 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
870886 }
871887 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
872888 }
873889 else throw("Strict value is not equal to itself.")
874890 }
875891
876892
877893 func managerPublicKeyOrUnit () = {
878894 let managerVaultAddress = getManagerVaultAddressOrThis()
879895 match getString(managerVaultAddress, keyManagerPublicKey()) {
880896 case s: String =>
881897 fromBase58String(s)
882898 case _: Unit =>
883899 unit
884900 case _ =>
885901 throw("Match error")
886902 }
887903 }
888904
889905
890906 func isManager (i) = match managerPublicKeyOrUnit() {
891907 case pk: ByteVector =>
892908 (i.callerPublicKey == pk)
893909 case _: Unit =>
894910 (i.caller == this)
895911 case _ =>
896912 throw("Match error")
897913 }
898914
899915
900916 func mustManager (i) = {
901917 let pd = throw("Permission denied")
902918 match managerPublicKeyOrUnit() {
903919 case pk: ByteVector =>
904920 if ((i.callerPublicKey == pk))
905921 then true
906922 else pd
907923 case _: Unit =>
908924 if ((i.caller == this))
909925 then true
910926 else pd
911927 case _ =>
912928 throw("Match error")
913929 }
914930 }
915931
916932
917933 @Callable(i)
918934 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
919935
920936
921937
922938 @Callable(i)
923939 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
924- let $t03988140186 = if ((isReverse == false))
940+ let $t04016740472 = if ((isReverse == false))
925941 then {
926942 let assetOut = getStringOrFail(this, pa())
927943 let assetIn = getStringOrFail(this, aa())
928944 $Tuple2(assetOut, assetIn)
929945 }
930946 else {
931947 let assetOut = getStringOrFail(this, aa())
932948 let assetIn = getStringOrFail(this, pa())
933949 $Tuple2(assetOut, assetIn)
934950 }
935- let assetOut = $t03988140186._1
936- let assetIn = $t03988140186._2
951+ let assetOut = $t04016740472._1
952+ let assetIn = $t04016740472._2
937953 let poolAssetInBalance = getAccBalance(assetIn)
938954 let poolAssetOutBalance = getAccBalance(assetOut)
939955 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
940956 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
941957 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
942958 let checkK = if ((newK >= oldK))
943959 then true
944960 else throw("new K is fewer error")
945961 if ((checkK == checkK))
946962 then $Tuple2(nil, amountOut)
947963 else throw("Strict value is not equal to itself.")
948964 }
949965
950966
951967
952968 @Callable(i)
953969 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
954970 let swapContact = {
955971 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
956972 if ($isInstanceOf(@, "String"))
957973 then @
958974 else throw(($getType(@) + " couldn't be cast to String"))
959975 }
960976 let isPoolSwapDisabled = {
961977 let @ = invoke(factoryContract, "isPoolSwapDisabledREADONLY", [toString(this)], nil)
962978 if ($isInstanceOf(@, "Boolean"))
963979 then @
964980 else throw(($getType(@) + " couldn't be cast to Boolean"))
965981 }
966982 let isSwapDisabled = if (!(isAddressWhitelisted(i.caller)))
967983 then if (if (isGlobalShutdown())
968984 then true
969985 else (cfgPoolStatus == PoolShutdown))
970986 then true
971987 else isPoolSwapDisabled
972988 else false
973989 let checks = [if (if (!(isSwapDisabled))
974990 then true
975991 else isManager(i))
976992 then true
977993 else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn))
978994 then true
979995 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
980996 then true
981997 else throwErr("Permission denied")]
982998 if ((checks == checks))
983999 then {
9841000 let pmt = value(i.payments[0])
9851001 let assetIn = assetIdToString(pmt.assetId)
9861002 let assetOut = if ((isReverse == false))
9871003 then getStringOrFail(this, pa())
9881004 else getStringOrFail(this, aa())
9891005 let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount)
9901006 let poolAssetOutBalance = getAccBalance(assetOut)
9911007 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
9921008 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
9931009 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
9941010 let checkK = if ((newK >= oldK))
9951011 then true
9961012 else throw("new K is fewer error")
9971013 if ((checkK == checkK))
9981014 then {
9991015 let checkMin = if ((amountOut >= amountOutMin))
10001016 then true
10011017 else throw("Exchange result is fewer coins than expected")
10021018 if ((checkMin == checkMin))
10031019 then {
10041020 let amountAssetBalanceDelta = if (isReverse)
10051021 then -(amountOut)
10061022 else feePoolAmount
10071023 let priceAssetBalanceDelta = if (isReverse)
10081024 then feePoolAmount
10091025 else -(amountOut)
10101026 let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1
10111027 if ((refreshKLpActions == refreshKLpActions))
10121028 then {
10131029 let rebalanceState = rebalanceAsset(assetIn)
10141030 if ((rebalanceState == rebalanceState))
10151031 then {
10161032 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
10171033 if ((withdrawState == withdrawState))
10181034 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
10191035 else throw("Strict value is not equal to itself.")
10201036 }
10211037 else throw("Strict value is not equal to itself.")
10221038 }
10231039 else throw("Strict value is not equal to itself.")
10241040 }
10251041 else throw("Strict value is not equal to itself.")
10261042 }
10271043 else throw("Strict value is not equal to itself.")
10281044 }
10291045 else throw("Strict value is not equal to itself.")
10301046 }
10311047
10321048
10331049
10341050 @Callable(i)
10351051 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10361052 then throw("Invalid slippageTolerance passed")
10371053 else {
10381054 let estPut = commonPut(i, slippageTolerance, true)
10391055 let emitLpAmt = estPut._2
10401056 let lpAssetId = estPut._7
10411057 let state = estPut._9
10421058 let amDiff = estPut._10
10431059 let prDiff = estPut._11
10441060 let amId = estPut._12
10451061 let prId = estPut._13
10461062 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10471063 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10481064 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10491065 if ((currentKLp == currentKLp))
10501066 then {
10511067 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10521068 if ((emitInv == emitInv))
10531069 then {
10541070 let emitInvLegacy = match emitInv {
10551071 case legacyFactoryContract: Address =>
10561072 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10571073 case _ =>
10581074 unit
10591075 }
10601076 if ((emitInvLegacy == emitInvLegacy))
10611077 then {
10621078 let slippageAInv = if ((amDiff > 0))
10631079 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10641080 else nil
10651081 if ((slippageAInv == slippageAInv))
10661082 then {
10671083 let slippagePInv = if ((prDiff > 0))
10681084 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10691085 else nil
10701086 if ((slippagePInv == slippagePInv))
10711087 then {
10721088 let lpTransfer = if (shouldAutoStake)
10731089 then {
10741090 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10751091 if ((slpStakeInv == slpStakeInv))
10761092 then nil
10771093 else throw("Strict value is not equal to itself.")
10781094 }
10791095 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1080- let $t04536245824 = refreshKLpInternal(0, 0, 0)
1081- if (($t04536245824 == $t04536245824))
1096+ let $t04564846110 = refreshKLpInternal(0, 0, 0)
1097+ if (($t04564846110 == $t04564846110))
10821098 then {
1083- let updatedKLp = $t04536245824._2
1084- let refreshKLpActions = $t04536245824._1
1099+ let updatedKLp = $t04564846110._2
1100+ let refreshKLpActions = $t04564846110._1
10851101 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10861102 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10871103 then {
10881104 let reb = invoke(this, "rebalance", nil, nil)
10891105 if ((reb == reb))
10901106 then ((state ++ lpTransfer) ++ refreshKLpActions)
10911107 else throw("Strict value is not equal to itself.")
10921108 }
10931109 else throw("Strict value is not equal to itself.")
10941110 }
10951111 else throw("Strict value is not equal to itself.")
10961112 }
10971113 else throw("Strict value is not equal to itself.")
10981114 }
10991115 else throw("Strict value is not equal to itself.")
11001116 }
11011117 else throw("Strict value is not equal to itself.")
11021118 }
11031119 else throw("Strict value is not equal to itself.")
11041120 }
11051121 else throw("Strict value is not equal to itself.")
11061122 }
11071123
11081124
11091125
11101126 @Callable(i)
11111127 func putForFree (maxSlippage) = if ((0 > maxSlippage))
11121128 then throw("Invalid value passed")
11131129 else {
11141130 let estPut = commonPut(i, maxSlippage, false)
11151131 let state = estPut._9
11161132 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
11171133 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
11181134 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11191135 if ((currentKLp == currentKLp))
11201136 then {
1121- let $t04643646501 = refreshKLpInternal(0, 0, 0)
1122- let refreshKLpActions = $t04643646501._1
1123- let updatedKLp = $t04643646501._2
1137+ let $t04672246787 = refreshKLpInternal(0, 0, 0)
1138+ let refreshKLpActions = $t04672246787._1
1139+ let updatedKLp = $t04672246787._2
11241140 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11251141 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11261142 then (state ++ refreshKLpActions)
11271143 else throw("Strict value is not equal to itself.")
11281144 }
11291145 else throw("Strict value is not equal to itself.")
11301146 }
11311147
11321148
11331149
11341150 @Callable(i)
11351151 func putOneTkn (minOutAmount,autoStake) = {
11361152 let isPoolOneTokenOperationsDisabled = {
11371153 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11381154 if ($isInstanceOf(@, "Boolean"))
11391155 then @
11401156 else throw(($getType(@) + " couldn't be cast to Boolean"))
11411157 }
11421158 let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
11431159 then if (if (if (isGlobalShutdown())
11441160 then true
11451161 else (cfgPoolStatus == PoolPutDisabled))
11461162 then true
11471163 else (cfgPoolStatus == PoolShutdown))
11481164 then true
11491165 else isPoolOneTokenOperationsDisabled
11501166 else false
11511167 let checks = [if (if (!(isPutDisabled))
11521168 then true
11531169 else isManager(i))
11541170 then true
11551171 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11561172 then true
11571173 else throwErr("exactly 1 payment are expected")]
11581174 if ((checks == checks))
11591175 then {
11601176 let payment = i.payments[0]
11611177 let paymentAssetId = payment.assetId
11621178 let paymentAmountRaw = payment.amount
11631179 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11641180 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11651181 else if ((paymentAssetId == cfgPriceAssetId))
11661182 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11671183 else throwErr("payment asset is not supported")
11681184 if ((currentKLp == currentKLp))
11691185 then {
11701186 let userAddress = i.caller
11711187 let txId = i.transactionId
1172- let $t04773047882 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1173- if (($t04773047882 == $t04773047882))
1188+ let $t04801648168 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1189+ if (($t04801648168 == $t04801648168))
11741190 then {
1175- let paymentInAmountAsset = $t04773047882._5
1176- let bonus = $t04773047882._4
1177- let feeAmount = $t04773047882._3
1178- let commonState = $t04773047882._2
1179- let emitAmountEstimated = $t04773047882._1
1191+ let paymentInAmountAsset = $t04801648168._5
1192+ let bonus = $t04801648168._4
1193+ let feeAmount = $t04801648168._3
1194+ let commonState = $t04801648168._2
1195+ let emitAmountEstimated = $t04801648168._1
11801196 let emitAmount = if (if ((minOutAmount > 0))
11811197 then (minOutAmount > emitAmountEstimated)
11821198 else false)
11831199 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11841200 else emitAmountEstimated
11851201 let emitInv = emit(emitAmount)
11861202 if ((emitInv == emitInv))
11871203 then {
11881204 let lpTransfer = if (autoStake)
11891205 then {
11901206 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11911207 if ((stakeInv == stakeInv))
11921208 then nil
11931209 else throw("Strict value is not equal to itself.")
11941210 }
11951211 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11961212 let sendFee = if ((feeAmount > 0))
11971213 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11981214 else nil
1199- let $t04846848665 = if ((this == feeCollectorAddress))
1215+ let $t04875448951 = if ((this == feeCollectorAddress))
12001216 then $Tuple2(0, 0)
12011217 else if (paymentInAmountAsset)
12021218 then $Tuple2(-(feeAmount), 0)
12031219 else $Tuple2(0, -(feeAmount))
1204- let amountAssetBalanceDelta = $t04846848665._1
1205- let priceAssetBalanceDelta = $t04846848665._2
1206- let $t04866848776 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1207- let refreshKLpActions = $t04866848776._1
1208- let updatedKLp = $t04866848776._2
1220+ let amountAssetBalanceDelta = $t04875448951._1
1221+ let priceAssetBalanceDelta = $t04875448951._2
1222+ let $t04895449062 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1223+ let refreshKLpActions = $t04895449062._1
1224+ let updatedKLp = $t04895449062._2
12091225 let kLp = value(getString(keyKLp))
12101226 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12111227 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12121228 then {
12131229 let reb = invoke(this, "rebalance", nil, nil)
12141230 if ((reb == reb))
12151231 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
12161232 else throw("Strict value is not equal to itself.")
12171233 }
12181234 else throw("Strict value is not equal to itself.")
12191235 }
12201236 else throw("Strict value is not equal to itself.")
12211237 }
12221238 else throw("Strict value is not equal to itself.")
12231239 }
12241240 else throw("Strict value is not equal to itself.")
12251241 }
12261242 else throw("Strict value is not equal to itself.")
12271243 }
12281244
12291245
12301246
12311247 @Callable(i)
12321248 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1233- let $t04913149288 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1234- let emitAmountEstimated = $t04913149288._1
1235- let commonState = $t04913149288._2
1236- let feeAmount = $t04913149288._3
1237- let bonus = $t04913149288._4
1238- let paymentInAmountAsset = $t04913149288._5
1249+ let $t04941749574 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1250+ let emitAmountEstimated = $t04941749574._1
1251+ let commonState = $t04941749574._2
1252+ let feeAmount = $t04941749574._3
1253+ let bonus = $t04941749574._4
1254+ let paymentInAmountAsset = $t04941749574._5
12391255 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12401256 }
12411257
12421258
12431259
12441260 @Callable(i)
12451261 func getOneTkn (outAssetIdStr,minOutAmount) = {
12461262 let isPoolOneTokenOperationsDisabled = {
12471263 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12481264 if ($isInstanceOf(@, "Boolean"))
12491265 then @
12501266 else throw(($getType(@) + " couldn't be cast to Boolean"))
12511267 }
12521268 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
12531269 then if (if (isGlobalShutdown())
12541270 then true
12551271 else (cfgPoolStatus == PoolShutdown))
12561272 then true
12571273 else isPoolOneTokenOperationsDisabled
12581274 else false
12591275 let checks = [if (if (!(isGetDisabled))
12601276 then true
12611277 else isManager(i))
12621278 then true
12631279 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12641280 then true
12651281 else throwErr("exactly 1 payment are expected")]
12661282 if ((checks == checks))
12671283 then {
12681284 let outAssetId = parseAssetId(outAssetIdStr)
12691285 let payment = i.payments[0]
12701286 let paymentAssetId = payment.assetId
12711287 let paymentAmount = payment.amount
12721288 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12731289 if ((currentKLp == currentKLp))
12741290 then {
12751291 let userAddress = i.caller
12761292 let txId = i.transactionId
1277- let $t05021050363 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1278- if (($t05021050363 == $t05021050363))
1293+ let $t05049650649 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1294+ if (($t05049650649 == $t05049650649))
12791295 then {
1280- let outInAmountAsset = $t05021050363._5
1281- let bonus = $t05021050363._4
1282- let feeAmount = $t05021050363._3
1283- let commonState = $t05021050363._2
1284- let amountEstimated = $t05021050363._1
1296+ let outInAmountAsset = $t05049650649._5
1297+ let bonus = $t05049650649._4
1298+ let feeAmount = $t05049650649._3
1299+ let commonState = $t05049650649._2
1300+ let amountEstimated = $t05049650649._1
12851301 let amount = if (if ((minOutAmount > 0))
12861302 then (minOutAmount > amountEstimated)
12871303 else false)
12881304 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12891305 else amountEstimated
12901306 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12911307 if ((burnInv == burnInv))
12921308 then {
12931309 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12941310 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12951311 let sendFee = if ((feeAmount > 0))
12961312 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12971313 else nil
1298- let $t05102751274 = {
1314+ let $t05131351560 = {
12991315 let feeAmountForCalc = if ((this == feeCollectorAddress))
13001316 then 0
13011317 else feeAmount
13021318 if (outInAmountAsset)
13031319 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13041320 else $Tuple2(0, -((amount + feeAmountForCalc)))
13051321 }
1306- let amountAssetBalanceDelta = $t05102751274._1
1307- let priceAssetBalanceDelta = $t05102751274._2
1308- let $t05127751385 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1309- let refreshKLpActions = $t05127751385._1
1310- let updatedKLp = $t05127751385._2
1322+ let amountAssetBalanceDelta = $t05131351560._1
1323+ let priceAssetBalanceDelta = $t05131351560._2
1324+ let $t05156351671 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1325+ let refreshKLpActions = $t05156351671._1
1326+ let updatedKLp = $t05156351671._2
13111327 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13121328 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13131329 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13141330 else throw("Strict value is not equal to itself.")
13151331 }
13161332 else throw("Strict value is not equal to itself.")
13171333 }
13181334 else throw("Strict value is not equal to itself.")
13191335 }
13201336 else throw("Strict value is not equal to itself.")
13211337 }
13221338 else throw("Strict value is not equal to itself.")
13231339 }
13241340
13251341
13261342
13271343 @Callable(i)
13281344 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1329- let $t05166351819 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1330- let amountEstimated = $t05166351819._1
1331- let commonState = $t05166351819._2
1332- let feeAmount = $t05166351819._3
1333- let bonus = $t05166351819._4
1334- let outInAmountAsset = $t05166351819._5
1345+ let $t05194952105 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1346+ let amountEstimated = $t05194952105._1
1347+ let commonState = $t05194952105._2
1348+ let feeAmount = $t05194952105._3
1349+ let bonus = $t05194952105._4
1350+ let outInAmountAsset = $t05194952105._5
13351351 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13361352 }
13371353
13381354
13391355
13401356 @Callable(i)
13411357 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13421358 let isPoolOneTokenOperationsDisabled = {
13431359 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13441360 if ($isInstanceOf(@, "Boolean"))
13451361 then @
13461362 else throw(($getType(@) + " couldn't be cast to Boolean"))
13471363 }
13481364 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
13491365 then if (if (isGlobalShutdown())
13501366 then true
13511367 else (cfgPoolStatus == PoolShutdown))
13521368 then true
13531369 else isPoolOneTokenOperationsDisabled
13541370 else false
13551371 let checks = [if (if (!(isGetDisabled))
13561372 then true
13571373 else isManager(i))
13581374 then true
13591375 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13601376 then true
13611377 else throwErr("no payments are expected")]
13621378 if ((checks == checks))
13631379 then {
13641380 let outAssetId = parseAssetId(outAssetIdStr)
13651381 let userAddress = i.caller
13661382 let txId = i.transactionId
13671383 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13681384 if ((currentKLp == currentKLp))
13691385 then {
13701386 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13711387 if ((unstakeInv == unstakeInv))
13721388 then {
1373- let $t05276152912 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1374- if (($t05276152912 == $t05276152912))
1389+ let $t05304753198 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1390+ if (($t05304753198 == $t05304753198))
13751391 then {
1376- let outInAmountAsset = $t05276152912._5
1377- let bonus = $t05276152912._4
1378- let feeAmount = $t05276152912._3
1379- let commonState = $t05276152912._2
1380- let amountEstimated = $t05276152912._1
1392+ let outInAmountAsset = $t05304753198._5
1393+ let bonus = $t05304753198._4
1394+ let feeAmount = $t05304753198._3
1395+ let commonState = $t05304753198._2
1396+ let amountEstimated = $t05304753198._1
13811397 let amount = if (if ((minOutAmount > 0))
13821398 then (minOutAmount > amountEstimated)
13831399 else false)
13841400 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13851401 else amountEstimated
13861402 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13871403 if ((burnInv == burnInv))
13881404 then {
13891405 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13901406 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13911407 let sendFee = if ((feeAmount > 0))
13921408 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13931409 else nil
1394- let $t05357153818 = {
1410+ let $t05385754104 = {
13951411 let feeAmountForCalc = if ((this == feeCollectorAddress))
13961412 then 0
13971413 else feeAmount
13981414 if (outInAmountAsset)
13991415 then $Tuple2(-((amount + feeAmountForCalc)), 0)
14001416 else $Tuple2(0, -((amount + feeAmountForCalc)))
14011417 }
1402- let amountAssetBalanceDelta = $t05357153818._1
1403- let priceAssetBalanceDelta = $t05357153818._2
1404- let $t05382153929 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1405- let refreshKLpActions = $t05382153929._1
1406- let updatedKLp = $t05382153929._2
1418+ let amountAssetBalanceDelta = $t05385754104._1
1419+ let priceAssetBalanceDelta = $t05385754104._2
1420+ let $t05410754215 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1421+ let refreshKLpActions = $t05410754215._1
1422+ let updatedKLp = $t05410754215._2
14071423 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14081424 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14091425 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14101426 else throw("Strict value is not equal to itself.")
14111427 }
14121428 else throw("Strict value is not equal to itself.")
14131429 }
14141430 else throw("Strict value is not equal to itself.")
14151431 }
14161432 else throw("Strict value is not equal to itself.")
14171433 }
14181434 else throw("Strict value is not equal to itself.")
14191435 }
14201436 else throw("Strict value is not equal to itself.")
14211437 }
14221438
14231439
14241440
14251441 @Callable(i)
14261442 func get () = {
14271443 let res = commonGet(i)
14281444 let outAmAmt = res._1
14291445 let outPrAmt = res._2
14301446 let pmtAmt = res._3
14311447 let pmtAssetId = res._4
14321448 let state = res._5
14331449 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14341450 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14351451 if ((currentKLp == currentKLp))
14361452 then {
14371453 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14381454 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14391455 then {
1440- let $t05502455105 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1441- let refreshKLpActions = $t05502455105._1
1442- let updatedKLp = $t05502455105._2
1456+ let $t05531055391 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1457+ let refreshKLpActions = $t05531055391._1
1458+ let updatedKLp = $t05531055391._2
14431459 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14441460 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14451461 then ((withdrawState ++ state) ++ refreshKLpActions)
14461462 else throw("Strict value is not equal to itself.")
14471463 }
14481464 else throw("Strict value is not equal to itself.")
14491465 }
14501466 else throw("Strict value is not equal to itself.")
14511467 }
14521468
14531469
14541470
14551471 @Callable(i)
14561472 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14571473 let res = commonGet(i)
14581474 let outAmAmt = res._1
14591475 let outPrAmt = res._2
14601476 let pmtAmt = res._3
14611477 let pmtAssetId = res._4
14621478 let state = res._5
14631479 if ((noLessThenAmtAsset > outAmAmt))
14641480 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14651481 else if ((noLessThenPriceAsset > outPrAmt))
14661482 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14671483 else {
14681484 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14691485 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14701486 if ((currentKLp == currentKLp))
14711487 then {
14721488 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14731489 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14741490 then {
1475- let $t05620056281 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1476- let refreshKLpActions = $t05620056281._1
1477- let updatedKLp = $t05620056281._2
1491+ let $t05648656567 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1492+ let refreshKLpActions = $t05648656567._1
1493+ let updatedKLp = $t05648656567._2
14781494 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14791495 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14801496 then ((withdrawState ++ state) ++ refreshKLpActions)
14811497 else throw("Strict value is not equal to itself.")
14821498 }
14831499 else throw("Strict value is not equal to itself.")
14841500 }
14851501 else throw("Strict value is not equal to itself.")
14861502 }
14871503 }
14881504
14891505
14901506
14911507 @Callable(i)
14921508 func unstakeAndGet (amount) = {
14931509 let checkPayments = if ((size(i.payments) != 0))
14941510 then throw("No payments are expected")
14951511 else true
14961512 if ((checkPayments == checkPayments))
14971513 then {
14981514 let cfg = getPoolConfig()
14991515 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
15001516 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15011517 if ((currentKLp == currentKLp))
15021518 then {
15031519 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
15041520 if ((unstakeInv == unstakeInv))
15051521 then {
15061522 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
15071523 let outAmAmt = res._1
15081524 let outPrAmt = res._2
15091525 let poolStatus = parseIntValue(res._9)
15101526 let state = res._10
15111527 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15121528 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
15131529 then if (isGlobalShutdown())
15141530 then true
15151531 else (cfgPoolStatus == PoolShutdown)
15161532 else false
15171533 let checkPoolStatus = if (isGetDisabled)
15181534 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
15191535 else true
15201536 if ((checkPoolStatus == checkPoolStatus))
15211537 then {
15221538 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15231539 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15241540 then {
1525- let $t05762957710 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1526- let refreshKLpActions = $t05762957710._1
1527- let updatedKLp = $t05762957710._2
1541+ let $t05791557996 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1542+ let refreshKLpActions = $t05791557996._1
1543+ let updatedKLp = $t05791557996._2
15281544 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15291545 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15301546 then ((withdrawState ++ state) ++ refreshKLpActions)
15311547 else throw("Strict value is not equal to itself.")
15321548 }
15331549 else throw("Strict value is not equal to itself.")
15341550 }
15351551 else throw("Strict value is not equal to itself.")
15361552 }
15371553 else throw("Strict value is not equal to itself.")
15381554 }
15391555 else throw("Strict value is not equal to itself.")
15401556 }
15411557 else throw("Strict value is not equal to itself.")
15421558 }
15431559
15441560
15451561
15461562 @Callable(i)
15471563 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15481564 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
15491565 then if (isGlobalShutdown())
15501566 then true
15511567 else (cfgPoolStatus == PoolShutdown)
15521568 else false
15531569 let checks = [if (!(isGetDisabled))
15541570 then true
15551571 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15561572 then true
15571573 else throw("no payments are expected")]
15581574 if ((checks == checks))
15591575 then {
15601576 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15611577 if ((currentKLp == currentKLp))
15621578 then {
15631579 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15641580 if ((unstakeInv == unstakeInv))
15651581 then {
15661582 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15671583 let outAmAmt = res._1
15681584 let outPrAmt = res._2
15691585 let state = res._10
15701586 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15711587 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15721588 then true
15731589 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15741590 then true
15751591 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15761592 if ((checkAmounts == checkAmounts))
15771593 then {
15781594 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15791595 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15801596 then {
1581- let $t05918859269 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1582- let refreshKLpActions = $t05918859269._1
1583- let updatedKLp = $t05918859269._2
1597+ let $t05947459555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1598+ let refreshKLpActions = $t05947459555._1
1599+ let updatedKLp = $t05947459555._2
15841600 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15851601 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15861602 then ((withdrawState ++ state) ++ refreshKLpActions)
15871603 else throw("Strict value is not equal to itself.")
15881604 }
15891605 else throw("Strict value is not equal to itself.")
15901606 }
15911607 else throw("Strict value is not equal to itself.")
15921608 }
15931609 else throw("Strict value is not equal to itself.")
15941610 }
15951611 else throw("Strict value is not equal to itself.")
15961612 }
15971613 else throw("Strict value is not equal to itself.")
15981614 }
15991615
16001616
16011617
16021618 @Callable(i)
16031619 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
16041620 then throw("permissions denied")
16051621 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
16061622
16071623
16081624
16091625 @Callable(i)
16101626 func refreshKLp () = {
16111627 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
16121628 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
16131629 then unit
16141630 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
16151631 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
16161632 then {
16171633 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1618- let $t06047360537 = refreshKLpInternal(0, 0, 0)
1619- let kLpUpdateActions = $t06047360537._1
1620- let updatedKLp = $t06047360537._2
1634+ let $t06075960823 = refreshKLpInternal(0, 0, 0)
1635+ let kLpUpdateActions = $t06075960823._1
1636+ let updatedKLp = $t06075960823._2
16211637 let actions = if ((kLp != updatedKLp))
16221638 then kLpUpdateActions
16231639 else throwErr("nothing to refresh")
16241640 $Tuple2(actions, toString(updatedKLp))
16251641 }
16261642 else throw("Strict value is not equal to itself.")
16271643 }
16281644
16291645
16301646
16311647 @Callable(i)
16321648 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
16331649
16341650
16351651
16361652 @Callable(i)
16371653 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16381654
16391655
16401656
16411657 @Callable(i)
16421658 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16431659 let prices = calcPrices(amAmt, prAmt, lpAmt)
16441660 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16451661 }
16461662
16471663
16481664
16491665 @Callable(i)
16501666 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16511667
16521668
16531669
16541670 @Callable(i)
16551671 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16561672
16571673
16581674
16591675 @Callable(i)
16601676 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16611677
16621678
16631679
16641680 @Callable(i)
16651681 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16661682
16671683
16681684
16691685 @Callable(i)
16701686 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16711687 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16721688 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16731689 }
16741690
16751691
16761692
16771693 @Callable(i)
16781694 func statsREADONLY () = {
16791695 let cfg = getPoolConfig()
16801696 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16811697 let amtAssetId = cfg[idxAmtAssetId]
16821698 let priceAssetId = cfg[idxPriceAssetId]
16831699 let iAmtAssetId = cfg[idxIAmtAssetId]
16841700 let iPriceAssetId = cfg[idxIPriceAssetId]
16851701 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16861702 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16871703 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16881704 let accAmtAssetBalance = getAccBalance(amtAssetId)
16891705 let accPriceAssetBalance = getAccBalance(priceAssetId)
16901706 let pricesList = if ((poolLPBalance == 0))
16911707 then [zeroBigInt, zeroBigInt, zeroBigInt]
16921708 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16931709 let curPrice = 0
16941710 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16951711 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16961712 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16971713 $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))
16981714 }
16991715
17001716
17011717
17021718 @Callable(i)
17031719 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
17041720 let cfg = getPoolConfig()
17051721 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17061722 let amAssetIdStr = cfg[idxAmtAssetId]
17071723 let amAssetId = fromBase58String(amAssetIdStr)
17081724 let prAssetIdStr = cfg[idxPriceAssetId]
17091725 let prAssetId = fromBase58String(prAssetIdStr)
17101726 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17111727 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17121728 let poolStatus = cfg[idxPoolStatus]
17131729 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17141730 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
17151731 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
17161732 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
17171733 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
17181734 let curPriceX18 = if ((poolLPBalance == 0))
17191735 then zeroBigInt
17201736 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
17211737 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
17221738 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
17231739 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
17241740 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17251741 let calcLpAmt = estPut._1
17261742 let curPriceCalc = estPut._3
17271743 let amBalance = estPut._4
17281744 let prBalance = estPut._5
17291745 let lpEmission = estPut._6
17301746 $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))
17311747 }
17321748
17331749
17341750
17351751 @Callable(i)
17361752 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17371753 let cfg = getPoolConfig()
17381754 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17391755 let amAssetIdStr = cfg[idxAmtAssetId]
17401756 let amAssetId = fromBase58String(amAssetIdStr)
17411757 let prAssetIdStr = cfg[idxPriceAssetId]
17421758 let prAssetId = fromBase58String(prAssetIdStr)
17431759 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17441760 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17451761 let poolStatus = cfg[idxPoolStatus]
17461762 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17471763 let amBalanceRaw = getAccBalance(amAssetIdStr)
17481764 let prBalanceRaw = getAccBalance(prAssetIdStr)
17491765 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17501766 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17511767 let curPriceX18 = if ((poolLPBalance == 0))
17521768 then zeroBigInt
17531769 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17541770 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17551771 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17561772 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17571773 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17581774 let calcLpAmt = estPut._1
17591775 let curPriceCalc = estPut._3
17601776 let amBalance = estPut._4
17611777 let prBalance = estPut._5
17621778 let lpEmission = estPut._6
17631779 $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))
17641780 }
17651781
17661782
17671783
17681784 @Callable(i)
17691785 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17701786 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17711787 let outAmAmt = res._1
17721788 let outPrAmt = res._2
17731789 let amBalance = res._5
17741790 let prBalance = res._6
17751791 let lpEmission = res._7
17761792 let curPrice = res._8
17771793 let poolStatus = parseIntValue(res._9)
17781794 $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))
17791795 }
17801796
17811797
17821798 @Verifier(tx)
17831799 func verify () = {
17841800 let targetPublicKey = match managerPublicKeyOrUnit() {
17851801 case pk: ByteVector =>
17861802 pk
17871803 case _: Unit =>
17881804 tx.senderPublicKey
17891805 case _ =>
17901806 throw("Match error")
17911807 }
17921808 match tx {
17931809 case order: Order =>
17941810 let matcherPub = getMatcherPubOrFail()
1795- let $t06919969316 = if (skipOrderValidation())
1811+ let $t06948569602 = if (skipOrderValidation())
17961812 then $Tuple2(true, "")
17971813 else validateMatcherOrderAllowed(order)
1798- let orderValid = $t06919969316._1
1799- let orderValidInfo = $t06919969316._2
1814+ let orderValid = $t06948569602._1
1815+ let orderValidInfo = $t06948569602._2
18001816 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
18011817 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
18021818 if (if (if (orderValid)
18031819 then senderValid
18041820 else false)
18051821 then matcherValid
18061822 else false)
18071823 then true
18081824 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
18091825 case s: SetScriptTransaction =>
18101826 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
18111827 then true
18121828 else {
18131829 let newHash = blake2b256(value(s.script))
18141830 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
18151831 let currentHash = scriptHash(this)
18161832 if ((allowedHash == newHash))
18171833 then (currentHash != newHash)
18181834 else false
18191835 }
18201836 case _ =>
18211837 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
18221838 }
18231839 }
18241840

github/deemru/w8io/026f985 
235.48 ms