tx · G8EwcKNg9TF91khBUfGoTSXuKTAiYWr1u9uZYpz5dPMB

3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT:  -0.03800000 Waves

2023.04.06 17:30 [2522826] smart account 3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT > SELF 0.00000000 Waves

{ "type": 13, "id": "G8EwcKNg9TF91khBUfGoTSXuKTAiYWr1u9uZYpz5dPMB", "fee": 3800000, "feeAssetId": null, "timestamp": 1680791428447, "version": 2, "chainId": 84, "sender": "3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT", "senderPublicKey": "AYbpHveq7zviKTDV7SGTB1pZGFbkumgfq3jSwVv6BznT", "proofs": [ "2bLh4zYnDtm1fr3Pcw87S4pRnk3hkskKn5Z4F7i9akUyuZ9dJ2XBQrPK6F5518jCiododPNNS7CwXfgKKY8tfi9p" ], "script": "base64:BgLiLwgCEgUKAwEEARIHCgUBBAEIARIDCgEIEgASBAoCAQQSAwoBARIECgIBBBIECgIIARIECgIIARIECgIIARIFCgMBCAESABIECgIBARIDCgEBEgUKAwEBARIECgIICBIAEgASAwoBCBIFCgMBAQESBAoCAQESBAoCCAESBAoCCAgSCwoJCAEBAgECCAQEEgYKBAgIAQgSABIDCgEBEgMKAQESBAoCCAEiCmxQZGVjaW1hbHMiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgt3YXZlc1N0cmluZyIDU0VQIgpQb29sQWN0aXZlIg9Qb29sUHV0RGlzYWJsZWQiE1Bvb2xNYXRjaGVyRGlzYWJsZWQiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiDWlkeFBvb2xTdGF0dXMiEGlkeFBvb2xMUEFzc2V0SWQiDWlkeEFtdEFzc2V0SWQiD2lkeFByaWNlQXNzZXRJZCIOaWR4QW10QXNzZXREY20iEGlkeFByaWNlQXNzZXREY20iDmlkeElBbXRBc3NldElkIhBp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FAmRBD3NlbmRlclB1YmxpY0tleQQCYUcJAPQDAwgFAmRBCWJvZHlCeXRlcwkAkQMCCAUCZEEGcHJvb2ZzAAEFAmhjAwMDBQJhRAUCYUYHBQJhRwcGCQECYUMEBQJhRAUCYUUFAmFGBQJhRwMJAAECBQJkVwIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAmZhBQJkVwMJAPQDAwgFAmdaCWJvZHlCeXRlcwkAkQMCCAUCZ1oGcHJvb2ZzAAAFAmhiBgQCaGUJAPYDAQkBBXZhbHVlAQgFAmZhBnNjcmlwdAQCaGYJANsEAQkBBXZhbHVlAQkAnQgCBQJhTwkBAmFBAAQCaGcJAPEHAQUEdGhpcwMJAAACBQJoZgUCaGUJAQIhPQIFAmhnBQJoZQcJAPQDAwgFAmdaCWJvZHlCeXRlcwkAkQMCCAUCZ1oGcHJvb2ZzAAAFAmhiqF/ylA==", "height": 2522826, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GU5aE7V6jPwbkLUyZVnQ5me7AygDLVZYmTp19ByKQSnA Next: FtYdWNsBnsCHAa2Hr7nJ8Y7rBRSAsh7r6DbKXPaDw7CR Diff:
OldNewDifferences
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133-func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134-
135-
136-func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137-
138-
139-func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
140-
141-
142-func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
143-
144-
145133 func keyFactoryConfig () = "%s__factoryConfig"
146134
147135
231219
232220 let poolConfigParsed = parsePoolConfig(getPoolConfig())
233221
234-let $t089629128 = poolConfigParsed
222+let $t084698635 = poolConfigParsed
235223
236-let cfgPoolAddress = $t089629128._1
224+let cfgPoolAddress = $t084698635._1
237225
238-let cfgPoolStatus = $t089629128._2
226+let cfgPoolStatus = $t084698635._2
239227
240-let cfgLpAssetId = $t089629128._3
228+let cfgLpAssetId = $t084698635._3
241229
242-let cfgAmountAssetId = $t089629128._4
230+let cfgAmountAssetId = $t084698635._4
243231
244-let cfgPriceAssetId = $t089629128._5
232+let cfgPriceAssetId = $t084698635._5
245233
246-let cfgAmountAssetDecimals = $t089629128._6
234+let cfgAmountAssetDecimals = $t084698635._6
247235
248-let cfgPriceAssetDecimals = $t089629128._7
236+let cfgPriceAssetDecimals = $t084698635._7
249237
250238 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
251239
260248 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)
261249
262250
263-func getAccBalance (assetId) = {
264- let balanceOnPool = if ((assetId == "WAVES"))
265- then wavesBalance(this).available
266- else assetBalance(this, fromBase58String(assetId))
267- let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
268- max([0, totalBalance])
269- }
251+func getAccBalance (assetId) = if ((assetId == "WAVES"))
252+ then wavesBalance(this).available
253+ else assetBalance(this, fromBase58String(assetId))
270254
271255
272256 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
273257
274258
275259 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
276-
277-
278-func getRate (proxy) = {
279- let inv = invoke(proxy, "getRate", nil, nil)
280- if ((inv == inv))
281- then match inv {
282- case r: Int =>
283- r
284- case _ =>
285- throwErr("proxy.getRate() unexpected value")
286- }
287- else throw("Strict value is not equal to itself.")
288- }
289-
290-
291-func deposit (assetId,amount,stakingAssetId,proxy) = {
292- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
293- if ((currentAdditionalBalance == currentAdditionalBalance))
294- then {
295- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
296- if ((currentStakingAssetBalance == currentStakingAssetBalance))
297- then {
298- let asset = parseAssetId(assetId)
299- if ((amount > 0))
300- then {
301- let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
302- if ((depositInvoke == depositInvoke))
303- then match depositInvoke {
304- case receivedStakingAsset: Int =>
305- let newAdditionalBalance = (currentAdditionalBalance + amount)
306- let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
307-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
308- case _ =>
309- nil
310- }
311- else throw("Strict value is not equal to itself.")
312- }
313- else nil
314- }
315- else throw("Strict value is not equal to itself.")
316- }
317- else throw("Strict value is not equal to itself.")
318- }
319-
320-
321-func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
322- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
323- if ((currentAdditionalBalance == currentAdditionalBalance))
324- then {
325- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
326- if ((currentStakingAssetBalance == currentStakingAssetBalance))
327- then {
328- let currentProxyRate = getRate(proxy)
329- if ((currentProxyRate == currentProxyRate))
330- then {
331- let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
332- let stakingAsset = parseAssetId(stakingAssetId)
333- let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
334- let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
335- let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
336- if ((sendStakingAssetAmount > 0))
337- then {
338- let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
339- if ((withdrawInvoke == withdrawInvoke))
340- then match withdrawInvoke {
341- case receivedAssets: Int =>
342- let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
343- let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
344-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
345- case _ =>
346- nil
347- }
348- else throw("Strict value is not equal to itself.")
349- }
350- else nil
351- }
352- else throw("Strict value is not equal to itself.")
353- }
354- else throw("Strict value is not equal to itself.")
355- }
356- else throw("Strict value is not equal to itself.")
357- }
358-
359-
360-func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
361- case a: (Boolean, Int, Int, String, String, Int, String) =>
362- a
363- case _ =>
364- throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
365-}
366-
367-
368-func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
369- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
370- if ((currentAdditionalBalance == currentAdditionalBalance))
371- then {
372- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
373- if ((currentStakingAssetBalance == currentStakingAssetBalance))
374- then {
375- let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
376- let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
377- let diff = (currentAdditionalBalance - targetAdditionalBalance)
378- if ((diff == 0))
379- then nil
380- else if ((0 > diff))
381- then {
382- let sendAssetAmount = -(diff)
383- deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
384- }
385- else {
386- let getAssetAmount = diff
387- withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
388- }
389- }
390- else throw("Strict value is not equal to itself.")
391- }
392- else throw("Strict value is not equal to itself.")
393- }
394-
395-
396-func rebalanceAsset (assetId) = {
397- let $t01536415500 = getLeaseProxyConfig(assetId)
398- let isLeasable = $t01536415500._1
399- let leasedRatio = $t01536415500._2
400- let minBalance = $t01536415500._3
401- let proxyAddress = $t01536415500._4
402- let proxyAssetId = $t01536415500._5
403- let proxyRateMul = $t01536415500._6
404- let stakingProfitAddress = $t01536415500._7
405- if (isLeasable)
406- then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
407- else nil
408- }
409-
410-
411-func withdrawAndRebalanceAsset (assetId,getAmount) = {
412- let $t01588916025 = getLeaseProxyConfig(assetId)
413- let isLeasable = $t01588916025._1
414- let leasedRatio = $t01588916025._2
415- let minBalance = $t01588916025._3
416- let proxyAddress = $t01588916025._4
417- let proxyAssetId = $t01588916025._5
418- let proxyRateMul = $t01588916025._6
419- let stakingProfitAddress = $t01588916025._7
420- if (isLeasable)
421- then {
422- let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
423- if ((newTotalLeasableBalance == newTotalLeasableBalance))
424- then {
425- let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
426- if ((newAdditionalBalance == newAdditionalBalance))
427- then {
428- let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
429- if ((withdrawAmount == withdrawAmount))
430- then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
431- else throw("Strict value is not equal to itself.")
432- }
433- else throw("Strict value is not equal to itself.")
434- }
435- else throw("Strict value is not equal to itself.")
436- }
437- else nil
438- }
439-
440-
441-func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
442- let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
443- let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
444- (AmAmtWithdrawState ++ PrAmtWithdrawState)
445- }
446260
447261
448262 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
624438 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
625439 let amountAssetAmount = order.amount
626440 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
627- let $t02815328365 = if ((order.orderType == Buy))
441+ let $t02154121753 = if ((order.orderType == Buy))
628442 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
629443 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
630- let amountAssetBalanceDelta = $t02815328365._1
631- let priceAssetBalanceDelta = $t02815328365._2
444+ let amountAssetBalanceDelta = $t02154121753._1
445+ let priceAssetBalanceDelta = $t02154121753._2
632446 if (if (if (isGlobalShutdown())
633447 then true
634448 else (cfgPoolStatus == PoolMatcherDisabled))
641455 then throw("Wrong order assets.")
642456 else {
643457 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
644- let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
645- let unusedActions = $t02880528905._1
646- let kLpNew = $t02880528905._2
458+ let $t02219322293 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
459+ let unusedActions = $t02219322293._1
460+ let kLpNew = $t02219322293._2
647461 let isOrderValid = (kLpNew >= kLp)
648462 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
649463 $Tuple2(isOrderValid, info)
722536 else if ((paymentAssetId == cfgPriceAssetId))
723537 then false
724538 else throwErr("invalid asset")
725- let $t03201832311 = if (isEval)
539+ let $t02540625699 = if (isEval)
726540 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
727541 else if (paymentInAmountAsset)
728542 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
729543 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
730- let amountBalanceOld = $t03201832311._1
731- let priceBalanceOld = $t03201832311._2
732- let $t03231532464 = if (paymentInAmountAsset)
544+ let amountBalanceOld = $t02540625699._1
545+ let priceBalanceOld = $t02540625699._2
546+ let $t02570325852 = if (paymentInAmountAsset)
733547 then $Tuple2(paymentAmountRaw, 0)
734548 else $Tuple2(0, paymentAmountRaw)
735- let amountAssetAmountRaw = $t03231532464._1
736- let priceAssetAmountRaw = $t03231532464._2
549+ let amountAssetAmountRaw = $t02570325852._1
550+ let priceAssetAmountRaw = $t02570325852._2
737551 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
738552 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
739- let $t03259632660 = takeFee(paymentAmountRaw, inFee)
740- let paymentAmount = $t03259632660._1
741- let feeAmount = $t03259632660._2
553+ let $t02598426048 = takeFee(paymentAmountRaw, inFee)
554+ let paymentAmount = $t02598426048._1
555+ let feeAmount = $t02598426048._2
742556 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
743557 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
744558 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
761575 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
762576 let priceOld = fromX18(priceOldX18, scale8)
763577 let loss = {
764- let $t03434134508 = if (paymentInAmountAsset)
578+ let $t02772927896 = if (paymentInAmountAsset)
765579 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
766580 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
767- let amount = $t03434134508._1
768- let balance = $t03434134508._2
581+ let amount = $t02772927896._1
582+ let balance = $t02772927896._2
769583 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
770584 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
771585 }
805619 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
806620 let redeemedBigInt = toBigInt(paymentAmount)
807621 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
808- let $t03658636642 = takeFee(amountRaw, outFee)
809- let totalAmount = $t03658636642._1
810- let feeAmount = $t03658636642._2
811- let $t03664636872 = if (outInAmountAsset)
622+ let $t02997430030 = takeFee(amountRaw, outFee)
623+ let totalAmount = $t02997430030._1
624+ let feeAmount = $t02997430030._2
625+ let $t03003430260 = if (outInAmountAsset)
812626 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
813627 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
814- let outAmAmount = $t03664636872._1
815- let outPrAmount = $t03664636872._2
816- let amBalanceNew = $t03664636872._3
817- let prBalanceNew = $t03664636872._4
628+ let outAmAmount = $t03003430260._1
629+ let outPrAmount = $t03003430260._2
630+ let amBalanceNew = $t03003430260._3
631+ let prBalanceNew = $t03003430260._4
818632 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
819633 let priceNew = fromX18(priceNewX18, scale8)
820634 let commonState = if (isEval)
880694
881695
882696 @Callable(i)
883-func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
884-
885-
886-
887-@Callable(i)
888697 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
889- let $t03875839063 = if ((isReverse == false))
698+ let $t03197732282 = if ((isReverse == false))
890699 then {
891700 let assetOut = getStringOrFail(this, pa())
892701 let assetIn = getStringOrFail(this, aa())
897706 let assetIn = getStringOrFail(this, pa())
898707 $Tuple2(assetOut, assetIn)
899708 }
900- let assetOut = $t03875839063._1
901- let assetIn = $t03875839063._2
709+ let assetOut = $t03197732282._1
710+ let assetIn = $t03197732282._2
902711 let poolAssetInBalance = getAccBalance(assetIn)
903712 let poolAssetOutBalance = getAccBalance(assetOut)
904713 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
948757 then true
949758 else throw("Exchange result is fewer coins than expected")
950759 if ((checkMin == checkMin))
951- then {
952- let rebalanceState = rebalanceAsset(assetIn)
953- if ((rebalanceState == rebalanceState))
954- then {
955- let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
956- if ((withdrawState == withdrawState))
957- then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
958- else throw("Strict value is not equal to itself.")
959- }
960- else throw("Strict value is not equal to itself.")
961- }
760+ then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut)
962761 else throw("Strict value is not equal to itself.")
963762 }
964763 else throw("Strict value is not equal to itself.")
1049848 else throw("Strict value is not equal to itself.")
1050849 }
1051850 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1052- let $t04410944571 = refreshKLpInternal(0, 0, 0)
1053- if (($t04410944571 == $t04410944571))
851+ let $t03716637628 = refreshKLpInternal(0, 0, 0)
852+ if (($t03716637628 == $t03716637628))
1054853 then {
1055- let updatedKLp = $t04410944571._2
1056- let refreshKLpActions = $t04410944571._1
854+ let updatedKLp = $t03716637628._2
855+ let refreshKLpActions = $t03716637628._1
1057856 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1058857 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1059- then {
1060- let reb = invoke(this, "rebalance", nil, nil)
1061- if ((reb == reb))
1062- then ((state ++ lpTransfer) ++ refreshKLpActions)
1063- else throw("Strict value is not equal to itself.")
1064- }
858+ then ((state ++ lpTransfer) ++ refreshKLpActions)
1065859 else throw("Strict value is not equal to itself.")
1066860 }
1067861 else throw("Strict value is not equal to itself.")
1090884 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
1091885 if ((currentKLp == currentKLp))
1092886 then {
1093- let $t04518345248 = refreshKLpInternal(0, 0, 0)
1094- let refreshKLpActions = $t04518345248._1
1095- let updatedKLp = $t04518345248._2
887+ let $t03819038255 = refreshKLpInternal(0, 0, 0)
888+ let refreshKLpActions = $t03819038255._1
889+ let updatedKLp = $t03819038255._2
1096890 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1097891 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1098892 then (state ++ refreshKLpActions)
1139933 then {
1140934 let userAddress = i.caller
1141935 let txId = i.transactionId
1142- let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1143- if (($t04643646588 == $t04643646588))
936+ let $t03944339595 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
937+ if (($t03944339595 == $t03944339595))
1144938 then {
1145- let paymentInAmountAsset = $t04643646588._5
1146- let bonus = $t04643646588._4
1147- let feeAmount = $t04643646588._3
1148- let commonState = $t04643646588._2
1149- let emitAmountEstimated = $t04643646588._1
939+ let paymentInAmountAsset = $t03944339595._5
940+ let bonus = $t03944339595._4
941+ let feeAmount = $t03944339595._3
942+ let commonState = $t03944339595._2
943+ let emitAmountEstimated = $t03944339595._1
1150944 let emitAmount = if (if ((minOutAmount > 0))
1151945 then (minOutAmount > emitAmountEstimated)
1152946 else false)
1166960 let sendFee = if ((feeAmount > 0))
1167961 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
1168962 else nil
1169- let $t04717447371 = if ((this == feeCollectorAddress))
963+ let $t04018140378 = if ((this == feeCollectorAddress))
1170964 then $Tuple2(0, 0)
1171965 else if (paymentInAmountAsset)
1172966 then $Tuple2(-(feeAmount), 0)
1173967 else $Tuple2(0, -(feeAmount))
1174- let amountAssetBalanceDelta = $t04717447371._1
1175- let priceAssetBalanceDelta = $t04717447371._2
1176- let $t04737447482 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1177- let refreshKLpActions = $t04737447482._1
1178- let updatedKLp = $t04737447482._2
968+ let amountAssetBalanceDelta = $t04018140378._1
969+ let priceAssetBalanceDelta = $t04018140378._2
970+ let $t04038140489 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
971+ let refreshKLpActions = $t04038140489._1
972+ let updatedKLp = $t04038140489._2
1179973 let kLp = value(getString(keyKLp))
1180974 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1181975 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1182- then {
1183- let reb = invoke(this, "rebalance", nil, nil)
1184- if ((reb == reb))
1185- then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
1186- else throw("Strict value is not equal to itself.")
1187- }
976+ then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
1188977 else throw("Strict value is not equal to itself.")
1189978 }
1190979 else throw("Strict value is not equal to itself.")
1200989
1201990 @Callable(i)
1202991 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1203- let $t04783747994 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1204- let emitAmountEstimated = $t04783747994._1
1205- let commonState = $t04783747994._2
1206- let feeAmount = $t04783747994._3
1207- let bonus = $t04783747994._4
1208- let paymentInAmountAsset = $t04783747994._5
992+ let $t04079540952 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
993+ let emitAmountEstimated = $t04079540952._1
994+ let commonState = $t04079540952._2
995+ let feeAmount = $t04079540952._3
996+ let bonus = $t04079540952._4
997+ let paymentInAmountAsset = $t04079540952._5
1209998 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
1210999 }
12111000
12421031 then {
12431032 let userAddress = i.caller
12441033 let txId = i.transactionId
1245- let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1246- if (($t04887949032 == $t04887949032))
1034+ let $t04183741990 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1035+ if (($t04183741990 == $t04183741990))
12471036 then {
1248- let outInAmountAsset = $t04887949032._5
1249- let bonus = $t04887949032._4
1250- let feeAmount = $t04887949032._3
1251- let commonState = $t04887949032._2
1252- let amountEstimated = $t04887949032._1
1037+ let outInAmountAsset = $t04183741990._5
1038+ let bonus = $t04183741990._4
1039+ let feeAmount = $t04183741990._3
1040+ let commonState = $t04183741990._2
1041+ let amountEstimated = $t04183741990._1
12531042 let amount = if (if ((minOutAmount > 0))
12541043 then (minOutAmount > amountEstimated)
12551044 else false)
12581047 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12591048 if ((burnInv == burnInv))
12601049 then {
1261- let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
12621050 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12631051 let sendFee = if ((feeAmount > 0))
12641052 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12651053 else nil
1266- let $t04960349850 = {
1054+ let $t04249042737 = {
12671055 let feeAmountForCalc = if ((this == feeCollectorAddress))
12681056 then 0
12691057 else feeAmount
12711059 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12721060 else $Tuple2(0, -((amount + feeAmountForCalc)))
12731061 }
1274- let amountAssetBalanceDelta = $t04960349850._1
1275- let priceAssetBalanceDelta = $t04960349850._2
1276- let $t04985349961 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1277- let refreshKLpActions = $t04985349961._1
1278- let updatedKLp = $t04985349961._2
1062+ let amountAssetBalanceDelta = $t04249042737._1
1063+ let priceAssetBalanceDelta = $t04249042737._2
1064+ let $t04274042848 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1065+ let refreshKLpActions = $t04274042848._1
1066+ let updatedKLp = $t04274042848._2
12791067 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12801068 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1281- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1069+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12821070 else throw("Strict value is not equal to itself.")
12831071 }
12841072 else throw("Strict value is not equal to itself.")
12941082
12951083 @Callable(i)
12961084 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1297- let $t05023950395 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1298- let amountEstimated = $t05023950395._1
1299- let commonState = $t05023950395._2
1300- let feeAmount = $t05023950395._3
1301- let bonus = $t05023950395._4
1302- let outInAmountAsset = $t05023950395._5
1085+ let $t04310543261 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1086+ let amountEstimated = $t04310543261._1
1087+ let commonState = $t04310543261._2
1088+ let feeAmount = $t04310543261._3
1089+ let bonus = $t04310543261._4
1090+ let outInAmountAsset = $t04310543261._5
13031091 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13041092 }
13051093
13361124 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13371125 if ((unstakeInv == unstakeInv))
13381126 then {
1339- let $t05130051451 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1340- if (($t05130051451 == $t05130051451))
1127+ let $t04416644317 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1128+ if (($t04416644317 == $t04416644317))
13411129 then {
1342- let outInAmountAsset = $t05130051451._5
1343- let bonus = $t05130051451._4
1344- let feeAmount = $t05130051451._3
1345- let commonState = $t05130051451._2
1346- let amountEstimated = $t05130051451._1
1130+ let outInAmountAsset = $t04416644317._5
1131+ let bonus = $t04416644317._4
1132+ let feeAmount = $t04416644317._3
1133+ let commonState = $t04416644317._2
1134+ let amountEstimated = $t04416644317._1
13471135 let amount = if (if ((minOutAmount > 0))
13481136 then (minOutAmount > amountEstimated)
13491137 else false)
13521140 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13531141 if ((burnInv == burnInv))
13541142 then {
1355- let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
13561143 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13571144 let sendFee = if ((feeAmount > 0))
13581145 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13591146 else nil
1360- let $t05201752264 = {
1147+ let $t04481245059 = {
13611148 let feeAmountForCalc = if ((this == feeCollectorAddress))
13621149 then 0
13631150 else feeAmount
13651152 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13661153 else $Tuple2(0, -((amount + feeAmountForCalc)))
13671154 }
1368- let amountAssetBalanceDelta = $t05201752264._1
1369- let priceAssetBalanceDelta = $t05201752264._2
1370- let $t05226752375 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1371- let refreshKLpActions = $t05226752375._1
1372- let updatedKLp = $t05226752375._2
1155+ let amountAssetBalanceDelta = $t04481245059._1
1156+ let priceAssetBalanceDelta = $t04481245059._2
1157+ let $t04506245170 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1158+ let refreshKLpActions = $t04506245170._1
1159+ let updatedKLp = $t04506245170._2
13731160 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13741161 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1375- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1162+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13761163 else throw("Strict value is not equal to itself.")
13771164 }
13781165 else throw("Strict value is not equal to itself.")
13911178 @Callable(i)
13921179 func get () = {
13931180 let res = commonGet(i)
1394- let outAmAmt = res._1
1181+ let outAmtAmt = res._1
13951182 let outPrAmt = res._2
13961183 let pmtAmt = res._3
13971184 let pmtAssetId = res._4
13981185 let state = res._5
1399- let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14001186 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14011187 if ((currentKLp == currentKLp))
14021188 then {
14031189 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14041190 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14051191 then {
1406- let $t05347053551 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1407- let refreshKLpActions = $t05347053551._1
1408- let updatedKLp = $t05347053551._2
1192+ let $t04611646198 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1193+ let refreshKLpActions = $t04611646198._1
1194+ let updatedKLp = $t04611646198._2
14091195 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14101196 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1411- then ((withdrawState ++ state) ++ refreshKLpActions)
1197+ then (state ++ refreshKLpActions)
14121198 else throw("Strict value is not equal to itself.")
14131199 }
14141200 else throw("Strict value is not equal to itself.")
14311217 else if ((noLessThenPriceAsset > outPrAmt))
14321218 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14331219 else {
1434- let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14351220 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14361221 if ((currentKLp == currentKLp))
14371222 then {
14381223 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14391224 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14401225 then {
1441- let $t05464654727 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1442- let refreshKLpActions = $t05464654727._1
1443- let updatedKLp = $t05464654727._2
1226+ let $t04714747228 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1227+ let refreshKLpActions = $t04714747228._1
1228+ let updatedKLp = $t04714747228._2
14441229 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14451230 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1446- then ((withdrawState ++ state) ++ refreshKLpActions)
1231+ then (state ++ refreshKLpActions)
14471232 else throw("Strict value is not equal to itself.")
14481233 }
14491234 else throw("Strict value is not equal to itself.")
14741259 let outPrAmt = res._2
14751260 let poolStatus = parseIntValue(res._9)
14761261 let state = res._10
1477- let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14781262 let checkPoolStatus = if (if (isGlobalShutdown())
14791263 then true
14801264 else (poolStatus == PoolShutdown))
14851269 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14861270 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14871271 then {
1488- let $t05599956080 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1489- let refreshKLpActions = $t05599956080._1
1490- let updatedKLp = $t05599956080._2
1272+ let $t04835448435 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1273+ let refreshKLpActions = $t04835448435._1
1274+ let updatedKLp = $t04835448435._2
14911275 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14921276 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1493- then ((withdrawState ++ state) ++ refreshKLpActions)
1277+ then (state ++ refreshKLpActions)
14941278 else throw("Strict value is not equal to itself.")
14951279 }
14961280 else throw("Strict value is not equal to itself.")
15281312 let outAmAmt = res._1
15291313 let outPrAmt = res._2
15301314 let state = res._10
1531- let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15321315 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15331316 then true
15341317 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15391322 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15401323 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15411324 then {
1542- let $t05752157602 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1543- let refreshKLpActions = $t05752157602._1
1544- let updatedKLp = $t05752157602._2
1325+ let $t04973049811 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1326+ let refreshKLpActions = $t04973049811._1
1327+ let updatedKLp = $t04973049811._2
15451328 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15461329 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1547- then ((withdrawState ++ state) ++ refreshKLpActions)
1330+ then (state ++ refreshKLpActions)
15481331 else throw("Strict value is not equal to itself.")
15491332 }
15501333 else throw("Strict value is not equal to itself.")
15761359 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15771360 then {
15781361 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1579- let $t05880658870 = refreshKLpInternal(0, 0, 0)
1580- let kLpUpdateActions = $t05880658870._1
1581- let updatedKLp = $t05880658870._2
1362+ let $t05099851062 = refreshKLpInternal(0, 0, 0)
1363+ let kLpUpdateActions = $t05099851062._1
1364+ let updatedKLp = $t05099851062._2
15821365 let actions = if ((kLp != updatedKLp))
15831366 then kLpUpdateActions
15841367 else throwErr("nothing to refresh")
17531536 match tx {
17541537 case order: Order =>
17551538 let matcherPub = getMatcherPubOrFail()
1756- let $t06753267601 = validateMatcherOrderAllowed(order)
1757- let orderValid = $t06753267601._1
1758- let orderValidInfo = $t06753267601._2
1539+ let $t05972459793 = validateMatcherOrderAllowed(order)
1540+ let orderValid = $t05972459793._1
1541+ let orderValidInfo = $t05972459793._2
17591542 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17601543 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17611544 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
133-func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134-
135-
136-func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137-
138-
139-func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
140-
141-
142-func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
143-
144-
145133 func keyFactoryConfig () = "%s__factoryConfig"
146134
147135
148136 func keyMatcherPub () = "%s%s__matcher__publicKey"
149137
150138
151139 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
152140
153141
154142 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
155143
156144
157145 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
158146
159147
160148 func keyAllPoolsShutdown () = "%s__shutdown"
161149
162150
163151 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
164152
165153
166154 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
167155
168156
169157 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
170158
171159 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
172160
173161
174162 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
175163
176164
177165 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
178166
179167
180168 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
181169
182170
183171 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
184172
185173
186174 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
187175
188176 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
189177
190178 let inFee = {
191179 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
192180 if ($isInstanceOf(@, "Int"))
193181 then @
194182 else throw(($getType(@) + " couldn't be cast to Int"))
195183 }
196184
197185 let outFee = {
198186 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
199187 if ($isInstanceOf(@, "Int"))
200188 then @
201189 else throw(($getType(@) + " couldn't be cast to Int"))
202190 }
203191
204192 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
205193
206194
207195 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
208196
209197
210198 func getPoolConfig () = {
211199 let amtAsset = getStringOrFail(this, aa())
212200 let priceAsset = getStringOrFail(this, pa())
213201 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
214202 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
215203 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
216204 }
217205
218206
219207 func parseAssetId (input) = if ((input == wavesString))
220208 then unit
221209 else fromBase58String(input)
222210
223211
224212 func assetIdToString (input) = if ((input == unit))
225213 then wavesString
226214 else toBase58String(value(input))
227215
228216
229217 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]))
230218
231219
232220 let poolConfigParsed = parsePoolConfig(getPoolConfig())
233221
234-let $t089629128 = poolConfigParsed
222+let $t084698635 = poolConfigParsed
235223
236-let cfgPoolAddress = $t089629128._1
224+let cfgPoolAddress = $t084698635._1
237225
238-let cfgPoolStatus = $t089629128._2
226+let cfgPoolStatus = $t084698635._2
239227
240-let cfgLpAssetId = $t089629128._3
228+let cfgLpAssetId = $t084698635._3
241229
242-let cfgAmountAssetId = $t089629128._4
230+let cfgAmountAssetId = $t084698635._4
243231
244-let cfgPriceAssetId = $t089629128._5
232+let cfgPriceAssetId = $t084698635._5
245233
246-let cfgAmountAssetDecimals = $t089629128._6
234+let cfgAmountAssetDecimals = $t084698635._6
247235
248-let cfgPriceAssetDecimals = $t089629128._7
236+let cfgPriceAssetDecimals = $t084698635._7
249237
250238 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
251239
252240
253241 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
254242
255243 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
256244
257245 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)
258246
259247
260248 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)
261249
262250
263-func getAccBalance (assetId) = {
264- let balanceOnPool = if ((assetId == "WAVES"))
265- then wavesBalance(this).available
266- else assetBalance(this, fromBase58String(assetId))
267- let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
268- max([0, totalBalance])
269- }
251+func getAccBalance (assetId) = if ((assetId == "WAVES"))
252+ then wavesBalance(this).available
253+ else assetBalance(this, fromBase58String(assetId))
270254
271255
272256 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
273257
274258
275259 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
276-
277-
278-func getRate (proxy) = {
279- let inv = invoke(proxy, "getRate", nil, nil)
280- if ((inv == inv))
281- then match inv {
282- case r: Int =>
283- r
284- case _ =>
285- throwErr("proxy.getRate() unexpected value")
286- }
287- else throw("Strict value is not equal to itself.")
288- }
289-
290-
291-func deposit (assetId,amount,stakingAssetId,proxy) = {
292- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
293- if ((currentAdditionalBalance == currentAdditionalBalance))
294- then {
295- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
296- if ((currentStakingAssetBalance == currentStakingAssetBalance))
297- then {
298- let asset = parseAssetId(assetId)
299- if ((amount > 0))
300- then {
301- let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
302- if ((depositInvoke == depositInvoke))
303- then match depositInvoke {
304- case receivedStakingAsset: Int =>
305- let newAdditionalBalance = (currentAdditionalBalance + amount)
306- let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
307-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
308- case _ =>
309- nil
310- }
311- else throw("Strict value is not equal to itself.")
312- }
313- else nil
314- }
315- else throw("Strict value is not equal to itself.")
316- }
317- else throw("Strict value is not equal to itself.")
318- }
319-
320-
321-func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
322- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
323- if ((currentAdditionalBalance == currentAdditionalBalance))
324- then {
325- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
326- if ((currentStakingAssetBalance == currentStakingAssetBalance))
327- then {
328- let currentProxyRate = getRate(proxy)
329- if ((currentProxyRate == currentProxyRate))
330- then {
331- let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
332- let stakingAsset = parseAssetId(stakingAssetId)
333- let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
334- let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
335- let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
336- if ((sendStakingAssetAmount > 0))
337- then {
338- let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
339- if ((withdrawInvoke == withdrawInvoke))
340- then match withdrawInvoke {
341- case receivedAssets: Int =>
342- let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
343- let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
344-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
345- case _ =>
346- nil
347- }
348- else throw("Strict value is not equal to itself.")
349- }
350- else nil
351- }
352- else throw("Strict value is not equal to itself.")
353- }
354- else throw("Strict value is not equal to itself.")
355- }
356- else throw("Strict value is not equal to itself.")
357- }
358-
359-
360-func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
361- case a: (Boolean, Int, Int, String, String, Int, String) =>
362- a
363- case _ =>
364- throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
365-}
366-
367-
368-func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
369- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
370- if ((currentAdditionalBalance == currentAdditionalBalance))
371- then {
372- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
373- if ((currentStakingAssetBalance == currentStakingAssetBalance))
374- then {
375- let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
376- let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
377- let diff = (currentAdditionalBalance - targetAdditionalBalance)
378- if ((diff == 0))
379- then nil
380- else if ((0 > diff))
381- then {
382- let sendAssetAmount = -(diff)
383- deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
384- }
385- else {
386- let getAssetAmount = diff
387- withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
388- }
389- }
390- else throw("Strict value is not equal to itself.")
391- }
392- else throw("Strict value is not equal to itself.")
393- }
394-
395-
396-func rebalanceAsset (assetId) = {
397- let $t01536415500 = getLeaseProxyConfig(assetId)
398- let isLeasable = $t01536415500._1
399- let leasedRatio = $t01536415500._2
400- let minBalance = $t01536415500._3
401- let proxyAddress = $t01536415500._4
402- let proxyAssetId = $t01536415500._5
403- let proxyRateMul = $t01536415500._6
404- let stakingProfitAddress = $t01536415500._7
405- if (isLeasable)
406- then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
407- else nil
408- }
409-
410-
411-func withdrawAndRebalanceAsset (assetId,getAmount) = {
412- let $t01588916025 = getLeaseProxyConfig(assetId)
413- let isLeasable = $t01588916025._1
414- let leasedRatio = $t01588916025._2
415- let minBalance = $t01588916025._3
416- let proxyAddress = $t01588916025._4
417- let proxyAssetId = $t01588916025._5
418- let proxyRateMul = $t01588916025._6
419- let stakingProfitAddress = $t01588916025._7
420- if (isLeasable)
421- then {
422- let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
423- if ((newTotalLeasableBalance == newTotalLeasableBalance))
424- then {
425- let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
426- if ((newAdditionalBalance == newAdditionalBalance))
427- then {
428- let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
429- if ((withdrawAmount == withdrawAmount))
430- then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
431- else throw("Strict value is not equal to itself.")
432- }
433- else throw("Strict value is not equal to itself.")
434- }
435- else throw("Strict value is not equal to itself.")
436- }
437- else nil
438- }
439-
440-
441-func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
442- let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
443- let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
444- (AmAmtWithdrawState ++ PrAmtWithdrawState)
445- }
446260
447261
448262 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
449263 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
450264 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
451265 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
452266 }
453267
454268
455269 func calcPrices (amAmt,prAmt,lpAmt) = {
456270 let cfg = getPoolConfig()
457271 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
458272 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
459273 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
460274 let amAmtX18 = toX18(amAmt, amtAssetDcm)
461275 let prAmtX18 = toX18(prAmt, priceAssetDcm)
462276 let lpAmtX18 = toX18(lpAmt, scale8)
463277 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
464278 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
465279 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
466280 }
467281
468282
469283 func calculatePrices (amAmt,prAmt,lpAmt) = {
470284 let prices = calcPrices(amAmt, prAmt, lpAmt)
471285 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
472286 }
473287
474288
475289 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
476290 let cfg = getPoolConfig()
477291 let lpAssetId = cfg[idxPoolLPAssetId]
478292 let amAssetId = cfg[idxAmtAssetId]
479293 let prAssetId = cfg[idxPriceAssetId]
480294 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
481295 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
482296 let poolStatus = cfg[idxPoolStatus]
483297 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
484298 if ((lpAssetId != pmtAssetId))
485299 then throw("Invalid asset passed.")
486300 else {
487301 let amBalance = getAccBalance(amAssetId)
488302 let amBalanceX18 = toX18(amBalance, amAssetDcm)
489303 let prBalance = getAccBalance(prAssetId)
490304 let prBalanceX18 = toX18(prBalance, prAssetDcm)
491305 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
492306 let curPrice = fromX18(curPriceX18, scale8)
493307 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
494308 let lpEmissionX18 = toX18(lpEmission, scale8)
495309 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
496310 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
497311 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
498312 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
499313 let state = if ((txId58 == ""))
500314 then nil
501315 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
502316 then unit
503317 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
504318 then unit
505319 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)]
506320 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
507321 }
508322 }
509323
510324
511325 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
512326 let cfg = getPoolConfig()
513327 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
514328 let amAssetIdStr = cfg[idxAmtAssetId]
515329 let prAssetIdStr = cfg[idxPriceAssetId]
516330 let iAmtAssetId = cfg[idxIAmtAssetId]
517331 let iPriceAssetId = cfg[idxIPriceAssetId]
518332 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
519333 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
520334 let poolStatus = cfg[idxPoolStatus]
521335 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
522336 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
523337 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
524338 if (if ((amAssetIdStr != inAmAssetIdStr))
525339 then true
526340 else (prAssetIdStr != inPrAssetIdStr))
527341 then throw("Invalid amt or price asset passed.")
528342 else {
529343 let amBalance = if (isEvaluate)
530344 then getAccBalance(amAssetIdStr)
531345 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
532346 let prBalance = if (isEvaluate)
533347 then getAccBalance(prAssetIdStr)
534348 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
535349 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
536350 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
537351 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
538352 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
539353 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
540354 let res = if ((lpEmission == 0))
541355 then {
542356 let curPriceX18 = zeroBigInt
543357 let slippageX18 = zeroBigInt
544358 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
545359 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
546360 }
547361 else {
548362 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
549363 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
550364 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
551365 if (if ((curPriceX18 != zeroBigInt))
552366 then (slippageX18 > slippageToleranceX18)
553367 else false)
554368 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
555369 else {
556370 let lpEmissionX18 = toX18(lpEmission, scale8)
557371 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
558372 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
559373 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
560374 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
561375 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
562376 let expAmtAssetAmtX18 = expectedAmts._1
563377 let expPriceAssetAmtX18 = expectedAmts._2
564378 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
565379 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
566380 }
567381 }
568382 let calcLpAmt = res._1
569383 let calcAmAssetPmt = res._2
570384 let calcPrAssetPmt = res._3
571385 let curPrice = fromX18(res._4, scale8)
572386 let slippageCalc = fromX18(res._5, scale8)
573387 if ((0 >= calcLpAmt))
574388 then throw("Invalid calculations. LP calculated is less than zero.")
575389 else {
576390 let emitLpAmt = if (!(emitLp))
577391 then 0
578392 else calcLpAmt
579393 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
580394 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
581395 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))]
582396 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
583397 }
584398 }
585399 }
586400
587401
588402 func calcKLp (amountBalance,priceBalance,lpEmission) = {
589403 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
590404 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
591405 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
592406 if ((lpEmission == big0))
593407 then big0
594408 else updatedKLp
595409 }
596410
597411
598412 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
599413 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
600414 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
601415 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
602416 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
603417 currentKLp
604418 }
605419
606420
607421 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
608422 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
609423 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
610424 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
611425 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
612426 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
613427 $Tuple2(actions, updatedKLp)
614428 }
615429
616430
617431 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
618432 then true
619433 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
620434
621435
622436 func validateMatcherOrderAllowed (order) = {
623437 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
624438 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
625439 let amountAssetAmount = order.amount
626440 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
627- let $t02815328365 = if ((order.orderType == Buy))
441+ let $t02154121753 = if ((order.orderType == Buy))
628442 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
629443 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
630- let amountAssetBalanceDelta = $t02815328365._1
631- let priceAssetBalanceDelta = $t02815328365._2
444+ let amountAssetBalanceDelta = $t02154121753._1
445+ let priceAssetBalanceDelta = $t02154121753._2
632446 if (if (if (isGlobalShutdown())
633447 then true
634448 else (cfgPoolStatus == PoolMatcherDisabled))
635449 then true
636450 else (cfgPoolStatus == PoolShutdown))
637451 then throw("Exchange operations disabled")
638452 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
639453 then true
640454 else (order.assetPair.priceAsset != cfgPriceAssetId))
641455 then throw("Wrong order assets.")
642456 else {
643457 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
644- let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
645- let unusedActions = $t02880528905._1
646- let kLpNew = $t02880528905._2
458+ let $t02219322293 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
459+ let unusedActions = $t02219322293._1
460+ let kLpNew = $t02219322293._2
647461 let isOrderValid = (kLpNew >= kLp)
648462 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
649463 $Tuple2(isOrderValid, info)
650464 }
651465 }
652466
653467
654468 func commonGet (i) = if ((size(i.payments) != 1))
655469 then throw("exactly 1 payment is expected")
656470 else {
657471 let pmt = value(i.payments[0])
658472 let pmtAssetId = value(pmt.assetId)
659473 let pmtAmt = pmt.amount
660474 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
661475 let outAmAmt = res._1
662476 let outPrAmt = res._2
663477 let poolStatus = parseIntValue(res._9)
664478 let state = res._10
665479 if (if (isGlobalShutdown())
666480 then true
667481 else (poolStatus == PoolShutdown))
668482 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
669483 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
670484 }
671485
672486
673487 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
674488 then throw("exactly 2 payments are expected")
675489 else {
676490 let amAssetPmt = value(i.payments[0])
677491 let prAssetPmt = value(i.payments[1])
678492 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
679493 let poolStatus = parseIntValue(estPut._8)
680494 if (if (if (isGlobalShutdown())
681495 then true
682496 else (poolStatus == PoolPutDisabled))
683497 then true
684498 else (poolStatus == PoolShutdown))
685499 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
686500 else estPut
687501 }
688502
689503
690504 func emit (amount) = {
691505 let emitInv = invoke(factoryContract, "emit", [amount], nil)
692506 if ((emitInv == emitInv))
693507 then {
694508 let emitInvLegacy = match emitInv {
695509 case legacyFactoryContract: Address =>
696510 invoke(legacyFactoryContract, "emit", [amount], nil)
697511 case _ =>
698512 unit
699513 }
700514 if ((emitInvLegacy == emitInvLegacy))
701515 then amount
702516 else throw("Strict value is not equal to itself.")
703517 }
704518 else throw("Strict value is not equal to itself.")
705519 }
706520
707521
708522 func takeFee (amount,fee) = {
709523 let feeAmount = if ((fee == 0))
710524 then 0
711525 else fraction(amount, fee, scale8)
712526 $Tuple2((amount - feeAmount), feeAmount)
713527 }
714528
715529
716530 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
717531 let isEval = (txId == unit)
718532 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
719533 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
720534 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
721535 then true
722536 else if ((paymentAssetId == cfgPriceAssetId))
723537 then false
724538 else throwErr("invalid asset")
725- let $t03201832311 = if (isEval)
539+ let $t02540625699 = if (isEval)
726540 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
727541 else if (paymentInAmountAsset)
728542 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
729543 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
730- let amountBalanceOld = $t03201832311._1
731- let priceBalanceOld = $t03201832311._2
732- let $t03231532464 = if (paymentInAmountAsset)
544+ let amountBalanceOld = $t02540625699._1
545+ let priceBalanceOld = $t02540625699._2
546+ let $t02570325852 = if (paymentInAmountAsset)
733547 then $Tuple2(paymentAmountRaw, 0)
734548 else $Tuple2(0, paymentAmountRaw)
735- let amountAssetAmountRaw = $t03231532464._1
736- let priceAssetAmountRaw = $t03231532464._2
549+ let amountAssetAmountRaw = $t02570325852._1
550+ let priceAssetAmountRaw = $t02570325852._2
737551 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
738552 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
739- let $t03259632660 = takeFee(paymentAmountRaw, inFee)
740- let paymentAmount = $t03259632660._1
741- let feeAmount = $t03259632660._2
553+ let $t02598426048 = takeFee(paymentAmountRaw, inFee)
554+ let paymentAmount = $t02598426048._1
555+ let feeAmount = $t02598426048._2
742556 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
743557 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
744558 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
745559 let priceNew = fromX18(priceNewX18, scale8)
746560 let paymentBalance = if (paymentInAmountAsset)
747561 then amountBalanceOld
748562 else priceBalanceOld
749563 let paymentBalanceBigInt = toBigInt(paymentBalance)
750564 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
751565 let chechSupply = if ((supplyBigInt > big0))
752566 then true
753567 else throwErr("initial deposit requires all coins")
754568 if ((chechSupply == chechSupply))
755569 then {
756570 let depositBigInt = toBigInt(paymentAmount)
757571 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
758572 let commonState = if (isEval)
759573 then nil
760574 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))]
761575 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
762576 let priceOld = fromX18(priceOldX18, scale8)
763577 let loss = {
764- let $t03434134508 = if (paymentInAmountAsset)
578+ let $t02772927896 = if (paymentInAmountAsset)
765579 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
766580 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
767- let amount = $t03434134508._1
768- let balance = $t03434134508._2
581+ let amount = $t02772927896._1
582+ let balance = $t02772927896._2
769583 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
770584 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
771585 }
772586 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
773587 }
774588 else throw("Strict value is not equal to itself.")
775589 }
776590
777591
778592 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
779593 let isEval = (txId == unit)
780594 let cfg = getPoolConfig()
781595 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
782596 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
783597 let checks = [if ((paymentAssetId == cfgLpAssetId))
784598 then true
785599 else throwErr("invalid lp asset")]
786600 if ((checks == checks))
787601 then {
788602 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
789603 then true
790604 else if ((outAssetId == cfgPriceAssetId))
791605 then false
792606 else throwErr("invalid asset")
793607 let balanceBigInt = if (outInAmountAsset)
794608 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
795609 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
796610 let outInAmountAssetDecimals = if (outInAmountAsset)
797611 then amtAssetDcm
798612 else priceAssetDcm
799613 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
800614 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
801615 let outBalance = if (outInAmountAsset)
802616 then amBalanceOld
803617 else prBalanceOld
804618 let outBalanceBigInt = toBigInt(outBalance)
805619 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
806620 let redeemedBigInt = toBigInt(paymentAmount)
807621 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
808- let $t03658636642 = takeFee(amountRaw, outFee)
809- let totalAmount = $t03658636642._1
810- let feeAmount = $t03658636642._2
811- let $t03664636872 = if (outInAmountAsset)
622+ let $t02997430030 = takeFee(amountRaw, outFee)
623+ let totalAmount = $t02997430030._1
624+ let feeAmount = $t02997430030._2
625+ let $t03003430260 = if (outInAmountAsset)
812626 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
813627 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
814- let outAmAmount = $t03664636872._1
815- let outPrAmount = $t03664636872._2
816- let amBalanceNew = $t03664636872._3
817- let prBalanceNew = $t03664636872._4
628+ let outAmAmount = $t03003430260._1
629+ let outPrAmount = $t03003430260._2
630+ let amBalanceNew = $t03003430260._3
631+ let prBalanceNew = $t03003430260._4
818632 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
819633 let priceNew = fromX18(priceNewX18, scale8)
820634 let commonState = if (isEval)
821635 then nil
822636 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)]
823637 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
824638 let priceOld = fromX18(priceOldX18, scale8)
825639 let loss = {
826640 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
827641 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
828642 }
829643 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
830644 }
831645 else throw("Strict value is not equal to itself.")
832646 }
833647
834648
835649 func managerPublicKeyOrUnit () = match getString(mpk()) {
836650 case s: String =>
837651 fromBase58String(s)
838652 case _: Unit =>
839653 unit
840654 case _ =>
841655 throw("Match error")
842656 }
843657
844658
845659 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
846660 case s: String =>
847661 fromBase58String(s)
848662 case _: Unit =>
849663 unit
850664 case _ =>
851665 throw("Match error")
852666 }
853667
854668
855669 func isManager (i) = match managerPublicKeyOrUnit() {
856670 case pk: ByteVector =>
857671 (i.callerPublicKey == pk)
858672 case _: Unit =>
859673 (i.caller == this)
860674 case _ =>
861675 throw("Match error")
862676 }
863677
864678
865679 func mustManager (i) = {
866680 let pd = throw("Permission denied")
867681 match managerPublicKeyOrUnit() {
868682 case pk: ByteVector =>
869683 if ((i.callerPublicKey == pk))
870684 then true
871685 else pd
872686 case _: Unit =>
873687 if ((i.caller == this))
874688 then true
875689 else pd
876690 case _ =>
877691 throw("Match error")
878692 }
879693 }
880694
881695
882696 @Callable(i)
883-func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
884-
885-
886-
887-@Callable(i)
888697 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
889- let $t03875839063 = if ((isReverse == false))
698+ let $t03197732282 = if ((isReverse == false))
890699 then {
891700 let assetOut = getStringOrFail(this, pa())
892701 let assetIn = getStringOrFail(this, aa())
893702 $Tuple2(assetOut, assetIn)
894703 }
895704 else {
896705 let assetOut = getStringOrFail(this, aa())
897706 let assetIn = getStringOrFail(this, pa())
898707 $Tuple2(assetOut, assetIn)
899708 }
900- let assetOut = $t03875839063._1
901- let assetIn = $t03875839063._2
709+ let assetOut = $t03197732282._1
710+ let assetIn = $t03197732282._2
902711 let poolAssetInBalance = getAccBalance(assetIn)
903712 let poolAssetOutBalance = getAccBalance(assetOut)
904713 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
905714 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
906715 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
907716 let checkK = if ((newK >= oldK))
908717 then true
909718 else throw("new K is fewer error")
910719 if ((checkK == checkK))
911720 then $Tuple2(nil, amountOut)
912721 else throw("Strict value is not equal to itself.")
913722 }
914723
915724
916725
917726 @Callable(i)
918727 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
919728 let swapContact = {
920729 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
921730 if ($isInstanceOf(@, "String"))
922731 then @
923732 else throw(($getType(@) + " couldn't be cast to String"))
924733 }
925734 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
926735 then true
927736 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
928737 then true
929738 else throwErr("Permission denied")]
930739 if ((checks == checks))
931740 then {
932741 let pmt = value(i.payments[0])
933742 let assetIn = assetIdToString(pmt.assetId)
934743 let assetOut = if ((isReverse == false))
935744 then getStringOrFail(this, pa())
936745 else getStringOrFail(this, aa())
937746 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
938747 let poolAssetOutBalance = getAccBalance(assetOut)
939748 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
940749 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
941750 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
942751 let checkK = if ((newK >= oldK))
943752 then true
944753 else throw("new K is fewer error")
945754 if ((checkK == checkK))
946755 then {
947756 let checkMin = if ((amountOut >= amountOutMin))
948757 then true
949758 else throw("Exchange result is fewer coins than expected")
950759 if ((checkMin == checkMin))
951- then {
952- let rebalanceState = rebalanceAsset(assetIn)
953- if ((rebalanceState == rebalanceState))
954- then {
955- let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
956- if ((withdrawState == withdrawState))
957- then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
958- else throw("Strict value is not equal to itself.")
959- }
960- else throw("Strict value is not equal to itself.")
961- }
760+ then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut)
962761 else throw("Strict value is not equal to itself.")
963762 }
964763 else throw("Strict value is not equal to itself.")
965764 }
966765 else throw("Strict value is not equal to itself.")
967766 }
968767
969768
970769
971770 @Callable(i)
972771 func setManager (pendingManagerPublicKey) = {
973772 let checkCaller = mustManager(i)
974773 if ((checkCaller == checkCaller))
975774 then {
976775 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
977776 if ((checkManagerPublicKey == checkManagerPublicKey))
978777 then [StringEntry(pmpk(), pendingManagerPublicKey)]
979778 else throw("Strict value is not equal to itself.")
980779 }
981780 else throw("Strict value is not equal to itself.")
982781 }
983782
984783
985784
986785 @Callable(i)
987786 func confirmManager () = {
988787 let pm = pendingManagerPublicKeyOrUnit()
989788 let hasPM = if (isDefined(pm))
990789 then true
991790 else throw("No pending manager")
992791 if ((hasPM == hasPM))
993792 then {
994793 let checkPM = if ((i.callerPublicKey == value(pm)))
995794 then true
996795 else throw("You are not pending manager")
997796 if ((checkPM == checkPM))
998797 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
999798 else throw("Strict value is not equal to itself.")
1000799 }
1001800 else throw("Strict value is not equal to itself.")
1002801 }
1003802
1004803
1005804
1006805 @Callable(i)
1007806 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
1008807 then throw("Invalid slippageTolerance passed")
1009808 else {
1010809 let estPut = commonPut(i, slippageTolerance, true)
1011810 let emitLpAmt = estPut._2
1012811 let lpAssetId = estPut._7
1013812 let state = estPut._9
1014813 let amDiff = estPut._10
1015814 let prDiff = estPut._11
1016815 let amId = estPut._12
1017816 let prId = estPut._13
1018817 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1019818 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1020819 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
1021820 if ((currentKLp == currentKLp))
1022821 then {
1023822 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
1024823 if ((emitInv == emitInv))
1025824 then {
1026825 let emitInvLegacy = match emitInv {
1027826 case legacyFactoryContract: Address =>
1028827 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
1029828 case _ =>
1030829 unit
1031830 }
1032831 if ((emitInvLegacy == emitInvLegacy))
1033832 then {
1034833 let slippageAInv = if ((amDiff > 0))
1035834 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
1036835 else nil
1037836 if ((slippageAInv == slippageAInv))
1038837 then {
1039838 let slippagePInv = if ((prDiff > 0))
1040839 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
1041840 else nil
1042841 if ((slippagePInv == slippagePInv))
1043842 then {
1044843 let lpTransfer = if (shouldAutoStake)
1045844 then {
1046845 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
1047846 if ((slpStakeInv == slpStakeInv))
1048847 then nil
1049848 else throw("Strict value is not equal to itself.")
1050849 }
1051850 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1052- let $t04410944571 = refreshKLpInternal(0, 0, 0)
1053- if (($t04410944571 == $t04410944571))
851+ let $t03716637628 = refreshKLpInternal(0, 0, 0)
852+ if (($t03716637628 == $t03716637628))
1054853 then {
1055- let updatedKLp = $t04410944571._2
1056- let refreshKLpActions = $t04410944571._1
854+ let updatedKLp = $t03716637628._2
855+ let refreshKLpActions = $t03716637628._1
1057856 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1058857 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1059- then {
1060- let reb = invoke(this, "rebalance", nil, nil)
1061- if ((reb == reb))
1062- then ((state ++ lpTransfer) ++ refreshKLpActions)
1063- else throw("Strict value is not equal to itself.")
1064- }
858+ then ((state ++ lpTransfer) ++ refreshKLpActions)
1065859 else throw("Strict value is not equal to itself.")
1066860 }
1067861 else throw("Strict value is not equal to itself.")
1068862 }
1069863 else throw("Strict value is not equal to itself.")
1070864 }
1071865 else throw("Strict value is not equal to itself.")
1072866 }
1073867 else throw("Strict value is not equal to itself.")
1074868 }
1075869 else throw("Strict value is not equal to itself.")
1076870 }
1077871 else throw("Strict value is not equal to itself.")
1078872 }
1079873
1080874
1081875
1082876 @Callable(i)
1083877 func putForFree (maxSlippage) = if ((0 > maxSlippage))
1084878 then throw("Invalid value passed")
1085879 else {
1086880 let estPut = commonPut(i, maxSlippage, false)
1087881 let state = estPut._9
1088882 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1089883 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1090884 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
1091885 if ((currentKLp == currentKLp))
1092886 then {
1093- let $t04518345248 = refreshKLpInternal(0, 0, 0)
1094- let refreshKLpActions = $t04518345248._1
1095- let updatedKLp = $t04518345248._2
887+ let $t03819038255 = refreshKLpInternal(0, 0, 0)
888+ let refreshKLpActions = $t03819038255._1
889+ let updatedKLp = $t03819038255._2
1096890 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1097891 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1098892 then (state ++ refreshKLpActions)
1099893 else throw("Strict value is not equal to itself.")
1100894 }
1101895 else throw("Strict value is not equal to itself.")
1102896 }
1103897
1104898
1105899
1106900 @Callable(i)
1107901 func putOneTkn (minOutAmount,autoStake) = {
1108902 let isPoolOneTokenOperationsDisabled = {
1109903 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
1110904 if ($isInstanceOf(@, "Boolean"))
1111905 then @
1112906 else throw(($getType(@) + " couldn't be cast to Boolean"))
1113907 }
1114908 let isPutDisabled = if (if (if (isGlobalShutdown())
1115909 then true
1116910 else (cfgPoolStatus == PoolPutDisabled))
1117911 then true
1118912 else (cfgPoolStatus == PoolShutdown))
1119913 then true
1120914 else isPoolOneTokenOperationsDisabled
1121915 let checks = [if (if (!(isPutDisabled))
1122916 then true
1123917 else isManager(i))
1124918 then true
1125919 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
1126920 then true
1127921 else throwErr("exactly 1 payment are expected")]
1128922 if ((checks == checks))
1129923 then {
1130924 let payment = i.payments[0]
1131925 let paymentAssetId = payment.assetId
1132926 let paymentAmountRaw = payment.amount
1133927 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
1134928 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
1135929 else if ((paymentAssetId == cfgPriceAssetId))
1136930 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
1137931 else throwErr("payment asset is not supported")
1138932 if ((currentKLp == currentKLp))
1139933 then {
1140934 let userAddress = i.caller
1141935 let txId = i.transactionId
1142- let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1143- if (($t04643646588 == $t04643646588))
936+ let $t03944339595 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
937+ if (($t03944339595 == $t03944339595))
1144938 then {
1145- let paymentInAmountAsset = $t04643646588._5
1146- let bonus = $t04643646588._4
1147- let feeAmount = $t04643646588._3
1148- let commonState = $t04643646588._2
1149- let emitAmountEstimated = $t04643646588._1
939+ let paymentInAmountAsset = $t03944339595._5
940+ let bonus = $t03944339595._4
941+ let feeAmount = $t03944339595._3
942+ let commonState = $t03944339595._2
943+ let emitAmountEstimated = $t03944339595._1
1150944 let emitAmount = if (if ((minOutAmount > 0))
1151945 then (minOutAmount > emitAmountEstimated)
1152946 else false)
1153947 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
1154948 else emitAmountEstimated
1155949 let emitInv = emit(emitAmount)
1156950 if ((emitInv == emitInv))
1157951 then {
1158952 let lpTransfer = if (autoStake)
1159953 then {
1160954 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
1161955 if ((stakeInv == stakeInv))
1162956 then nil
1163957 else throw("Strict value is not equal to itself.")
1164958 }
1165959 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
1166960 let sendFee = if ((feeAmount > 0))
1167961 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
1168962 else nil
1169- let $t04717447371 = if ((this == feeCollectorAddress))
963+ let $t04018140378 = if ((this == feeCollectorAddress))
1170964 then $Tuple2(0, 0)
1171965 else if (paymentInAmountAsset)
1172966 then $Tuple2(-(feeAmount), 0)
1173967 else $Tuple2(0, -(feeAmount))
1174- let amountAssetBalanceDelta = $t04717447371._1
1175- let priceAssetBalanceDelta = $t04717447371._2
1176- let $t04737447482 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1177- let refreshKLpActions = $t04737447482._1
1178- let updatedKLp = $t04737447482._2
968+ let amountAssetBalanceDelta = $t04018140378._1
969+ let priceAssetBalanceDelta = $t04018140378._2
970+ let $t04038140489 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
971+ let refreshKLpActions = $t04038140489._1
972+ let updatedKLp = $t04038140489._2
1179973 let kLp = value(getString(keyKLp))
1180974 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1181975 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1182- then {
1183- let reb = invoke(this, "rebalance", nil, nil)
1184- if ((reb == reb))
1185- then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
1186- else throw("Strict value is not equal to itself.")
1187- }
976+ then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
1188977 else throw("Strict value is not equal to itself.")
1189978 }
1190979 else throw("Strict value is not equal to itself.")
1191980 }
1192981 else throw("Strict value is not equal to itself.")
1193982 }
1194983 else throw("Strict value is not equal to itself.")
1195984 }
1196985 else throw("Strict value is not equal to itself.")
1197986 }
1198987
1199988
1200989
1201990 @Callable(i)
1202991 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1203- let $t04783747994 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1204- let emitAmountEstimated = $t04783747994._1
1205- let commonState = $t04783747994._2
1206- let feeAmount = $t04783747994._3
1207- let bonus = $t04783747994._4
1208- let paymentInAmountAsset = $t04783747994._5
992+ let $t04079540952 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
993+ let emitAmountEstimated = $t04079540952._1
994+ let commonState = $t04079540952._2
995+ let feeAmount = $t04079540952._3
996+ let bonus = $t04079540952._4
997+ let paymentInAmountAsset = $t04079540952._5
1209998 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
1210999 }
12111000
12121001
12131002
12141003 @Callable(i)
12151004 func getOneTkn (outAssetIdStr,minOutAmount) = {
12161005 let isPoolOneTokenOperationsDisabled = {
12171006 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12181007 if ($isInstanceOf(@, "Boolean"))
12191008 then @
12201009 else throw(($getType(@) + " couldn't be cast to Boolean"))
12211010 }
12221011 let isGetDisabled = if (if (isGlobalShutdown())
12231012 then true
12241013 else (cfgPoolStatus == PoolShutdown))
12251014 then true
12261015 else isPoolOneTokenOperationsDisabled
12271016 let checks = [if (if (!(isGetDisabled))
12281017 then true
12291018 else isManager(i))
12301019 then true
12311020 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12321021 then true
12331022 else throwErr("exactly 1 payment are expected")]
12341023 if ((checks == checks))
12351024 then {
12361025 let outAssetId = parseAssetId(outAssetIdStr)
12371026 let payment = i.payments[0]
12381027 let paymentAssetId = payment.assetId
12391028 let paymentAmount = payment.amount
12401029 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12411030 if ((currentKLp == currentKLp))
12421031 then {
12431032 let userAddress = i.caller
12441033 let txId = i.transactionId
1245- let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1246- if (($t04887949032 == $t04887949032))
1034+ let $t04183741990 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1035+ if (($t04183741990 == $t04183741990))
12471036 then {
1248- let outInAmountAsset = $t04887949032._5
1249- let bonus = $t04887949032._4
1250- let feeAmount = $t04887949032._3
1251- let commonState = $t04887949032._2
1252- let amountEstimated = $t04887949032._1
1037+ let outInAmountAsset = $t04183741990._5
1038+ let bonus = $t04183741990._4
1039+ let feeAmount = $t04183741990._3
1040+ let commonState = $t04183741990._2
1041+ let amountEstimated = $t04183741990._1
12531042 let amount = if (if ((minOutAmount > 0))
12541043 then (minOutAmount > amountEstimated)
12551044 else false)
12561045 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12571046 else amountEstimated
12581047 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12591048 if ((burnInv == burnInv))
12601049 then {
1261- let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
12621050 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12631051 let sendFee = if ((feeAmount > 0))
12641052 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12651053 else nil
1266- let $t04960349850 = {
1054+ let $t04249042737 = {
12671055 let feeAmountForCalc = if ((this == feeCollectorAddress))
12681056 then 0
12691057 else feeAmount
12701058 if (outInAmountAsset)
12711059 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12721060 else $Tuple2(0, -((amount + feeAmountForCalc)))
12731061 }
1274- let amountAssetBalanceDelta = $t04960349850._1
1275- let priceAssetBalanceDelta = $t04960349850._2
1276- let $t04985349961 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1277- let refreshKLpActions = $t04985349961._1
1278- let updatedKLp = $t04985349961._2
1062+ let amountAssetBalanceDelta = $t04249042737._1
1063+ let priceAssetBalanceDelta = $t04249042737._2
1064+ let $t04274042848 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1065+ let refreshKLpActions = $t04274042848._1
1066+ let updatedKLp = $t04274042848._2
12791067 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12801068 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1281- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1069+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12821070 else throw("Strict value is not equal to itself.")
12831071 }
12841072 else throw("Strict value is not equal to itself.")
12851073 }
12861074 else throw("Strict value is not equal to itself.")
12871075 }
12881076 else throw("Strict value is not equal to itself.")
12891077 }
12901078 else throw("Strict value is not equal to itself.")
12911079 }
12921080
12931081
12941082
12951083 @Callable(i)
12961084 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1297- let $t05023950395 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1298- let amountEstimated = $t05023950395._1
1299- let commonState = $t05023950395._2
1300- let feeAmount = $t05023950395._3
1301- let bonus = $t05023950395._4
1302- let outInAmountAsset = $t05023950395._5
1085+ let $t04310543261 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1086+ let amountEstimated = $t04310543261._1
1087+ let commonState = $t04310543261._2
1088+ let feeAmount = $t04310543261._3
1089+ let bonus = $t04310543261._4
1090+ let outInAmountAsset = $t04310543261._5
13031091 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13041092 }
13051093
13061094
13071095
13081096 @Callable(i)
13091097 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13101098 let isPoolOneTokenOperationsDisabled = {
13111099 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13121100 if ($isInstanceOf(@, "Boolean"))
13131101 then @
13141102 else throw(($getType(@) + " couldn't be cast to Boolean"))
13151103 }
13161104 let isGetDisabled = if (if (isGlobalShutdown())
13171105 then true
13181106 else (cfgPoolStatus == PoolShutdown))
13191107 then true
13201108 else isPoolOneTokenOperationsDisabled
13211109 let checks = [if (if (!(isGetDisabled))
13221110 then true
13231111 else isManager(i))
13241112 then true
13251113 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13261114 then true
13271115 else throwErr("no payments are expected")]
13281116 if ((checks == checks))
13291117 then {
13301118 let outAssetId = parseAssetId(outAssetIdStr)
13311119 let userAddress = i.caller
13321120 let txId = i.transactionId
13331121 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13341122 if ((currentKLp == currentKLp))
13351123 then {
13361124 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13371125 if ((unstakeInv == unstakeInv))
13381126 then {
1339- let $t05130051451 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1340- if (($t05130051451 == $t05130051451))
1127+ let $t04416644317 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1128+ if (($t04416644317 == $t04416644317))
13411129 then {
1342- let outInAmountAsset = $t05130051451._5
1343- let bonus = $t05130051451._4
1344- let feeAmount = $t05130051451._3
1345- let commonState = $t05130051451._2
1346- let amountEstimated = $t05130051451._1
1130+ let outInAmountAsset = $t04416644317._5
1131+ let bonus = $t04416644317._4
1132+ let feeAmount = $t04416644317._3
1133+ let commonState = $t04416644317._2
1134+ let amountEstimated = $t04416644317._1
13471135 let amount = if (if ((minOutAmount > 0))
13481136 then (minOutAmount > amountEstimated)
13491137 else false)
13501138 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13511139 else amountEstimated
13521140 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13531141 if ((burnInv == burnInv))
13541142 then {
1355- let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
13561143 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13571144 let sendFee = if ((feeAmount > 0))
13581145 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13591146 else nil
1360- let $t05201752264 = {
1147+ let $t04481245059 = {
13611148 let feeAmountForCalc = if ((this == feeCollectorAddress))
13621149 then 0
13631150 else feeAmount
13641151 if (outInAmountAsset)
13651152 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13661153 else $Tuple2(0, -((amount + feeAmountForCalc)))
13671154 }
1368- let amountAssetBalanceDelta = $t05201752264._1
1369- let priceAssetBalanceDelta = $t05201752264._2
1370- let $t05226752375 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1371- let refreshKLpActions = $t05226752375._1
1372- let updatedKLp = $t05226752375._2
1155+ let amountAssetBalanceDelta = $t04481245059._1
1156+ let priceAssetBalanceDelta = $t04481245059._2
1157+ let $t04506245170 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1158+ let refreshKLpActions = $t04506245170._1
1159+ let updatedKLp = $t04506245170._2
13731160 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13741161 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1375- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1162+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13761163 else throw("Strict value is not equal to itself.")
13771164 }
13781165 else throw("Strict value is not equal to itself.")
13791166 }
13801167 else throw("Strict value is not equal to itself.")
13811168 }
13821169 else throw("Strict value is not equal to itself.")
13831170 }
13841171 else throw("Strict value is not equal to itself.")
13851172 }
13861173 else throw("Strict value is not equal to itself.")
13871174 }
13881175
13891176
13901177
13911178 @Callable(i)
13921179 func get () = {
13931180 let res = commonGet(i)
1394- let outAmAmt = res._1
1181+ let outAmtAmt = res._1
13951182 let outPrAmt = res._2
13961183 let pmtAmt = res._3
13971184 let pmtAssetId = res._4
13981185 let state = res._5
1399- let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14001186 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14011187 if ((currentKLp == currentKLp))
14021188 then {
14031189 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14041190 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14051191 then {
1406- let $t05347053551 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1407- let refreshKLpActions = $t05347053551._1
1408- let updatedKLp = $t05347053551._2
1192+ let $t04611646198 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1193+ let refreshKLpActions = $t04611646198._1
1194+ let updatedKLp = $t04611646198._2
14091195 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14101196 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1411- then ((withdrawState ++ state) ++ refreshKLpActions)
1197+ then (state ++ refreshKLpActions)
14121198 else throw("Strict value is not equal to itself.")
14131199 }
14141200 else throw("Strict value is not equal to itself.")
14151201 }
14161202 else throw("Strict value is not equal to itself.")
14171203 }
14181204
14191205
14201206
14211207 @Callable(i)
14221208 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14231209 let res = commonGet(i)
14241210 let outAmAmt = res._1
14251211 let outPrAmt = res._2
14261212 let pmtAmt = res._3
14271213 let pmtAssetId = res._4
14281214 let state = res._5
14291215 if ((noLessThenAmtAsset > outAmAmt))
14301216 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14311217 else if ((noLessThenPriceAsset > outPrAmt))
14321218 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14331219 else {
1434- let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14351220 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14361221 if ((currentKLp == currentKLp))
14371222 then {
14381223 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14391224 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14401225 then {
1441- let $t05464654727 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1442- let refreshKLpActions = $t05464654727._1
1443- let updatedKLp = $t05464654727._2
1226+ let $t04714747228 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1227+ let refreshKLpActions = $t04714747228._1
1228+ let updatedKLp = $t04714747228._2
14441229 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14451230 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1446- then ((withdrawState ++ state) ++ refreshKLpActions)
1231+ then (state ++ refreshKLpActions)
14471232 else throw("Strict value is not equal to itself.")
14481233 }
14491234 else throw("Strict value is not equal to itself.")
14501235 }
14511236 else throw("Strict value is not equal to itself.")
14521237 }
14531238 }
14541239
14551240
14561241
14571242 @Callable(i)
14581243 func unstakeAndGet (amount) = {
14591244 let checkPayments = if ((size(i.payments) != 0))
14601245 then throw("No payments are expected")
14611246 else true
14621247 if ((checkPayments == checkPayments))
14631248 then {
14641249 let cfg = getPoolConfig()
14651250 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14661251 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14671252 if ((currentKLp == currentKLp))
14681253 then {
14691254 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14701255 if ((unstakeInv == unstakeInv))
14711256 then {
14721257 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14731258 let outAmAmt = res._1
14741259 let outPrAmt = res._2
14751260 let poolStatus = parseIntValue(res._9)
14761261 let state = res._10
1477- let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14781262 let checkPoolStatus = if (if (isGlobalShutdown())
14791263 then true
14801264 else (poolStatus == PoolShutdown))
14811265 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14821266 else true
14831267 if ((checkPoolStatus == checkPoolStatus))
14841268 then {
14851269 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14861270 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14871271 then {
1488- let $t05599956080 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1489- let refreshKLpActions = $t05599956080._1
1490- let updatedKLp = $t05599956080._2
1272+ let $t04835448435 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1273+ let refreshKLpActions = $t04835448435._1
1274+ let updatedKLp = $t04835448435._2
14911275 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14921276 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1493- then ((withdrawState ++ state) ++ refreshKLpActions)
1277+ then (state ++ refreshKLpActions)
14941278 else throw("Strict value is not equal to itself.")
14951279 }
14961280 else throw("Strict value is not equal to itself.")
14971281 }
14981282 else throw("Strict value is not equal to itself.")
14991283 }
15001284 else throw("Strict value is not equal to itself.")
15011285 }
15021286 else throw("Strict value is not equal to itself.")
15031287 }
15041288 else throw("Strict value is not equal to itself.")
15051289 }
15061290
15071291
15081292
15091293 @Callable(i)
15101294 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15111295 let isGetDisabled = if (isGlobalShutdown())
15121296 then true
15131297 else (cfgPoolStatus == PoolShutdown)
15141298 let checks = [if (!(isGetDisabled))
15151299 then true
15161300 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15171301 then true
15181302 else throw("no payments are expected")]
15191303 if ((checks == checks))
15201304 then {
15211305 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15221306 if ((currentKLp == currentKLp))
15231307 then {
15241308 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15251309 if ((unstakeInv == unstakeInv))
15261310 then {
15271311 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15281312 let outAmAmt = res._1
15291313 let outPrAmt = res._2
15301314 let state = res._10
1531- let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15321315 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15331316 then true
15341317 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15351318 then true
15361319 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15371320 if ((checkAmounts == checkAmounts))
15381321 then {
15391322 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15401323 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15411324 then {
1542- let $t05752157602 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1543- let refreshKLpActions = $t05752157602._1
1544- let updatedKLp = $t05752157602._2
1325+ let $t04973049811 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1326+ let refreshKLpActions = $t04973049811._1
1327+ let updatedKLp = $t04973049811._2
15451328 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15461329 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1547- then ((withdrawState ++ state) ++ refreshKLpActions)
1330+ then (state ++ refreshKLpActions)
15481331 else throw("Strict value is not equal to itself.")
15491332 }
15501333 else throw("Strict value is not equal to itself.")
15511334 }
15521335 else throw("Strict value is not equal to itself.")
15531336 }
15541337 else throw("Strict value is not equal to itself.")
15551338 }
15561339 else throw("Strict value is not equal to itself.")
15571340 }
15581341 else throw("Strict value is not equal to itself.")
15591342 }
15601343
15611344
15621345
15631346 @Callable(i)
15641347 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15651348 then throw("permissions denied")
15661349 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15671350
15681351
15691352
15701353 @Callable(i)
15711354 func refreshKLp () = {
15721355 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15731356 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15741357 then unit
15751358 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15761359 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15771360 then {
15781361 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1579- let $t05880658870 = refreshKLpInternal(0, 0, 0)
1580- let kLpUpdateActions = $t05880658870._1
1581- let updatedKLp = $t05880658870._2
1362+ let $t05099851062 = refreshKLpInternal(0, 0, 0)
1363+ let kLpUpdateActions = $t05099851062._1
1364+ let updatedKLp = $t05099851062._2
15821365 let actions = if ((kLp != updatedKLp))
15831366 then kLpUpdateActions
15841367 else throwErr("nothing to refresh")
15851368 $Tuple2(actions, toString(updatedKLp))
15861369 }
15871370 else throw("Strict value is not equal to itself.")
15881371 }
15891372
15901373
15911374
15921375 @Callable(i)
15931376 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
15941377
15951378
15961379
15971380 @Callable(i)
15981381 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
15991382
16001383
16011384
16021385 @Callable(i)
16031386 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16041387 let prices = calcPrices(amAmt, prAmt, lpAmt)
16051388 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16061389 }
16071390
16081391
16091392
16101393 @Callable(i)
16111394 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16121395
16131396
16141397
16151398 @Callable(i)
16161399 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16171400
16181401
16191402
16201403 @Callable(i)
16211404 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16221405
16231406
16241407
16251408 @Callable(i)
16261409 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16271410
16281411
16291412
16301413 @Callable(i)
16311414 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16321415 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16331416 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16341417 }
16351418
16361419
16371420
16381421 @Callable(i)
16391422 func statsREADONLY () = {
16401423 let cfg = getPoolConfig()
16411424 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16421425 let amtAssetId = cfg[idxAmtAssetId]
16431426 let priceAssetId = cfg[idxPriceAssetId]
16441427 let iAmtAssetId = cfg[idxIAmtAssetId]
16451428 let iPriceAssetId = cfg[idxIPriceAssetId]
16461429 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16471430 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16481431 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16491432 let accAmtAssetBalance = getAccBalance(amtAssetId)
16501433 let accPriceAssetBalance = getAccBalance(priceAssetId)
16511434 let pricesList = if ((poolLPBalance == 0))
16521435 then [zeroBigInt, zeroBigInt, zeroBigInt]
16531436 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16541437 let curPrice = 0
16551438 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16561439 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16571440 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16581441 $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))
16591442 }
16601443
16611444
16621445
16631446 @Callable(i)
16641447 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16651448 let cfg = getPoolConfig()
16661449 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16671450 let amAssetIdStr = cfg[idxAmtAssetId]
16681451 let amAssetId = fromBase58String(amAssetIdStr)
16691452 let prAssetIdStr = cfg[idxPriceAssetId]
16701453 let prAssetId = fromBase58String(prAssetIdStr)
16711454 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16721455 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16731456 let poolStatus = cfg[idxPoolStatus]
16741457 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16751458 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16761459 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16771460 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16781461 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16791462 let curPriceX18 = if ((poolLPBalance == 0))
16801463 then zeroBigInt
16811464 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16821465 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16831466 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16841467 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16851468 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16861469 let calcLpAmt = estPut._1
16871470 let curPriceCalc = estPut._3
16881471 let amBalance = estPut._4
16891472 let prBalance = estPut._5
16901473 let lpEmission = estPut._6
16911474 $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))
16921475 }
16931476
16941477
16951478
16961479 @Callable(i)
16971480 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
16981481 let cfg = getPoolConfig()
16991482 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17001483 let amAssetIdStr = cfg[idxAmtAssetId]
17011484 let amAssetId = fromBase58String(amAssetIdStr)
17021485 let prAssetIdStr = cfg[idxPriceAssetId]
17031486 let prAssetId = fromBase58String(prAssetIdStr)
17041487 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17051488 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17061489 let poolStatus = cfg[idxPoolStatus]
17071490 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17081491 let amBalanceRaw = getAccBalance(amAssetIdStr)
17091492 let prBalanceRaw = getAccBalance(prAssetIdStr)
17101493 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17111494 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17121495 let curPriceX18 = if ((poolLPBalance == 0))
17131496 then zeroBigInt
17141497 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17151498 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17161499 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17171500 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17181501 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17191502 let calcLpAmt = estPut._1
17201503 let curPriceCalc = estPut._3
17211504 let amBalance = estPut._4
17221505 let prBalance = estPut._5
17231506 let lpEmission = estPut._6
17241507 $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))
17251508 }
17261509
17271510
17281511
17291512 @Callable(i)
17301513 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17311514 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17321515 let outAmAmt = res._1
17331516 let outPrAmt = res._2
17341517 let amBalance = res._5
17351518 let prBalance = res._6
17361519 let lpEmission = res._7
17371520 let curPrice = res._8
17381521 let poolStatus = parseIntValue(res._9)
17391522 $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))
17401523 }
17411524
17421525
17431526 @Verifier(tx)
17441527 func verify () = {
17451528 let targetPublicKey = match managerPublicKeyOrUnit() {
17461529 case pk: ByteVector =>
17471530 pk
17481531 case _: Unit =>
17491532 tx.senderPublicKey
17501533 case _ =>
17511534 throw("Match error")
17521535 }
17531536 match tx {
17541537 case order: Order =>
17551538 let matcherPub = getMatcherPubOrFail()
1756- let $t06753267601 = validateMatcherOrderAllowed(order)
1757- let orderValid = $t06753267601._1
1758- let orderValidInfo = $t06753267601._2
1539+ let $t05972459793 = validateMatcherOrderAllowed(order)
1540+ let orderValid = $t05972459793._1
1541+ let orderValidInfo = $t05972459793._2
17591542 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17601543 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17611544 if (if (if (orderValid)
17621545 then senderValid
17631546 else false)
17641547 then matcherValid
17651548 else false)
17661549 then true
17671550 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17681551 case s: SetScriptTransaction =>
17691552 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17701553 then true
17711554 else {
17721555 let newHash = blake2b256(value(s.script))
17731556 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17741557 let currentHash = scriptHash(this)
17751558 if ((allowedHash == newHash))
17761559 then (currentHash != newHash)
17771560 else false
17781561 }
17791562 case _ =>
17801563 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17811564 }
17821565 }
17831566

github/deemru/w8io/026f985 
219.01 ms