tx · 8JLvF7R7AYc1EWJqf7nrnQeYGR8EjWWpNQV5cNorQStE

3MsdLkCCcsf1niGwjyQCMi8aC4CkNbm2Wy9:  -0.04300000 Waves

2023.04.05 11:51 [2521028] smart account 3MsdLkCCcsf1niGwjyQCMi8aC4CkNbm2Wy9 > SELF 0.00000000 Waves

{ "type": 13, "id": "8JLvF7R7AYc1EWJqf7nrnQeYGR8EjWWpNQV5cNorQStE", "fee": 4300000, "feeAssetId": null, "timestamp": 1680684693601, "version": 2, "chainId": 84, "sender": "3MsdLkCCcsf1niGwjyQCMi8aC4CkNbm2Wy9", "senderPublicKey": "B4L9D9LnFwCPW8fFVc65SHyFNYjb1KJv6MUQXPGMPSTy", "proofs": [ "5nnR1hhQ7b8HEPHf8T7PCrGNoQYau7aVCyzqLLCDGekpuHvRA9tvJXFDoY4zBi6gkHhPmoUkSdruAvRZtyVQH8vM" ], "script": "base64:BgLENwgCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdE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kAzAgCCQCkAwEFAmR3CQDMCAIJAKQDAQUCZHQJAMwIAgkApgMBBQJkegkAzAgCCQCkAwEFAmRzBQNuaWwFAWoBAmlsAQJpbQAEAmluBAJiWAkBAmdpAAMJAAECBQJiWAIKQnl0ZVZlY3RvcgQCZ20FAmJYBQJnbQMJAAECBQJiWAIEVW5pdAgFAmlsD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yBAJiWAUCaWwDCQABAgUCYlgCBU9yZGVyBAJlTAUCYlgEAmlvCQECYmQABAJpcAkBAmVLAQUCZUwEAmFLCAUCaXACXzEEAmFMCAUCaXACXzIEAmFNCQD0AwMIBQJlTAlib2R5Qnl0ZXMJAJEDAggFAmVMBnByb29mcwAACAUCZUwPc2VuZGVyUHVibGljS2V5BAJhTgkA9AMDCAUCZUwJYm9keUJ5dGVzCQCRAwIIBQJlTAZwcm9vZnMAAQUCaW8DAwMFAmFLBQJhTQcFAmFOBwYJAQJhSgQFAmFLBQJhTAUCYU0FAmFOAwkAAQIFAmJYAhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCZ2oFAmJYAwkA9AMDCAUCaWwJYm9keUJ5dGVzCQCRAwIIBQJpbAZwcm9vZnMAAAUCaW4GBAJpcQkA9gMBCQEFdmFsdWUBCAUCZ2oGc2NyaXB0BAJpcgkA2wQBCQEFdmFsdWUBCQCdCAIFAmFWCQECYUgABAJpcwkA8QcBBQR0aGlzAwkAAAIFAmlyBQJpcQkBAiE9AgUCaXMFAmlxBwkA9AMDCAUCaWwJYm9keUJ5dGVzCQCRAwIIBQJpbAZwcm9vZnMAAAUCaW4Trefl", "height": 2521028, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FWHttZYRJev3zvgfbsguUzUScz9PT91b5SCSTgU7H5t1 Next: CkpjTGjm98L1e3GmUofCgmC8XqtKD2En7YfCku2fWJhx Diff:
OldNewDifferences
430430 }
431431
432432
433-func withdrawAssetWrapper (assetId,amount) = match getLeaseProxyConfig(assetId) {
433+func getWithdrawAssetState (assetId,getAmount) = match getLeaseProxyConfig(assetId) {
434434 case a: (Boolean, Int, Int, String, String, Int, String) =>
435- let $t01645316562 = a
436- let isLeasable = $t01645316562._1
437- let leasedRatio = $t01645316562._2
438- let minBalance = $t01645316562._3
439- let proxyAddress = $t01645316562._4
440- let proxyAssetId = $t01645316562._5
441- let proxyRateMul = $t01645316562._6
442- let stakingProfitAddress = $t01645316562._7
435+ let $t01651616625 = a
436+ let isLeasable = $t01651616625._1
437+ let leasedRatio = $t01651616625._2
438+ let minBalance = $t01651616625._3
439+ let proxyAddress = $t01651616625._4
440+ let proxyAssetId = $t01651616625._5
441+ let proxyRateMul = $t01651616625._6
442+ let stakingProfitAddress = $t01651616625._7
443443 if (isLeasable)
444- then withdraw(assetId, amount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
444+ then {
445+ let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
446+ if ((newTotalCalcBalance == newTotalCalcBalance))
447+ then {
448+ let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
449+ if ((newAdditionalBalance == newAdditionalBalance))
450+ then {
451+ let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
452+ if ((withdrawAmount == withdrawAmount))
453+ then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
454+ else throw("Strict value is not equal to itself.")
455+ }
456+ else throw("Strict value is not equal to itself.")
457+ }
458+ else throw("Strict value is not equal to itself.")
459+ }
445460 else nil
446461 case _ =>
447- throwErr((("[" + assetId) + "] withdrawAssetWrapper() error"))
462+ throwErr((("[" + assetId) + "] getWithdrawAssetState() error"))
448463 }
449-
450-
451-func getWithdrawAssetState (assetId,amount) = {
452- let assetOnPool = match parseAssetId(assetId) {
453- case b: ByteVector =>
454- assetBalance(this, b)
455- case w: Unit =>
456- wavesBalance(this).available
457- case _ =>
458- throw("Match error")
459- }
460- if ((amount > assetOnPool))
461- then {
462- let amountDiff = (amount - assetOnPool)
463- withdrawAssetWrapper(assetId, amountDiff)
464- }
465- else nil
466- }
467464
468465
469466 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
523520 let PrAmtWithdrawState = getWithdrawAssetState(prAssetId, outPrAmt)
524521 if ((PrAmtWithdrawState == PrAmtWithdrawState))
525522 then {
526- let reb = invoke(this, "rebalance", nil, nil)
527- if ((reb == reb))
528- then {
529- let state = if ((txId58 == ""))
530- then nil
531- else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
532- then unit
533- else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
534- then unit
535- 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)])
536- $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
537- }
538- else throw("Strict value is not equal to itself.")
523+ let state = if ((txId58 == ""))
524+ then nil
525+ else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
526+ then unit
527+ else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
528+ then unit
529+ 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)])
530+ $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
539531 }
540532 else throw("Strict value is not equal to itself.")
541533 }
660652 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
661653 let amountAssetAmount = order.amount
662654 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
663- let $t02880029012 = if ((order.orderType == Buy))
655+ let $t02870728919 = if ((order.orderType == Buy))
664656 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
665657 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
666- let amountAssetBalanceDelta = $t02880029012._1
667- let priceAssetBalanceDelta = $t02880029012._2
658+ let amountAssetBalanceDelta = $t02870728919._1
659+ let priceAssetBalanceDelta = $t02870728919._2
668660 if (if (if (isGlobalShutdown())
669661 then true
670662 else (cfgPoolStatus == PoolMatcherDisabled))
677669 then throw("Wrong order assets.")
678670 else {
679671 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
680- let $t02945229552 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
681- let unusedActions = $t02945229552._1
682- let kLpNew = $t02945229552._2
672+ let $t02935929459 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
673+ let unusedActions = $t02935929459._1
674+ let kLpNew = $t02935929459._2
683675 let isOrderValid = (kLpNew >= kLp)
684676 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
685677 $Tuple2(isOrderValid, info)
758750 else if ((paymentAssetId == cfgPriceAssetId))
759751 then false
760752 else throwErr("invalid asset")
761- let $t03266532958 = if (isEval)
753+ let $t03257232865 = if (isEval)
762754 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
763755 else if (paymentInAmountAsset)
764756 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
765757 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
766- let amountBalanceOld = $t03266532958._1
767- let priceBalanceOld = $t03266532958._2
768- let $t03296233111 = if (paymentInAmountAsset)
758+ let amountBalanceOld = $t03257232865._1
759+ let priceBalanceOld = $t03257232865._2
760+ let $t03286933018 = if (paymentInAmountAsset)
769761 then $Tuple2(paymentAmountRaw, 0)
770762 else $Tuple2(0, paymentAmountRaw)
771- let amountAssetAmountRaw = $t03296233111._1
772- let priceAssetAmountRaw = $t03296233111._2
763+ let amountAssetAmountRaw = $t03286933018._1
764+ let priceAssetAmountRaw = $t03286933018._2
773765 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
774766 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
775- let $t03324333307 = takeFee(paymentAmountRaw, inFee)
776- let paymentAmount = $t03324333307._1
777- let feeAmount = $t03324333307._2
767+ let $t03315033214 = takeFee(paymentAmountRaw, inFee)
768+ let paymentAmount = $t03315033214._1
769+ let feeAmount = $t03315033214._2
778770 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
779771 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
780772 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
797789 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
798790 let priceOld = fromX18(priceOldX18, scale8)
799791 let loss = {
800- let $t03498835155 = if (paymentInAmountAsset)
792+ let $t03489535062 = if (paymentInAmountAsset)
801793 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
802794 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
803- let amount = $t03498835155._1
804- let balance = $t03498835155._2
795+ let amount = $t03489535062._1
796+ let balance = $t03489535062._2
805797 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
806798 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
807799 }
841833 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
842834 let redeemedBigInt = toBigInt(paymentAmount)
843835 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
844- let $t03723337289 = takeFee(amountRaw, outFee)
845- let totalAmount = $t03723337289._1
846- let feeAmount = $t03723337289._2
847- let $t03729337519 = if (outInAmountAsset)
836+ let $t03714037196 = takeFee(amountRaw, outFee)
837+ let totalAmount = $t03714037196._1
838+ let feeAmount = $t03714037196._2
839+ let $t03720037426 = if (outInAmountAsset)
848840 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
849841 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
850- let outAmAmount = $t03729337519._1
851- let outPrAmount = $t03729337519._2
852- let amBalanceNew = $t03729337519._3
853- let prBalanceNew = $t03729337519._4
842+ let outAmAmount = $t03720037426._1
843+ let outPrAmount = $t03720037426._2
844+ let amBalanceNew = $t03720037426._3
845+ let prBalanceNew = $t03720037426._4
854846 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
855847 let priceNew = fromX18(priceNewX18, scale8)
856848 let commonState = if (isEval)
922914
923915 @Callable(i)
924916 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
925- let $t03940539710 = if ((isReverse == false))
917+ let $t03931239617 = if ((isReverse == false))
926918 then {
927919 let assetOut = getStringOrFail(this, pa())
928920 let assetIn = getStringOrFail(this, aa())
933925 let assetIn = getStringOrFail(this, pa())
934926 $Tuple2(assetOut, assetIn)
935927 }
936- let assetOut = $t03940539710._1
937- let assetIn = $t03940539710._2
928+ let assetOut = $t03931239617._1
929+ let assetIn = $t03931239617._2
938930 let poolAssetInBalance = getAccBalance(assetIn)
939931 let poolAssetOutBalance = getAccBalance(assetOut)
940932 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
993985 }
994986 let withdrawState = getWithdrawAssetState(assetOut, amountOut)
995987 if ((withdrawState == withdrawState))
996- then {
997- let reb = invoke(this, "rebalance", nil, nil)
998- if ((reb == reb))
999- then $Tuple2((withdrawState ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1000- else throw("Strict value is not equal to itself.")
1001- }
988+ then $Tuple2((withdrawState ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1002989 else throw("Strict value is not equal to itself.")
1003990 }
1004991 else throw("Strict value is not equal to itself.")
10911078 else throw("Strict value is not equal to itself.")
10921079 }
10931080 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1094- let $t04491145373 = refreshKLpInternal(0, 0, 0)
1095- if (($t04491145373 == $t04491145373))
1081+ let $t04477045232 = refreshKLpInternal(0, 0, 0)
1082+ if (($t04477045232 == $t04477045232))
10961083 then {
1097- let updatedKLp = $t04491145373._2
1098- let refreshKLpActions = $t04491145373._1
1084+ let updatedKLp = $t04477045232._2
1085+ let refreshKLpActions = $t04477045232._1
10991086 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11001087 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11011088 then {
11321119 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11331120 if ((currentKLp == currentKLp))
11341121 then {
1135- let $t04598546050 = refreshKLpInternal(0, 0, 0)
1136- let refreshKLpActions = $t04598546050._1
1137- let updatedKLp = $t04598546050._2
1122+ let $t04584445909 = refreshKLpInternal(0, 0, 0)
1123+ let refreshKLpActions = $t04584445909._1
1124+ let updatedKLp = $t04584445909._2
11381125 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11391126 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11401127 then (state ++ refreshKLpActions)
11811168 then {
11821169 let userAddress = i.caller
11831170 let txId = i.transactionId
1184- let $t04723847390 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1185- if (($t04723847390 == $t04723847390))
1171+ let $t04709747249 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1172+ if (($t04709747249 == $t04709747249))
11861173 then {
1187- let paymentInAmountAsset = $t04723847390._5
1188- let bonus = $t04723847390._4
1189- let feeAmount = $t04723847390._3
1190- let commonState = $t04723847390._2
1191- let emitAmountEstimated = $t04723847390._1
1174+ let paymentInAmountAsset = $t04709747249._5
1175+ let bonus = $t04709747249._4
1176+ let feeAmount = $t04709747249._3
1177+ let commonState = $t04709747249._2
1178+ let emitAmountEstimated = $t04709747249._1
11921179 let emitAmount = if (if ((minOutAmount > 0))
11931180 then (minOutAmount > emitAmountEstimated)
11941181 else false)
12081195 let sendFee = if ((feeAmount > 0))
12091196 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
12101197 else nil
1211- let $t04797648173 = if ((this == feeCollectorAddress))
1198+ let $t04783548032 = if ((this == feeCollectorAddress))
12121199 then $Tuple2(0, 0)
12131200 else if (paymentInAmountAsset)
12141201 then $Tuple2(-(feeAmount), 0)
12151202 else $Tuple2(0, -(feeAmount))
1216- let amountAssetBalanceDelta = $t04797648173._1
1217- let priceAssetBalanceDelta = $t04797648173._2
1218- let $t04817648284 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1219- let refreshKLpActions = $t04817648284._1
1220- let updatedKLp = $t04817648284._2
1203+ let amountAssetBalanceDelta = $t04783548032._1
1204+ let priceAssetBalanceDelta = $t04783548032._2
1205+ let $t04803548143 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1206+ let refreshKLpActions = $t04803548143._1
1207+ let updatedKLp = $t04803548143._2
12211208 let kLp = value(getString(keyKLp))
12221209 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12231210 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12421229
12431230 @Callable(i)
12441231 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1245- let $t04863948796 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1246- let emitAmountEstimated = $t04863948796._1
1247- let commonState = $t04863948796._2
1248- let feeAmount = $t04863948796._3
1249- let bonus = $t04863948796._4
1250- let paymentInAmountAsset = $t04863948796._5
1232+ let $t04849848655 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1233+ let emitAmountEstimated = $t04849848655._1
1234+ let commonState = $t04849848655._2
1235+ let feeAmount = $t04849848655._3
1236+ let bonus = $t04849848655._4
1237+ let paymentInAmountAsset = $t04849848655._5
12511238 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12521239 }
12531240
12841271 then {
12851272 let userAddress = i.caller
12861273 let txId = i.transactionId
1287- let $t04968149834 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1288- if (($t04968149834 == $t04968149834))
1274+ let $t04954049693 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1275+ if (($t04954049693 == $t04954049693))
12891276 then {
1290- let outInAmountAsset = $t04968149834._5
1291- let bonus = $t04968149834._4
1292- let feeAmount = $t04968149834._3
1293- let commonState = $t04968149834._2
1294- let amountEstimated = $t04968149834._1
1277+ let outInAmountAsset = $t04954049693._5
1278+ let bonus = $t04954049693._4
1279+ let feeAmount = $t04954049693._3
1280+ let commonState = $t04954049693._2
1281+ let amountEstimated = $t04954049693._1
12951282 let amount = if (if ((minOutAmount > 0))
12961283 then (minOutAmount > amountEstimated)
12971284 else false)
13131300 let sendFee = if ((feeAmount > 0))
13141301 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13151302 else nil
1316- let $t05059050837 = {
1303+ let $t05044950696 = {
13171304 let feeAmountForCalc = if ((this == feeCollectorAddress))
13181305 then 0
13191306 else feeAmount
13211308 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13221309 else $Tuple2(0, -((amount + feeAmountForCalc)))
13231310 }
1324- let amountAssetBalanceDelta = $t05059050837._1
1325- let priceAssetBalanceDelta = $t05059050837._2
1326- let $t05084050948 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1327- let refreshKLpActions = $t05084050948._1
1328- let updatedKLp = $t05084050948._2
1311+ let amountAssetBalanceDelta = $t05044950696._1
1312+ let priceAssetBalanceDelta = $t05044950696._2
1313+ let $t05069950807 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1314+ let refreshKLpActions = $t05069950807._1
1315+ let updatedKLp = $t05069950807._2
13291316 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13301317 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1331- then {
1332- let reb = invoke(this, "rebalance", nil, nil)
1333- if ((reb == reb))
1334- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1335- else throw("Strict value is not equal to itself.")
1336- }
1318+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13371319 else throw("Strict value is not equal to itself.")
13381320 }
13391321 else throw("Strict value is not equal to itself.")
13511333
13521334 @Callable(i)
13531335 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1354- let $t05127451430 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1355- let amountEstimated = $t05127451430._1
1356- let commonState = $t05127451430._2
1357- let feeAmount = $t05127451430._3
1358- let bonus = $t05127451430._4
1359- let outInAmountAsset = $t05127451430._5
1336+ let $t05108551241 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1337+ let amountEstimated = $t05108551241._1
1338+ let commonState = $t05108551241._2
1339+ let feeAmount = $t05108551241._3
1340+ let bonus = $t05108551241._4
1341+ let outInAmountAsset = $t05108551241._5
13601342 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13611343 }
13621344
13931375 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13941376 if ((unstakeInv == unstakeInv))
13951377 then {
1396- let $t05233552486 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1397- if (($t05233552486 == $t05233552486))
1378+ let $t05214652297 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1379+ if (($t05214652297 == $t05214652297))
13981380 then {
1399- let outInAmountAsset = $t05233552486._5
1400- let bonus = $t05233552486._4
1401- let feeAmount = $t05233552486._3
1402- let commonState = $t05233552486._2
1403- let amountEstimated = $t05233552486._1
1381+ let outInAmountAsset = $t05214652297._5
1382+ let bonus = $t05214652297._4
1383+ let feeAmount = $t05214652297._3
1384+ let commonState = $t05214652297._2
1385+ let amountEstimated = $t05214652297._1
14041386 let amount = if (if ((minOutAmount > 0))
14051387 then (minOutAmount > amountEstimated)
14061388 else false)
14161398 let sendFee = if ((feeAmount > 0))
14171399 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
14181400 else nil
1419- let $t05305153298 = {
1401+ let $t05286253109 = {
14201402 let feeAmountForCalc = if ((this == feeCollectorAddress))
14211403 then 0
14221404 else feeAmount
14241406 then $Tuple2(-((amount + feeAmountForCalc)), 0)
14251407 else $Tuple2(0, -((amount + feeAmountForCalc)))
14261408 }
1427- let amountAssetBalanceDelta = $t05305153298._1
1428- let priceAssetBalanceDelta = $t05305153298._2
1429- let $t05330153409 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1430- let refreshKLpActions = $t05330153409._1
1431- let updatedKLp = $t05330153409._2
1409+ let amountAssetBalanceDelta = $t05286253109._1
1410+ let priceAssetBalanceDelta = $t05286253109._2
1411+ let $t05311253220 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1412+ let refreshKLpActions = $t05311253220._1
1413+ let updatedKLp = $t05311253220._2
14321414 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14331415 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1434- then {
1435- let reb = invoke(this, "rebalance", nil, nil)
1436- if ((reb == reb))
1437- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1438- else throw("Strict value is not equal to itself.")
1439- }
1416+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14401417 else throw("Strict value is not equal to itself.")
14411418 }
14421419 else throw("Strict value is not equal to itself.")
14681445 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14691446 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14701447 then {
1471- let $t05442354505 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1472- let refreshKLpActions = $t05442354505._1
1473- let updatedKLp = $t05442354505._2
1448+ let $t05418754269 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1449+ let refreshKLpActions = $t05418754269._1
1450+ let updatedKLp = $t05418754269._2
14741451 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14751452 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14761453 then (state ++ refreshKLpActions)
15021479 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
15031480 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15041481 then {
1505- let $t05545455535 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1506- let refreshKLpActions = $t05545455535._1
1507- let updatedKLp = $t05545455535._2
1482+ let $t05521855299 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1483+ let refreshKLpActions = $t05521855299._1
1484+ let updatedKLp = $t05521855299._2
15081485 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15091486 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15101487 then (state ++ refreshKLpActions)
15481525 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15491526 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15501527 then {
1551- let $t05666156742 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1552- let refreshKLpActions = $t05666156742._1
1553- let updatedKLp = $t05666156742._2
1528+ let $t05642556506 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1529+ let refreshKLpActions = $t05642556506._1
1530+ let updatedKLp = $t05642556506._2
15541531 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15551532 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15561533 then (state ++ refreshKLpActions)
16011578 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
16021579 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
16031580 then {
1604- let $t05803758118 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1605- let refreshKLpActions = $t05803758118._1
1606- let updatedKLp = $t05803758118._2
1581+ let $t05780157882 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1582+ let refreshKLpActions = $t05780157882._1
1583+ let updatedKLp = $t05780157882._2
16071584 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
16081585 if ((isUpdatedKLpValid == isUpdatedKLpValid))
16091586 then (state ++ refreshKLpActions)
16381615 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
16391616 then {
16401617 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1641- let $t05930559369 = refreshKLpInternal(0, 0, 0)
1642- let kLpUpdateActions = $t05930559369._1
1643- let updatedKLp = $t05930559369._2
1618+ let $t05906959133 = refreshKLpInternal(0, 0, 0)
1619+ let kLpUpdateActions = $t05906959133._1
1620+ let updatedKLp = $t05906959133._2
16441621 let actions = if ((kLp != updatedKLp))
16451622 then kLpUpdateActions
16461623 else throwErr("nothing to refresh")
18151792 match tx {
18161793 case order: Order =>
18171794 let matcherPub = getMatcherPubOrFail()
1818- let $t06803168100 = validateMatcherOrderAllowed(order)
1819- let orderValid = $t06803168100._1
1820- let orderValidInfo = $t06803168100._2
1795+ let $t06779567864 = validateMatcherOrderAllowed(order)
1796+ let orderValid = $t06779567864._1
1797+ let orderValidInfo = $t06779567864._2
18211798 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
18221799 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
18231800 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 mpk () = "%s__managerPublicKey"
9494
9595
9696 func pmpk () = "%s__pendingManagerPublicKey"
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 keySWavesAssetId () = "%s__sWavesAssetId"
134134
135135
136136 func keySWavesProxyAddress () = "%s__sWavesProxyAddress"
137137
138138
139139 func keyAdditionalBalance (assetId) = makeString(["%s%s", "additionalBalance", assetId], SEP)
140140
141141
142142 func keyStakingAssetBalance (assetId) = makeString(["%s%s", "stakingAssetBalance", assetId], SEP)
143143
144144
145145 func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
146146
147147
148148 func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
149149
150150
151151 func keyFactoryConfig () = "%s__factoryConfig"
152152
153153
154154 func keyMatcherPub () = "%s%s__matcher__publicKey"
155155
156156
157157 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
158158
159159
160160 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
161161
162162
163163 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
164164
165165
166166 func keyAllPoolsShutdown () = "%s__shutdown"
167167
168168
169169 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
170170
171171
172172 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
173173
174174
175175 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
176176
177177 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
178178
179179
180180 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
181181
182182
183183 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
184184
185185
186186 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
187187
188188
189189 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
190190
191191
192192 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
193193
194194 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
195195
196196 let inFee = {
197197 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
198198 if ($isInstanceOf(@, "Int"))
199199 then @
200200 else throw(($getType(@) + " couldn't be cast to Int"))
201201 }
202202
203203 let outFee = {
204204 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
205205 if ($isInstanceOf(@, "Int"))
206206 then @
207207 else throw(($getType(@) + " couldn't be cast to Int"))
208208 }
209209
210210 func sWavesId () = getStringOrFail(factoryContract, keySWavesAssetId())
211211
212212
213213 func sWavesProxy () = getStringOrFail(factoryContract, keySWavesProxyAddress())
214214
215215
216216 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
217217
218218
219219 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
220220
221221
222222 func getPoolConfig () = {
223223 let amtAsset = getStringOrFail(this, aa())
224224 let priceAsset = getStringOrFail(this, pa())
225225 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
226226 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
227227 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
228228 }
229229
230230
231231 func parseAssetId (input) = if ((input == wavesString))
232232 then unit
233233 else fromBase58String(input)
234234
235235
236236 func assetIdToString (input) = if ((input == unit))
237237 then wavesString
238238 else toBase58String(value(input))
239239
240240
241241 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]))
242242
243243
244244 let poolConfigParsed = parsePoolConfig(getPoolConfig())
245245
246246 let $t092979463 = poolConfigParsed
247247
248248 let cfgPoolAddress = $t092979463._1
249249
250250 let cfgPoolStatus = $t092979463._2
251251
252252 let cfgLpAssetId = $t092979463._3
253253
254254 let cfgAmountAssetId = $t092979463._4
255255
256256 let cfgPriceAssetId = $t092979463._5
257257
258258 let cfgAmountAssetDecimals = $t092979463._6
259259
260260 let cfgPriceAssetDecimals = $t092979463._7
261261
262262 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
263263
264264
265265 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
266266
267267 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
268268
269269 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)
270270
271271
272272 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)
273273
274274
275275 func getAccBalance (assetId) = {
276276 let balanceOnPool = if ((assetId == "WAVES"))
277277 then wavesBalance(this).available
278278 else assetBalance(this, fromBase58String(assetId))
279279 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
280280 max([0, totalBalance])
281281 }
282282
283283
284284 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
285285
286286
287287 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
288288
289289
290290 func getRate (proxy) = {
291291 let inv = invoke(proxy, "getRate", nil, nil)
292292 if ((inv == inv))
293293 then match inv {
294294 case r: Int =>
295295 r
296296 case _ =>
297297 throwErr("proxy.getRate() unexpected value")
298298 }
299299 else throw("Strict value is not equal to itself.")
300300 }
301301
302302
303303 func deposit (assetId,amount,stakingAssetId,proxy) = {
304304 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
305305 if ((currentAdditionalBalance == currentAdditionalBalance))
306306 then {
307307 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
308308 if ((currentStakingAssetBalance == currentStakingAssetBalance))
309309 then {
310310 let asset = parseAssetId(assetId)
311311 if ((amount > 0))
312312 then {
313313 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
314314 if ((depositInvoke == depositInvoke))
315315 then match depositInvoke {
316316 case receivedStakingAsset: Int =>
317317 let newAdditionalBalance = (currentAdditionalBalance + amount)
318318 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
319319 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
320320 case _ =>
321321 nil
322322 }
323323 else throw("Strict value is not equal to itself.")
324324 }
325325 else nil
326326 }
327327 else throw("Strict value is not equal to itself.")
328328 }
329329 else throw("Strict value is not equal to itself.")
330330 }
331331
332332
333333 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
334334 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
335335 if ((currentAdditionalBalance == currentAdditionalBalance))
336336 then {
337337 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
338338 if ((currentStakingAssetBalance == currentStakingAssetBalance))
339339 then {
340340 let currentProxyRate = getRate(proxy)
341341 if ((currentProxyRate == currentProxyRate))
342342 then {
343343 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
344344 let stakingAsset = parseAssetId(stakingAssetId)
345345 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
346346 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
347347 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
348348 if ((sendStakingAssetAmount > 0))
349349 then {
350350 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
351351 if ((withdrawInvoke == withdrawInvoke))
352352 then match withdrawInvoke {
353353 case receivedAssets: Int =>
354354 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
355355 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
356356 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
357357 case _ =>
358358 nil
359359 }
360360 else throw("Strict value is not equal to itself.")
361361 }
362362 else nil
363363 }
364364 else throw("Strict value is not equal to itself.")
365365 }
366366 else throw("Strict value is not equal to itself.")
367367 }
368368 else throw("Strict value is not equal to itself.")
369369 }
370370
371371
372372 func getLeaseProxyConfig (assetId) = invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil)
373373
374374
375375 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
376376 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
377377 if ((currentAdditionalBalance == currentAdditionalBalance))
378378 then {
379379 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
380380 if ((currentStakingAssetBalance == currentStakingAssetBalance))
381381 then {
382382 let availableBalance = match parseAssetId(assetId) {
383383 case b: ByteVector =>
384384 assetBalance(this, b)
385385 case u: Unit =>
386386 wavesBalance(this).available
387387 case _ =>
388388 throw("Match error")
389389 }
390390 if ((availableBalance == availableBalance))
391391 then {
392392 let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
393393 let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
394394 let diff = (currentAdditionalBalance - targetAdditionalBalance)
395395 if ((diff == 0))
396396 then nil
397397 else if ((0 > diff))
398398 then {
399399 let sendAssetAmount = -(diff)
400400 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
401401 }
402402 else {
403403 let getAssetAmount = diff
404404 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
405405 }
406406 }
407407 else throw("Strict value is not equal to itself.")
408408 }
409409 else throw("Strict value is not equal to itself.")
410410 }
411411 else throw("Strict value is not equal to itself.")
412412 }
413413
414414
415415 func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
416416 case a: (Boolean, Int, Int, String, String, Int, String) =>
417417 let $t01581415923 = a
418418 let isLeasable = $t01581415923._1
419419 let leasedRatio = $t01581415923._2
420420 let minBalance = $t01581415923._3
421421 let proxyAddress = $t01581415923._4
422422 let proxyAssetId = $t01581415923._5
423423 let proxyRateMul = $t01581415923._6
424424 let stakingProfitAddress = $t01581415923._7
425425 if (isLeasable)
426426 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
427427 else nil
428428 case _ =>
429429 throwErr((("[" + assetId) + "] Rebalance error"))
430430 }
431431
432432
433-func withdrawAssetWrapper (assetId,amount) = match getLeaseProxyConfig(assetId) {
433+func getWithdrawAssetState (assetId,getAmount) = match getLeaseProxyConfig(assetId) {
434434 case a: (Boolean, Int, Int, String, String, Int, String) =>
435- let $t01645316562 = a
436- let isLeasable = $t01645316562._1
437- let leasedRatio = $t01645316562._2
438- let minBalance = $t01645316562._3
439- let proxyAddress = $t01645316562._4
440- let proxyAssetId = $t01645316562._5
441- let proxyRateMul = $t01645316562._6
442- let stakingProfitAddress = $t01645316562._7
435+ let $t01651616625 = a
436+ let isLeasable = $t01651616625._1
437+ let leasedRatio = $t01651616625._2
438+ let minBalance = $t01651616625._3
439+ let proxyAddress = $t01651616625._4
440+ let proxyAssetId = $t01651616625._5
441+ let proxyRateMul = $t01651616625._6
442+ let stakingProfitAddress = $t01651616625._7
443443 if (isLeasable)
444- then withdraw(assetId, amount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
444+ then {
445+ let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
446+ if ((newTotalCalcBalance == newTotalCalcBalance))
447+ then {
448+ let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
449+ if ((newAdditionalBalance == newAdditionalBalance))
450+ then {
451+ let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
452+ if ((withdrawAmount == withdrawAmount))
453+ then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
454+ else throw("Strict value is not equal to itself.")
455+ }
456+ else throw("Strict value is not equal to itself.")
457+ }
458+ else throw("Strict value is not equal to itself.")
459+ }
445460 else nil
446461 case _ =>
447- throwErr((("[" + assetId) + "] withdrawAssetWrapper() error"))
462+ throwErr((("[" + assetId) + "] getWithdrawAssetState() error"))
448463 }
449-
450-
451-func getWithdrawAssetState (assetId,amount) = {
452- let assetOnPool = match parseAssetId(assetId) {
453- case b: ByteVector =>
454- assetBalance(this, b)
455- case w: Unit =>
456- wavesBalance(this).available
457- case _ =>
458- throw("Match error")
459- }
460- if ((amount > assetOnPool))
461- then {
462- let amountDiff = (amount - assetOnPool)
463- withdrawAssetWrapper(assetId, amountDiff)
464- }
465- else nil
466- }
467464
468465
469466 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
470467 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
471468 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
472469 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
473470 }
474471
475472
476473 func calcPrices (amAmt,prAmt,lpAmt) = {
477474 let cfg = getPoolConfig()
478475 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
479476 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
480477 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
481478 let amAmtX18 = toX18(amAmt, amtAssetDcm)
482479 let prAmtX18 = toX18(prAmt, priceAssetDcm)
483480 let lpAmtX18 = toX18(lpAmt, scale8)
484481 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
485482 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
486483 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
487484 }
488485
489486
490487 func calculatePrices (amAmt,prAmt,lpAmt) = {
491488 let prices = calcPrices(amAmt, prAmt, lpAmt)
492489 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
493490 }
494491
495492
496493 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
497494 let cfg = getPoolConfig()
498495 let lpAssetId = cfg[idxPoolLPAssetId]
499496 let amAssetId = cfg[idxAmtAssetId]
500497 let prAssetId = cfg[idxPriceAssetId]
501498 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
502499 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
503500 let poolStatus = cfg[idxPoolStatus]
504501 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
505502 if ((lpAssetId != pmtAssetId))
506503 then throw("Invalid asset passed.")
507504 else {
508505 let amBalance = getAccBalance(amAssetId)
509506 let amBalanceX18 = toX18(amBalance, amAssetDcm)
510507 let prBalance = getAccBalance(prAssetId)
511508 let prBalanceX18 = toX18(prBalance, prAssetDcm)
512509 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
513510 let curPrice = fromX18(curPriceX18, scale8)
514511 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
515512 let lpEmissionX18 = toX18(lpEmission, scale8)
516513 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
517514 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
518515 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
519516 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
520517 let AmAmtWithdrawState = getWithdrawAssetState(amAssetId, outAmAmt)
521518 if ((AmAmtWithdrawState == AmAmtWithdrawState))
522519 then {
523520 let PrAmtWithdrawState = getWithdrawAssetState(prAssetId, outPrAmt)
524521 if ((PrAmtWithdrawState == PrAmtWithdrawState))
525522 then {
526- let reb = invoke(this, "rebalance", nil, nil)
527- if ((reb == reb))
528- then {
529- let state = if ((txId58 == ""))
530- then nil
531- else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
532- then unit
533- else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
534- then unit
535- 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)])
536- $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
537- }
538- else throw("Strict value is not equal to itself.")
523+ let state = if ((txId58 == ""))
524+ then nil
525+ else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
526+ then unit
527+ else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
528+ then unit
529+ 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)])
530+ $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
539531 }
540532 else throw("Strict value is not equal to itself.")
541533 }
542534 else throw("Strict value is not equal to itself.")
543535 }
544536 }
545537
546538
547539 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
548540 let cfg = getPoolConfig()
549541 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
550542 let amAssetIdStr = cfg[idxAmtAssetId]
551543 let prAssetIdStr = cfg[idxPriceAssetId]
552544 let iAmtAssetId = cfg[idxIAmtAssetId]
553545 let iPriceAssetId = cfg[idxIPriceAssetId]
554546 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
555547 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
556548 let poolStatus = cfg[idxPoolStatus]
557549 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
558550 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
559551 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
560552 if (if ((amAssetIdStr != inAmAssetIdStr))
561553 then true
562554 else (prAssetIdStr != inPrAssetIdStr))
563555 then throw("Invalid amt or price asset passed.")
564556 else {
565557 let amBalance = if (isEvaluate)
566558 then getAccBalance(amAssetIdStr)
567559 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
568560 let prBalance = if (isEvaluate)
569561 then getAccBalance(prAssetIdStr)
570562 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
571563 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
572564 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
573565 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
574566 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
575567 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
576568 let res = if ((lpEmission == 0))
577569 then {
578570 let curPriceX18 = zeroBigInt
579571 let slippageX18 = zeroBigInt
580572 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
581573 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
582574 }
583575 else {
584576 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
585577 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
586578 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
587579 if (if ((curPriceX18 != zeroBigInt))
588580 then (slippageX18 > slippageToleranceX18)
589581 else false)
590582 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
591583 else {
592584 let lpEmissionX18 = toX18(lpEmission, scale8)
593585 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
594586 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
595587 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
596588 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
597589 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
598590 let expAmtAssetAmtX18 = expectedAmts._1
599591 let expPriceAssetAmtX18 = expectedAmts._2
600592 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
601593 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
602594 }
603595 }
604596 let calcLpAmt = res._1
605597 let calcAmAssetPmt = res._2
606598 let calcPrAssetPmt = res._3
607599 let curPrice = fromX18(res._4, scale8)
608600 let slippageCalc = fromX18(res._5, scale8)
609601 if ((0 >= calcLpAmt))
610602 then throw("Invalid calculations. LP calculated is less than zero.")
611603 else {
612604 let emitLpAmt = if (!(emitLp))
613605 then 0
614606 else calcLpAmt
615607 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
616608 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
617609 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))]
618610 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
619611 }
620612 }
621613 }
622614
623615
624616 func calcKLp (amountBalance,priceBalance,lpEmission) = {
625617 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
626618 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
627619 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
628620 if ((lpEmission == big0))
629621 then big0
630622 else updatedKLp
631623 }
632624
633625
634626 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
635627 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
636628 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
637629 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
638630 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
639631 currentKLp
640632 }
641633
642634
643635 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
644636 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
645637 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
646638 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
647639 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
648640 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
649641 $Tuple2(actions, updatedKLp)
650642 }
651643
652644
653645 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
654646 then true
655647 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
656648
657649
658650 func validateMatcherOrderAllowed (order) = {
659651 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
660652 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
661653 let amountAssetAmount = order.amount
662654 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
663- let $t02880029012 = if ((order.orderType == Buy))
655+ let $t02870728919 = if ((order.orderType == Buy))
664656 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
665657 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
666- let amountAssetBalanceDelta = $t02880029012._1
667- let priceAssetBalanceDelta = $t02880029012._2
658+ let amountAssetBalanceDelta = $t02870728919._1
659+ let priceAssetBalanceDelta = $t02870728919._2
668660 if (if (if (isGlobalShutdown())
669661 then true
670662 else (cfgPoolStatus == PoolMatcherDisabled))
671663 then true
672664 else (cfgPoolStatus == PoolShutdown))
673665 then throw("Exchange operations disabled")
674666 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
675667 then true
676668 else (order.assetPair.priceAsset != cfgPriceAssetId))
677669 then throw("Wrong order assets.")
678670 else {
679671 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
680- let $t02945229552 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
681- let unusedActions = $t02945229552._1
682- let kLpNew = $t02945229552._2
672+ let $t02935929459 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
673+ let unusedActions = $t02935929459._1
674+ let kLpNew = $t02935929459._2
683675 let isOrderValid = (kLpNew >= kLp)
684676 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
685677 $Tuple2(isOrderValid, info)
686678 }
687679 }
688680
689681
690682 func commonGet (i) = if ((size(i.payments) != 1))
691683 then throw("exactly 1 payment is expected")
692684 else {
693685 let pmt = value(i.payments[0])
694686 let pmtAssetId = value(pmt.assetId)
695687 let pmtAmt = pmt.amount
696688 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
697689 let outAmAmt = res._1
698690 let outPrAmt = res._2
699691 let poolStatus = parseIntValue(res._9)
700692 let state = res._10
701693 if (if (isGlobalShutdown())
702694 then true
703695 else (poolStatus == PoolShutdown))
704696 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
705697 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
706698 }
707699
708700
709701 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
710702 then throw("exactly 2 payments are expected")
711703 else {
712704 let amAssetPmt = value(i.payments[0])
713705 let prAssetPmt = value(i.payments[1])
714706 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
715707 let poolStatus = parseIntValue(estPut._8)
716708 if (if (if (isGlobalShutdown())
717709 then true
718710 else (poolStatus == PoolPutDisabled))
719711 then true
720712 else (poolStatus == PoolShutdown))
721713 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
722714 else estPut
723715 }
724716
725717
726718 func emit (amount) = {
727719 let emitInv = invoke(factoryContract, "emit", [amount], nil)
728720 if ((emitInv == emitInv))
729721 then {
730722 let emitInvLegacy = match emitInv {
731723 case legacyFactoryContract: Address =>
732724 invoke(legacyFactoryContract, "emit", [amount], nil)
733725 case _ =>
734726 unit
735727 }
736728 if ((emitInvLegacy == emitInvLegacy))
737729 then amount
738730 else throw("Strict value is not equal to itself.")
739731 }
740732 else throw("Strict value is not equal to itself.")
741733 }
742734
743735
744736 func takeFee (amount,fee) = {
745737 let feeAmount = if ((fee == 0))
746738 then 0
747739 else fraction(amount, fee, scale8)
748740 $Tuple2((amount - feeAmount), feeAmount)
749741 }
750742
751743
752744 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
753745 let isEval = (txId == unit)
754746 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
755747 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
756748 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
757749 then true
758750 else if ((paymentAssetId == cfgPriceAssetId))
759751 then false
760752 else throwErr("invalid asset")
761- let $t03266532958 = if (isEval)
753+ let $t03257232865 = if (isEval)
762754 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
763755 else if (paymentInAmountAsset)
764756 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
765757 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
766- let amountBalanceOld = $t03266532958._1
767- let priceBalanceOld = $t03266532958._2
768- let $t03296233111 = if (paymentInAmountAsset)
758+ let amountBalanceOld = $t03257232865._1
759+ let priceBalanceOld = $t03257232865._2
760+ let $t03286933018 = if (paymentInAmountAsset)
769761 then $Tuple2(paymentAmountRaw, 0)
770762 else $Tuple2(0, paymentAmountRaw)
771- let amountAssetAmountRaw = $t03296233111._1
772- let priceAssetAmountRaw = $t03296233111._2
763+ let amountAssetAmountRaw = $t03286933018._1
764+ let priceAssetAmountRaw = $t03286933018._2
773765 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
774766 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
775- let $t03324333307 = takeFee(paymentAmountRaw, inFee)
776- let paymentAmount = $t03324333307._1
777- let feeAmount = $t03324333307._2
767+ let $t03315033214 = takeFee(paymentAmountRaw, inFee)
768+ let paymentAmount = $t03315033214._1
769+ let feeAmount = $t03315033214._2
778770 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
779771 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
780772 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
781773 let priceNew = fromX18(priceNewX18, scale8)
782774 let paymentBalance = if (paymentInAmountAsset)
783775 then amountBalanceOld
784776 else priceBalanceOld
785777 let paymentBalanceBigInt = toBigInt(paymentBalance)
786778 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
787779 let chechSupply = if ((supplyBigInt > big0))
788780 then true
789781 else throwErr("initial deposit requires all coins")
790782 if ((chechSupply == chechSupply))
791783 then {
792784 let depositBigInt = toBigInt(paymentAmount)
793785 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
794786 let commonState = if (isEval)
795787 then nil
796788 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))]
797789 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
798790 let priceOld = fromX18(priceOldX18, scale8)
799791 let loss = {
800- let $t03498835155 = if (paymentInAmountAsset)
792+ let $t03489535062 = if (paymentInAmountAsset)
801793 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
802794 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
803- let amount = $t03498835155._1
804- let balance = $t03498835155._2
795+ let amount = $t03489535062._1
796+ let balance = $t03489535062._2
805797 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
806798 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
807799 }
808800 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
809801 }
810802 else throw("Strict value is not equal to itself.")
811803 }
812804
813805
814806 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
815807 let isEval = (txId == unit)
816808 let cfg = getPoolConfig()
817809 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
818810 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
819811 let checks = [if ((paymentAssetId == cfgLpAssetId))
820812 then true
821813 else throwErr("invalid lp asset")]
822814 if ((checks == checks))
823815 then {
824816 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
825817 then true
826818 else if ((outAssetId == cfgPriceAssetId))
827819 then false
828820 else throwErr("invalid asset")
829821 let balanceBigInt = if (outInAmountAsset)
830822 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
831823 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
832824 let outInAmountAssetDecimals = if (outInAmountAsset)
833825 then amtAssetDcm
834826 else priceAssetDcm
835827 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
836828 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
837829 let outBalance = if (outInAmountAsset)
838830 then amBalanceOld
839831 else prBalanceOld
840832 let outBalanceBigInt = toBigInt(outBalance)
841833 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
842834 let redeemedBigInt = toBigInt(paymentAmount)
843835 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
844- let $t03723337289 = takeFee(amountRaw, outFee)
845- let totalAmount = $t03723337289._1
846- let feeAmount = $t03723337289._2
847- let $t03729337519 = if (outInAmountAsset)
836+ let $t03714037196 = takeFee(amountRaw, outFee)
837+ let totalAmount = $t03714037196._1
838+ let feeAmount = $t03714037196._2
839+ let $t03720037426 = if (outInAmountAsset)
848840 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
849841 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
850- let outAmAmount = $t03729337519._1
851- let outPrAmount = $t03729337519._2
852- let amBalanceNew = $t03729337519._3
853- let prBalanceNew = $t03729337519._4
842+ let outAmAmount = $t03720037426._1
843+ let outPrAmount = $t03720037426._2
844+ let amBalanceNew = $t03720037426._3
845+ let prBalanceNew = $t03720037426._4
854846 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
855847 let priceNew = fromX18(priceNewX18, scale8)
856848 let commonState = if (isEval)
857849 then nil
858850 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)]
859851 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
860852 let priceOld = fromX18(priceOldX18, scale8)
861853 let loss = {
862854 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
863855 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
864856 }
865857 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
866858 }
867859 else throw("Strict value is not equal to itself.")
868860 }
869861
870862
871863 func managerPublicKeyOrUnit () = match getString(mpk()) {
872864 case s: String =>
873865 fromBase58String(s)
874866 case _: Unit =>
875867 unit
876868 case _ =>
877869 throw("Match error")
878870 }
879871
880872
881873 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
882874 case s: String =>
883875 fromBase58String(s)
884876 case _: Unit =>
885877 unit
886878 case _ =>
887879 throw("Match error")
888880 }
889881
890882
891883 func isManager (i) = match managerPublicKeyOrUnit() {
892884 case pk: ByteVector =>
893885 (i.callerPublicKey == pk)
894886 case _: Unit =>
895887 (i.caller == this)
896888 case _ =>
897889 throw("Match error")
898890 }
899891
900892
901893 func mustManager (i) = {
902894 let pd = throw("Permission denied")
903895 match managerPublicKeyOrUnit() {
904896 case pk: ByteVector =>
905897 if ((i.callerPublicKey == pk))
906898 then true
907899 else pd
908900 case _: Unit =>
909901 if ((i.caller == this))
910902 then true
911903 else pd
912904 case _ =>
913905 throw("Match error")
914906 }
915907 }
916908
917909
918910 @Callable(i)
919911 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
920912
921913
922914
923915 @Callable(i)
924916 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
925- let $t03940539710 = if ((isReverse == false))
917+ let $t03931239617 = if ((isReverse == false))
926918 then {
927919 let assetOut = getStringOrFail(this, pa())
928920 let assetIn = getStringOrFail(this, aa())
929921 $Tuple2(assetOut, assetIn)
930922 }
931923 else {
932924 let assetOut = getStringOrFail(this, aa())
933925 let assetIn = getStringOrFail(this, pa())
934926 $Tuple2(assetOut, assetIn)
935927 }
936- let assetOut = $t03940539710._1
937- let assetIn = $t03940539710._2
928+ let assetOut = $t03931239617._1
929+ let assetIn = $t03931239617._2
938930 let poolAssetInBalance = getAccBalance(assetIn)
939931 let poolAssetOutBalance = getAccBalance(assetOut)
940932 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
941933 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
942934 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
943935 let checkK = if ((newK >= oldK))
944936 then true
945937 else throw("new K is fewer error")
946938 if ((checkK == checkK))
947939 then $Tuple2(nil, amountOut)
948940 else throw("Strict value is not equal to itself.")
949941 }
950942
951943
952944
953945 @Callable(i)
954946 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
955947 let swapContact = {
956948 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
957949 if ($isInstanceOf(@, "String"))
958950 then @
959951 else throw(($getType(@) + " couldn't be cast to String"))
960952 }
961953 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
962954 then true
963955 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
964956 then true
965957 else throwErr("Permission denied")]
966958 if ((checks == checks))
967959 then {
968960 let pmt = value(i.payments[0])
969961 let assetIn = assetIdToString(pmt.assetId)
970962 let assetOut = if ((isReverse == false))
971963 then getStringOrFail(this, pa())
972964 else getStringOrFail(this, aa())
973965 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
974966 let poolAssetOutBalance = getAccBalance(assetOut)
975967 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
976968 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
977969 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
978970 let checkK = if ((newK >= oldK))
979971 then true
980972 else throw("new K is fewer error")
981973 if ((checkK == checkK))
982974 then {
983975 let checkMin = if ((amountOut >= amountOutMin))
984976 then true
985977 else throw("Exchange result is fewer coins than expected")
986978 if ((checkMin == checkMin))
987979 then {
988980 let lsConf = match getLeaseProxyConfig(assetOut) {
989981 case a: (Boolean, Int, Int, String, String, Int, String) =>
990982 a
991983 case _ =>
992984 throw("error lease config")
993985 }
994986 let withdrawState = getWithdrawAssetState(assetOut, amountOut)
995987 if ((withdrawState == withdrawState))
996- then {
997- let reb = invoke(this, "rebalance", nil, nil)
998- if ((reb == reb))
999- then $Tuple2((withdrawState ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1000- else throw("Strict value is not equal to itself.")
1001- }
988+ then $Tuple2((withdrawState ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1002989 else throw("Strict value is not equal to itself.")
1003990 }
1004991 else throw("Strict value is not equal to itself.")
1005992 }
1006993 else throw("Strict value is not equal to itself.")
1007994 }
1008995 else throw("Strict value is not equal to itself.")
1009996 }
1010997
1011998
1012999
10131000 @Callable(i)
10141001 func setManager (pendingManagerPublicKey) = {
10151002 let checkCaller = mustManager(i)
10161003 if ((checkCaller == checkCaller))
10171004 then {
10181005 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
10191006 if ((checkManagerPublicKey == checkManagerPublicKey))
10201007 then [StringEntry(pmpk(), pendingManagerPublicKey)]
10211008 else throw("Strict value is not equal to itself.")
10221009 }
10231010 else throw("Strict value is not equal to itself.")
10241011 }
10251012
10261013
10271014
10281015 @Callable(i)
10291016 func confirmManager () = {
10301017 let pm = pendingManagerPublicKeyOrUnit()
10311018 let hasPM = if (isDefined(pm))
10321019 then true
10331020 else throw("No pending manager")
10341021 if ((hasPM == hasPM))
10351022 then {
10361023 let checkPM = if ((i.callerPublicKey == value(pm)))
10371024 then true
10381025 else throw("You are not pending manager")
10391026 if ((checkPM == checkPM))
10401027 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
10411028 else throw("Strict value is not equal to itself.")
10421029 }
10431030 else throw("Strict value is not equal to itself.")
10441031 }
10451032
10461033
10471034
10481035 @Callable(i)
10491036 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10501037 then throw("Invalid slippageTolerance passed")
10511038 else {
10521039 let estPut = commonPut(i, slippageTolerance, true)
10531040 let emitLpAmt = estPut._2
10541041 let lpAssetId = estPut._7
10551042 let state = estPut._9
10561043 let amDiff = estPut._10
10571044 let prDiff = estPut._11
10581045 let amId = estPut._12
10591046 let prId = estPut._13
10601047 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10611048 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10621049 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10631050 if ((currentKLp == currentKLp))
10641051 then {
10651052 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10661053 if ((emitInv == emitInv))
10671054 then {
10681055 let emitInvLegacy = match emitInv {
10691056 case legacyFactoryContract: Address =>
10701057 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10711058 case _ =>
10721059 unit
10731060 }
10741061 if ((emitInvLegacy == emitInvLegacy))
10751062 then {
10761063 let slippageAInv = if ((amDiff > 0))
10771064 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10781065 else nil
10791066 if ((slippageAInv == slippageAInv))
10801067 then {
10811068 let slippagePInv = if ((prDiff > 0))
10821069 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10831070 else nil
10841071 if ((slippagePInv == slippagePInv))
10851072 then {
10861073 let lpTransfer = if (shouldAutoStake)
10871074 then {
10881075 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10891076 if ((slpStakeInv == slpStakeInv))
10901077 then nil
10911078 else throw("Strict value is not equal to itself.")
10921079 }
10931080 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1094- let $t04491145373 = refreshKLpInternal(0, 0, 0)
1095- if (($t04491145373 == $t04491145373))
1081+ let $t04477045232 = refreshKLpInternal(0, 0, 0)
1082+ if (($t04477045232 == $t04477045232))
10961083 then {
1097- let updatedKLp = $t04491145373._2
1098- let refreshKLpActions = $t04491145373._1
1084+ let updatedKLp = $t04477045232._2
1085+ let refreshKLpActions = $t04477045232._1
10991086 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11001087 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11011088 then {
11021089 let reb = invoke(this, "rebalance", nil, nil)
11031090 if ((reb == reb))
11041091 then ((state ++ lpTransfer) ++ refreshKLpActions)
11051092 else throw("Strict value is not equal to itself.")
11061093 }
11071094 else throw("Strict value is not equal to itself.")
11081095 }
11091096 else throw("Strict value is not equal to itself.")
11101097 }
11111098 else throw("Strict value is not equal to itself.")
11121099 }
11131100 else throw("Strict value is not equal to itself.")
11141101 }
11151102 else throw("Strict value is not equal to itself.")
11161103 }
11171104 else throw("Strict value is not equal to itself.")
11181105 }
11191106 else throw("Strict value is not equal to itself.")
11201107 }
11211108
11221109
11231110
11241111 @Callable(i)
11251112 func putForFree (maxSlippage) = if ((0 > maxSlippage))
11261113 then throw("Invalid value passed")
11271114 else {
11281115 let estPut = commonPut(i, maxSlippage, false)
11291116 let state = estPut._9
11301117 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
11311118 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
11321119 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11331120 if ((currentKLp == currentKLp))
11341121 then {
1135- let $t04598546050 = refreshKLpInternal(0, 0, 0)
1136- let refreshKLpActions = $t04598546050._1
1137- let updatedKLp = $t04598546050._2
1122+ let $t04584445909 = refreshKLpInternal(0, 0, 0)
1123+ let refreshKLpActions = $t04584445909._1
1124+ let updatedKLp = $t04584445909._2
11381125 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11391126 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11401127 then (state ++ refreshKLpActions)
11411128 else throw("Strict value is not equal to itself.")
11421129 }
11431130 else throw("Strict value is not equal to itself.")
11441131 }
11451132
11461133
11471134
11481135 @Callable(i)
11491136 func putOneTkn (minOutAmount,autoStake) = {
11501137 let isPoolOneTokenOperationsDisabled = {
11511138 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11521139 if ($isInstanceOf(@, "Boolean"))
11531140 then @
11541141 else throw(($getType(@) + " couldn't be cast to Boolean"))
11551142 }
11561143 let isPutDisabled = if (if (if (isGlobalShutdown())
11571144 then true
11581145 else (cfgPoolStatus == PoolPutDisabled))
11591146 then true
11601147 else (cfgPoolStatus == PoolShutdown))
11611148 then true
11621149 else isPoolOneTokenOperationsDisabled
11631150 let checks = [if (if (!(isPutDisabled))
11641151 then true
11651152 else isManager(i))
11661153 then true
11671154 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11681155 then true
11691156 else throwErr("exactly 1 payment are expected")]
11701157 if ((checks == checks))
11711158 then {
11721159 let payment = i.payments[0]
11731160 let paymentAssetId = payment.assetId
11741161 let paymentAmountRaw = payment.amount
11751162 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11761163 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11771164 else if ((paymentAssetId == cfgPriceAssetId))
11781165 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11791166 else throwErr("payment asset is not supported")
11801167 if ((currentKLp == currentKLp))
11811168 then {
11821169 let userAddress = i.caller
11831170 let txId = i.transactionId
1184- let $t04723847390 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1185- if (($t04723847390 == $t04723847390))
1171+ let $t04709747249 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1172+ if (($t04709747249 == $t04709747249))
11861173 then {
1187- let paymentInAmountAsset = $t04723847390._5
1188- let bonus = $t04723847390._4
1189- let feeAmount = $t04723847390._3
1190- let commonState = $t04723847390._2
1191- let emitAmountEstimated = $t04723847390._1
1174+ let paymentInAmountAsset = $t04709747249._5
1175+ let bonus = $t04709747249._4
1176+ let feeAmount = $t04709747249._3
1177+ let commonState = $t04709747249._2
1178+ let emitAmountEstimated = $t04709747249._1
11921179 let emitAmount = if (if ((minOutAmount > 0))
11931180 then (minOutAmount > emitAmountEstimated)
11941181 else false)
11951182 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11961183 else emitAmountEstimated
11971184 let emitInv = emit(emitAmount)
11981185 if ((emitInv == emitInv))
11991186 then {
12001187 let lpTransfer = if (autoStake)
12011188 then {
12021189 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
12031190 if ((stakeInv == stakeInv))
12041191 then nil
12051192 else throw("Strict value is not equal to itself.")
12061193 }
12071194 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
12081195 let sendFee = if ((feeAmount > 0))
12091196 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
12101197 else nil
1211- let $t04797648173 = if ((this == feeCollectorAddress))
1198+ let $t04783548032 = if ((this == feeCollectorAddress))
12121199 then $Tuple2(0, 0)
12131200 else if (paymentInAmountAsset)
12141201 then $Tuple2(-(feeAmount), 0)
12151202 else $Tuple2(0, -(feeAmount))
1216- let amountAssetBalanceDelta = $t04797648173._1
1217- let priceAssetBalanceDelta = $t04797648173._2
1218- let $t04817648284 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1219- let refreshKLpActions = $t04817648284._1
1220- let updatedKLp = $t04817648284._2
1203+ let amountAssetBalanceDelta = $t04783548032._1
1204+ let priceAssetBalanceDelta = $t04783548032._2
1205+ let $t04803548143 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1206+ let refreshKLpActions = $t04803548143._1
1207+ let updatedKLp = $t04803548143._2
12211208 let kLp = value(getString(keyKLp))
12221209 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12231210 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12241211 then {
12251212 let reb = invoke(this, "rebalance", nil, nil)
12261213 if ((reb == reb))
12271214 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
12281215 else throw("Strict value is not equal to itself.")
12291216 }
12301217 else throw("Strict value is not equal to itself.")
12311218 }
12321219 else throw("Strict value is not equal to itself.")
12331220 }
12341221 else throw("Strict value is not equal to itself.")
12351222 }
12361223 else throw("Strict value is not equal to itself.")
12371224 }
12381225 else throw("Strict value is not equal to itself.")
12391226 }
12401227
12411228
12421229
12431230 @Callable(i)
12441231 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1245- let $t04863948796 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1246- let emitAmountEstimated = $t04863948796._1
1247- let commonState = $t04863948796._2
1248- let feeAmount = $t04863948796._3
1249- let bonus = $t04863948796._4
1250- let paymentInAmountAsset = $t04863948796._5
1232+ let $t04849848655 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1233+ let emitAmountEstimated = $t04849848655._1
1234+ let commonState = $t04849848655._2
1235+ let feeAmount = $t04849848655._3
1236+ let bonus = $t04849848655._4
1237+ let paymentInAmountAsset = $t04849848655._5
12511238 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12521239 }
12531240
12541241
12551242
12561243 @Callable(i)
12571244 func getOneTkn (outAssetIdStr,minOutAmount) = {
12581245 let isPoolOneTokenOperationsDisabled = {
12591246 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12601247 if ($isInstanceOf(@, "Boolean"))
12611248 then @
12621249 else throw(($getType(@) + " couldn't be cast to Boolean"))
12631250 }
12641251 let isGetDisabled = if (if (isGlobalShutdown())
12651252 then true
12661253 else (cfgPoolStatus == PoolShutdown))
12671254 then true
12681255 else isPoolOneTokenOperationsDisabled
12691256 let checks = [if (if (!(isGetDisabled))
12701257 then true
12711258 else isManager(i))
12721259 then true
12731260 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12741261 then true
12751262 else throwErr("exactly 1 payment are expected")]
12761263 if ((checks == checks))
12771264 then {
12781265 let outAssetId = parseAssetId(outAssetIdStr)
12791266 let payment = i.payments[0]
12801267 let paymentAssetId = payment.assetId
12811268 let paymentAmount = payment.amount
12821269 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12831270 if ((currentKLp == currentKLp))
12841271 then {
12851272 let userAddress = i.caller
12861273 let txId = i.transactionId
1287- let $t04968149834 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1288- if (($t04968149834 == $t04968149834))
1274+ let $t04954049693 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1275+ if (($t04954049693 == $t04954049693))
12891276 then {
1290- let outInAmountAsset = $t04968149834._5
1291- let bonus = $t04968149834._4
1292- let feeAmount = $t04968149834._3
1293- let commonState = $t04968149834._2
1294- let amountEstimated = $t04968149834._1
1277+ let outInAmountAsset = $t04954049693._5
1278+ let bonus = $t04954049693._4
1279+ let feeAmount = $t04954049693._3
1280+ let commonState = $t04954049693._2
1281+ let amountEstimated = $t04954049693._1
12951282 let amount = if (if ((minOutAmount > 0))
12961283 then (minOutAmount > amountEstimated)
12971284 else false)
12981285 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12991286 else amountEstimated
13001287 let lsConf = match getLeaseProxyConfig(outAssetIdStr) {
13011288 case a: (Boolean, Int, Int, String, String, Int, String) =>
13021289 a
13031290 case _ =>
13041291 throw("error lease config")
13051292 }
13061293 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
13071294 if ((burnInv == burnInv))
13081295 then {
13091296 let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
13101297 if ((withdrawState == withdrawState))
13111298 then {
13121299 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
13131300 let sendFee = if ((feeAmount > 0))
13141301 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13151302 else nil
1316- let $t05059050837 = {
1303+ let $t05044950696 = {
13171304 let feeAmountForCalc = if ((this == feeCollectorAddress))
13181305 then 0
13191306 else feeAmount
13201307 if (outInAmountAsset)
13211308 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13221309 else $Tuple2(0, -((amount + feeAmountForCalc)))
13231310 }
1324- let amountAssetBalanceDelta = $t05059050837._1
1325- let priceAssetBalanceDelta = $t05059050837._2
1326- let $t05084050948 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1327- let refreshKLpActions = $t05084050948._1
1328- let updatedKLp = $t05084050948._2
1311+ let amountAssetBalanceDelta = $t05044950696._1
1312+ let priceAssetBalanceDelta = $t05044950696._2
1313+ let $t05069950807 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1314+ let refreshKLpActions = $t05069950807._1
1315+ let updatedKLp = $t05069950807._2
13291316 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13301317 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1331- then {
1332- let reb = invoke(this, "rebalance", nil, nil)
1333- if ((reb == reb))
1334- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1335- else throw("Strict value is not equal to itself.")
1336- }
1318+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13371319 else throw("Strict value is not equal to itself.")
13381320 }
13391321 else throw("Strict value is not equal to itself.")
13401322 }
13411323 else throw("Strict value is not equal to itself.")
13421324 }
13431325 else throw("Strict value is not equal to itself.")
13441326 }
13451327 else throw("Strict value is not equal to itself.")
13461328 }
13471329 else throw("Strict value is not equal to itself.")
13481330 }
13491331
13501332
13511333
13521334 @Callable(i)
13531335 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1354- let $t05127451430 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1355- let amountEstimated = $t05127451430._1
1356- let commonState = $t05127451430._2
1357- let feeAmount = $t05127451430._3
1358- let bonus = $t05127451430._4
1359- let outInAmountAsset = $t05127451430._5
1336+ let $t05108551241 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1337+ let amountEstimated = $t05108551241._1
1338+ let commonState = $t05108551241._2
1339+ let feeAmount = $t05108551241._3
1340+ let bonus = $t05108551241._4
1341+ let outInAmountAsset = $t05108551241._5
13601342 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13611343 }
13621344
13631345
13641346
13651347 @Callable(i)
13661348 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13671349 let isPoolOneTokenOperationsDisabled = {
13681350 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13691351 if ($isInstanceOf(@, "Boolean"))
13701352 then @
13711353 else throw(($getType(@) + " couldn't be cast to Boolean"))
13721354 }
13731355 let isGetDisabled = if (if (isGlobalShutdown())
13741356 then true
13751357 else (cfgPoolStatus == PoolShutdown))
13761358 then true
13771359 else isPoolOneTokenOperationsDisabled
13781360 let checks = [if (if (!(isGetDisabled))
13791361 then true
13801362 else isManager(i))
13811363 then true
13821364 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13831365 then true
13841366 else throwErr("no payments are expected")]
13851367 if ((checks == checks))
13861368 then {
13871369 let outAssetId = parseAssetId(outAssetIdStr)
13881370 let userAddress = i.caller
13891371 let txId = i.transactionId
13901372 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13911373 if ((currentKLp == currentKLp))
13921374 then {
13931375 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13941376 if ((unstakeInv == unstakeInv))
13951377 then {
1396- let $t05233552486 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1397- if (($t05233552486 == $t05233552486))
1378+ let $t05214652297 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1379+ if (($t05214652297 == $t05214652297))
13981380 then {
1399- let outInAmountAsset = $t05233552486._5
1400- let bonus = $t05233552486._4
1401- let feeAmount = $t05233552486._3
1402- let commonState = $t05233552486._2
1403- let amountEstimated = $t05233552486._1
1381+ let outInAmountAsset = $t05214652297._5
1382+ let bonus = $t05214652297._4
1383+ let feeAmount = $t05214652297._3
1384+ let commonState = $t05214652297._2
1385+ let amountEstimated = $t05214652297._1
14041386 let amount = if (if ((minOutAmount > 0))
14051387 then (minOutAmount > amountEstimated)
14061388 else false)
14071389 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
14081390 else amountEstimated
14091391 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
14101392 if ((burnInv == burnInv))
14111393 then {
14121394 let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
14131395 if ((withdrawState == withdrawState))
14141396 then {
14151397 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
14161398 let sendFee = if ((feeAmount > 0))
14171399 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
14181400 else nil
1419- let $t05305153298 = {
1401+ let $t05286253109 = {
14201402 let feeAmountForCalc = if ((this == feeCollectorAddress))
14211403 then 0
14221404 else feeAmount
14231405 if (outInAmountAsset)
14241406 then $Tuple2(-((amount + feeAmountForCalc)), 0)
14251407 else $Tuple2(0, -((amount + feeAmountForCalc)))
14261408 }
1427- let amountAssetBalanceDelta = $t05305153298._1
1428- let priceAssetBalanceDelta = $t05305153298._2
1429- let $t05330153409 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1430- let refreshKLpActions = $t05330153409._1
1431- let updatedKLp = $t05330153409._2
1409+ let amountAssetBalanceDelta = $t05286253109._1
1410+ let priceAssetBalanceDelta = $t05286253109._2
1411+ let $t05311253220 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1412+ let refreshKLpActions = $t05311253220._1
1413+ let updatedKLp = $t05311253220._2
14321414 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14331415 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1434- then {
1435- let reb = invoke(this, "rebalance", nil, nil)
1436- if ((reb == reb))
1437- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1438- else throw("Strict value is not equal to itself.")
1439- }
1416+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14401417 else throw("Strict value is not equal to itself.")
14411418 }
14421419 else throw("Strict value is not equal to itself.")
14431420 }
14441421 else throw("Strict value is not equal to itself.")
14451422 }
14461423 else throw("Strict value is not equal to itself.")
14471424 }
14481425 else throw("Strict value is not equal to itself.")
14491426 }
14501427 else throw("Strict value is not equal to itself.")
14511428 }
14521429 else throw("Strict value is not equal to itself.")
14531430 }
14541431
14551432
14561433
14571434 @Callable(i)
14581435 func get () = {
14591436 let res = commonGet(i)
14601437 let outAmtAmt = res._1
14611438 let outPrAmt = res._2
14621439 let pmtAmt = res._3
14631440 let pmtAssetId = res._4
14641441 let state = res._5
14651442 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14661443 if ((currentKLp == currentKLp))
14671444 then {
14681445 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14691446 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14701447 then {
1471- let $t05442354505 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1472- let refreshKLpActions = $t05442354505._1
1473- let updatedKLp = $t05442354505._2
1448+ let $t05418754269 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1449+ let refreshKLpActions = $t05418754269._1
1450+ let updatedKLp = $t05418754269._2
14741451 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14751452 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14761453 then (state ++ refreshKLpActions)
14771454 else throw("Strict value is not equal to itself.")
14781455 }
14791456 else throw("Strict value is not equal to itself.")
14801457 }
14811458 else throw("Strict value is not equal to itself.")
14821459 }
14831460
14841461
14851462
14861463 @Callable(i)
14871464 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14881465 let res = commonGet(i)
14891466 let outAmAmt = res._1
14901467 let outPrAmt = res._2
14911468 let pmtAmt = res._3
14921469 let pmtAssetId = res._4
14931470 let state = res._5
14941471 if ((noLessThenAmtAsset > outAmAmt))
14951472 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14961473 else if ((noLessThenPriceAsset > outPrAmt))
14971474 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14981475 else {
14991476 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15001477 if ((currentKLp == currentKLp))
15011478 then {
15021479 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
15031480 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15041481 then {
1505- let $t05545455535 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1506- let refreshKLpActions = $t05545455535._1
1507- let updatedKLp = $t05545455535._2
1482+ let $t05521855299 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1483+ let refreshKLpActions = $t05521855299._1
1484+ let updatedKLp = $t05521855299._2
15081485 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15091486 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15101487 then (state ++ refreshKLpActions)
15111488 else throw("Strict value is not equal to itself.")
15121489 }
15131490 else throw("Strict value is not equal to itself.")
15141491 }
15151492 else throw("Strict value is not equal to itself.")
15161493 }
15171494 }
15181495
15191496
15201497
15211498 @Callable(i)
15221499 func unstakeAndGet (amount) = {
15231500 let checkPayments = if ((size(i.payments) != 0))
15241501 then throw("No payments are expected")
15251502 else true
15261503 if ((checkPayments == checkPayments))
15271504 then {
15281505 let cfg = getPoolConfig()
15291506 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
15301507 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15311508 if ((currentKLp == currentKLp))
15321509 then {
15331510 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
15341511 if ((unstakeInv == unstakeInv))
15351512 then {
15361513 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
15371514 let outAmAmt = res._1
15381515 let outPrAmt = res._2
15391516 let poolStatus = parseIntValue(res._9)
15401517 let state = res._10
15411518 let checkPoolStatus = if (if (isGlobalShutdown())
15421519 then true
15431520 else (poolStatus == PoolShutdown))
15441521 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
15451522 else true
15461523 if ((checkPoolStatus == checkPoolStatus))
15471524 then {
15481525 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15491526 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15501527 then {
1551- let $t05666156742 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1552- let refreshKLpActions = $t05666156742._1
1553- let updatedKLp = $t05666156742._2
1528+ let $t05642556506 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1529+ let refreshKLpActions = $t05642556506._1
1530+ let updatedKLp = $t05642556506._2
15541531 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15551532 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15561533 then (state ++ refreshKLpActions)
15571534 else throw("Strict value is not equal to itself.")
15581535 }
15591536 else throw("Strict value is not equal to itself.")
15601537 }
15611538 else throw("Strict value is not equal to itself.")
15621539 }
15631540 else throw("Strict value is not equal to itself.")
15641541 }
15651542 else throw("Strict value is not equal to itself.")
15661543 }
15671544 else throw("Strict value is not equal to itself.")
15681545 }
15691546
15701547
15711548
15721549 @Callable(i)
15731550 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15741551 let isGetDisabled = if (isGlobalShutdown())
15751552 then true
15761553 else (cfgPoolStatus == PoolShutdown)
15771554 let checks = [if (!(isGetDisabled))
15781555 then true
15791556 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15801557 then true
15811558 else throw("no payments are expected")]
15821559 if ((checks == checks))
15831560 then {
15841561 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15851562 if ((currentKLp == currentKLp))
15861563 then {
15871564 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15881565 if ((unstakeInv == unstakeInv))
15891566 then {
15901567 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15911568 let outAmAmt = res._1
15921569 let outPrAmt = res._2
15931570 let state = res._10
15941571 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15951572 then true
15961573 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15971574 then true
15981575 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15991576 if ((checkAmounts == checkAmounts))
16001577 then {
16011578 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
16021579 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
16031580 then {
1604- let $t05803758118 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1605- let refreshKLpActions = $t05803758118._1
1606- let updatedKLp = $t05803758118._2
1581+ let $t05780157882 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1582+ let refreshKLpActions = $t05780157882._1
1583+ let updatedKLp = $t05780157882._2
16071584 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
16081585 if ((isUpdatedKLpValid == isUpdatedKLpValid))
16091586 then (state ++ refreshKLpActions)
16101587 else throw("Strict value is not equal to itself.")
16111588 }
16121589 else throw("Strict value is not equal to itself.")
16131590 }
16141591 else throw("Strict value is not equal to itself.")
16151592 }
16161593 else throw("Strict value is not equal to itself.")
16171594 }
16181595 else throw("Strict value is not equal to itself.")
16191596 }
16201597 else throw("Strict value is not equal to itself.")
16211598 }
16221599
16231600
16241601
16251602 @Callable(i)
16261603 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
16271604 then throw("permissions denied")
16281605 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
16291606
16301607
16311608
16321609 @Callable(i)
16331610 func refreshKLp () = {
16341611 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
16351612 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
16361613 then unit
16371614 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
16381615 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
16391616 then {
16401617 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1641- let $t05930559369 = refreshKLpInternal(0, 0, 0)
1642- let kLpUpdateActions = $t05930559369._1
1643- let updatedKLp = $t05930559369._2
1618+ let $t05906959133 = refreshKLpInternal(0, 0, 0)
1619+ let kLpUpdateActions = $t05906959133._1
1620+ let updatedKLp = $t05906959133._2
16441621 let actions = if ((kLp != updatedKLp))
16451622 then kLpUpdateActions
16461623 else throwErr("nothing to refresh")
16471624 $Tuple2(actions, toString(updatedKLp))
16481625 }
16491626 else throw("Strict value is not equal to itself.")
16501627 }
16511628
16521629
16531630
16541631 @Callable(i)
16551632 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
16561633
16571634
16581635
16591636 @Callable(i)
16601637 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16611638
16621639
16631640
16641641 @Callable(i)
16651642 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16661643 let prices = calcPrices(amAmt, prAmt, lpAmt)
16671644 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16681645 }
16691646
16701647
16711648
16721649 @Callable(i)
16731650 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16741651
16751652
16761653
16771654 @Callable(i)
16781655 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16791656
16801657
16811658
16821659 @Callable(i)
16831660 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16841661
16851662
16861663
16871664 @Callable(i)
16881665 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16891666
16901667
16911668
16921669 @Callable(i)
16931670 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16941671 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16951672 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16961673 }
16971674
16981675
16991676
17001677 @Callable(i)
17011678 func statsREADONLY () = {
17021679 let cfg = getPoolConfig()
17031680 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17041681 let amtAssetId = cfg[idxAmtAssetId]
17051682 let priceAssetId = cfg[idxPriceAssetId]
17061683 let iAmtAssetId = cfg[idxIAmtAssetId]
17071684 let iPriceAssetId = cfg[idxIPriceAssetId]
17081685 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17091686 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17101687 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17111688 let accAmtAssetBalance = getAccBalance(amtAssetId)
17121689 let accPriceAssetBalance = getAccBalance(priceAssetId)
17131690 let pricesList = if ((poolLPBalance == 0))
17141691 then [zeroBigInt, zeroBigInt, zeroBigInt]
17151692 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
17161693 let curPrice = 0
17171694 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
17181695 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
17191696 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
17201697 $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))
17211698 }
17221699
17231700
17241701
17251702 @Callable(i)
17261703 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
17271704 let cfg = getPoolConfig()
17281705 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17291706 let amAssetIdStr = cfg[idxAmtAssetId]
17301707 let amAssetId = fromBase58String(amAssetIdStr)
17311708 let prAssetIdStr = cfg[idxPriceAssetId]
17321709 let prAssetId = fromBase58String(prAssetIdStr)
17331710 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17341711 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17351712 let poolStatus = cfg[idxPoolStatus]
17361713 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17371714 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
17381715 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
17391716 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
17401717 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
17411718 let curPriceX18 = if ((poolLPBalance == 0))
17421719 then zeroBigInt
17431720 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
17441721 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
17451722 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
17461723 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
17471724 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17481725 let calcLpAmt = estPut._1
17491726 let curPriceCalc = estPut._3
17501727 let amBalance = estPut._4
17511728 let prBalance = estPut._5
17521729 let lpEmission = estPut._6
17531730 $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))
17541731 }
17551732
17561733
17571734
17581735 @Callable(i)
17591736 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17601737 let cfg = getPoolConfig()
17611738 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17621739 let amAssetIdStr = cfg[idxAmtAssetId]
17631740 let amAssetId = fromBase58String(amAssetIdStr)
17641741 let prAssetIdStr = cfg[idxPriceAssetId]
17651742 let prAssetId = fromBase58String(prAssetIdStr)
17661743 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17671744 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17681745 let poolStatus = cfg[idxPoolStatus]
17691746 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17701747 let amBalanceRaw = getAccBalance(amAssetIdStr)
17711748 let prBalanceRaw = getAccBalance(prAssetIdStr)
17721749 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17731750 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17741751 let curPriceX18 = if ((poolLPBalance == 0))
17751752 then zeroBigInt
17761753 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17771754 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17781755 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17791756 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17801757 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17811758 let calcLpAmt = estPut._1
17821759 let curPriceCalc = estPut._3
17831760 let amBalance = estPut._4
17841761 let prBalance = estPut._5
17851762 let lpEmission = estPut._6
17861763 $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))
17871764 }
17881765
17891766
17901767
17911768 @Callable(i)
17921769 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17931770 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17941771 let outAmAmt = res._1
17951772 let outPrAmt = res._2
17961773 let amBalance = res._5
17971774 let prBalance = res._6
17981775 let lpEmission = res._7
17991776 let curPrice = res._8
18001777 let poolStatus = parseIntValue(res._9)
18011778 $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))
18021779 }
18031780
18041781
18051782 @Verifier(tx)
18061783 func verify () = {
18071784 let targetPublicKey = match managerPublicKeyOrUnit() {
18081785 case pk: ByteVector =>
18091786 pk
18101787 case _: Unit =>
18111788 tx.senderPublicKey
18121789 case _ =>
18131790 throw("Match error")
18141791 }
18151792 match tx {
18161793 case order: Order =>
18171794 let matcherPub = getMatcherPubOrFail()
1818- let $t06803168100 = validateMatcherOrderAllowed(order)
1819- let orderValid = $t06803168100._1
1820- let orderValidInfo = $t06803168100._2
1795+ let $t06779567864 = validateMatcherOrderAllowed(order)
1796+ let orderValid = $t06779567864._1
1797+ let orderValidInfo = $t06779567864._2
18211798 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
18221799 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
18231800 if (if (if (orderValid)
18241801 then senderValid
18251802 else false)
18261803 then matcherValid
18271804 else false)
18281805 then true
18291806 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
18301807 case s: SetScriptTransaction =>
18311808 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
18321809 then true
18331810 else {
18341811 let newHash = blake2b256(value(s.script))
18351812 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
18361813 let currentHash = scriptHash(this)
18371814 if ((allowedHash == newHash))
18381815 then (currentHash != newHash)
18391816 else false
18401817 }
18411818 case _ =>
18421819 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
18431820 }
18441821 }
18451822

github/deemru/w8io/026f985 
232.60 ms