tx · 5YAvxu5uuhrG8r1wsq2x6DzPuQEYQdg4BYsJc7ssjc5H

3N4fjtbSScYeo4FjiqnrbWN3SKWSdKKZzJe:  -0.04300000 Waves

2024.04.17 09:39 [3066422] smart account 3N4fjtbSScYeo4FjiqnrbWN3SKWSdKKZzJe > SELF 0.00000000 Waves

{ "type": 13, "id": "5YAvxu5uuhrG8r1wsq2x6DzPuQEYQdg4BYsJc7ssjc5H", "fee": 4300000, "feeAssetId": null, "timestamp": 1713335811538, "version": 2, "chainId": 84, "sender": "3N4fjtbSScYeo4FjiqnrbWN3SKWSdKKZzJe", "senderPublicKey": "5CfxywSuGhYoM5Z3qDR1nywNdn6vX6Uw2VjcPiTrjdB6", "proofs": [ "5nbwkA4yQFjfvgQfRZoXoWV2e7eLwocb6Gnds7xiQbJuLKPDm4j5mxz2RtST8DcJWqCP4NwCxVpKg8aMjfuQPWAF" ], "script": "base64:BgLjOAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQ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BnByb29mcwAABQJpb6uQlhc=", "height": 3066422, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3mDNSn9c1gKP2SWuYHY3JBfzBe7zJkc11s4G1dk76e7G Next: AiBdaRaud84djUP28GXCRv57PkWj8S2esr4evuddn2kb Diff:
OldNewDifferences
228228 else throw(($getType(@) + " couldn't be cast to Int"))
229229 }
230230
231+func keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP)
232+
233+
234+func isAddressWhitelisted (address) = valueOrElse(getBoolean(factoryContract, keyAddressWhitelisted(address)), false)
235+
236+
231237 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
232238
233239
258264
259265 let poolConfigParsed = parsePoolConfig(getPoolConfig())
260266
261-let $t095299695 = poolConfigParsed
267+let $t097699935 = poolConfigParsed
262268
263-let cfgPoolAddress = $t095299695._1
269+let cfgPoolAddress = $t097699935._1
264270
265-let cfgPoolStatus = $t095299695._2
271+let cfgPoolStatus = $t097699935._2
266272
267-let cfgLpAssetId = $t095299695._3
273+let cfgLpAssetId = $t097699935._3
268274
269-let cfgAmountAssetId = $t095299695._4
275+let cfgAmountAssetId = $t097699935._4
270276
271-let cfgPriceAssetId = $t095299695._5
277+let cfgPriceAssetId = $t097699935._5
272278
273-let cfgAmountAssetDecimals = $t095299695._6
279+let cfgAmountAssetDecimals = $t097699935._6
274280
275-let cfgPriceAssetDecimals = $t095299695._7
281+let cfgPriceAssetDecimals = $t097699935._7
276282
277283 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
278284
393399
394400
395401 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
396- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
397- if ((currentAdditionalBalance == currentAdditionalBalance))
402+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
403+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
398404 then {
399- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
400- if ((currentStakingAssetBalance == currentStakingAssetBalance))
405+ let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
406+ then getAdditionalBalanceOrZero(assetId)
407+ else 0
408+ if ((currentAdditionalBalance == currentAdditionalBalance))
401409 then {
402410 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
403411 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
421429
422430
423431 func rebalanceAsset (assetId) = {
424- let $t01593116067 = getLeaseProxyConfig(assetId)
425- let isLeasable = $t01593116067._1
426- let leasedRatio = $t01593116067._2
427- let minBalance = $t01593116067._3
428- let proxyAddress = $t01593116067._4
429- let proxyAssetId = $t01593116067._5
430- let proxyRateMul = $t01593116067._6
431- let stakingProfitAddress = $t01593116067._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
432440 if (isLeasable)
433441 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434442 else nil
436444
437445
438446 func withdrawAndRebalanceAsset (assetId,getAmount) = {
439- let $t01646616602 = getLeaseProxyConfig(assetId)
440- let isLeasable = $t01646616602._1
441- let leasedRatio = $t01646616602._2
442- let minBalance = $t01646616602._3
443- let proxyAddress = $t01646616602._4
444- let proxyAssetId = $t01646616602._5
445- let proxyRateMul = $t01646616602._6
446- let stakingProfitAddress = $t01646616602._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
447455 if (isLeasable)
448456 then {
449- let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
450- if ((newTotalLeasableBalance == newTotalLeasableBalance))
457+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(proxyAssetId)
458+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
451459 then {
452- let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
453- if ((newAdditionalBalance == newAdditionalBalance))
460+ let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
461+ then getAdditionalBalanceOrZero(assetId)
462+ else 0
463+ if ((currentAdditionalBalance == currentAdditionalBalance))
454464 then {
455- let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
456- if ((withdrawAmount == withdrawAmount))
457- then if ((0 > withdrawAmount))
458- then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
459- 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+ }
460482 else throw("Strict value is not equal to itself.")
461483 }
462484 else throw("Strict value is not equal to itself.")
656678 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
657679 let amountAssetAmount = order.amount
658680 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
659- let $t02899129203 = if ((order.orderType == Buy))
681+ let $t02951729729 = if ((order.orderType == Buy))
660682 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
661683 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
662- let amountAssetBalanceDelta = $t02899129203._1
663- let priceAssetBalanceDelta = $t02899129203._2
684+ let amountAssetBalanceDelta = $t02951729729._1
685+ let priceAssetBalanceDelta = $t02951729729._2
664686 if (if (if (isGlobalShutdown())
665687 then true
666688 else (cfgPoolStatus == PoolMatcherDisabled))
673695 then throw("Wrong order assets.")
674696 else {
675697 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
676- let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677- let unusedActions = $t02964329743._1
678- let kLpNew = $t02964329743._2
698+ let $t03016930269 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
699+ let unusedActions = $t03016930269._1
700+ let kLpNew = $t03016930269._2
679701 let isOrderValid = (kLpNew >= kLp)
680702 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
681703 $Tuple2(isOrderValid, info)
692714 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
693715 let outAmAmt = res._1
694716 let outPrAmt = res._2
695- let poolStatus = parseIntValue(res._9)
696717 let state = res._10
697- if (if (isGlobalShutdown())
698- then true
699- else (poolStatus == PoolShutdown))
700- then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
718+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
719+ then if (isGlobalShutdown())
720+ then true
721+ else (cfgPoolStatus == PoolShutdown)
722+ else false
723+ if (isGetDisabled)
724+ then throw(("Get operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
701725 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
702726 }
703727
708732 let amAssetPmt = value(i.payments[0])
709733 let prAssetPmt = value(i.payments[1])
710734 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
711- let poolStatus = parseIntValue(estPut._8)
712- if (if (if (isGlobalShutdown())
713- then true
714- else (poolStatus == PoolPutDisabled))
715- then true
716- else (poolStatus == PoolShutdown))
717- then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
735+ let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
736+ then if (if (isGlobalShutdown())
737+ then true
738+ else (cfgPoolStatus == PoolPutDisabled))
739+ then true
740+ else (cfgPoolStatus == PoolShutdown)
741+ else false
742+ if (isPutDisabled)
743+ then throw(("Put operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
718744 else estPut
719745 }
720746
754780 else if ((paymentAssetId == cfgPriceAssetId))
755781 then false
756782 else throwErr("invalid asset")
757- let $t03285633149 = if (isEval)
783+ let $t03345533748 = if (isEval)
758784 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
759785 else if (paymentInAmountAsset)
760786 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
761787 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
762- let amountBalanceOld = $t03285633149._1
763- let priceBalanceOld = $t03285633149._2
764- let $t03315333302 = if (paymentInAmountAsset)
788+ let amountBalanceOld = $t03345533748._1
789+ let priceBalanceOld = $t03345533748._2
790+ let $t03375233901 = if (paymentInAmountAsset)
765791 then $Tuple2(paymentAmountRaw, 0)
766792 else $Tuple2(0, paymentAmountRaw)
767- let amountAssetAmountRaw = $t03315333302._1
768- let priceAssetAmountRaw = $t03315333302._2
793+ let amountAssetAmountRaw = $t03375233901._1
794+ let priceAssetAmountRaw = $t03375233901._2
769795 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
770796 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
771- let $t03343433498 = takeFee(paymentAmountRaw, inFee)
772- let paymentAmount = $t03343433498._1
773- let feeAmount = $t03343433498._2
797+ let $t03403334097 = takeFee(paymentAmountRaw, inFee)
798+ let paymentAmount = $t03403334097._1
799+ let feeAmount = $t03403334097._2
774800 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
775801 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
776802 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
793819 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
794820 let priceOld = fromX18(priceOldX18, scale8)
795821 let loss = {
796- let $t03517935346 = if (paymentInAmountAsset)
822+ let $t03577835945 = if (paymentInAmountAsset)
797823 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
798824 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
799- let amount = $t03517935346._1
800- let balance = $t03517935346._2
825+ let amount = $t03577835945._1
826+ let balance = $t03577835945._2
801827 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
802828 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
803829 }
837863 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
838864 let redeemedBigInt = toBigInt(paymentAmount)
839865 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
840- let $t03742437480 = takeFee(amountRaw, outFee)
841- let totalAmount = $t03742437480._1
842- let feeAmount = $t03742437480._2
843- let $t03748437710 = if (outInAmountAsset)
866+ let $t03802338079 = takeFee(amountRaw, outFee)
867+ let totalAmount = $t03802338079._1
868+ let feeAmount = $t03802338079._2
869+ let $t03808338309 = if (outInAmountAsset)
844870 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
845871 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
846- let outAmAmount = $t03748437710._1
847- let outPrAmount = $t03748437710._2
848- let amBalanceNew = $t03748437710._3
849- let prBalanceNew = $t03748437710._4
872+ let outAmAmount = $t03808338309._1
873+ let outPrAmount = $t03808338309._2
874+ let amBalanceNew = $t03808338309._3
875+ let prBalanceNew = $t03808338309._4
850876 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
851877 let priceNew = fromX18(priceNewX18, scale8)
852878 let commonState = if (isEval)
911937
912938 @Callable(i)
913939 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
914- let $t03956839873 = if ((isReverse == false))
940+ let $t04016740472 = if ((isReverse == false))
915941 then {
916942 let assetOut = getStringOrFail(this, pa())
917943 let assetIn = getStringOrFail(this, aa())
922948 let assetIn = getStringOrFail(this, pa())
923949 $Tuple2(assetOut, assetIn)
924950 }
925- let assetOut = $t03956839873._1
926- let assetIn = $t03956839873._2
951+ let assetOut = $t04016740472._1
952+ let assetIn = $t04016740472._2
927953 let poolAssetInBalance = getAccBalance(assetIn)
928954 let poolAssetOutBalance = getAccBalance(assetOut)
929955 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
947973 then @
948974 else throw(($getType(@) + " couldn't be cast to String"))
949975 }
950- let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
976+ let isPoolSwapDisabled = {
977+ let @ = invoke(factoryContract, "isPoolSwapDisabledREADONLY", [toString(this)], nil)
978+ if ($isInstanceOf(@, "Boolean"))
979+ then @
980+ else throw(($getType(@) + " couldn't be cast to Boolean"))
981+ }
982+ let isSwapDisabled = if (!(isAddressWhitelisted(i.caller)))
983+ then if (if (isGlobalShutdown())
984+ then true
985+ else (cfgPoolStatus == PoolShutdown))
986+ then true
987+ else isPoolSwapDisabled
988+ else false
989+ let checks = [if (if (!(isSwapDisabled))
990+ then true
991+ else isManager(i))
992+ then true
993+ else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn))
951994 then true
952995 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
953996 then true
9741017 else throw("Exchange result is fewer coins than expected")
9751018 if ((checkMin == checkMin))
9761019 then {
977- let rebalanceState = rebalanceAsset(assetIn)
978- if ((rebalanceState == rebalanceState))
1020+ let amountAssetBalanceDelta = if (isReverse)
1021+ then -(amountOut)
1022+ else feePoolAmount
1023+ let priceAssetBalanceDelta = if (isReverse)
1024+ then feePoolAmount
1025+ else -(amountOut)
1026+ let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1
1027+ if ((refreshKLpActions == refreshKLpActions))
9791028 then {
980- let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
981- if ((withdrawState == withdrawState))
982- then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1029+ let rebalanceState = rebalanceAsset(assetIn)
1030+ if ((rebalanceState == rebalanceState))
1031+ then {
1032+ let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
1033+ if ((withdrawState == withdrawState))
1034+ then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1035+ else throw("Strict value is not equal to itself.")
1036+ }
9831037 else throw("Strict value is not equal to itself.")
9841038 }
9851039 else throw("Strict value is not equal to itself.")
10391093 else throw("Strict value is not equal to itself.")
10401094 }
10411095 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1042- let $t04437644838 = refreshKLpInternal(0, 0, 0)
1043- if (($t04437644838 == $t04437644838))
1096+ let $t04564846110 = refreshKLpInternal(0, 0, 0)
1097+ if (($t04564846110 == $t04564846110))
10441098 then {
1045- let updatedKLp = $t04437644838._2
1046- let refreshKLpActions = $t04437644838._1
1099+ let updatedKLp = $t04564846110._2
1100+ let refreshKLpActions = $t04564846110._1
10471101 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10481102 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10491103 then {
10801134 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10811135 if ((currentKLp == currentKLp))
10821136 then {
1083- let $t04545045515 = refreshKLpInternal(0, 0, 0)
1084- let refreshKLpActions = $t04545045515._1
1085- let updatedKLp = $t04545045515._2
1137+ let $t04672246787 = refreshKLpInternal(0, 0, 0)
1138+ let refreshKLpActions = $t04672246787._1
1139+ let updatedKLp = $t04672246787._2
10861140 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10871141 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10881142 then (state ++ refreshKLpActions)
11011155 then @
11021156 else throw(($getType(@) + " couldn't be cast to Boolean"))
11031157 }
1104- let isPutDisabled = if (if (if (isGlobalShutdown())
1105- then true
1106- else (cfgPoolStatus == PoolPutDisabled))
1107- then true
1108- else (cfgPoolStatus == PoolShutdown))
1109- then true
1110- else isPoolOneTokenOperationsDisabled
1158+ let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
1159+ then if (if (if (isGlobalShutdown())
1160+ then true
1161+ else (cfgPoolStatus == PoolPutDisabled))
1162+ then true
1163+ else (cfgPoolStatus == PoolShutdown))
1164+ then true
1165+ else isPoolOneTokenOperationsDisabled
1166+ else false
11111167 let checks = [if (if (!(isPutDisabled))
11121168 then true
11131169 else isManager(i))
11291185 then {
11301186 let userAddress = i.caller
11311187 let txId = i.transactionId
1132- let $t04670346855 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133- if (($t04670346855 == $t04670346855))
1188+ let $t04801648168 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1189+ if (($t04801648168 == $t04801648168))
11341190 then {
1135- let paymentInAmountAsset = $t04670346855._5
1136- let bonus = $t04670346855._4
1137- let feeAmount = $t04670346855._3
1138- let commonState = $t04670346855._2
1139- let emitAmountEstimated = $t04670346855._1
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
11401196 let emitAmount = if (if ((minOutAmount > 0))
11411197 then (minOutAmount > emitAmountEstimated)
11421198 else false)
11561212 let sendFee = if ((feeAmount > 0))
11571213 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11581214 else nil
1159- let $t04744147638 = if ((this == feeCollectorAddress))
1215+ let $t04875448951 = if ((this == feeCollectorAddress))
11601216 then $Tuple2(0, 0)
11611217 else if (paymentInAmountAsset)
11621218 then $Tuple2(-(feeAmount), 0)
11631219 else $Tuple2(0, -(feeAmount))
1164- let amountAssetBalanceDelta = $t04744147638._1
1165- let priceAssetBalanceDelta = $t04744147638._2
1166- let $t04764147749 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167- let refreshKLpActions = $t04764147749._1
1168- let updatedKLp = $t04764147749._2
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
11691225 let kLp = value(getString(keyKLp))
11701226 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11711227 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11901246
11911247 @Callable(i)
11921248 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1193- let $t04810448261 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194- let emitAmountEstimated = $t04810448261._1
1195- let commonState = $t04810448261._2
1196- let feeAmount = $t04810448261._3
1197- let bonus = $t04810448261._4
1198- let paymentInAmountAsset = $t04810448261._5
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
11991255 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12001256 }
12011257
12091265 then @
12101266 else throw(($getType(@) + " couldn't be cast to Boolean"))
12111267 }
1212- let isGetDisabled = if (if (isGlobalShutdown())
1213- then true
1214- else (cfgPoolStatus == PoolShutdown))
1215- then true
1216- else isPoolOneTokenOperationsDisabled
1268+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1269+ then if (if (isGlobalShutdown())
1270+ then true
1271+ else (cfgPoolStatus == PoolShutdown))
1272+ then true
1273+ else isPoolOneTokenOperationsDisabled
1274+ else false
12171275 let checks = [if (if (!(isGetDisabled))
12181276 then true
12191277 else isManager(i))
12321290 then {
12331291 let userAddress = i.caller
12341292 let txId = i.transactionId
1235- let $t04914649299 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236- if (($t04914649299 == $t04914649299))
1293+ let $t05049650649 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1294+ if (($t05049650649 == $t05049650649))
12371295 then {
1238- let outInAmountAsset = $t04914649299._5
1239- let bonus = $t04914649299._4
1240- let feeAmount = $t04914649299._3
1241- let commonState = $t04914649299._2
1242- let amountEstimated = $t04914649299._1
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
12431301 let amount = if (if ((minOutAmount > 0))
12441302 then (minOutAmount > amountEstimated)
12451303 else false)
12531311 let sendFee = if ((feeAmount > 0))
12541312 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12551313 else nil
1256- let $t04996350210 = {
1314+ let $t05131351560 = {
12571315 let feeAmountForCalc = if ((this == feeCollectorAddress))
12581316 then 0
12591317 else feeAmount
12611319 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12621320 else $Tuple2(0, -((amount + feeAmountForCalc)))
12631321 }
1264- let amountAssetBalanceDelta = $t04996350210._1
1265- let priceAssetBalanceDelta = $t04996350210._2
1266- let $t05021350321 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267- let refreshKLpActions = $t05021350321._1
1268- let updatedKLp = $t05021350321._2
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
12691327 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12701328 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12711329 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12841342
12851343 @Callable(i)
12861344 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1287- let $t05059950755 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288- let amountEstimated = $t05059950755._1
1289- let commonState = $t05059950755._2
1290- let feeAmount = $t05059950755._3
1291- let bonus = $t05059950755._4
1292- let outInAmountAsset = $t05059950755._5
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
12931351 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12941352 }
12951353
13031361 then @
13041362 else throw(($getType(@) + " couldn't be cast to Boolean"))
13051363 }
1306- let isGetDisabled = if (if (isGlobalShutdown())
1307- then true
1308- else (cfgPoolStatus == PoolShutdown))
1309- then true
1310- else isPoolOneTokenOperationsDisabled
1364+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1365+ then if (if (isGlobalShutdown())
1366+ then true
1367+ else (cfgPoolStatus == PoolShutdown))
1368+ then true
1369+ else isPoolOneTokenOperationsDisabled
1370+ else false
13111371 let checks = [if (if (!(isGetDisabled))
13121372 then true
13131373 else isManager(i))
13261386 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13271387 if ((unstakeInv == unstakeInv))
13281388 then {
1329- let $t05166051811 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330- if (($t05166051811 == $t05166051811))
1389+ let $t05304753198 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1390+ if (($t05304753198 == $t05304753198))
13311391 then {
1332- let outInAmountAsset = $t05166051811._5
1333- let bonus = $t05166051811._4
1334- let feeAmount = $t05166051811._3
1335- let commonState = $t05166051811._2
1336- let amountEstimated = $t05166051811._1
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
13371397 let amount = if (if ((minOutAmount > 0))
13381398 then (minOutAmount > amountEstimated)
13391399 else false)
13471407 let sendFee = if ((feeAmount > 0))
13481408 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13491409 else nil
1350- let $t05247052717 = {
1410+ let $t05385754104 = {
13511411 let feeAmountForCalc = if ((this == feeCollectorAddress))
13521412 then 0
13531413 else feeAmount
13551415 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13561416 else $Tuple2(0, -((amount + feeAmountForCalc)))
13571417 }
1358- let amountAssetBalanceDelta = $t05247052717._1
1359- let priceAssetBalanceDelta = $t05247052717._2
1360- let $t05272052828 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361- let refreshKLpActions = $t05272052828._1
1362- let updatedKLp = $t05272052828._2
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
13631423 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13641424 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13651425 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13931453 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13941454 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13951455 then {
1396- let $t05392354004 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397- let refreshKLpActions = $t05392354004._1
1398- let updatedKLp = $t05392354004._2
1456+ let $t05531055391 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1457+ let refreshKLpActions = $t05531055391._1
1458+ let updatedKLp = $t05531055391._2
13991459 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14001460 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14011461 then ((withdrawState ++ state) ++ refreshKLpActions)
14281488 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14291489 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14301490 then {
1431- let $t05509955180 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432- let refreshKLpActions = $t05509955180._1
1433- let updatedKLp = $t05509955180._2
1491+ let $t05648656567 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1492+ let refreshKLpActions = $t05648656567._1
1493+ let updatedKLp = $t05648656567._2
14341494 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14351495 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14361496 then ((withdrawState ++ state) ++ refreshKLpActions)
14651525 let poolStatus = parseIntValue(res._9)
14661526 let state = res._10
14671527 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
1468- let checkPoolStatus = if (if (isGlobalShutdown())
1469- then true
1470- else (poolStatus == PoolShutdown))
1528+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1529+ then if (isGlobalShutdown())
1530+ then true
1531+ else (cfgPoolStatus == PoolShutdown)
1532+ else false
1533+ let checkPoolStatus = if (isGetDisabled)
14711534 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14721535 else true
14731536 if ((checkPoolStatus == checkPoolStatus))
14751538 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14761539 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14771540 then {
1478- let $t05645256533 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479- let refreshKLpActions = $t05645256533._1
1480- let updatedKLp = $t05645256533._2
1541+ let $t05791557996 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1542+ let refreshKLpActions = $t05791557996._1
1543+ let updatedKLp = $t05791557996._2
14811544 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14821545 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14831546 then ((withdrawState ++ state) ++ refreshKLpActions)
14981561
14991562 @Callable(i)
15001563 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
1501- let isGetDisabled = if (isGlobalShutdown())
1502- then true
1503- else (cfgPoolStatus == PoolShutdown)
1564+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1565+ then if (isGlobalShutdown())
1566+ then true
1567+ else (cfgPoolStatus == PoolShutdown)
1568+ else false
15041569 let checks = [if (!(isGetDisabled))
15051570 then true
15061571 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15291594 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15301595 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15311596 then {
1532- let $t05797458055 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533- let refreshKLpActions = $t05797458055._1
1534- let updatedKLp = $t05797458055._2
1597+ let $t05947459555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1598+ let refreshKLpActions = $t05947459555._1
1599+ let updatedKLp = $t05947459555._2
15351600 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15361601 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15371602 then ((withdrawState ++ state) ++ refreshKLpActions)
15661631 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15671632 then {
15681633 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1569- let $t05925959323 = refreshKLpInternal(0, 0, 0)
1570- let kLpUpdateActions = $t05925959323._1
1571- let updatedKLp = $t05925959323._2
1634+ let $t06075960823 = refreshKLpInternal(0, 0, 0)
1635+ let kLpUpdateActions = $t06075960823._1
1636+ let updatedKLp = $t06075960823._2
15721637 let actions = if ((kLp != updatedKLp))
15731638 then kLpUpdateActions
15741639 else throwErr("nothing to refresh")
17431808 match tx {
17441809 case order: Order =>
17451810 let matcherPub = getMatcherPubOrFail()
1746- let $t06798568102 = if (skipOrderValidation())
1811+ let $t06948569602 = if (skipOrderValidation())
17471812 then $Tuple2(true, "")
17481813 else validateMatcherOrderAllowed(order)
1749- let orderValid = $t06798568102._1
1750- let orderValidInfo = $t06798568102._2
1814+ let orderValid = $t06948569602._1
1815+ let orderValidInfo = $t06948569602._2
17511816 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17521817 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17531818 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
231+func keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP)
232+
233+
234+func isAddressWhitelisted (address) = valueOrElse(getBoolean(factoryContract, keyAddressWhitelisted(address)), false)
235+
236+
231237 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
232238
233239
234240 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
235241
236242
237243 func getPoolConfig () = {
238244 let amtAsset = getStringOrFail(this, aa())
239245 let priceAsset = getStringOrFail(this, pa())
240246 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
241247 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
242248 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
243249 }
244250
245251
246252 func parseAssetId (input) = if ((input == wavesString))
247253 then unit
248254 else fromBase58String(input)
249255
250256
251257 func assetIdToString (input) = if ((input == unit))
252258 then wavesString
253259 else toBase58String(value(input))
254260
255261
256262 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]))
257263
258264
259265 let poolConfigParsed = parsePoolConfig(getPoolConfig())
260266
261-let $t095299695 = poolConfigParsed
267+let $t097699935 = poolConfigParsed
262268
263-let cfgPoolAddress = $t095299695._1
269+let cfgPoolAddress = $t097699935._1
264270
265-let cfgPoolStatus = $t095299695._2
271+let cfgPoolStatus = $t097699935._2
266272
267-let cfgLpAssetId = $t095299695._3
273+let cfgLpAssetId = $t097699935._3
268274
269-let cfgAmountAssetId = $t095299695._4
275+let cfgAmountAssetId = $t097699935._4
270276
271-let cfgPriceAssetId = $t095299695._5
277+let cfgPriceAssetId = $t097699935._5
272278
273-let cfgAmountAssetDecimals = $t095299695._6
279+let cfgAmountAssetDecimals = $t097699935._6
274280
275-let cfgPriceAssetDecimals = $t095299695._7
281+let cfgPriceAssetDecimals = $t097699935._7
276282
277283 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
278284
279285
280286 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
281287
282288 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
283289
284290 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)
285291
286292
287293 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)
288294
289295
290296 func getAccBalance (assetId) = {
291297 let balanceOnPool = if ((assetId == "WAVES"))
292298 then wavesBalance(this).available
293299 else assetBalance(this, fromBase58String(assetId))
294300 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
295301 max([0, totalBalance])
296302 }
297303
298304
299305 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
300306
301307
302308 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
303309
304310
305311 func getRate (proxy) = {
306312 let inv = invoke(proxy, "getRate", nil, nil)
307313 if ((inv == inv))
308314 then match inv {
309315 case r: Int =>
310316 r
311317 case _ =>
312318 throwErr("proxy.getRate() unexpected value")
313319 }
314320 else throw("Strict value is not equal to itself.")
315321 }
316322
317323
318324 func deposit (assetId,amount,stakingAssetId,proxy) = {
319325 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
320326 if ((currentAdditionalBalance == currentAdditionalBalance))
321327 then {
322328 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
323329 if ((currentStakingAssetBalance == currentStakingAssetBalance))
324330 then {
325331 let asset = parseAssetId(assetId)
326332 if ((amount > 0))
327333 then {
328334 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
329335 if ((depositInvoke == depositInvoke))
330336 then match depositInvoke {
331337 case receivedStakingAsset: Int =>
332338 let newAdditionalBalance = (currentAdditionalBalance + amount)
333339 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
334340 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
335341 case _ =>
336342 nil
337343 }
338344 else throw("Strict value is not equal to itself.")
339345 }
340346 else nil
341347 }
342348 else throw("Strict value is not equal to itself.")
343349 }
344350 else throw("Strict value is not equal to itself.")
345351 }
346352
347353
348354 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
349355 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
350356 if ((currentAdditionalBalance == currentAdditionalBalance))
351357 then {
352358 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
353359 if ((currentStakingAssetBalance == currentStakingAssetBalance))
354360 then {
355361 let currentProxyRate = getRate(proxy)
356362 if ((currentProxyRate == currentProxyRate))
357363 then {
358364 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
359365 let stakingAsset = parseAssetId(stakingAssetId)
360366 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
361367 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362368 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
363369 if ((sendStakingAssetAmount > 0))
364370 then {
365371 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
366372 if ((withdrawInvoke == withdrawInvoke))
367373 then match withdrawInvoke {
368374 case receivedAssets: Int =>
369375 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
370376 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
371377 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
372378 case _ =>
373379 nil
374380 }
375381 else throw("Strict value is not equal to itself.")
376382 }
377383 else nil
378384 }
379385 else throw("Strict value is not equal to itself.")
380386 }
381387 else throw("Strict value is not equal to itself.")
382388 }
383389 else throw("Strict value is not equal to itself.")
384390 }
385391
386392
387393 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
388394 case a: (Boolean, Int, Int, String, String, Int, String) =>
389395 a
390396 case _ =>
391397 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
392398 }
393399
394400
395401 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
396- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
397- if ((currentAdditionalBalance == currentAdditionalBalance))
402+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
403+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
398404 then {
399- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
400- if ((currentStakingAssetBalance == currentStakingAssetBalance))
405+ let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
406+ then getAdditionalBalanceOrZero(assetId)
407+ else 0
408+ if ((currentAdditionalBalance == currentAdditionalBalance))
401409 then {
402410 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
403411 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
404412 let diff = (currentAdditionalBalance - targetAdditionalBalance)
405413 if ((diff == 0))
406414 then nil
407415 else if ((0 > diff))
408416 then {
409417 let sendAssetAmount = -(diff)
410418 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
411419 }
412420 else {
413421 let getAssetAmount = diff
414422 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
415423 }
416424 }
417425 else throw("Strict value is not equal to itself.")
418426 }
419427 else throw("Strict value is not equal to itself.")
420428 }
421429
422430
423431 func rebalanceAsset (assetId) = {
424- let $t01593116067 = getLeaseProxyConfig(assetId)
425- let isLeasable = $t01593116067._1
426- let leasedRatio = $t01593116067._2
427- let minBalance = $t01593116067._3
428- let proxyAddress = $t01593116067._4
429- let proxyAssetId = $t01593116067._5
430- let proxyRateMul = $t01593116067._6
431- let stakingProfitAddress = $t01593116067._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
432440 if (isLeasable)
433441 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434442 else nil
435443 }
436444
437445
438446 func withdrawAndRebalanceAsset (assetId,getAmount) = {
439- let $t01646616602 = getLeaseProxyConfig(assetId)
440- let isLeasable = $t01646616602._1
441- let leasedRatio = $t01646616602._2
442- let minBalance = $t01646616602._3
443- let proxyAddress = $t01646616602._4
444- let proxyAssetId = $t01646616602._5
445- let proxyRateMul = $t01646616602._6
446- let stakingProfitAddress = $t01646616602._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
447455 if (isLeasable)
448456 then {
449- let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
450- if ((newTotalLeasableBalance == newTotalLeasableBalance))
457+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(proxyAssetId)
458+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
451459 then {
452- let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
453- if ((newAdditionalBalance == newAdditionalBalance))
460+ let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
461+ then getAdditionalBalanceOrZero(assetId)
462+ else 0
463+ if ((currentAdditionalBalance == currentAdditionalBalance))
454464 then {
455- let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
456- if ((withdrawAmount == withdrawAmount))
457- then if ((0 > withdrawAmount))
458- then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
459- 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+ }
460482 else throw("Strict value is not equal to itself.")
461483 }
462484 else throw("Strict value is not equal to itself.")
463485 }
464486 else throw("Strict value is not equal to itself.")
465487 }
466488 else nil
467489 }
468490
469491
470492 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
471493 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
472494 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
473495 (AmAmtWithdrawState ++ PrAmtWithdrawState)
474496 }
475497
476498
477499 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
478500 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
479501 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
480502 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
481503 }
482504
483505
484506 func calcPrices (amAmt,prAmt,lpAmt) = {
485507 let cfg = getPoolConfig()
486508 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
487509 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
488510 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
489511 let amAmtX18 = toX18(amAmt, amtAssetDcm)
490512 let prAmtX18 = toX18(prAmt, priceAssetDcm)
491513 let lpAmtX18 = toX18(lpAmt, scale8)
492514 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
493515 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
494516 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
495517 }
496518
497519
498520 func calculatePrices (amAmt,prAmt,lpAmt) = {
499521 let prices = calcPrices(amAmt, prAmt, lpAmt)
500522 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
501523 }
502524
503525
504526 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
505527 let cfg = getPoolConfig()
506528 let lpAssetId = cfg[idxPoolLPAssetId]
507529 let amAssetId = cfg[idxAmtAssetId]
508530 let prAssetId = cfg[idxPriceAssetId]
509531 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
510532 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
511533 let poolStatus = cfg[idxPoolStatus]
512534 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
513535 if ((lpAssetId != pmtAssetId))
514536 then throw("Invalid asset passed.")
515537 else {
516538 let amBalance = getAccBalance(amAssetId)
517539 let amBalanceX18 = toX18(amBalance, amAssetDcm)
518540 let prBalance = getAccBalance(prAssetId)
519541 let prBalanceX18 = toX18(prBalance, prAssetDcm)
520542 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
521543 let curPrice = fromX18(curPriceX18, scale8)
522544 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
523545 let lpEmissionX18 = toX18(lpEmission, scale8)
524546 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
525547 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
526548 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
527549 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
528550 let state = if ((txId58 == ""))
529551 then nil
530552 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
531553 then unit
532554 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
533555 then unit
534556 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)]
535557 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
536558 }
537559 }
538560
539561
540562 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
541563 let cfg = getPoolConfig()
542564 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
543565 let amAssetIdStr = cfg[idxAmtAssetId]
544566 let prAssetIdStr = cfg[idxPriceAssetId]
545567 let iAmtAssetId = cfg[idxIAmtAssetId]
546568 let iPriceAssetId = cfg[idxIPriceAssetId]
547569 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
548570 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
549571 let poolStatus = cfg[idxPoolStatus]
550572 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
551573 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
552574 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
553575 if (if ((amAssetIdStr != inAmAssetIdStr))
554576 then true
555577 else (prAssetIdStr != inPrAssetIdStr))
556578 then throw("Invalid amt or price asset passed.")
557579 else {
558580 let amBalance = if (isEvaluate)
559581 then getAccBalance(amAssetIdStr)
560582 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
561583 let prBalance = if (isEvaluate)
562584 then getAccBalance(prAssetIdStr)
563585 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
564586 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
565587 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
566588 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
567589 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
568590 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
569591 let res = if ((lpEmission == 0))
570592 then {
571593 let curPriceX18 = zeroBigInt
572594 let slippageX18 = zeroBigInt
573595 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
574596 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
575597 }
576598 else {
577599 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
578600 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
579601 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
580602 if (if ((curPriceX18 != zeroBigInt))
581603 then (slippageX18 > slippageToleranceX18)
582604 else false)
583605 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
584606 else {
585607 let lpEmissionX18 = toX18(lpEmission, scale8)
586608 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
587609 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
588610 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
589611 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
590612 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
591613 let expAmtAssetAmtX18 = expectedAmts._1
592614 let expPriceAssetAmtX18 = expectedAmts._2
593615 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
594616 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
595617 }
596618 }
597619 let calcLpAmt = res._1
598620 let calcAmAssetPmt = res._2
599621 let calcPrAssetPmt = res._3
600622 let curPrice = fromX18(res._4, scale8)
601623 let slippageCalc = fromX18(res._5, scale8)
602624 if ((0 >= calcLpAmt))
603625 then throw("Invalid calculations. LP calculated is less than zero.")
604626 else {
605627 let emitLpAmt = if (!(emitLp))
606628 then 0
607629 else calcLpAmt
608630 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
609631 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
610632 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))]
611633 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
612634 }
613635 }
614636 }
615637
616638
617639 func calcKLp (amountBalance,priceBalance,lpEmission) = {
618640 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
619641 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
620642 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
621643 if ((lpEmission == big0))
622644 then big0
623645 else updatedKLp
624646 }
625647
626648
627649 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
628650 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
629651 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
630652 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
631653 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
632654 currentKLp
633655 }
634656
635657
636658 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
637659 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
638660 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
639661 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
640662 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
641663 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
642664 $Tuple2(actions, updatedKLp)
643665 }
644666
645667
646668 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
647669
648670
649671 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
650672 then true
651673 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
652674
653675
654676 func validateMatcherOrderAllowed (order) = {
655677 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
656678 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
657679 let amountAssetAmount = order.amount
658680 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
659- let $t02899129203 = if ((order.orderType == Buy))
681+ let $t02951729729 = if ((order.orderType == Buy))
660682 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
661683 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
662- let amountAssetBalanceDelta = $t02899129203._1
663- let priceAssetBalanceDelta = $t02899129203._2
684+ let amountAssetBalanceDelta = $t02951729729._1
685+ let priceAssetBalanceDelta = $t02951729729._2
664686 if (if (if (isGlobalShutdown())
665687 then true
666688 else (cfgPoolStatus == PoolMatcherDisabled))
667689 then true
668690 else (cfgPoolStatus == PoolShutdown))
669691 then throw("Exchange operations disabled")
670692 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
671693 then true
672694 else (order.assetPair.priceAsset != cfgPriceAssetId))
673695 then throw("Wrong order assets.")
674696 else {
675697 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
676- let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677- let unusedActions = $t02964329743._1
678- let kLpNew = $t02964329743._2
698+ let $t03016930269 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
699+ let unusedActions = $t03016930269._1
700+ let kLpNew = $t03016930269._2
679701 let isOrderValid = (kLpNew >= kLp)
680702 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
681703 $Tuple2(isOrderValid, info)
682704 }
683705 }
684706
685707
686708 func commonGet (i) = if ((size(i.payments) != 1))
687709 then throw("exactly 1 payment is expected")
688710 else {
689711 let pmt = value(i.payments[0])
690712 let pmtAssetId = value(pmt.assetId)
691713 let pmtAmt = pmt.amount
692714 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
693715 let outAmAmt = res._1
694716 let outPrAmt = res._2
695- let poolStatus = parseIntValue(res._9)
696717 let state = res._10
697- if (if (isGlobalShutdown())
698- then true
699- else (poolStatus == PoolShutdown))
700- then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
718+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
719+ then if (isGlobalShutdown())
720+ then true
721+ else (cfgPoolStatus == PoolShutdown)
722+ else false
723+ if (isGetDisabled)
724+ then throw(("Get operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
701725 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
702726 }
703727
704728
705729 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
706730 then throw("exactly 2 payments are expected")
707731 else {
708732 let amAssetPmt = value(i.payments[0])
709733 let prAssetPmt = value(i.payments[1])
710734 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
711- let poolStatus = parseIntValue(estPut._8)
712- if (if (if (isGlobalShutdown())
713- then true
714- else (poolStatus == PoolPutDisabled))
715- then true
716- else (poolStatus == PoolShutdown))
717- then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
735+ let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
736+ then if (if (isGlobalShutdown())
737+ then true
738+ else (cfgPoolStatus == PoolPutDisabled))
739+ then true
740+ else (cfgPoolStatus == PoolShutdown)
741+ else false
742+ if (isPutDisabled)
743+ then throw(("Put operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
718744 else estPut
719745 }
720746
721747
722748 func emit (amount) = {
723749 let emitInv = invoke(factoryContract, "emit", [amount], nil)
724750 if ((emitInv == emitInv))
725751 then {
726752 let emitInvLegacy = match emitInv {
727753 case legacyFactoryContract: Address =>
728754 invoke(legacyFactoryContract, "emit", [amount], nil)
729755 case _ =>
730756 unit
731757 }
732758 if ((emitInvLegacy == emitInvLegacy))
733759 then amount
734760 else throw("Strict value is not equal to itself.")
735761 }
736762 else throw("Strict value is not equal to itself.")
737763 }
738764
739765
740766 func takeFee (amount,fee) = {
741767 let feeAmount = if ((fee == 0))
742768 then 0
743769 else fraction(amount, fee, scale8)
744770 $Tuple2((amount - feeAmount), feeAmount)
745771 }
746772
747773
748774 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
749775 let isEval = (txId == unit)
750776 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
751777 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
752778 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
753779 then true
754780 else if ((paymentAssetId == cfgPriceAssetId))
755781 then false
756782 else throwErr("invalid asset")
757- let $t03285633149 = if (isEval)
783+ let $t03345533748 = if (isEval)
758784 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
759785 else if (paymentInAmountAsset)
760786 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
761787 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
762- let amountBalanceOld = $t03285633149._1
763- let priceBalanceOld = $t03285633149._2
764- let $t03315333302 = if (paymentInAmountAsset)
788+ let amountBalanceOld = $t03345533748._1
789+ let priceBalanceOld = $t03345533748._2
790+ let $t03375233901 = if (paymentInAmountAsset)
765791 then $Tuple2(paymentAmountRaw, 0)
766792 else $Tuple2(0, paymentAmountRaw)
767- let amountAssetAmountRaw = $t03315333302._1
768- let priceAssetAmountRaw = $t03315333302._2
793+ let amountAssetAmountRaw = $t03375233901._1
794+ let priceAssetAmountRaw = $t03375233901._2
769795 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
770796 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
771- let $t03343433498 = takeFee(paymentAmountRaw, inFee)
772- let paymentAmount = $t03343433498._1
773- let feeAmount = $t03343433498._2
797+ let $t03403334097 = takeFee(paymentAmountRaw, inFee)
798+ let paymentAmount = $t03403334097._1
799+ let feeAmount = $t03403334097._2
774800 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
775801 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
776802 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
777803 let priceNew = fromX18(priceNewX18, scale8)
778804 let paymentBalance = if (paymentInAmountAsset)
779805 then amountBalanceOld
780806 else priceBalanceOld
781807 let paymentBalanceBigInt = toBigInt(paymentBalance)
782808 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
783809 let chechSupply = if ((supplyBigInt > big0))
784810 then true
785811 else throwErr("initial deposit requires all coins")
786812 if ((chechSupply == chechSupply))
787813 then {
788814 let depositBigInt = toBigInt(paymentAmount)
789815 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
790816 let commonState = if (isEval)
791817 then nil
792818 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))]
793819 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
794820 let priceOld = fromX18(priceOldX18, scale8)
795821 let loss = {
796- let $t03517935346 = if (paymentInAmountAsset)
822+ let $t03577835945 = if (paymentInAmountAsset)
797823 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
798824 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
799- let amount = $t03517935346._1
800- let balance = $t03517935346._2
825+ let amount = $t03577835945._1
826+ let balance = $t03577835945._2
801827 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
802828 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
803829 }
804830 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
805831 }
806832 else throw("Strict value is not equal to itself.")
807833 }
808834
809835
810836 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
811837 let isEval = (txId == unit)
812838 let cfg = getPoolConfig()
813839 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
814840 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
815841 let checks = [if ((paymentAssetId == cfgLpAssetId))
816842 then true
817843 else throwErr("invalid lp asset")]
818844 if ((checks == checks))
819845 then {
820846 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
821847 then true
822848 else if ((outAssetId == cfgPriceAssetId))
823849 then false
824850 else throwErr("invalid asset")
825851 let balanceBigInt = if (outInAmountAsset)
826852 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
827853 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
828854 let outInAmountAssetDecimals = if (outInAmountAsset)
829855 then amtAssetDcm
830856 else priceAssetDcm
831857 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
832858 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
833859 let outBalance = if (outInAmountAsset)
834860 then amBalanceOld
835861 else prBalanceOld
836862 let outBalanceBigInt = toBigInt(outBalance)
837863 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
838864 let redeemedBigInt = toBigInt(paymentAmount)
839865 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
840- let $t03742437480 = takeFee(amountRaw, outFee)
841- let totalAmount = $t03742437480._1
842- let feeAmount = $t03742437480._2
843- let $t03748437710 = if (outInAmountAsset)
866+ let $t03802338079 = takeFee(amountRaw, outFee)
867+ let totalAmount = $t03802338079._1
868+ let feeAmount = $t03802338079._2
869+ let $t03808338309 = if (outInAmountAsset)
844870 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
845871 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
846- let outAmAmount = $t03748437710._1
847- let outPrAmount = $t03748437710._2
848- let amBalanceNew = $t03748437710._3
849- let prBalanceNew = $t03748437710._4
872+ let outAmAmount = $t03808338309._1
873+ let outPrAmount = $t03808338309._2
874+ let amBalanceNew = $t03808338309._3
875+ let prBalanceNew = $t03808338309._4
850876 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
851877 let priceNew = fromX18(priceNewX18, scale8)
852878 let commonState = if (isEval)
853879 then nil
854880 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)]
855881 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
856882 let priceOld = fromX18(priceOldX18, scale8)
857883 let loss = {
858884 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
859885 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
860886 }
861887 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
862888 }
863889 else throw("Strict value is not equal to itself.")
864890 }
865891
866892
867893 func managerPublicKeyOrUnit () = {
868894 let managerVaultAddress = getManagerVaultAddressOrThis()
869895 match getString(managerVaultAddress, keyManagerPublicKey()) {
870896 case s: String =>
871897 fromBase58String(s)
872898 case _: Unit =>
873899 unit
874900 case _ =>
875901 throw("Match error")
876902 }
877903 }
878904
879905
880906 func isManager (i) = match managerPublicKeyOrUnit() {
881907 case pk: ByteVector =>
882908 (i.callerPublicKey == pk)
883909 case _: Unit =>
884910 (i.caller == this)
885911 case _ =>
886912 throw("Match error")
887913 }
888914
889915
890916 func mustManager (i) = {
891917 let pd = throw("Permission denied")
892918 match managerPublicKeyOrUnit() {
893919 case pk: ByteVector =>
894920 if ((i.callerPublicKey == pk))
895921 then true
896922 else pd
897923 case _: Unit =>
898924 if ((i.caller == this))
899925 then true
900926 else pd
901927 case _ =>
902928 throw("Match error")
903929 }
904930 }
905931
906932
907933 @Callable(i)
908934 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
909935
910936
911937
912938 @Callable(i)
913939 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
914- let $t03956839873 = if ((isReverse == false))
940+ let $t04016740472 = if ((isReverse == false))
915941 then {
916942 let assetOut = getStringOrFail(this, pa())
917943 let assetIn = getStringOrFail(this, aa())
918944 $Tuple2(assetOut, assetIn)
919945 }
920946 else {
921947 let assetOut = getStringOrFail(this, aa())
922948 let assetIn = getStringOrFail(this, pa())
923949 $Tuple2(assetOut, assetIn)
924950 }
925- let assetOut = $t03956839873._1
926- let assetIn = $t03956839873._2
951+ let assetOut = $t04016740472._1
952+ let assetIn = $t04016740472._2
927953 let poolAssetInBalance = getAccBalance(assetIn)
928954 let poolAssetOutBalance = getAccBalance(assetOut)
929955 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
930956 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
931957 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
932958 let checkK = if ((newK >= oldK))
933959 then true
934960 else throw("new K is fewer error")
935961 if ((checkK == checkK))
936962 then $Tuple2(nil, amountOut)
937963 else throw("Strict value is not equal to itself.")
938964 }
939965
940966
941967
942968 @Callable(i)
943969 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
944970 let swapContact = {
945971 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
946972 if ($isInstanceOf(@, "String"))
947973 then @
948974 else throw(($getType(@) + " couldn't be cast to String"))
949975 }
950- let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
976+ let isPoolSwapDisabled = {
977+ let @ = invoke(factoryContract, "isPoolSwapDisabledREADONLY", [toString(this)], nil)
978+ if ($isInstanceOf(@, "Boolean"))
979+ then @
980+ else throw(($getType(@) + " couldn't be cast to Boolean"))
981+ }
982+ let isSwapDisabled = if (!(isAddressWhitelisted(i.caller)))
983+ then if (if (isGlobalShutdown())
984+ then true
985+ else (cfgPoolStatus == PoolShutdown))
986+ then true
987+ else isPoolSwapDisabled
988+ else false
989+ let checks = [if (if (!(isSwapDisabled))
990+ then true
991+ else isManager(i))
992+ then true
993+ else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn))
951994 then true
952995 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
953996 then true
954997 else throwErr("Permission denied")]
955998 if ((checks == checks))
956999 then {
9571000 let pmt = value(i.payments[0])
9581001 let assetIn = assetIdToString(pmt.assetId)
9591002 let assetOut = if ((isReverse == false))
9601003 then getStringOrFail(this, pa())
9611004 else getStringOrFail(this, aa())
9621005 let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount)
9631006 let poolAssetOutBalance = getAccBalance(assetOut)
9641007 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
9651008 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
9661009 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
9671010 let checkK = if ((newK >= oldK))
9681011 then true
9691012 else throw("new K is fewer error")
9701013 if ((checkK == checkK))
9711014 then {
9721015 let checkMin = if ((amountOut >= amountOutMin))
9731016 then true
9741017 else throw("Exchange result is fewer coins than expected")
9751018 if ((checkMin == checkMin))
9761019 then {
977- let rebalanceState = rebalanceAsset(assetIn)
978- if ((rebalanceState == rebalanceState))
1020+ let amountAssetBalanceDelta = if (isReverse)
1021+ then -(amountOut)
1022+ else feePoolAmount
1023+ let priceAssetBalanceDelta = if (isReverse)
1024+ then feePoolAmount
1025+ else -(amountOut)
1026+ let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1
1027+ if ((refreshKLpActions == refreshKLpActions))
9791028 then {
980- let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
981- if ((withdrawState == withdrawState))
982- then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1029+ let rebalanceState = rebalanceAsset(assetIn)
1030+ if ((rebalanceState == rebalanceState))
1031+ then {
1032+ let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
1033+ if ((withdrawState == withdrawState))
1034+ then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1035+ else throw("Strict value is not equal to itself.")
1036+ }
9831037 else throw("Strict value is not equal to itself.")
9841038 }
9851039 else throw("Strict value is not equal to itself.")
9861040 }
9871041 else throw("Strict value is not equal to itself.")
9881042 }
9891043 else throw("Strict value is not equal to itself.")
9901044 }
9911045 else throw("Strict value is not equal to itself.")
9921046 }
9931047
9941048
9951049
9961050 @Callable(i)
9971051 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
9981052 then throw("Invalid slippageTolerance passed")
9991053 else {
10001054 let estPut = commonPut(i, slippageTolerance, true)
10011055 let emitLpAmt = estPut._2
10021056 let lpAssetId = estPut._7
10031057 let state = estPut._9
10041058 let amDiff = estPut._10
10051059 let prDiff = estPut._11
10061060 let amId = estPut._12
10071061 let prId = estPut._13
10081062 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10091063 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10101064 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10111065 if ((currentKLp == currentKLp))
10121066 then {
10131067 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10141068 if ((emitInv == emitInv))
10151069 then {
10161070 let emitInvLegacy = match emitInv {
10171071 case legacyFactoryContract: Address =>
10181072 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10191073 case _ =>
10201074 unit
10211075 }
10221076 if ((emitInvLegacy == emitInvLegacy))
10231077 then {
10241078 let slippageAInv = if ((amDiff > 0))
10251079 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10261080 else nil
10271081 if ((slippageAInv == slippageAInv))
10281082 then {
10291083 let slippagePInv = if ((prDiff > 0))
10301084 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10311085 else nil
10321086 if ((slippagePInv == slippagePInv))
10331087 then {
10341088 let lpTransfer = if (shouldAutoStake)
10351089 then {
10361090 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10371091 if ((slpStakeInv == slpStakeInv))
10381092 then nil
10391093 else throw("Strict value is not equal to itself.")
10401094 }
10411095 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1042- let $t04437644838 = refreshKLpInternal(0, 0, 0)
1043- if (($t04437644838 == $t04437644838))
1096+ let $t04564846110 = refreshKLpInternal(0, 0, 0)
1097+ if (($t04564846110 == $t04564846110))
10441098 then {
1045- let updatedKLp = $t04437644838._2
1046- let refreshKLpActions = $t04437644838._1
1099+ let updatedKLp = $t04564846110._2
1100+ let refreshKLpActions = $t04564846110._1
10471101 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10481102 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10491103 then {
10501104 let reb = invoke(this, "rebalance", nil, nil)
10511105 if ((reb == reb))
10521106 then ((state ++ lpTransfer) ++ refreshKLpActions)
10531107 else throw("Strict value is not equal to itself.")
10541108 }
10551109 else throw("Strict value is not equal to itself.")
10561110 }
10571111 else throw("Strict value is not equal to itself.")
10581112 }
10591113 else throw("Strict value is not equal to itself.")
10601114 }
10611115 else throw("Strict value is not equal to itself.")
10621116 }
10631117 else throw("Strict value is not equal to itself.")
10641118 }
10651119 else throw("Strict value is not equal to itself.")
10661120 }
10671121 else throw("Strict value is not equal to itself.")
10681122 }
10691123
10701124
10711125
10721126 @Callable(i)
10731127 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10741128 then throw("Invalid value passed")
10751129 else {
10761130 let estPut = commonPut(i, maxSlippage, false)
10771131 let state = estPut._9
10781132 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10791133 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10801134 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10811135 if ((currentKLp == currentKLp))
10821136 then {
1083- let $t04545045515 = refreshKLpInternal(0, 0, 0)
1084- let refreshKLpActions = $t04545045515._1
1085- let updatedKLp = $t04545045515._2
1137+ let $t04672246787 = refreshKLpInternal(0, 0, 0)
1138+ let refreshKLpActions = $t04672246787._1
1139+ let updatedKLp = $t04672246787._2
10861140 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10871141 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10881142 then (state ++ refreshKLpActions)
10891143 else throw("Strict value is not equal to itself.")
10901144 }
10911145 else throw("Strict value is not equal to itself.")
10921146 }
10931147
10941148
10951149
10961150 @Callable(i)
10971151 func putOneTkn (minOutAmount,autoStake) = {
10981152 let isPoolOneTokenOperationsDisabled = {
10991153 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11001154 if ($isInstanceOf(@, "Boolean"))
11011155 then @
11021156 else throw(($getType(@) + " couldn't be cast to Boolean"))
11031157 }
1104- let isPutDisabled = if (if (if (isGlobalShutdown())
1105- then true
1106- else (cfgPoolStatus == PoolPutDisabled))
1107- then true
1108- else (cfgPoolStatus == PoolShutdown))
1109- then true
1110- else isPoolOneTokenOperationsDisabled
1158+ let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
1159+ then if (if (if (isGlobalShutdown())
1160+ then true
1161+ else (cfgPoolStatus == PoolPutDisabled))
1162+ then true
1163+ else (cfgPoolStatus == PoolShutdown))
1164+ then true
1165+ else isPoolOneTokenOperationsDisabled
1166+ else false
11111167 let checks = [if (if (!(isPutDisabled))
11121168 then true
11131169 else isManager(i))
11141170 then true
11151171 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11161172 then true
11171173 else throwErr("exactly 1 payment are expected")]
11181174 if ((checks == checks))
11191175 then {
11201176 let payment = i.payments[0]
11211177 let paymentAssetId = payment.assetId
11221178 let paymentAmountRaw = payment.amount
11231179 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11241180 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11251181 else if ((paymentAssetId == cfgPriceAssetId))
11261182 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11271183 else throwErr("payment asset is not supported")
11281184 if ((currentKLp == currentKLp))
11291185 then {
11301186 let userAddress = i.caller
11311187 let txId = i.transactionId
1132- let $t04670346855 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133- if (($t04670346855 == $t04670346855))
1188+ let $t04801648168 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1189+ if (($t04801648168 == $t04801648168))
11341190 then {
1135- let paymentInAmountAsset = $t04670346855._5
1136- let bonus = $t04670346855._4
1137- let feeAmount = $t04670346855._3
1138- let commonState = $t04670346855._2
1139- let emitAmountEstimated = $t04670346855._1
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
11401196 let emitAmount = if (if ((minOutAmount > 0))
11411197 then (minOutAmount > emitAmountEstimated)
11421198 else false)
11431199 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11441200 else emitAmountEstimated
11451201 let emitInv = emit(emitAmount)
11461202 if ((emitInv == emitInv))
11471203 then {
11481204 let lpTransfer = if (autoStake)
11491205 then {
11501206 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11511207 if ((stakeInv == stakeInv))
11521208 then nil
11531209 else throw("Strict value is not equal to itself.")
11541210 }
11551211 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11561212 let sendFee = if ((feeAmount > 0))
11571213 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11581214 else nil
1159- let $t04744147638 = if ((this == feeCollectorAddress))
1215+ let $t04875448951 = if ((this == feeCollectorAddress))
11601216 then $Tuple2(0, 0)
11611217 else if (paymentInAmountAsset)
11621218 then $Tuple2(-(feeAmount), 0)
11631219 else $Tuple2(0, -(feeAmount))
1164- let amountAssetBalanceDelta = $t04744147638._1
1165- let priceAssetBalanceDelta = $t04744147638._2
1166- let $t04764147749 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167- let refreshKLpActions = $t04764147749._1
1168- let updatedKLp = $t04764147749._2
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
11691225 let kLp = value(getString(keyKLp))
11701226 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11711227 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11721228 then {
11731229 let reb = invoke(this, "rebalance", nil, nil)
11741230 if ((reb == reb))
11751231 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11761232 else throw("Strict value is not equal to itself.")
11771233 }
11781234 else throw("Strict value is not equal to itself.")
11791235 }
11801236 else throw("Strict value is not equal to itself.")
11811237 }
11821238 else throw("Strict value is not equal to itself.")
11831239 }
11841240 else throw("Strict value is not equal to itself.")
11851241 }
11861242 else throw("Strict value is not equal to itself.")
11871243 }
11881244
11891245
11901246
11911247 @Callable(i)
11921248 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1193- let $t04810448261 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194- let emitAmountEstimated = $t04810448261._1
1195- let commonState = $t04810448261._2
1196- let feeAmount = $t04810448261._3
1197- let bonus = $t04810448261._4
1198- let paymentInAmountAsset = $t04810448261._5
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
11991255 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12001256 }
12011257
12021258
12031259
12041260 @Callable(i)
12051261 func getOneTkn (outAssetIdStr,minOutAmount) = {
12061262 let isPoolOneTokenOperationsDisabled = {
12071263 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12081264 if ($isInstanceOf(@, "Boolean"))
12091265 then @
12101266 else throw(($getType(@) + " couldn't be cast to Boolean"))
12111267 }
1212- let isGetDisabled = if (if (isGlobalShutdown())
1213- then true
1214- else (cfgPoolStatus == PoolShutdown))
1215- then true
1216- else isPoolOneTokenOperationsDisabled
1268+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1269+ then if (if (isGlobalShutdown())
1270+ then true
1271+ else (cfgPoolStatus == PoolShutdown))
1272+ then true
1273+ else isPoolOneTokenOperationsDisabled
1274+ else false
12171275 let checks = [if (if (!(isGetDisabled))
12181276 then true
12191277 else isManager(i))
12201278 then true
12211279 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12221280 then true
12231281 else throwErr("exactly 1 payment are expected")]
12241282 if ((checks == checks))
12251283 then {
12261284 let outAssetId = parseAssetId(outAssetIdStr)
12271285 let payment = i.payments[0]
12281286 let paymentAssetId = payment.assetId
12291287 let paymentAmount = payment.amount
12301288 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12311289 if ((currentKLp == currentKLp))
12321290 then {
12331291 let userAddress = i.caller
12341292 let txId = i.transactionId
1235- let $t04914649299 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236- if (($t04914649299 == $t04914649299))
1293+ let $t05049650649 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1294+ if (($t05049650649 == $t05049650649))
12371295 then {
1238- let outInAmountAsset = $t04914649299._5
1239- let bonus = $t04914649299._4
1240- let feeAmount = $t04914649299._3
1241- let commonState = $t04914649299._2
1242- let amountEstimated = $t04914649299._1
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
12431301 let amount = if (if ((minOutAmount > 0))
12441302 then (minOutAmount > amountEstimated)
12451303 else false)
12461304 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12471305 else amountEstimated
12481306 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12491307 if ((burnInv == burnInv))
12501308 then {
12511309 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12521310 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12531311 let sendFee = if ((feeAmount > 0))
12541312 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12551313 else nil
1256- let $t04996350210 = {
1314+ let $t05131351560 = {
12571315 let feeAmountForCalc = if ((this == feeCollectorAddress))
12581316 then 0
12591317 else feeAmount
12601318 if (outInAmountAsset)
12611319 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12621320 else $Tuple2(0, -((amount + feeAmountForCalc)))
12631321 }
1264- let amountAssetBalanceDelta = $t04996350210._1
1265- let priceAssetBalanceDelta = $t04996350210._2
1266- let $t05021350321 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267- let refreshKLpActions = $t05021350321._1
1268- let updatedKLp = $t05021350321._2
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
12691327 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12701328 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12711329 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12721330 else throw("Strict value is not equal to itself.")
12731331 }
12741332 else throw("Strict value is not equal to itself.")
12751333 }
12761334 else throw("Strict value is not equal to itself.")
12771335 }
12781336 else throw("Strict value is not equal to itself.")
12791337 }
12801338 else throw("Strict value is not equal to itself.")
12811339 }
12821340
12831341
12841342
12851343 @Callable(i)
12861344 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1287- let $t05059950755 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288- let amountEstimated = $t05059950755._1
1289- let commonState = $t05059950755._2
1290- let feeAmount = $t05059950755._3
1291- let bonus = $t05059950755._4
1292- let outInAmountAsset = $t05059950755._5
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
12931351 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12941352 }
12951353
12961354
12971355
12981356 @Callable(i)
12991357 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13001358 let isPoolOneTokenOperationsDisabled = {
13011359 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13021360 if ($isInstanceOf(@, "Boolean"))
13031361 then @
13041362 else throw(($getType(@) + " couldn't be cast to Boolean"))
13051363 }
1306- let isGetDisabled = if (if (isGlobalShutdown())
1307- then true
1308- else (cfgPoolStatus == PoolShutdown))
1309- then true
1310- else isPoolOneTokenOperationsDisabled
1364+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1365+ then if (if (isGlobalShutdown())
1366+ then true
1367+ else (cfgPoolStatus == PoolShutdown))
1368+ then true
1369+ else isPoolOneTokenOperationsDisabled
1370+ else false
13111371 let checks = [if (if (!(isGetDisabled))
13121372 then true
13131373 else isManager(i))
13141374 then true
13151375 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13161376 then true
13171377 else throwErr("no payments are expected")]
13181378 if ((checks == checks))
13191379 then {
13201380 let outAssetId = parseAssetId(outAssetIdStr)
13211381 let userAddress = i.caller
13221382 let txId = i.transactionId
13231383 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13241384 if ((currentKLp == currentKLp))
13251385 then {
13261386 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13271387 if ((unstakeInv == unstakeInv))
13281388 then {
1329- let $t05166051811 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330- if (($t05166051811 == $t05166051811))
1389+ let $t05304753198 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1390+ if (($t05304753198 == $t05304753198))
13311391 then {
1332- let outInAmountAsset = $t05166051811._5
1333- let bonus = $t05166051811._4
1334- let feeAmount = $t05166051811._3
1335- let commonState = $t05166051811._2
1336- let amountEstimated = $t05166051811._1
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
13371397 let amount = if (if ((minOutAmount > 0))
13381398 then (minOutAmount > amountEstimated)
13391399 else false)
13401400 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13411401 else amountEstimated
13421402 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13431403 if ((burnInv == burnInv))
13441404 then {
13451405 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13461406 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13471407 let sendFee = if ((feeAmount > 0))
13481408 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13491409 else nil
1350- let $t05247052717 = {
1410+ let $t05385754104 = {
13511411 let feeAmountForCalc = if ((this == feeCollectorAddress))
13521412 then 0
13531413 else feeAmount
13541414 if (outInAmountAsset)
13551415 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13561416 else $Tuple2(0, -((amount + feeAmountForCalc)))
13571417 }
1358- let amountAssetBalanceDelta = $t05247052717._1
1359- let priceAssetBalanceDelta = $t05247052717._2
1360- let $t05272052828 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361- let refreshKLpActions = $t05272052828._1
1362- let updatedKLp = $t05272052828._2
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
13631423 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13641424 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13651425 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13661426 else throw("Strict value is not equal to itself.")
13671427 }
13681428 else throw("Strict value is not equal to itself.")
13691429 }
13701430 else throw("Strict value is not equal to itself.")
13711431 }
13721432 else throw("Strict value is not equal to itself.")
13731433 }
13741434 else throw("Strict value is not equal to itself.")
13751435 }
13761436 else throw("Strict value is not equal to itself.")
13771437 }
13781438
13791439
13801440
13811441 @Callable(i)
13821442 func get () = {
13831443 let res = commonGet(i)
13841444 let outAmAmt = res._1
13851445 let outPrAmt = res._2
13861446 let pmtAmt = res._3
13871447 let pmtAssetId = res._4
13881448 let state = res._5
13891449 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
13901450 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13911451 if ((currentKLp == currentKLp))
13921452 then {
13931453 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13941454 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13951455 then {
1396- let $t05392354004 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397- let refreshKLpActions = $t05392354004._1
1398- let updatedKLp = $t05392354004._2
1456+ let $t05531055391 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1457+ let refreshKLpActions = $t05531055391._1
1458+ let updatedKLp = $t05531055391._2
13991459 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14001460 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14011461 then ((withdrawState ++ state) ++ refreshKLpActions)
14021462 else throw("Strict value is not equal to itself.")
14031463 }
14041464 else throw("Strict value is not equal to itself.")
14051465 }
14061466 else throw("Strict value is not equal to itself.")
14071467 }
14081468
14091469
14101470
14111471 @Callable(i)
14121472 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14131473 let res = commonGet(i)
14141474 let outAmAmt = res._1
14151475 let outPrAmt = res._2
14161476 let pmtAmt = res._3
14171477 let pmtAssetId = res._4
14181478 let state = res._5
14191479 if ((noLessThenAmtAsset > outAmAmt))
14201480 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14211481 else if ((noLessThenPriceAsset > outPrAmt))
14221482 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14231483 else {
14241484 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14251485 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14261486 if ((currentKLp == currentKLp))
14271487 then {
14281488 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14291489 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14301490 then {
1431- let $t05509955180 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432- let refreshKLpActions = $t05509955180._1
1433- let updatedKLp = $t05509955180._2
1491+ let $t05648656567 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1492+ let refreshKLpActions = $t05648656567._1
1493+ let updatedKLp = $t05648656567._2
14341494 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14351495 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14361496 then ((withdrawState ++ state) ++ refreshKLpActions)
14371497 else throw("Strict value is not equal to itself.")
14381498 }
14391499 else throw("Strict value is not equal to itself.")
14401500 }
14411501 else throw("Strict value is not equal to itself.")
14421502 }
14431503 }
14441504
14451505
14461506
14471507 @Callable(i)
14481508 func unstakeAndGet (amount) = {
14491509 let checkPayments = if ((size(i.payments) != 0))
14501510 then throw("No payments are expected")
14511511 else true
14521512 if ((checkPayments == checkPayments))
14531513 then {
14541514 let cfg = getPoolConfig()
14551515 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14561516 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14571517 if ((currentKLp == currentKLp))
14581518 then {
14591519 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14601520 if ((unstakeInv == unstakeInv))
14611521 then {
14621522 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14631523 let outAmAmt = res._1
14641524 let outPrAmt = res._2
14651525 let poolStatus = parseIntValue(res._9)
14661526 let state = res._10
14671527 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
1468- let checkPoolStatus = if (if (isGlobalShutdown())
1469- then true
1470- else (poolStatus == PoolShutdown))
1528+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1529+ then if (isGlobalShutdown())
1530+ then true
1531+ else (cfgPoolStatus == PoolShutdown)
1532+ else false
1533+ let checkPoolStatus = if (isGetDisabled)
14711534 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14721535 else true
14731536 if ((checkPoolStatus == checkPoolStatus))
14741537 then {
14751538 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14761539 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14771540 then {
1478- let $t05645256533 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479- let refreshKLpActions = $t05645256533._1
1480- let updatedKLp = $t05645256533._2
1541+ let $t05791557996 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1542+ let refreshKLpActions = $t05791557996._1
1543+ let updatedKLp = $t05791557996._2
14811544 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14821545 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14831546 then ((withdrawState ++ state) ++ refreshKLpActions)
14841547 else throw("Strict value is not equal to itself.")
14851548 }
14861549 else throw("Strict value is not equal to itself.")
14871550 }
14881551 else throw("Strict value is not equal to itself.")
14891552 }
14901553 else throw("Strict value is not equal to itself.")
14911554 }
14921555 else throw("Strict value is not equal to itself.")
14931556 }
14941557 else throw("Strict value is not equal to itself.")
14951558 }
14961559
14971560
14981561
14991562 @Callable(i)
15001563 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
1501- let isGetDisabled = if (isGlobalShutdown())
1502- then true
1503- else (cfgPoolStatus == PoolShutdown)
1564+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1565+ then if (isGlobalShutdown())
1566+ then true
1567+ else (cfgPoolStatus == PoolShutdown)
1568+ else false
15041569 let checks = [if (!(isGetDisabled))
15051570 then true
15061571 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15071572 then true
15081573 else throw("no payments are expected")]
15091574 if ((checks == checks))
15101575 then {
15111576 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15121577 if ((currentKLp == currentKLp))
15131578 then {
15141579 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15151580 if ((unstakeInv == unstakeInv))
15161581 then {
15171582 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15181583 let outAmAmt = res._1
15191584 let outPrAmt = res._2
15201585 let state = res._10
15211586 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15221587 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15231588 then true
15241589 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15251590 then true
15261591 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15271592 if ((checkAmounts == checkAmounts))
15281593 then {
15291594 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15301595 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15311596 then {
1532- let $t05797458055 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533- let refreshKLpActions = $t05797458055._1
1534- let updatedKLp = $t05797458055._2
1597+ let $t05947459555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1598+ let refreshKLpActions = $t05947459555._1
1599+ let updatedKLp = $t05947459555._2
15351600 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15361601 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15371602 then ((withdrawState ++ state) ++ refreshKLpActions)
15381603 else throw("Strict value is not equal to itself.")
15391604 }
15401605 else throw("Strict value is not equal to itself.")
15411606 }
15421607 else throw("Strict value is not equal to itself.")
15431608 }
15441609 else throw("Strict value is not equal to itself.")
15451610 }
15461611 else throw("Strict value is not equal to itself.")
15471612 }
15481613 else throw("Strict value is not equal to itself.")
15491614 }
15501615
15511616
15521617
15531618 @Callable(i)
15541619 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15551620 then throw("permissions denied")
15561621 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15571622
15581623
15591624
15601625 @Callable(i)
15611626 func refreshKLp () = {
15621627 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15631628 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15641629 then unit
15651630 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15661631 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15671632 then {
15681633 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1569- let $t05925959323 = refreshKLpInternal(0, 0, 0)
1570- let kLpUpdateActions = $t05925959323._1
1571- let updatedKLp = $t05925959323._2
1634+ let $t06075960823 = refreshKLpInternal(0, 0, 0)
1635+ let kLpUpdateActions = $t06075960823._1
1636+ let updatedKLp = $t06075960823._2
15721637 let actions = if ((kLp != updatedKLp))
15731638 then kLpUpdateActions
15741639 else throwErr("nothing to refresh")
15751640 $Tuple2(actions, toString(updatedKLp))
15761641 }
15771642 else throw("Strict value is not equal to itself.")
15781643 }
15791644
15801645
15811646
15821647 @Callable(i)
15831648 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
15841649
15851650
15861651
15871652 @Callable(i)
15881653 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
15891654
15901655
15911656
15921657 @Callable(i)
15931658 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
15941659 let prices = calcPrices(amAmt, prAmt, lpAmt)
15951660 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
15961661 }
15971662
15981663
15991664
16001665 @Callable(i)
16011666 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16021667
16031668
16041669
16051670 @Callable(i)
16061671 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16071672
16081673
16091674
16101675 @Callable(i)
16111676 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16121677
16131678
16141679
16151680 @Callable(i)
16161681 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16171682
16181683
16191684
16201685 @Callable(i)
16211686 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16221687 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16231688 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16241689 }
16251690
16261691
16271692
16281693 @Callable(i)
16291694 func statsREADONLY () = {
16301695 let cfg = getPoolConfig()
16311696 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16321697 let amtAssetId = cfg[idxAmtAssetId]
16331698 let priceAssetId = cfg[idxPriceAssetId]
16341699 let iAmtAssetId = cfg[idxIAmtAssetId]
16351700 let iPriceAssetId = cfg[idxIPriceAssetId]
16361701 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16371702 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16381703 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16391704 let accAmtAssetBalance = getAccBalance(amtAssetId)
16401705 let accPriceAssetBalance = getAccBalance(priceAssetId)
16411706 let pricesList = if ((poolLPBalance == 0))
16421707 then [zeroBigInt, zeroBigInt, zeroBigInt]
16431708 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16441709 let curPrice = 0
16451710 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16461711 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16471712 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16481713 $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))
16491714 }
16501715
16511716
16521717
16531718 @Callable(i)
16541719 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16551720 let cfg = getPoolConfig()
16561721 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16571722 let amAssetIdStr = cfg[idxAmtAssetId]
16581723 let amAssetId = fromBase58String(amAssetIdStr)
16591724 let prAssetIdStr = cfg[idxPriceAssetId]
16601725 let prAssetId = fromBase58String(prAssetIdStr)
16611726 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16621727 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16631728 let poolStatus = cfg[idxPoolStatus]
16641729 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16651730 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16661731 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16671732 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16681733 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16691734 let curPriceX18 = if ((poolLPBalance == 0))
16701735 then zeroBigInt
16711736 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16721737 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16731738 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16741739 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16751740 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16761741 let calcLpAmt = estPut._1
16771742 let curPriceCalc = estPut._3
16781743 let amBalance = estPut._4
16791744 let prBalance = estPut._5
16801745 let lpEmission = estPut._6
16811746 $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))
16821747 }
16831748
16841749
16851750
16861751 @Callable(i)
16871752 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
16881753 let cfg = getPoolConfig()
16891754 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16901755 let amAssetIdStr = cfg[idxAmtAssetId]
16911756 let amAssetId = fromBase58String(amAssetIdStr)
16921757 let prAssetIdStr = cfg[idxPriceAssetId]
16931758 let prAssetId = fromBase58String(prAssetIdStr)
16941759 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16951760 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16961761 let poolStatus = cfg[idxPoolStatus]
16971762 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16981763 let amBalanceRaw = getAccBalance(amAssetIdStr)
16991764 let prBalanceRaw = getAccBalance(prAssetIdStr)
17001765 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17011766 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17021767 let curPriceX18 = if ((poolLPBalance == 0))
17031768 then zeroBigInt
17041769 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17051770 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17061771 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17071772 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17081773 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17091774 let calcLpAmt = estPut._1
17101775 let curPriceCalc = estPut._3
17111776 let amBalance = estPut._4
17121777 let prBalance = estPut._5
17131778 let lpEmission = estPut._6
17141779 $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))
17151780 }
17161781
17171782
17181783
17191784 @Callable(i)
17201785 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17211786 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17221787 let outAmAmt = res._1
17231788 let outPrAmt = res._2
17241789 let amBalance = res._5
17251790 let prBalance = res._6
17261791 let lpEmission = res._7
17271792 let curPrice = res._8
17281793 let poolStatus = parseIntValue(res._9)
17291794 $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))
17301795 }
17311796
17321797
17331798 @Verifier(tx)
17341799 func verify () = {
17351800 let targetPublicKey = match managerPublicKeyOrUnit() {
17361801 case pk: ByteVector =>
17371802 pk
17381803 case _: Unit =>
17391804 tx.senderPublicKey
17401805 case _ =>
17411806 throw("Match error")
17421807 }
17431808 match tx {
17441809 case order: Order =>
17451810 let matcherPub = getMatcherPubOrFail()
1746- let $t06798568102 = if (skipOrderValidation())
1811+ let $t06948569602 = if (skipOrderValidation())
17471812 then $Tuple2(true, "")
17481813 else validateMatcherOrderAllowed(order)
1749- let orderValid = $t06798568102._1
1750- let orderValidInfo = $t06798568102._2
1814+ let orderValid = $t06948569602._1
1815+ let orderValidInfo = $t06948569602._2
17511816 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17521817 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17531818 if (if (if (orderValid)
17541819 then senderValid
17551820 else false)
17561821 then matcherValid
17571822 else false)
17581823 then true
17591824 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17601825 case s: SetScriptTransaction =>
17611826 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17621827 then true
17631828 else {
17641829 let newHash = blake2b256(value(s.script))
17651830 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17661831 let currentHash = scriptHash(this)
17671832 if ((allowedHash == newHash))
17681833 then (currentHash != newHash)
17691834 else false
17701835 }
17711836 case _ =>
17721837 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17731838 }
17741839 }
17751840

github/deemru/w8io/026f985 
256.70 ms