tx · F4EPeFV2iqW37GMzcwFczJXrMFY9iEbS7Y9DMxi2dkVz

3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT:  -0.04300000 Waves

2023.04.04 13:54 [2519727] smart account 3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT > SELF 0.00000000 Waves

{ "type": 13, "id": "F4EPeFV2iqW37GMzcwFczJXrMFY9iEbS7Y9DMxi2dkVz", "fee": 4300000, "feeAssetId": null, "timestamp": 1680605650376, "version": 2, "chainId": 84, "sender": "3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT", "senderPublicKey": "AYbpHveq7zviKTDV7SGTB1pZGFbkumgfq3jSwVv6BznT", "proofs": [ "24AGjN8kom4XL7seJjqCTNZX8SxUrUrjRHgBF82vSTkdj8vNs1a8cavHvUFQumoeZhrQSM2GDVc2yhY2UoJu8nHR" ], "script": "base64:BgKdNwgCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlke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XMJAJEDAggFAmlrBnByb29mcwAABQJpbVP5/UQ=", "height": 2519727, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5aEcWjdinQhuARjR4gHtBnFkar5hUHzbAdVCdNcrKtML Next: 41PtbF3TB8d776iYf2p5zuLApfbUgjgWrRi6RNmzqow7 Diff:
OldNewDifferences
243243
244244 let poolConfigParsed = parsePoolConfig(getPoolConfig())
245245
246-let $t092129378 = poolConfigParsed
246+let $t092859451 = poolConfigParsed
247247
248-let cfgPoolAddress = $t092129378._1
248+let cfgPoolAddress = $t092859451._1
249249
250-let cfgPoolStatus = $t092129378._2
250+let cfgPoolStatus = $t092859451._2
251251
252-let cfgLpAssetId = $t092129378._3
252+let cfgLpAssetId = $t092859451._3
253253
254-let cfgAmountAssetId = $t092129378._4
254+let cfgAmountAssetId = $t092859451._4
255255
256-let cfgPriceAssetId = $t092129378._5
256+let cfgPriceAssetId = $t092859451._5
257257
258-let cfgAmountAssetDecimals = $t092129378._6
258+let cfgAmountAssetDecimals = $t092859451._6
259259
260-let cfgPriceAssetDecimals = $t092129378._7
260+let cfgPriceAssetDecimals = $t092859451._7
261261
262262 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
263263
340340 }
341341
342342
343-func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul) = {
343+func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
344344 let currentAdditionalBalance = getAdditionalBalance(assetId)
345345 if ((currentAdditionalBalance == currentAdditionalBalance))
346346 then {
350350 let currentProxyRate = getRate(proxy)
351351 if ((currentProxyRate == currentProxyRate))
352352 then {
353+ let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
353354 let stakingAsset = parseAssetId(stakingAssetId)
355+ let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
354356 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
357+ let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
355358 if ((sendStakingAssetAmount > 0))
356359 then {
357360 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
359362 then match withdrawInvoke {
360363 case receivedAssets: Int =>
361364 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
362- let newStakingAssetBalance = (currentStakingAssetBalance - sendStakingAssetAmount)
363-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
365+ let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
366+[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
364367 case _ =>
365368 nil
366369 }
379382 func getLeaseProxyConfig (assetId) = invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil)
380383
381384
382-func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul) = {
385+func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
383386 let currentAdditionalBalance = getAdditionalBalance(assetId)
384387 if ((currentAdditionalBalance == currentAdditionalBalance))
385388 then {
408411 }
409412 else {
410413 let getAssetAmount = diff
411- withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul)
414+ withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
412415 }
413416 }
414417 else throw("Strict value is not equal to itself.")
421424
422425 func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
423426 case a: (Boolean, Int, Int, String, String, Int, String) =>
424- let $t01551515624 = a
425- let isLeasable = $t01551515624._1
426- let leasedRatio = $t01551515624._2
427- let minBalance = $t01551515624._3
428- let proxyAddress = $t01551515624._4
429- let proxyAssetId = $t01551515624._5
430- let proxyRateMul = $t01551515624._6
431- let stakingProfitAddress = $t01551515624._7
427+ let $t01605416163 = a
428+ let isLeasable = $t01605416163._1
429+ let leasedRatio = $t01605416163._2
430+ let minBalance = $t01605416163._3
431+ let proxyAddress = $t01605416163._4
432+ let proxyAssetId = $t01605416163._5
433+ let proxyRateMul = $t01605416163._6
434+ let stakingProfitAddress = $t01605416163._7
432435 if (isLeasable)
433- then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul)
436+ then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434437 else nil
435438 case _ =>
436439 throwErr((("[" + assetId) + "] Rebalance error"))
437440 }
441+
442+
443+func withdrawAssetWrapper (assetId,amount) = match getLeaseProxyConfig(assetId) {
444+ case a: (Boolean, Int, Int, String, String, Int, String) =>
445+ let $t01669316802 = a
446+ let isLeasable = $t01669316802._1
447+ let leasedRatio = $t01669316802._2
448+ let minBalance = $t01669316802._3
449+ let proxyAddress = $t01669316802._4
450+ let proxyAssetId = $t01669316802._5
451+ let proxyRateMul = $t01669316802._6
452+ let stakingProfitAddress = $t01669316802._7
453+ if (isLeasable)
454+ then withdraw(assetId, amount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
455+ else nil
456+ case _ =>
457+ throwErr((("[" + assetId) + "] withdrawAssetWrapper() error"))
458+}
459+
460+
461+func getWithdrawAssetState (assetId,amount) = {
462+ let assetOnPool = match parseAssetId(assetId) {
463+ case b: ByteVector =>
464+ assetBalance(this, b)
465+ case w: Unit =>
466+ wavesBalance(this).available
467+ case _ =>
468+ throw("Match error")
469+ }
470+ if ((amount > assetOnPool))
471+ then {
472+ let amountDiff = (amount - assetOnPool)
473+ withdrawAssetWrapper(assetId, amountDiff)
474+ }
475+ else nil
476+ }
438477
439478
440479 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
488527 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
489528 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
490529 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
491- let state = if ((txId58 == ""))
492- then nil
493- else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
494- then unit
495- else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
496- then unit
497- 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)]
498- $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
530+ let AmAmtWithdrawState = getWithdrawAssetState(amAssetId, outAmAmt)
531+ if ((AmAmtWithdrawState == AmAmtWithdrawState))
532+ then {
533+ let PrAmtWithdrawState = getWithdrawAssetState(prAssetId, outPrAmt)
534+ if ((PrAmtWithdrawState == PrAmtWithdrawState))
535+ then {
536+ let reb = invoke(this, "rebalance", nil, nil)
537+ if ((reb == reb))
538+ then {
539+ let state = if ((txId58 == ""))
540+ then nil
541+ else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
542+ then unit
543+ else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
544+ then unit
545+ 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)])
546+ $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
547+ }
548+ else throw("Strict value is not equal to itself.")
549+ }
550+ else throw("Strict value is not equal to itself.")
551+ }
552+ else throw("Strict value is not equal to itself.")
499553 }
500554 }
501555
616670 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
617671 let amountAssetAmount = order.amount
618672 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
619- let $t02714527357 = if ((order.orderType == Buy))
673+ let $t02904029252 = if ((order.orderType == Buy))
620674 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
621675 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
622- let amountAssetBalanceDelta = $t02714527357._1
623- let priceAssetBalanceDelta = $t02714527357._2
676+ let amountAssetBalanceDelta = $t02904029252._1
677+ let priceAssetBalanceDelta = $t02904029252._2
624678 if (if (if (isGlobalShutdown())
625679 then true
626680 else (cfgPoolStatus == PoolMatcherDisabled))
633687 then throw("Wrong order assets.")
634688 else {
635689 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
636- let $t02779727897 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
637- let unusedActions = $t02779727897._1
638- let kLpNew = $t02779727897._2
690+ let $t02969229792 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
691+ let unusedActions = $t02969229792._1
692+ let kLpNew = $t02969229792._2
639693 let isOrderValid = (kLpNew >= kLp)
640694 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
641695 $Tuple2(isOrderValid, info)
714768 else if ((paymentAssetId == cfgPriceAssetId))
715769 then false
716770 else throwErr("invalid asset")
717- let $t03101031303 = if (isEval)
771+ let $t03290533198 = if (isEval)
718772 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
719773 else if (paymentInAmountAsset)
720774 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
721775 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
722- let amountBalanceOld = $t03101031303._1
723- let priceBalanceOld = $t03101031303._2
724- let $t03130731456 = if (paymentInAmountAsset)
776+ let amountBalanceOld = $t03290533198._1
777+ let priceBalanceOld = $t03290533198._2
778+ let $t03320233351 = if (paymentInAmountAsset)
725779 then $Tuple2(paymentAmountRaw, 0)
726780 else $Tuple2(0, paymentAmountRaw)
727- let amountAssetAmountRaw = $t03130731456._1
728- let priceAssetAmountRaw = $t03130731456._2
781+ let amountAssetAmountRaw = $t03320233351._1
782+ let priceAssetAmountRaw = $t03320233351._2
729783 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
730784 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
731- let $t03158831652 = takeFee(paymentAmountRaw, inFee)
732- let paymentAmount = $t03158831652._1
733- let feeAmount = $t03158831652._2
785+ let $t03348333547 = takeFee(paymentAmountRaw, inFee)
786+ let paymentAmount = $t03348333547._1
787+ let feeAmount = $t03348333547._2
734788 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
735789 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
736790 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
753807 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
754808 let priceOld = fromX18(priceOldX18, scale8)
755809 let loss = {
756- let $t03333333500 = if (paymentInAmountAsset)
810+ let $t03522835395 = if (paymentInAmountAsset)
757811 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
758812 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
759- let amount = $t03333333500._1
760- let balance = $t03333333500._2
813+ let amount = $t03522835395._1
814+ let balance = $t03522835395._2
761815 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
762816 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
763817 }
797851 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
798852 let redeemedBigInt = toBigInt(paymentAmount)
799853 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
800- let $t03557835634 = takeFee(amountRaw, outFee)
801- let totalAmount = $t03557835634._1
802- let feeAmount = $t03557835634._2
803- let $t03563835864 = if (outInAmountAsset)
854+ let $t03747337529 = takeFee(amountRaw, outFee)
855+ let totalAmount = $t03747337529._1
856+ let feeAmount = $t03747337529._2
857+ let $t03753337759 = if (outInAmountAsset)
804858 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
805859 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
806- let outAmAmount = $t03563835864._1
807- let outPrAmount = $t03563835864._2
808- let amBalanceNew = $t03563835864._3
809- let prBalanceNew = $t03563835864._4
860+ let outAmAmount = $t03753337759._1
861+ let outPrAmount = $t03753337759._2
862+ let amBalanceNew = $t03753337759._3
863+ let prBalanceNew = $t03753337759._4
810864 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
811865 let priceNew = fromX18(priceNewX18, scale8)
812866 let commonState = if (isEval)
878932
879933 @Callable(i)
880934 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
881- let $t03775038055 = if ((isReverse == false))
935+ let $t03964539950 = if ((isReverse == false))
882936 then {
883937 let assetOut = getStringOrFail(this, pa())
884938 let assetIn = getStringOrFail(this, aa())
889943 let assetIn = getStringOrFail(this, pa())
890944 $Tuple2(assetOut, assetIn)
891945 }
892- let assetOut = $t03775038055._1
893- let assetIn = $t03775038055._2
946+ let assetOut = $t03964539950._1
947+ let assetIn = $t03964539950._2
894948 let poolAssetInBalance = getAccBalance(assetIn)
895949 let poolAssetOutBalance = getAccBalance(assetOut)
896950 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
9471001 case _ =>
9481002 throw("error lease config")
9491003 }
950- let $t04006140175 = lsConf
951- let isLeasable = $t04006140175._1
952- let leasedRatio = $t04006140175._2
953- let minBalance = $t04006140175._3
954- let proxyAddress = $t04006140175._4
955- let proxyAssetId = $t04006140175._5
956- let proxyRateMul = $t04006140175._6
957- let stakingProfitAddress = $t04006140175._7
958- let assetOnPool = assetBalance(this, fromBase58String(assetOut))
959- let amountOfProfit = if (if ((assetOut == "WAVES"))
960- then (amountOut > assetOnPool)
961- else false)
1004+ let withdrawState = getWithdrawAssetState(assetOut, amountOut)
1005+ if ((withdrawState == withdrawState))
9621006 then {
963- let amountDiff = (amountOut - assetOnPool)
964- let oldRatio = (getAdditionalBalance(assetOut) / getStakingAssetBalance(sWavesId()))
965- let oldWavesRoughBalane = wavesBalance(this).available
966- let wd = invoke(this, "withdraw", [assetOut, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil)
967- if ((wd == wd))
968- then {
969- let newWavesRoughBalane = wavesBalance(this).available
970- let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane)
971- (wavesDiff - amountDiff)
972- }
1007+ let reb = invoke(this, "rebalance", nil, nil)
1008+ if ((reb == reb))
1009+ then $Tuple2((withdrawState ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
9731010 else throw("Strict value is not equal to itself.")
9741011 }
975- else 0
976- let reb = invoke(this, "rebalance", nil, nil)
977- if ((reb == reb))
978- then $Tuple2([ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit), ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut)
9791012 else throw("Strict value is not equal to itself.")
9801013 }
9811014 else throw("Strict value is not equal to itself.")
10681101 else throw("Strict value is not equal to itself.")
10691102 }
10701103 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1071- let $t04398644448 = refreshKLpInternal(0, 0, 0)
1072- if (($t04398644448 == $t04398644448))
1104+ let $t04515145613 = refreshKLpInternal(0, 0, 0)
1105+ if (($t04515145613 == $t04515145613))
10731106 then {
1074- let updatedKLp = $t04398644448._2
1075- let refreshKLpActions = $t04398644448._1
1107+ let updatedKLp = $t04515145613._2
1108+ let refreshKLpActions = $t04515145613._1
10761109 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10771110 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10781111 then ((state ++ lpTransfer) ++ refreshKLpActions)
11041137 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11051138 if ((currentKLp == currentKLp))
11061139 then {
1107- let $t04501045075 = refreshKLpInternal(0, 0, 0)
1108- let refreshKLpActions = $t04501045075._1
1109- let updatedKLp = $t04501045075._2
1140+ let $t04617546240 = refreshKLpInternal(0, 0, 0)
1141+ let refreshKLpActions = $t04617546240._1
1142+ let updatedKLp = $t04617546240._2
11101143 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11111144 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11121145 then (state ++ refreshKLpActions)
11531186 then {
11541187 let userAddress = i.caller
11551188 let txId = i.transactionId
1156- let $t04626346415 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1157- if (($t04626346415 == $t04626346415))
1189+ let $t04742847580 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1190+ if (($t04742847580 == $t04742847580))
11581191 then {
1159- let paymentInAmountAsset = $t04626346415._5
1160- let bonus = $t04626346415._4
1161- let feeAmount = $t04626346415._3
1162- let commonState = $t04626346415._2
1163- let emitAmountEstimated = $t04626346415._1
1192+ let paymentInAmountAsset = $t04742847580._5
1193+ let bonus = $t04742847580._4
1194+ let feeAmount = $t04742847580._3
1195+ let commonState = $t04742847580._2
1196+ let emitAmountEstimated = $t04742847580._1
11641197 let emitAmount = if (if ((minOutAmount > 0))
11651198 then (minOutAmount > emitAmountEstimated)
11661199 else false)
11801213 let sendFee = if ((feeAmount > 0))
11811214 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11821215 else nil
1183- let $t04700147198 = if ((this == feeCollectorAddress))
1216+ let $t04816648363 = if ((this == feeCollectorAddress))
11841217 then $Tuple2(0, 0)
11851218 else if (paymentInAmountAsset)
11861219 then $Tuple2(-(feeAmount), 0)
11871220 else $Tuple2(0, -(feeAmount))
1188- let amountAssetBalanceDelta = $t04700147198._1
1189- let priceAssetBalanceDelta = $t04700147198._2
1190- let $t04720147309 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1191- let refreshKLpActions = $t04720147309._1
1192- let updatedKLp = $t04720147309._2
1221+ let amountAssetBalanceDelta = $t04816648363._1
1222+ let priceAssetBalanceDelta = $t04816648363._2
1223+ let $t04836648474 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1224+ let refreshKLpActions = $t04836648474._1
1225+ let updatedKLp = $t04836648474._2
11931226 let kLp = value(getString(keyKLp))
11941227 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11951228 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12141247
12151248 @Callable(i)
12161249 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1217- let $t04766447821 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1218- let emitAmountEstimated = $t04766447821._1
1219- let commonState = $t04766447821._2
1220- let feeAmount = $t04766447821._3
1221- let bonus = $t04766447821._4
1222- let paymentInAmountAsset = $t04766447821._5
1250+ let $t04882948986 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1251+ let emitAmountEstimated = $t04882948986._1
1252+ let commonState = $t04882948986._2
1253+ let feeAmount = $t04882948986._3
1254+ let bonus = $t04882948986._4
1255+ let paymentInAmountAsset = $t04882948986._5
12231256 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12241257 }
12251258
12561289 then {
12571290 let userAddress = i.caller
12581291 let txId = i.transactionId
1259- let $t04870648859 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1260- if (($t04870648859 == $t04870648859))
1292+ let $t04987150024 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1293+ if (($t04987150024 == $t04987150024))
12611294 then {
1262- let outInAmountAsset = $t04870648859._5
1263- let bonus = $t04870648859._4
1264- let feeAmount = $t04870648859._3
1265- let commonState = $t04870648859._2
1266- let amountEstimated = $t04870648859._1
1295+ let outInAmountAsset = $t04987150024._5
1296+ let bonus = $t04987150024._4
1297+ let feeAmount = $t04987150024._3
1298+ let commonState = $t04987150024._2
1299+ let amountEstimated = $t04987150024._1
12671300 let amount = if (if ((minOutAmount > 0))
12681301 then (minOutAmount > amountEstimated)
12691302 else false)
12751308 case _ =>
12761309 throw("error lease config")
12771310 }
1278- let $t04924349357 = lsConf
1279- let isLeasable = $t04924349357._1
1280- let leasedRatio = $t04924349357._2
1281- let minBalance = $t04924349357._3
1282- let proxyAddress = $t04924349357._4
1283- let proxyAssetId = $t04924349357._5
1284- let proxyRateMul = $t04924349357._6
1285- let stakingProfitAddress = $t04924349357._7
1286- let assetOnPool = assetBalance(this, fromBase58String(outAssetIdStr))
1287- let amountOfProfit = if (if ((outAssetIdStr == "WAVES"))
1288- then (amount > assetOnPool)
1289- else false)
1290- then {
1291- let amountDiff = (amount - assetOnPool)
1292- let oldRatio = (getAdditionalBalance(outAssetIdStr) / getStakingAssetBalance(sWavesId()))
1293- let oldWavesRoughBalane = wavesBalance(this).available
1294- let wd = invoke(this, "withdraw", [outAssetIdStr, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil)
1295- if ((wd == wd))
1296- then {
1297- let newWavesRoughBalane = wavesBalance(this).available
1298- let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane)
1299- (wavesDiff - amountDiff)
1300- }
1301- else throw("Strict value is not equal to itself.")
1302- }
1303- else 0
1304- let profitTransfer = [ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit)]
13051311 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
13061312 if ((burnInv == burnInv))
13071313 then {
1308- let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
1309- let sendFee = if ((feeAmount > 0))
1310- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1311- else nil
1312- let $t05039650643 = {
1313- let feeAmountForCalc = if ((this == feeCollectorAddress))
1314- then 0
1315- else feeAmount
1316- if (outInAmountAsset)
1317- then $Tuple2(-((amount + feeAmountForCalc)), 0)
1318- else $Tuple2(0, -((amount + feeAmountForCalc)))
1319- }
1320- let amountAssetBalanceDelta = $t05039650643._1
1321- let priceAssetBalanceDelta = $t05039650643._2
1322- let $t05064650754 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1323- let refreshKLpActions = $t05064650754._1
1324- let updatedKLp = $t05064650754._2
1325- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1326- if ((isUpdatedKLpValid == isUpdatedKLpValid))
1314+ let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
1315+ if ((withdrawState == withdrawState))
13271316 then {
1328- let reb = invoke(this, "rebalance", nil, nil)
1329- if ((reb == reb))
1330- then $Tuple2(((((commonState ++ assetTransfer) ++ profitTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1317+ let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
1318+ let sendFee = if ((feeAmount > 0))
1319+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1320+ else nil
1321+ let $t05078051027 = {
1322+ let feeAmountForCalc = if ((this == feeCollectorAddress))
1323+ then 0
1324+ else feeAmount
1325+ if (outInAmountAsset)
1326+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
1327+ else $Tuple2(0, -((amount + feeAmountForCalc)))
1328+ }
1329+ let amountAssetBalanceDelta = $t05078051027._1
1330+ let priceAssetBalanceDelta = $t05078051027._2
1331+ let $t05103051138 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1332+ let refreshKLpActions = $t05103051138._1
1333+ let updatedKLp = $t05103051138._2
1334+ let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1335+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1336+ then {
1337+ let reb = invoke(this, "rebalance", nil, nil)
1338+ if ((reb == reb))
1339+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1340+ else throw("Strict value is not equal to itself.")
1341+ }
13311342 else throw("Strict value is not equal to itself.")
13321343 }
13331344 else throw("Strict value is not equal to itself.")
13451356
13461357 @Callable(i)
13471358 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1348- let $t05108151237 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1349- let amountEstimated = $t05108151237._1
1350- let commonState = $t05108151237._2
1351- let feeAmount = $t05108151237._3
1352- let bonus = $t05108151237._4
1353- let outInAmountAsset = $t05108151237._5
1359+ let $t05144351599 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1360+ let amountEstimated = $t05144351599._1
1361+ let commonState = $t05144351599._2
1362+ let feeAmount = $t05144351599._3
1363+ let bonus = $t05144351599._4
1364+ let outInAmountAsset = $t05144351599._5
13541365 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13551366 }
13561367
13871398 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13881399 if ((unstakeInv == unstakeInv))
13891400 then {
1390- let $t05214252293 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1391- if (($t05214252293 == $t05214252293))
1401+ let $t05250452655 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1402+ if (($t05250452655 == $t05250452655))
13921403 then {
1393- let outInAmountAsset = $t05214252293._5
1394- let bonus = $t05214252293._4
1395- let feeAmount = $t05214252293._3
1396- let commonState = $t05214252293._2
1397- let amountEstimated = $t05214252293._1
1404+ let outInAmountAsset = $t05250452655._5
1405+ let bonus = $t05250452655._4
1406+ let feeAmount = $t05250452655._3
1407+ let commonState = $t05250452655._2
1408+ let amountEstimated = $t05250452655._1
13981409 let amount = if (if ((minOutAmount > 0))
13991410 then (minOutAmount > amountEstimated)
14001411 else false)
14031414 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
14041415 if ((burnInv == burnInv))
14051416 then {
1406- let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
1407- let sendFee = if ((feeAmount > 0))
1408- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1409- else nil
1410- let $t05278853035 = {
1411- let feeAmountForCalc = if ((this == feeCollectorAddress))
1412- then 0
1413- else feeAmount
1414- if (outInAmountAsset)
1415- then $Tuple2(-((amount + feeAmountForCalc)), 0)
1416- else $Tuple2(0, -((amount + feeAmountForCalc)))
1417- }
1418- let amountAssetBalanceDelta = $t05278853035._1
1419- let priceAssetBalanceDelta = $t05278853035._2
1420- let $t05303853146 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1421- let refreshKLpActions = $t05303853146._1
1422- let updatedKLp = $t05303853146._2
1423- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1424- if ((isUpdatedKLpValid == isUpdatedKLpValid))
1425- then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1417+ let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
1418+ if ((withdrawState == withdrawState))
1419+ then {
1420+ let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
1421+ let sendFee = if ((feeAmount > 0))
1422+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1423+ else nil
1424+ let $t05322053467 = {
1425+ let feeAmountForCalc = if ((this == feeCollectorAddress))
1426+ then 0
1427+ else feeAmount
1428+ if (outInAmountAsset)
1429+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
1430+ else $Tuple2(0, -((amount + feeAmountForCalc)))
1431+ }
1432+ let amountAssetBalanceDelta = $t05322053467._1
1433+ let priceAssetBalanceDelta = $t05322053467._2
1434+ let $t05347053578 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1435+ let refreshKLpActions = $t05347053578._1
1436+ let updatedKLp = $t05347053578._2
1437+ let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1438+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1439+ then {
1440+ let reb = invoke(this, "rebalance", nil, nil)
1441+ if ((reb == reb))
1442+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1443+ else throw("Strict value is not equal to itself.")
1444+ }
1445+ else throw("Strict value is not equal to itself.")
1446+ }
14261447 else throw("Strict value is not equal to itself.")
14271448 }
14281449 else throw("Strict value is not equal to itself.")
14521473 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14531474 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14541475 then {
1455- let $t05409254174 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1456- let refreshKLpActions = $t05409254174._1
1457- let updatedKLp = $t05409254174._2
1476+ let $t05459254674 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1477+ let refreshKLpActions = $t05459254674._1
1478+ let updatedKLp = $t05459254674._2
14581479 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14591480 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14601481 then (state ++ refreshKLpActions)
14861507 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14871508 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14881509 then {
1489- let $t05512355204 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1490- let refreshKLpActions = $t05512355204._1
1491- let updatedKLp = $t05512355204._2
1510+ let $t05562355704 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1511+ let refreshKLpActions = $t05562355704._1
1512+ let updatedKLp = $t05562355704._2
14921513 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14931514 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14941515 then (state ++ refreshKLpActions)
15321553 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15331554 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15341555 then {
1535- let $t05633056411 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1536- let refreshKLpActions = $t05633056411._1
1537- let updatedKLp = $t05633056411._2
1556+ let $t05683056911 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1557+ let refreshKLpActions = $t05683056911._1
1558+ let updatedKLp = $t05683056911._2
15381559 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15391560 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15401561 then (state ++ refreshKLpActions)
15851606 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15861607 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15871608 then {
1588- let $t05770657787 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1589- let refreshKLpActions = $t05770657787._1
1590- let updatedKLp = $t05770657787._2
1609+ let $t05820658287 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1610+ let refreshKLpActions = $t05820658287._1
1611+ let updatedKLp = $t05820658287._2
15911612 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15921613 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15931614 then (state ++ refreshKLpActions)
16221643 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
16231644 then {
16241645 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1625- let $t05897459038 = refreshKLpInternal(0, 0, 0)
1626- let kLpUpdateActions = $t05897459038._1
1627- let updatedKLp = $t05897459038._2
1646+ let $t05947459538 = refreshKLpInternal(0, 0, 0)
1647+ let kLpUpdateActions = $t05947459538._1
1648+ let updatedKLp = $t05947459538._2
16281649 let actions = if ((kLp != updatedKLp))
16291650 then kLpUpdateActions
16301651 else throwErr("nothing to refresh")
17991820 match tx {
18001821 case order: Order =>
18011822 let matcherPub = getMatcherPubOrFail()
1802- let $t06770067769 = validateMatcherOrderAllowed(order)
1803- let orderValid = $t06770067769._1
1804- let orderValidInfo = $t06770067769._2
1823+ let $t06820068269 = validateMatcherOrderAllowed(order)
1824+ let orderValid = $t06820068269._1
1825+ let orderValidInfo = $t06820068269._2
18051826 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
18061827 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
18071828 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 getAdditionalBalance (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
146146
147147
148148 func getStakingAssetBalance (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
246-let $t092129378 = poolConfigParsed
246+let $t092859451 = poolConfigParsed
247247
248-let cfgPoolAddress = $t092129378._1
248+let cfgPoolAddress = $t092859451._1
249249
250-let cfgPoolStatus = $t092129378._2
250+let cfgPoolStatus = $t092859451._2
251251
252-let cfgLpAssetId = $t092129378._3
252+let cfgLpAssetId = $t092859451._3
253253
254-let cfgAmountAssetId = $t092129378._4
254+let cfgAmountAssetId = $t092859451._4
255255
256-let cfgPriceAssetId = $t092129378._5
256+let cfgPriceAssetId = $t092859451._5
257257
258-let cfgAmountAssetDecimals = $t092129378._6
258+let cfgAmountAssetDecimals = $t092859451._6
259259
260-let cfgPriceAssetDecimals = $t092129378._7
260+let cfgPriceAssetDecimals = $t092859451._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) = if ((assetId == "WAVES"))
276276 then (wavesBalance(this).available + getAdditionalBalance(assetId))
277277 else if ((assetId == sWavesId()))
278278 then {
279279 let amtAsset = getStringOrFail(this, aa())
280280 let priceAsset = getStringOrFail(this, pa())
281281 if (if (if ((amtAsset == "WAVES"))
282282 then (priceAsset == sWavesId())
283283 else false)
284284 then true
285285 else if ((priceAsset == "WAVES"))
286286 then (amtAsset == sWavesId())
287287 else false)
288288 then assetBalance(this, fromBase58String(assetId))
289289 else (assetBalance(this, fromBase58String(assetId)) + getStakingAssetBalance(assetId))
290290 }
291291 else assetBalance(this, fromBase58String(assetId))
292292
293293
294294 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
295295
296296
297297 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
298298
299299
300300 func getRate (proxy) = {
301301 let inv = invoke(proxy, "getRate", nil, nil)
302302 if ((inv == inv))
303303 then match inv {
304304 case r: Int =>
305305 r
306306 case _ =>
307307 throwErr("proxy.getRate() unexpected value")
308308 }
309309 else throw("Strict value is not equal to itself.")
310310 }
311311
312312
313313 func deposit (assetId,amount,stakingAssetId,proxy) = {
314314 let currentAdditionalBalance = getAdditionalBalance(assetId)
315315 if ((currentAdditionalBalance == currentAdditionalBalance))
316316 then {
317317 let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
318318 if ((currentStakingAssetBalance == currentStakingAssetBalance))
319319 then {
320320 let asset = parseAssetId(assetId)
321321 if ((amount > 0))
322322 then {
323323 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
324324 if ((depositInvoke == depositInvoke))
325325 then match depositInvoke {
326326 case receivedStakingAsset: Int =>
327327 let newAdditionalBalance = (currentAdditionalBalance + amount)
328328 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
329329 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
330330 case _ =>
331331 nil
332332 }
333333 else throw("Strict value is not equal to itself.")
334334 }
335335 else nil
336336 }
337337 else throw("Strict value is not equal to itself.")
338338 }
339339 else throw("Strict value is not equal to itself.")
340340 }
341341
342342
343-func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul) = {
343+func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
344344 let currentAdditionalBalance = getAdditionalBalance(assetId)
345345 if ((currentAdditionalBalance == currentAdditionalBalance))
346346 then {
347347 let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
348348 if ((currentStakingAssetBalance == currentStakingAssetBalance))
349349 then {
350350 let currentProxyRate = getRate(proxy)
351351 if ((currentProxyRate == currentProxyRate))
352352 then {
353+ let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
353354 let stakingAsset = parseAssetId(stakingAssetId)
355+ let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
354356 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
357+ let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
355358 if ((sendStakingAssetAmount > 0))
356359 then {
357360 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
358361 if ((withdrawInvoke == withdrawInvoke))
359362 then match withdrawInvoke {
360363 case receivedAssets: Int =>
361364 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
362- let newStakingAssetBalance = (currentStakingAssetBalance - sendStakingAssetAmount)
363-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
365+ let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
366+[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
364367 case _ =>
365368 nil
366369 }
367370 else throw("Strict value is not equal to itself.")
368371 }
369372 else nil
370373 }
371374 else throw("Strict value is not equal to itself.")
372375 }
373376 else throw("Strict value is not equal to itself.")
374377 }
375378 else throw("Strict value is not equal to itself.")
376379 }
377380
378381
379382 func getLeaseProxyConfig (assetId) = invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil)
380383
381384
382-func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul) = {
385+func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
383386 let currentAdditionalBalance = getAdditionalBalance(assetId)
384387 if ((currentAdditionalBalance == currentAdditionalBalance))
385388 then {
386389 let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
387390 if ((currentStakingAssetBalance == currentStakingAssetBalance))
388391 then {
389392 let availableBalance = match parseAssetId(assetId) {
390393 case b: ByteVector =>
391394 assetBalance(this, b)
392395 case u: Unit =>
393396 wavesBalance(this).available
394397 case _ =>
395398 throw("Match error")
396399 }
397400 if ((availableBalance == availableBalance))
398401 then {
399402 let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
400403 let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
401404 let diff = (currentAdditionalBalance - targetAdditionalBalance)
402405 if ((diff == 0))
403406 then nil
404407 else if ((0 > diff))
405408 then {
406409 let sendAssetAmount = -(diff)
407410 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
408411 }
409412 else {
410413 let getAssetAmount = diff
411- withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul)
414+ withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
412415 }
413416 }
414417 else throw("Strict value is not equal to itself.")
415418 }
416419 else throw("Strict value is not equal to itself.")
417420 }
418421 else throw("Strict value is not equal to itself.")
419422 }
420423
421424
422425 func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
423426 case a: (Boolean, Int, Int, String, String, Int, String) =>
424- let $t01551515624 = a
425- let isLeasable = $t01551515624._1
426- let leasedRatio = $t01551515624._2
427- let minBalance = $t01551515624._3
428- let proxyAddress = $t01551515624._4
429- let proxyAssetId = $t01551515624._5
430- let proxyRateMul = $t01551515624._6
431- let stakingProfitAddress = $t01551515624._7
427+ let $t01605416163 = a
428+ let isLeasable = $t01605416163._1
429+ let leasedRatio = $t01605416163._2
430+ let minBalance = $t01605416163._3
431+ let proxyAddress = $t01605416163._4
432+ let proxyAssetId = $t01605416163._5
433+ let proxyRateMul = $t01605416163._6
434+ let stakingProfitAddress = $t01605416163._7
432435 if (isLeasable)
433- then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul)
436+ then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434437 else nil
435438 case _ =>
436439 throwErr((("[" + assetId) + "] Rebalance error"))
437440 }
441+
442+
443+func withdrawAssetWrapper (assetId,amount) = match getLeaseProxyConfig(assetId) {
444+ case a: (Boolean, Int, Int, String, String, Int, String) =>
445+ let $t01669316802 = a
446+ let isLeasable = $t01669316802._1
447+ let leasedRatio = $t01669316802._2
448+ let minBalance = $t01669316802._3
449+ let proxyAddress = $t01669316802._4
450+ let proxyAssetId = $t01669316802._5
451+ let proxyRateMul = $t01669316802._6
452+ let stakingProfitAddress = $t01669316802._7
453+ if (isLeasable)
454+ then withdraw(assetId, amount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
455+ else nil
456+ case _ =>
457+ throwErr((("[" + assetId) + "] withdrawAssetWrapper() error"))
458+}
459+
460+
461+func getWithdrawAssetState (assetId,amount) = {
462+ let assetOnPool = match parseAssetId(assetId) {
463+ case b: ByteVector =>
464+ assetBalance(this, b)
465+ case w: Unit =>
466+ wavesBalance(this).available
467+ case _ =>
468+ throw("Match error")
469+ }
470+ if ((amount > assetOnPool))
471+ then {
472+ let amountDiff = (amount - assetOnPool)
473+ withdrawAssetWrapper(assetId, amountDiff)
474+ }
475+ else nil
476+ }
438477
439478
440479 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
441480 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
442481 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
443482 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
444483 }
445484
446485
447486 func calcPrices (amAmt,prAmt,lpAmt) = {
448487 let cfg = getPoolConfig()
449488 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
450489 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
451490 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
452491 let amAmtX18 = toX18(amAmt, amtAssetDcm)
453492 let prAmtX18 = toX18(prAmt, priceAssetDcm)
454493 let lpAmtX18 = toX18(lpAmt, scale8)
455494 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
456495 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
457496 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
458497 }
459498
460499
461500 func calculatePrices (amAmt,prAmt,lpAmt) = {
462501 let prices = calcPrices(amAmt, prAmt, lpAmt)
463502 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
464503 }
465504
466505
467506 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
468507 let cfg = getPoolConfig()
469508 let lpAssetId = cfg[idxPoolLPAssetId]
470509 let amAssetId = cfg[idxAmtAssetId]
471510 let prAssetId = cfg[idxPriceAssetId]
472511 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
473512 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
474513 let poolStatus = cfg[idxPoolStatus]
475514 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
476515 if ((lpAssetId != pmtAssetId))
477516 then throw("Invalid asset passed.")
478517 else {
479518 let amBalance = getAccBalance(amAssetId)
480519 let amBalanceX18 = toX18(amBalance, amAssetDcm)
481520 let prBalance = getAccBalance(prAssetId)
482521 let prBalanceX18 = toX18(prBalance, prAssetDcm)
483522 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
484523 let curPrice = fromX18(curPriceX18, scale8)
485524 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
486525 let lpEmissionX18 = toX18(lpEmission, scale8)
487526 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
488527 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
489528 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
490529 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
491- let state = if ((txId58 == ""))
492- then nil
493- else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
494- then unit
495- else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
496- then unit
497- 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)]
498- $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
530+ let AmAmtWithdrawState = getWithdrawAssetState(amAssetId, outAmAmt)
531+ if ((AmAmtWithdrawState == AmAmtWithdrawState))
532+ then {
533+ let PrAmtWithdrawState = getWithdrawAssetState(prAssetId, outPrAmt)
534+ if ((PrAmtWithdrawState == PrAmtWithdrawState))
535+ then {
536+ let reb = invoke(this, "rebalance", nil, nil)
537+ if ((reb == reb))
538+ then {
539+ let state = if ((txId58 == ""))
540+ then nil
541+ else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
542+ then unit
543+ else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
544+ then unit
545+ 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)])
546+ $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
547+ }
548+ else throw("Strict value is not equal to itself.")
549+ }
550+ else throw("Strict value is not equal to itself.")
551+ }
552+ else throw("Strict value is not equal to itself.")
499553 }
500554 }
501555
502556
503557 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
504558 let cfg = getPoolConfig()
505559 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
506560 let amAssetIdStr = cfg[idxAmtAssetId]
507561 let prAssetIdStr = cfg[idxPriceAssetId]
508562 let iAmtAssetId = cfg[idxIAmtAssetId]
509563 let iPriceAssetId = cfg[idxIPriceAssetId]
510564 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
511565 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
512566 let poolStatus = cfg[idxPoolStatus]
513567 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
514568 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
515569 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
516570 if (if ((amAssetIdStr != inAmAssetIdStr))
517571 then true
518572 else (prAssetIdStr != inPrAssetIdStr))
519573 then throw("Invalid amt or price asset passed.")
520574 else {
521575 let amBalance = if (isEvaluate)
522576 then getAccBalance(amAssetIdStr)
523577 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
524578 let prBalance = if (isEvaluate)
525579 then getAccBalance(prAssetIdStr)
526580 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
527581 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
528582 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
529583 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
530584 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
531585 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
532586 let res = if ((lpEmission == 0))
533587 then {
534588 let curPriceX18 = zeroBigInt
535589 let slippageX18 = zeroBigInt
536590 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
537591 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
538592 }
539593 else {
540594 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
541595 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
542596 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
543597 if (if ((curPriceX18 != zeroBigInt))
544598 then (slippageX18 > slippageToleranceX18)
545599 else false)
546600 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
547601 else {
548602 let lpEmissionX18 = toX18(lpEmission, scale8)
549603 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
550604 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
551605 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
552606 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
553607 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
554608 let expAmtAssetAmtX18 = expectedAmts._1
555609 let expPriceAssetAmtX18 = expectedAmts._2
556610 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
557611 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
558612 }
559613 }
560614 let calcLpAmt = res._1
561615 let calcAmAssetPmt = res._2
562616 let calcPrAssetPmt = res._3
563617 let curPrice = fromX18(res._4, scale8)
564618 let slippageCalc = fromX18(res._5, scale8)
565619 if ((0 >= calcLpAmt))
566620 then throw("Invalid calculations. LP calculated is less than zero.")
567621 else {
568622 let emitLpAmt = if (!(emitLp))
569623 then 0
570624 else calcLpAmt
571625 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
572626 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
573627 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))]
574628 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
575629 }
576630 }
577631 }
578632
579633
580634 func calcKLp (amountBalance,priceBalance,lpEmission) = {
581635 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
582636 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
583637 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
584638 if ((lpEmission == big0))
585639 then big0
586640 else updatedKLp
587641 }
588642
589643
590644 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
591645 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
592646 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
593647 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
594648 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
595649 currentKLp
596650 }
597651
598652
599653 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
600654 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
601655 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
602656 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
603657 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
604658 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
605659 $Tuple2(actions, updatedKLp)
606660 }
607661
608662
609663 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
610664 then true
611665 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
612666
613667
614668 func validateMatcherOrderAllowed (order) = {
615669 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
616670 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
617671 let amountAssetAmount = order.amount
618672 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
619- let $t02714527357 = if ((order.orderType == Buy))
673+ let $t02904029252 = if ((order.orderType == Buy))
620674 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
621675 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
622- let amountAssetBalanceDelta = $t02714527357._1
623- let priceAssetBalanceDelta = $t02714527357._2
676+ let amountAssetBalanceDelta = $t02904029252._1
677+ let priceAssetBalanceDelta = $t02904029252._2
624678 if (if (if (isGlobalShutdown())
625679 then true
626680 else (cfgPoolStatus == PoolMatcherDisabled))
627681 then true
628682 else (cfgPoolStatus == PoolShutdown))
629683 then throw("Exchange operations disabled")
630684 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
631685 then true
632686 else (order.assetPair.priceAsset != cfgPriceAssetId))
633687 then throw("Wrong order assets.")
634688 else {
635689 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
636- let $t02779727897 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
637- let unusedActions = $t02779727897._1
638- let kLpNew = $t02779727897._2
690+ let $t02969229792 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
691+ let unusedActions = $t02969229792._1
692+ let kLpNew = $t02969229792._2
639693 let isOrderValid = (kLpNew >= kLp)
640694 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
641695 $Tuple2(isOrderValid, info)
642696 }
643697 }
644698
645699
646700 func commonGet (i) = if ((size(i.payments) != 1))
647701 then throw("exactly 1 payment is expected")
648702 else {
649703 let pmt = value(i.payments[0])
650704 let pmtAssetId = value(pmt.assetId)
651705 let pmtAmt = pmt.amount
652706 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
653707 let outAmAmt = res._1
654708 let outPrAmt = res._2
655709 let poolStatus = parseIntValue(res._9)
656710 let state = res._10
657711 if (if (isGlobalShutdown())
658712 then true
659713 else (poolStatus == PoolShutdown))
660714 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
661715 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
662716 }
663717
664718
665719 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
666720 then throw("exactly 2 payments are expected")
667721 else {
668722 let amAssetPmt = value(i.payments[0])
669723 let prAssetPmt = value(i.payments[1])
670724 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
671725 let poolStatus = parseIntValue(estPut._8)
672726 if (if (if (isGlobalShutdown())
673727 then true
674728 else (poolStatus == PoolPutDisabled))
675729 then true
676730 else (poolStatus == PoolShutdown))
677731 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
678732 else estPut
679733 }
680734
681735
682736 func emit (amount) = {
683737 let emitInv = invoke(factoryContract, "emit", [amount], nil)
684738 if ((emitInv == emitInv))
685739 then {
686740 let emitInvLegacy = match emitInv {
687741 case legacyFactoryContract: Address =>
688742 invoke(legacyFactoryContract, "emit", [amount], nil)
689743 case _ =>
690744 unit
691745 }
692746 if ((emitInvLegacy == emitInvLegacy))
693747 then amount
694748 else throw("Strict value is not equal to itself.")
695749 }
696750 else throw("Strict value is not equal to itself.")
697751 }
698752
699753
700754 func takeFee (amount,fee) = {
701755 let feeAmount = if ((fee == 0))
702756 then 0
703757 else fraction(amount, fee, scale8)
704758 $Tuple2((amount - feeAmount), feeAmount)
705759 }
706760
707761
708762 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
709763 let isEval = (txId == unit)
710764 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
711765 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
712766 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
713767 then true
714768 else if ((paymentAssetId == cfgPriceAssetId))
715769 then false
716770 else throwErr("invalid asset")
717- let $t03101031303 = if (isEval)
771+ let $t03290533198 = if (isEval)
718772 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
719773 else if (paymentInAmountAsset)
720774 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
721775 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
722- let amountBalanceOld = $t03101031303._1
723- let priceBalanceOld = $t03101031303._2
724- let $t03130731456 = if (paymentInAmountAsset)
776+ let amountBalanceOld = $t03290533198._1
777+ let priceBalanceOld = $t03290533198._2
778+ let $t03320233351 = if (paymentInAmountAsset)
725779 then $Tuple2(paymentAmountRaw, 0)
726780 else $Tuple2(0, paymentAmountRaw)
727- let amountAssetAmountRaw = $t03130731456._1
728- let priceAssetAmountRaw = $t03130731456._2
781+ let amountAssetAmountRaw = $t03320233351._1
782+ let priceAssetAmountRaw = $t03320233351._2
729783 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
730784 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
731- let $t03158831652 = takeFee(paymentAmountRaw, inFee)
732- let paymentAmount = $t03158831652._1
733- let feeAmount = $t03158831652._2
785+ let $t03348333547 = takeFee(paymentAmountRaw, inFee)
786+ let paymentAmount = $t03348333547._1
787+ let feeAmount = $t03348333547._2
734788 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
735789 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
736790 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
737791 let priceNew = fromX18(priceNewX18, scale8)
738792 let paymentBalance = if (paymentInAmountAsset)
739793 then amountBalanceOld
740794 else priceBalanceOld
741795 let paymentBalanceBigInt = toBigInt(paymentBalance)
742796 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
743797 let chechSupply = if ((supplyBigInt > big0))
744798 then true
745799 else throwErr("initial deposit requires all coins")
746800 if ((chechSupply == chechSupply))
747801 then {
748802 let depositBigInt = toBigInt(paymentAmount)
749803 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
750804 let commonState = if (isEval)
751805 then nil
752806 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))]
753807 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
754808 let priceOld = fromX18(priceOldX18, scale8)
755809 let loss = {
756- let $t03333333500 = if (paymentInAmountAsset)
810+ let $t03522835395 = if (paymentInAmountAsset)
757811 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
758812 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
759- let amount = $t03333333500._1
760- let balance = $t03333333500._2
813+ let amount = $t03522835395._1
814+ let balance = $t03522835395._2
761815 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
762816 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
763817 }
764818 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
765819 }
766820 else throw("Strict value is not equal to itself.")
767821 }
768822
769823
770824 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
771825 let isEval = (txId == unit)
772826 let cfg = getPoolConfig()
773827 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
774828 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
775829 let checks = [if ((paymentAssetId == cfgLpAssetId))
776830 then true
777831 else throwErr("invalid lp asset")]
778832 if ((checks == checks))
779833 then {
780834 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
781835 then true
782836 else if ((outAssetId == cfgPriceAssetId))
783837 then false
784838 else throwErr("invalid asset")
785839 let balanceBigInt = if (outInAmountAsset)
786840 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
787841 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
788842 let outInAmountAssetDecimals = if (outInAmountAsset)
789843 then amtAssetDcm
790844 else priceAssetDcm
791845 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
792846 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
793847 let outBalance = if (outInAmountAsset)
794848 then amBalanceOld
795849 else prBalanceOld
796850 let outBalanceBigInt = toBigInt(outBalance)
797851 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
798852 let redeemedBigInt = toBigInt(paymentAmount)
799853 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
800- let $t03557835634 = takeFee(amountRaw, outFee)
801- let totalAmount = $t03557835634._1
802- let feeAmount = $t03557835634._2
803- let $t03563835864 = if (outInAmountAsset)
854+ let $t03747337529 = takeFee(amountRaw, outFee)
855+ let totalAmount = $t03747337529._1
856+ let feeAmount = $t03747337529._2
857+ let $t03753337759 = if (outInAmountAsset)
804858 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
805859 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
806- let outAmAmount = $t03563835864._1
807- let outPrAmount = $t03563835864._2
808- let amBalanceNew = $t03563835864._3
809- let prBalanceNew = $t03563835864._4
860+ let outAmAmount = $t03753337759._1
861+ let outPrAmount = $t03753337759._2
862+ let amBalanceNew = $t03753337759._3
863+ let prBalanceNew = $t03753337759._4
810864 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
811865 let priceNew = fromX18(priceNewX18, scale8)
812866 let commonState = if (isEval)
813867 then nil
814868 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)]
815869 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
816870 let priceOld = fromX18(priceOldX18, scale8)
817871 let loss = {
818872 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
819873 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
820874 }
821875 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
822876 }
823877 else throw("Strict value is not equal to itself.")
824878 }
825879
826880
827881 func managerPublicKeyOrUnit () = match getString(mpk()) {
828882 case s: String =>
829883 fromBase58String(s)
830884 case _: Unit =>
831885 unit
832886 case _ =>
833887 throw("Match error")
834888 }
835889
836890
837891 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
838892 case s: String =>
839893 fromBase58String(s)
840894 case _: Unit =>
841895 unit
842896 case _ =>
843897 throw("Match error")
844898 }
845899
846900
847901 func isManager (i) = match managerPublicKeyOrUnit() {
848902 case pk: ByteVector =>
849903 (i.callerPublicKey == pk)
850904 case _: Unit =>
851905 (i.caller == this)
852906 case _ =>
853907 throw("Match error")
854908 }
855909
856910
857911 func mustManager (i) = {
858912 let pd = throw("Permission denied")
859913 match managerPublicKeyOrUnit() {
860914 case pk: ByteVector =>
861915 if ((i.callerPublicKey == pk))
862916 then true
863917 else pd
864918 case _: Unit =>
865919 if ((i.caller == this))
866920 then true
867921 else pd
868922 case _ =>
869923 throw("Match error")
870924 }
871925 }
872926
873927
874928 @Callable(i)
875929 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
876930
877931
878932
879933 @Callable(i)
880934 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
881- let $t03775038055 = if ((isReverse == false))
935+ let $t03964539950 = if ((isReverse == false))
882936 then {
883937 let assetOut = getStringOrFail(this, pa())
884938 let assetIn = getStringOrFail(this, aa())
885939 $Tuple2(assetOut, assetIn)
886940 }
887941 else {
888942 let assetOut = getStringOrFail(this, aa())
889943 let assetIn = getStringOrFail(this, pa())
890944 $Tuple2(assetOut, assetIn)
891945 }
892- let assetOut = $t03775038055._1
893- let assetIn = $t03775038055._2
946+ let assetOut = $t03964539950._1
947+ let assetIn = $t03964539950._2
894948 let poolAssetInBalance = getAccBalance(assetIn)
895949 let poolAssetOutBalance = getAccBalance(assetOut)
896950 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
897951 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
898952 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
899953 let checkK = if ((newK >= oldK))
900954 then true
901955 else throw("new K is fewer error")
902956 if ((checkK == checkK))
903957 then $Tuple2(nil, amountOut)
904958 else throw("Strict value is not equal to itself.")
905959 }
906960
907961
908962
909963 @Callable(i)
910964 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
911965 let swapContact = {
912966 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
913967 if ($isInstanceOf(@, "String"))
914968 then @
915969 else throw(($getType(@) + " couldn't be cast to String"))
916970 }
917971 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
918972 then true
919973 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
920974 then true
921975 else throwErr("Permission denied")]
922976 if ((checks == checks))
923977 then {
924978 let pmt = value(i.payments[0])
925979 let assetIn = assetIdToString(pmt.assetId)
926980 let assetOut = if ((isReverse == false))
927981 then getStringOrFail(this, pa())
928982 else getStringOrFail(this, aa())
929983 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
930984 let poolAssetOutBalance = getAccBalance(assetOut)
931985 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
932986 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
933987 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
934988 let checkK = if ((newK >= oldK))
935989 then true
936990 else throw("new K is fewer error")
937991 if ((checkK == checkK))
938992 then {
939993 let checkMin = if ((amountOut >= amountOutMin))
940994 then true
941995 else throw("Exchange result is fewer coins than expected")
942996 if ((checkMin == checkMin))
943997 then {
944998 let lsConf = match getLeaseProxyConfig(assetOut) {
945999 case a: (Boolean, Int, Int, String, String, Int, String) =>
9461000 a
9471001 case _ =>
9481002 throw("error lease config")
9491003 }
950- let $t04006140175 = lsConf
951- let isLeasable = $t04006140175._1
952- let leasedRatio = $t04006140175._2
953- let minBalance = $t04006140175._3
954- let proxyAddress = $t04006140175._4
955- let proxyAssetId = $t04006140175._5
956- let proxyRateMul = $t04006140175._6
957- let stakingProfitAddress = $t04006140175._7
958- let assetOnPool = assetBalance(this, fromBase58String(assetOut))
959- let amountOfProfit = if (if ((assetOut == "WAVES"))
960- then (amountOut > assetOnPool)
961- else false)
1004+ let withdrawState = getWithdrawAssetState(assetOut, amountOut)
1005+ if ((withdrawState == withdrawState))
9621006 then {
963- let amountDiff = (amountOut - assetOnPool)
964- let oldRatio = (getAdditionalBalance(assetOut) / getStakingAssetBalance(sWavesId()))
965- let oldWavesRoughBalane = wavesBalance(this).available
966- let wd = invoke(this, "withdraw", [assetOut, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil)
967- if ((wd == wd))
968- then {
969- let newWavesRoughBalane = wavesBalance(this).available
970- let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane)
971- (wavesDiff - amountDiff)
972- }
1007+ let reb = invoke(this, "rebalance", nil, nil)
1008+ if ((reb == reb))
1009+ then $Tuple2((withdrawState ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
9731010 else throw("Strict value is not equal to itself.")
9741011 }
975- else 0
976- let reb = invoke(this, "rebalance", nil, nil)
977- if ((reb == reb))
978- then $Tuple2([ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit), ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut)
9791012 else throw("Strict value is not equal to itself.")
9801013 }
9811014 else throw("Strict value is not equal to itself.")
9821015 }
9831016 else throw("Strict value is not equal to itself.")
9841017 }
9851018 else throw("Strict value is not equal to itself.")
9861019 }
9871020
9881021
9891022
9901023 @Callable(i)
9911024 func setManager (pendingManagerPublicKey) = {
9921025 let checkCaller = mustManager(i)
9931026 if ((checkCaller == checkCaller))
9941027 then {
9951028 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
9961029 if ((checkManagerPublicKey == checkManagerPublicKey))
9971030 then [StringEntry(pmpk(), pendingManagerPublicKey)]
9981031 else throw("Strict value is not equal to itself.")
9991032 }
10001033 else throw("Strict value is not equal to itself.")
10011034 }
10021035
10031036
10041037
10051038 @Callable(i)
10061039 func confirmManager () = {
10071040 let pm = pendingManagerPublicKeyOrUnit()
10081041 let hasPM = if (isDefined(pm))
10091042 then true
10101043 else throw("No pending manager")
10111044 if ((hasPM == hasPM))
10121045 then {
10131046 let checkPM = if ((i.callerPublicKey == value(pm)))
10141047 then true
10151048 else throw("You are not pending manager")
10161049 if ((checkPM == checkPM))
10171050 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
10181051 else throw("Strict value is not equal to itself.")
10191052 }
10201053 else throw("Strict value is not equal to itself.")
10211054 }
10221055
10231056
10241057
10251058 @Callable(i)
10261059 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10271060 then throw("Invalid slippageTolerance passed")
10281061 else {
10291062 let estPut = commonPut(i, slippageTolerance, true)
10301063 let emitLpAmt = estPut._2
10311064 let lpAssetId = estPut._7
10321065 let state = estPut._9
10331066 let amDiff = estPut._10
10341067 let prDiff = estPut._11
10351068 let amId = estPut._12
10361069 let prId = estPut._13
10371070 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10381071 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10391072 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10401073 if ((currentKLp == currentKLp))
10411074 then {
10421075 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10431076 if ((emitInv == emitInv))
10441077 then {
10451078 let emitInvLegacy = match emitInv {
10461079 case legacyFactoryContract: Address =>
10471080 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10481081 case _ =>
10491082 unit
10501083 }
10511084 if ((emitInvLegacy == emitInvLegacy))
10521085 then {
10531086 let slippageAInv = if ((amDiff > 0))
10541087 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10551088 else nil
10561089 if ((slippageAInv == slippageAInv))
10571090 then {
10581091 let slippagePInv = if ((prDiff > 0))
10591092 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10601093 else nil
10611094 if ((slippagePInv == slippagePInv))
10621095 then {
10631096 let lpTransfer = if (shouldAutoStake)
10641097 then {
10651098 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10661099 if ((slpStakeInv == slpStakeInv))
10671100 then nil
10681101 else throw("Strict value is not equal to itself.")
10691102 }
10701103 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1071- let $t04398644448 = refreshKLpInternal(0, 0, 0)
1072- if (($t04398644448 == $t04398644448))
1104+ let $t04515145613 = refreshKLpInternal(0, 0, 0)
1105+ if (($t04515145613 == $t04515145613))
10731106 then {
1074- let updatedKLp = $t04398644448._2
1075- let refreshKLpActions = $t04398644448._1
1107+ let updatedKLp = $t04515145613._2
1108+ let refreshKLpActions = $t04515145613._1
10761109 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10771110 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10781111 then ((state ++ lpTransfer) ++ refreshKLpActions)
10791112 else throw("Strict value is not equal to itself.")
10801113 }
10811114 else throw("Strict value is not equal to itself.")
10821115 }
10831116 else throw("Strict value is not equal to itself.")
10841117 }
10851118 else throw("Strict value is not equal to itself.")
10861119 }
10871120 else throw("Strict value is not equal to itself.")
10881121 }
10891122 else throw("Strict value is not equal to itself.")
10901123 }
10911124 else throw("Strict value is not equal to itself.")
10921125 }
10931126
10941127
10951128
10961129 @Callable(i)
10971130 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10981131 then throw("Invalid value passed")
10991132 else {
11001133 let estPut = commonPut(i, maxSlippage, false)
11011134 let state = estPut._9
11021135 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
11031136 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
11041137 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11051138 if ((currentKLp == currentKLp))
11061139 then {
1107- let $t04501045075 = refreshKLpInternal(0, 0, 0)
1108- let refreshKLpActions = $t04501045075._1
1109- let updatedKLp = $t04501045075._2
1140+ let $t04617546240 = refreshKLpInternal(0, 0, 0)
1141+ let refreshKLpActions = $t04617546240._1
1142+ let updatedKLp = $t04617546240._2
11101143 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11111144 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11121145 then (state ++ refreshKLpActions)
11131146 else throw("Strict value is not equal to itself.")
11141147 }
11151148 else throw("Strict value is not equal to itself.")
11161149 }
11171150
11181151
11191152
11201153 @Callable(i)
11211154 func putOneTkn (minOutAmount,autoStake) = {
11221155 let isPoolOneTokenOperationsDisabled = {
11231156 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11241157 if ($isInstanceOf(@, "Boolean"))
11251158 then @
11261159 else throw(($getType(@) + " couldn't be cast to Boolean"))
11271160 }
11281161 let isPutDisabled = if (if (if (isGlobalShutdown())
11291162 then true
11301163 else (cfgPoolStatus == PoolPutDisabled))
11311164 then true
11321165 else (cfgPoolStatus == PoolShutdown))
11331166 then true
11341167 else isPoolOneTokenOperationsDisabled
11351168 let checks = [if (if (!(isPutDisabled))
11361169 then true
11371170 else isManager(i))
11381171 then true
11391172 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11401173 then true
11411174 else throwErr("exactly 1 payment are expected")]
11421175 if ((checks == checks))
11431176 then {
11441177 let payment = i.payments[0]
11451178 let paymentAssetId = payment.assetId
11461179 let paymentAmountRaw = payment.amount
11471180 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11481181 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11491182 else if ((paymentAssetId == cfgPriceAssetId))
11501183 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11511184 else throwErr("payment asset is not supported")
11521185 if ((currentKLp == currentKLp))
11531186 then {
11541187 let userAddress = i.caller
11551188 let txId = i.transactionId
1156- let $t04626346415 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1157- if (($t04626346415 == $t04626346415))
1189+ let $t04742847580 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1190+ if (($t04742847580 == $t04742847580))
11581191 then {
1159- let paymentInAmountAsset = $t04626346415._5
1160- let bonus = $t04626346415._4
1161- let feeAmount = $t04626346415._3
1162- let commonState = $t04626346415._2
1163- let emitAmountEstimated = $t04626346415._1
1192+ let paymentInAmountAsset = $t04742847580._5
1193+ let bonus = $t04742847580._4
1194+ let feeAmount = $t04742847580._3
1195+ let commonState = $t04742847580._2
1196+ let emitAmountEstimated = $t04742847580._1
11641197 let emitAmount = if (if ((minOutAmount > 0))
11651198 then (minOutAmount > emitAmountEstimated)
11661199 else false)
11671200 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11681201 else emitAmountEstimated
11691202 let emitInv = emit(emitAmount)
11701203 if ((emitInv == emitInv))
11711204 then {
11721205 let lpTransfer = if (autoStake)
11731206 then {
11741207 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11751208 if ((stakeInv == stakeInv))
11761209 then nil
11771210 else throw("Strict value is not equal to itself.")
11781211 }
11791212 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11801213 let sendFee = if ((feeAmount > 0))
11811214 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11821215 else nil
1183- let $t04700147198 = if ((this == feeCollectorAddress))
1216+ let $t04816648363 = if ((this == feeCollectorAddress))
11841217 then $Tuple2(0, 0)
11851218 else if (paymentInAmountAsset)
11861219 then $Tuple2(-(feeAmount), 0)
11871220 else $Tuple2(0, -(feeAmount))
1188- let amountAssetBalanceDelta = $t04700147198._1
1189- let priceAssetBalanceDelta = $t04700147198._2
1190- let $t04720147309 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1191- let refreshKLpActions = $t04720147309._1
1192- let updatedKLp = $t04720147309._2
1221+ let amountAssetBalanceDelta = $t04816648363._1
1222+ let priceAssetBalanceDelta = $t04816648363._2
1223+ let $t04836648474 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1224+ let refreshKLpActions = $t04836648474._1
1225+ let updatedKLp = $t04836648474._2
11931226 let kLp = value(getString(keyKLp))
11941227 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11951228 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11961229 then {
11971230 let reb = invoke(this, "rebalance", nil, nil)
11981231 if ((reb == reb))
11991232 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
12001233 else throw("Strict value is not equal to itself.")
12011234 }
12021235 else throw("Strict value is not equal to itself.")
12031236 }
12041237 else throw("Strict value is not equal to itself.")
12051238 }
12061239 else throw("Strict value is not equal to itself.")
12071240 }
12081241 else throw("Strict value is not equal to itself.")
12091242 }
12101243 else throw("Strict value is not equal to itself.")
12111244 }
12121245
12131246
12141247
12151248 @Callable(i)
12161249 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1217- let $t04766447821 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1218- let emitAmountEstimated = $t04766447821._1
1219- let commonState = $t04766447821._2
1220- let feeAmount = $t04766447821._3
1221- let bonus = $t04766447821._4
1222- let paymentInAmountAsset = $t04766447821._5
1250+ let $t04882948986 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1251+ let emitAmountEstimated = $t04882948986._1
1252+ let commonState = $t04882948986._2
1253+ let feeAmount = $t04882948986._3
1254+ let bonus = $t04882948986._4
1255+ let paymentInAmountAsset = $t04882948986._5
12231256 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12241257 }
12251258
12261259
12271260
12281261 @Callable(i)
12291262 func getOneTkn (outAssetIdStr,minOutAmount) = {
12301263 let isPoolOneTokenOperationsDisabled = {
12311264 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12321265 if ($isInstanceOf(@, "Boolean"))
12331266 then @
12341267 else throw(($getType(@) + " couldn't be cast to Boolean"))
12351268 }
12361269 let isGetDisabled = if (if (isGlobalShutdown())
12371270 then true
12381271 else (cfgPoolStatus == PoolShutdown))
12391272 then true
12401273 else isPoolOneTokenOperationsDisabled
12411274 let checks = [if (if (!(isGetDisabled))
12421275 then true
12431276 else isManager(i))
12441277 then true
12451278 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12461279 then true
12471280 else throwErr("exactly 1 payment are expected")]
12481281 if ((checks == checks))
12491282 then {
12501283 let outAssetId = parseAssetId(outAssetIdStr)
12511284 let payment = i.payments[0]
12521285 let paymentAssetId = payment.assetId
12531286 let paymentAmount = payment.amount
12541287 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12551288 if ((currentKLp == currentKLp))
12561289 then {
12571290 let userAddress = i.caller
12581291 let txId = i.transactionId
1259- let $t04870648859 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1260- if (($t04870648859 == $t04870648859))
1292+ let $t04987150024 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1293+ if (($t04987150024 == $t04987150024))
12611294 then {
1262- let outInAmountAsset = $t04870648859._5
1263- let bonus = $t04870648859._4
1264- let feeAmount = $t04870648859._3
1265- let commonState = $t04870648859._2
1266- let amountEstimated = $t04870648859._1
1295+ let outInAmountAsset = $t04987150024._5
1296+ let bonus = $t04987150024._4
1297+ let feeAmount = $t04987150024._3
1298+ let commonState = $t04987150024._2
1299+ let amountEstimated = $t04987150024._1
12671300 let amount = if (if ((minOutAmount > 0))
12681301 then (minOutAmount > amountEstimated)
12691302 else false)
12701303 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12711304 else amountEstimated
12721305 let lsConf = match getLeaseProxyConfig(outAssetIdStr) {
12731306 case a: (Boolean, Int, Int, String, String, Int, String) =>
12741307 a
12751308 case _ =>
12761309 throw("error lease config")
12771310 }
1278- let $t04924349357 = lsConf
1279- let isLeasable = $t04924349357._1
1280- let leasedRatio = $t04924349357._2
1281- let minBalance = $t04924349357._3
1282- let proxyAddress = $t04924349357._4
1283- let proxyAssetId = $t04924349357._5
1284- let proxyRateMul = $t04924349357._6
1285- let stakingProfitAddress = $t04924349357._7
1286- let assetOnPool = assetBalance(this, fromBase58String(outAssetIdStr))
1287- let amountOfProfit = if (if ((outAssetIdStr == "WAVES"))
1288- then (amount > assetOnPool)
1289- else false)
1290- then {
1291- let amountDiff = (amount - assetOnPool)
1292- let oldRatio = (getAdditionalBalance(outAssetIdStr) / getStakingAssetBalance(sWavesId()))
1293- let oldWavesRoughBalane = wavesBalance(this).available
1294- let wd = invoke(this, "withdraw", [outAssetIdStr, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil)
1295- if ((wd == wd))
1296- then {
1297- let newWavesRoughBalane = wavesBalance(this).available
1298- let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane)
1299- (wavesDiff - amountDiff)
1300- }
1301- else throw("Strict value is not equal to itself.")
1302- }
1303- else 0
1304- let profitTransfer = [ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit)]
13051311 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
13061312 if ((burnInv == burnInv))
13071313 then {
1308- let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
1309- let sendFee = if ((feeAmount > 0))
1310- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1311- else nil
1312- let $t05039650643 = {
1313- let feeAmountForCalc = if ((this == feeCollectorAddress))
1314- then 0
1315- else feeAmount
1316- if (outInAmountAsset)
1317- then $Tuple2(-((amount + feeAmountForCalc)), 0)
1318- else $Tuple2(0, -((amount + feeAmountForCalc)))
1319- }
1320- let amountAssetBalanceDelta = $t05039650643._1
1321- let priceAssetBalanceDelta = $t05039650643._2
1322- let $t05064650754 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1323- let refreshKLpActions = $t05064650754._1
1324- let updatedKLp = $t05064650754._2
1325- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1326- if ((isUpdatedKLpValid == isUpdatedKLpValid))
1314+ let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
1315+ if ((withdrawState == withdrawState))
13271316 then {
1328- let reb = invoke(this, "rebalance", nil, nil)
1329- if ((reb == reb))
1330- then $Tuple2(((((commonState ++ assetTransfer) ++ profitTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1317+ let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
1318+ let sendFee = if ((feeAmount > 0))
1319+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1320+ else nil
1321+ let $t05078051027 = {
1322+ let feeAmountForCalc = if ((this == feeCollectorAddress))
1323+ then 0
1324+ else feeAmount
1325+ if (outInAmountAsset)
1326+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
1327+ else $Tuple2(0, -((amount + feeAmountForCalc)))
1328+ }
1329+ let amountAssetBalanceDelta = $t05078051027._1
1330+ let priceAssetBalanceDelta = $t05078051027._2
1331+ let $t05103051138 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1332+ let refreshKLpActions = $t05103051138._1
1333+ let updatedKLp = $t05103051138._2
1334+ let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1335+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1336+ then {
1337+ let reb = invoke(this, "rebalance", nil, nil)
1338+ if ((reb == reb))
1339+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1340+ else throw("Strict value is not equal to itself.")
1341+ }
13311342 else throw("Strict value is not equal to itself.")
13321343 }
13331344 else throw("Strict value is not equal to itself.")
13341345 }
13351346 else throw("Strict value is not equal to itself.")
13361347 }
13371348 else throw("Strict value is not equal to itself.")
13381349 }
13391350 else throw("Strict value is not equal to itself.")
13401351 }
13411352 else throw("Strict value is not equal to itself.")
13421353 }
13431354
13441355
13451356
13461357 @Callable(i)
13471358 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1348- let $t05108151237 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1349- let amountEstimated = $t05108151237._1
1350- let commonState = $t05108151237._2
1351- let feeAmount = $t05108151237._3
1352- let bonus = $t05108151237._4
1353- let outInAmountAsset = $t05108151237._5
1359+ let $t05144351599 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1360+ let amountEstimated = $t05144351599._1
1361+ let commonState = $t05144351599._2
1362+ let feeAmount = $t05144351599._3
1363+ let bonus = $t05144351599._4
1364+ let outInAmountAsset = $t05144351599._5
13541365 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13551366 }
13561367
13571368
13581369
13591370 @Callable(i)
13601371 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13611372 let isPoolOneTokenOperationsDisabled = {
13621373 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13631374 if ($isInstanceOf(@, "Boolean"))
13641375 then @
13651376 else throw(($getType(@) + " couldn't be cast to Boolean"))
13661377 }
13671378 let isGetDisabled = if (if (isGlobalShutdown())
13681379 then true
13691380 else (cfgPoolStatus == PoolShutdown))
13701381 then true
13711382 else isPoolOneTokenOperationsDisabled
13721383 let checks = [if (if (!(isGetDisabled))
13731384 then true
13741385 else isManager(i))
13751386 then true
13761387 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13771388 then true
13781389 else throwErr("no payments are expected")]
13791390 if ((checks == checks))
13801391 then {
13811392 let outAssetId = parseAssetId(outAssetIdStr)
13821393 let userAddress = i.caller
13831394 let txId = i.transactionId
13841395 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13851396 if ((currentKLp == currentKLp))
13861397 then {
13871398 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13881399 if ((unstakeInv == unstakeInv))
13891400 then {
1390- let $t05214252293 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1391- if (($t05214252293 == $t05214252293))
1401+ let $t05250452655 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1402+ if (($t05250452655 == $t05250452655))
13921403 then {
1393- let outInAmountAsset = $t05214252293._5
1394- let bonus = $t05214252293._4
1395- let feeAmount = $t05214252293._3
1396- let commonState = $t05214252293._2
1397- let amountEstimated = $t05214252293._1
1404+ let outInAmountAsset = $t05250452655._5
1405+ let bonus = $t05250452655._4
1406+ let feeAmount = $t05250452655._3
1407+ let commonState = $t05250452655._2
1408+ let amountEstimated = $t05250452655._1
13981409 let amount = if (if ((minOutAmount > 0))
13991410 then (minOutAmount > amountEstimated)
14001411 else false)
14011412 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
14021413 else amountEstimated
14031414 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
14041415 if ((burnInv == burnInv))
14051416 then {
1406- let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
1407- let sendFee = if ((feeAmount > 0))
1408- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1409- else nil
1410- let $t05278853035 = {
1411- let feeAmountForCalc = if ((this == feeCollectorAddress))
1412- then 0
1413- else feeAmount
1414- if (outInAmountAsset)
1415- then $Tuple2(-((amount + feeAmountForCalc)), 0)
1416- else $Tuple2(0, -((amount + feeAmountForCalc)))
1417- }
1418- let amountAssetBalanceDelta = $t05278853035._1
1419- let priceAssetBalanceDelta = $t05278853035._2
1420- let $t05303853146 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1421- let refreshKLpActions = $t05303853146._1
1422- let updatedKLp = $t05303853146._2
1423- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1424- if ((isUpdatedKLpValid == isUpdatedKLpValid))
1425- then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1417+ let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
1418+ if ((withdrawState == withdrawState))
1419+ then {
1420+ let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
1421+ let sendFee = if ((feeAmount > 0))
1422+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1423+ else nil
1424+ let $t05322053467 = {
1425+ let feeAmountForCalc = if ((this == feeCollectorAddress))
1426+ then 0
1427+ else feeAmount
1428+ if (outInAmountAsset)
1429+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
1430+ else $Tuple2(0, -((amount + feeAmountForCalc)))
1431+ }
1432+ let amountAssetBalanceDelta = $t05322053467._1
1433+ let priceAssetBalanceDelta = $t05322053467._2
1434+ let $t05347053578 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1435+ let refreshKLpActions = $t05347053578._1
1436+ let updatedKLp = $t05347053578._2
1437+ let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1438+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1439+ then {
1440+ let reb = invoke(this, "rebalance", nil, nil)
1441+ if ((reb == reb))
1442+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1443+ else throw("Strict value is not equal to itself.")
1444+ }
1445+ else throw("Strict value is not equal to itself.")
1446+ }
14261447 else throw("Strict value is not equal to itself.")
14271448 }
14281449 else throw("Strict value is not equal to itself.")
14291450 }
14301451 else throw("Strict value is not equal to itself.")
14311452 }
14321453 else throw("Strict value is not equal to itself.")
14331454 }
14341455 else throw("Strict value is not equal to itself.")
14351456 }
14361457 else throw("Strict value is not equal to itself.")
14371458 }
14381459
14391460
14401461
14411462 @Callable(i)
14421463 func get () = {
14431464 let res = commonGet(i)
14441465 let outAmtAmt = res._1
14451466 let outPrAmt = res._2
14461467 let pmtAmt = res._3
14471468 let pmtAssetId = res._4
14481469 let state = res._5
14491470 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14501471 if ((currentKLp == currentKLp))
14511472 then {
14521473 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14531474 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14541475 then {
1455- let $t05409254174 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1456- let refreshKLpActions = $t05409254174._1
1457- let updatedKLp = $t05409254174._2
1476+ let $t05459254674 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1477+ let refreshKLpActions = $t05459254674._1
1478+ let updatedKLp = $t05459254674._2
14581479 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14591480 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14601481 then (state ++ refreshKLpActions)
14611482 else throw("Strict value is not equal to itself.")
14621483 }
14631484 else throw("Strict value is not equal to itself.")
14641485 }
14651486 else throw("Strict value is not equal to itself.")
14661487 }
14671488
14681489
14691490
14701491 @Callable(i)
14711492 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14721493 let res = commonGet(i)
14731494 let outAmAmt = res._1
14741495 let outPrAmt = res._2
14751496 let pmtAmt = res._3
14761497 let pmtAssetId = res._4
14771498 let state = res._5
14781499 if ((noLessThenAmtAsset > outAmAmt))
14791500 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14801501 else if ((noLessThenPriceAsset > outPrAmt))
14811502 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14821503 else {
14831504 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14841505 if ((currentKLp == currentKLp))
14851506 then {
14861507 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14871508 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14881509 then {
1489- let $t05512355204 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1490- let refreshKLpActions = $t05512355204._1
1491- let updatedKLp = $t05512355204._2
1510+ let $t05562355704 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1511+ let refreshKLpActions = $t05562355704._1
1512+ let updatedKLp = $t05562355704._2
14921513 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14931514 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14941515 then (state ++ refreshKLpActions)
14951516 else throw("Strict value is not equal to itself.")
14961517 }
14971518 else throw("Strict value is not equal to itself.")
14981519 }
14991520 else throw("Strict value is not equal to itself.")
15001521 }
15011522 }
15021523
15031524
15041525
15051526 @Callable(i)
15061527 func unstakeAndGet (amount) = {
15071528 let checkPayments = if ((size(i.payments) != 0))
15081529 then throw("No payments are expected")
15091530 else true
15101531 if ((checkPayments == checkPayments))
15111532 then {
15121533 let cfg = getPoolConfig()
15131534 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
15141535 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15151536 if ((currentKLp == currentKLp))
15161537 then {
15171538 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
15181539 if ((unstakeInv == unstakeInv))
15191540 then {
15201541 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
15211542 let outAmAmt = res._1
15221543 let outPrAmt = res._2
15231544 let poolStatus = parseIntValue(res._9)
15241545 let state = res._10
15251546 let checkPoolStatus = if (if (isGlobalShutdown())
15261547 then true
15271548 else (poolStatus == PoolShutdown))
15281549 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
15291550 else true
15301551 if ((checkPoolStatus == checkPoolStatus))
15311552 then {
15321553 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15331554 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15341555 then {
1535- let $t05633056411 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1536- let refreshKLpActions = $t05633056411._1
1537- let updatedKLp = $t05633056411._2
1556+ let $t05683056911 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1557+ let refreshKLpActions = $t05683056911._1
1558+ let updatedKLp = $t05683056911._2
15381559 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15391560 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15401561 then (state ++ refreshKLpActions)
15411562 else throw("Strict value is not equal to itself.")
15421563 }
15431564 else throw("Strict value is not equal to itself.")
15441565 }
15451566 else throw("Strict value is not equal to itself.")
15461567 }
15471568 else throw("Strict value is not equal to itself.")
15481569 }
15491570 else throw("Strict value is not equal to itself.")
15501571 }
15511572 else throw("Strict value is not equal to itself.")
15521573 }
15531574
15541575
15551576
15561577 @Callable(i)
15571578 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15581579 let isGetDisabled = if (isGlobalShutdown())
15591580 then true
15601581 else (cfgPoolStatus == PoolShutdown)
15611582 let checks = [if (!(isGetDisabled))
15621583 then true
15631584 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15641585 then true
15651586 else throw("no payments are expected")]
15661587 if ((checks == checks))
15671588 then {
15681589 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15691590 if ((currentKLp == currentKLp))
15701591 then {
15711592 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15721593 if ((unstakeInv == unstakeInv))
15731594 then {
15741595 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15751596 let outAmAmt = res._1
15761597 let outPrAmt = res._2
15771598 let state = res._10
15781599 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15791600 then true
15801601 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15811602 then true
15821603 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15831604 if ((checkAmounts == checkAmounts))
15841605 then {
15851606 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15861607 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15871608 then {
1588- let $t05770657787 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1589- let refreshKLpActions = $t05770657787._1
1590- let updatedKLp = $t05770657787._2
1609+ let $t05820658287 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1610+ let refreshKLpActions = $t05820658287._1
1611+ let updatedKLp = $t05820658287._2
15911612 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15921613 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15931614 then (state ++ refreshKLpActions)
15941615 else throw("Strict value is not equal to itself.")
15951616 }
15961617 else throw("Strict value is not equal to itself.")
15971618 }
15981619 else throw("Strict value is not equal to itself.")
15991620 }
16001621 else throw("Strict value is not equal to itself.")
16011622 }
16021623 else throw("Strict value is not equal to itself.")
16031624 }
16041625 else throw("Strict value is not equal to itself.")
16051626 }
16061627
16071628
16081629
16091630 @Callable(i)
16101631 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
16111632 then throw("permissions denied")
16121633 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
16131634
16141635
16151636
16161637 @Callable(i)
16171638 func refreshKLp () = {
16181639 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
16191640 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
16201641 then unit
16211642 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
16221643 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
16231644 then {
16241645 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1625- let $t05897459038 = refreshKLpInternal(0, 0, 0)
1626- let kLpUpdateActions = $t05897459038._1
1627- let updatedKLp = $t05897459038._2
1646+ let $t05947459538 = refreshKLpInternal(0, 0, 0)
1647+ let kLpUpdateActions = $t05947459538._1
1648+ let updatedKLp = $t05947459538._2
16281649 let actions = if ((kLp != updatedKLp))
16291650 then kLpUpdateActions
16301651 else throwErr("nothing to refresh")
16311652 $Tuple2(actions, toString(updatedKLp))
16321653 }
16331654 else throw("Strict value is not equal to itself.")
16341655 }
16351656
16361657
16371658
16381659 @Callable(i)
16391660 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
16401661
16411662
16421663
16431664 @Callable(i)
16441665 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16451666
16461667
16471668
16481669 @Callable(i)
16491670 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16501671 let prices = calcPrices(amAmt, prAmt, lpAmt)
16511672 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16521673 }
16531674
16541675
16551676
16561677 @Callable(i)
16571678 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16581679
16591680
16601681
16611682 @Callable(i)
16621683 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16631684
16641685
16651686
16661687 @Callable(i)
16671688 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16681689
16691690
16701691
16711692 @Callable(i)
16721693 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16731694
16741695
16751696
16761697 @Callable(i)
16771698 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16781699 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16791700 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16801701 }
16811702
16821703
16831704
16841705 @Callable(i)
16851706 func statsREADONLY () = {
16861707 let cfg = getPoolConfig()
16871708 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16881709 let amtAssetId = cfg[idxAmtAssetId]
16891710 let priceAssetId = cfg[idxPriceAssetId]
16901711 let iAmtAssetId = cfg[idxIAmtAssetId]
16911712 let iPriceAssetId = cfg[idxIPriceAssetId]
16921713 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16931714 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16941715 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16951716 let accAmtAssetBalance = getAccBalance(amtAssetId)
16961717 let accPriceAssetBalance = getAccBalance(priceAssetId)
16971718 let pricesList = if ((poolLPBalance == 0))
16981719 then [zeroBigInt, zeroBigInt, zeroBigInt]
16991720 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
17001721 let curPrice = 0
17011722 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
17021723 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
17031724 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
17041725 $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))
17051726 }
17061727
17071728
17081729
17091730 @Callable(i)
17101731 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
17111732 let cfg = getPoolConfig()
17121733 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17131734 let amAssetIdStr = cfg[idxAmtAssetId]
17141735 let amAssetId = fromBase58String(amAssetIdStr)
17151736 let prAssetIdStr = cfg[idxPriceAssetId]
17161737 let prAssetId = fromBase58String(prAssetIdStr)
17171738 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17181739 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17191740 let poolStatus = cfg[idxPoolStatus]
17201741 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17211742 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
17221743 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
17231744 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
17241745 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
17251746 let curPriceX18 = if ((poolLPBalance == 0))
17261747 then zeroBigInt
17271748 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
17281749 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
17291750 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
17301751 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
17311752 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17321753 let calcLpAmt = estPut._1
17331754 let curPriceCalc = estPut._3
17341755 let amBalance = estPut._4
17351756 let prBalance = estPut._5
17361757 let lpEmission = estPut._6
17371758 $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))
17381759 }
17391760
17401761
17411762
17421763 @Callable(i)
17431764 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17441765 let cfg = getPoolConfig()
17451766 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17461767 let amAssetIdStr = cfg[idxAmtAssetId]
17471768 let amAssetId = fromBase58String(amAssetIdStr)
17481769 let prAssetIdStr = cfg[idxPriceAssetId]
17491770 let prAssetId = fromBase58String(prAssetIdStr)
17501771 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17511772 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17521773 let poolStatus = cfg[idxPoolStatus]
17531774 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17541775 let amBalanceRaw = getAccBalance(amAssetIdStr)
17551776 let prBalanceRaw = getAccBalance(prAssetIdStr)
17561777 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17571778 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17581779 let curPriceX18 = if ((poolLPBalance == 0))
17591780 then zeroBigInt
17601781 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17611782 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17621783 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17631784 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17641785 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17651786 let calcLpAmt = estPut._1
17661787 let curPriceCalc = estPut._3
17671788 let amBalance = estPut._4
17681789 let prBalance = estPut._5
17691790 let lpEmission = estPut._6
17701791 $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))
17711792 }
17721793
17731794
17741795
17751796 @Callable(i)
17761797 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17771798 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17781799 let outAmAmt = res._1
17791800 let outPrAmt = res._2
17801801 let amBalance = res._5
17811802 let prBalance = res._6
17821803 let lpEmission = res._7
17831804 let curPrice = res._8
17841805 let poolStatus = parseIntValue(res._9)
17851806 $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))
17861807 }
17871808
17881809
17891810 @Verifier(tx)
17901811 func verify () = {
17911812 let targetPublicKey = match managerPublicKeyOrUnit() {
17921813 case pk: ByteVector =>
17931814 pk
17941815 case _: Unit =>
17951816 tx.senderPublicKey
17961817 case _ =>
17971818 throw("Match error")
17981819 }
17991820 match tx {
18001821 case order: Order =>
18011822 let matcherPub = getMatcherPubOrFail()
1802- let $t06770067769 = validateMatcherOrderAllowed(order)
1803- let orderValid = $t06770067769._1
1804- let orderValidInfo = $t06770067769._2
1823+ let $t06820068269 = validateMatcherOrderAllowed(order)
1824+ let orderValid = $t06820068269._1
1825+ let orderValidInfo = $t06820068269._2
18051826 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
18061827 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
18071828 if (if (if (orderValid)
18081829 then senderValid
18091830 else false)
18101831 then matcherValid
18111832 else false)
18121833 then true
18131834 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
18141835 case s: SetScriptTransaction =>
18151836 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
18161837 then true
18171838 else {
18181839 let newHash = blake2b256(value(s.script))
18191840 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
18201841 let currentHash = scriptHash(this)
18211842 if ((allowedHash == newHash))
18221843 then (currentHash != newHash)
18231844 else false
18241845 }
18251846 case _ =>
18261847 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
18271848 }
18281849 }
18291850

github/deemru/w8io/026f985 
229.88 ms