tx · 9oxgP1z3iJtabKzHDH1yRcL259bW8tPS1qGM9reyhTza

3N3LtGiBDqDjfHpd7WnTCTKXB3gPWqUrDLL:  -0.04200000 Waves

2023.04.05 15:10 [2521219] smart account 3N3LtGiBDqDjfHpd7WnTCTKXB3gPWqUrDLL > SELF 0.00000000 Waves

{ "type": 13, "id": "9oxgP1z3iJtabKzHDH1yRcL259bW8tPS1qGM9reyhTza", "fee": 4200000, "feeAssetId": null, "timestamp": 1680696638737, "version": 2, "chainId": 84, "sender": "3N3LtGiBDqDjfHpd7WnTCTKXB3gPWqUrDLL", "senderPublicKey": "3wnnbmrpP3X4LxULFVHTeu7zNZBzFV7NSxRokwryVFaJ", "proofs": [ "4gDbRhTSNTuCCY7JT5hfAAy3cTq9r5dRtJ2WL3X5Ng6kue8oGDkyWnEtM95HhRJDaxnc1j7fuBNhbPE3o15T5uge" ], "script": "base64:BgKQNwgCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0S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FNldFNjcmlwdFRyYW5zYWN0aW9uBAJnZgUCYlQDCQD0AwMIBQJpaAlib2R5Qnl0ZXMJAJEDAggFAmloBnByb29mcwAABQJpagYEAmltCQD2AwEJAQV2YWx1ZQEIBQJnZgZzY3JpcHQEAmluCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYVQJAQJhRgAEAmlvCQDxBwEFBHRoaXMDCQAAAgUCaW4FAmltCQECIT0CBQJpbwUCaW0HCQD0AwMIBQJpaAlib2R5Qnl0ZXMJAJEDAggFAmloBnByb29mcwAABQJpauamT2I=", "height": 2521219, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Bq5H3Z5t78hhPJC2jyc6WgGLj3dvuCVHwbFGUaZiffqc Next: 6SQ6sdfqnrpBMLjsoUjo3yfoeQou259QQ6LXXMightqr Diff:
OldNewDifferences
357357 }
358358
359359
360-func getLeaseProxyConfig (assetId) = invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil)
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+}
361366
362367
363368 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
400405 }
401406
402407
403-func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
404- case a: (Boolean, Int, Int, String, String, Int, String) =>
405- let $t01547915588 = a
406- let isLeasable = $t01547915588._1
407- let leasedRatio = $t01547915588._2
408- let minBalance = $t01547915588._3
409- let proxyAddress = $t01547915588._4
410- let proxyAssetId = $t01547915588._5
411- let proxyRateMul = $t01547915588._6
412- let stakingProfitAddress = $t01547915588._7
413- if (isLeasable)
414- then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
415- else nil
416- case _ =>
417- throwErr((("[" + assetId) + "] Rebalance error"))
418-}
408+func rebalanceAsset (assetId) = {
409+ let $t01552715663 = getLeaseProxyConfig(assetId)
410+ let isLeasable = $t01552715663._1
411+ let leasedRatio = $t01552715663._2
412+ let minBalance = $t01552715663._3
413+ let proxyAddress = $t01552715663._4
414+ let proxyAssetId = $t01552715663._5
415+ let proxyRateMul = $t01552715663._6
416+ let stakingProfitAddress = $t01552715663._7
417+ if (isLeasable)
418+ then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
419+ else nil
420+ }
419421
420422
421-func getWithdrawAssetState (assetId,getAmount) = match getLeaseProxyConfig(assetId) {
422- case a: (Boolean, Int, Int, String, String, Int, String) =>
423- let $t01618116290 = a
424- let isLeasable = $t01618116290._1
425- let leasedRatio = $t01618116290._2
426- let minBalance = $t01618116290._3
427- let proxyAddress = $t01618116290._4
428- let proxyAssetId = $t01618116290._5
429- let proxyRateMul = $t01618116290._6
430- let stakingProfitAddress = $t01618116290._7
431- if (isLeasable)
432- then {
433- let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
434- if ((newTotalCalcBalance == newTotalCalcBalance))
435- then {
436- let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
437- if ((newAdditionalBalance == newAdditionalBalance))
438- then {
439- let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
440- if ((withdrawAmount == withdrawAmount))
441- then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
442- else throw("Strict value is not equal to itself.")
443- }
444- else throw("Strict value is not equal to itself.")
445- }
446- else throw("Strict value is not equal to itself.")
447- }
448- else nil
449- case _ =>
450- throwErr((("[" + assetId) + "] getWithdrawAssetState() error"))
451-}
423+func withdrawAndRebalanceAsset (assetId,getAmount) = {
424+ let $t01605216188 = getLeaseProxyConfig(assetId)
425+ let isLeasable = $t01605216188._1
426+ let leasedRatio = $t01605216188._2
427+ let minBalance = $t01605216188._3
428+ let proxyAddress = $t01605216188._4
429+ let proxyAssetId = $t01605216188._5
430+ let proxyRateMul = $t01605216188._6
431+ let stakingProfitAddress = $t01605216188._7
432+ if (isLeasable)
433+ then {
434+ let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
435+ if ((newTotalCalcBalance == newTotalCalcBalance))
436+ then {
437+ let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
438+ if ((newAdditionalBalance == newAdditionalBalance))
439+ then {
440+ let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
441+ if ((withdrawAmount == withdrawAmount))
442+ then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
443+ else throw("Strict value is not equal to itself.")
444+ }
445+ else throw("Strict value is not equal to itself.")
446+ }
447+ else throw("Strict value is not equal to itself.")
448+ }
449+ else nil
450+ }
452451
453452
454453 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
502501 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
503502 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
504503 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
505- let AmAmtWithdrawState = getWithdrawAssetState(amAssetId, outAmAmt)
504+ let AmAmtWithdrawState = withdrawAndRebalanceAsset(amAssetId, outAmAmt)
506505 if ((AmAmtWithdrawState == AmAmtWithdrawState))
507506 then {
508- let PrAmtWithdrawState = getWithdrawAssetState(prAssetId, outPrAmt)
507+ let PrAmtWithdrawState = withdrawAndRebalanceAsset(prAssetId, outPrAmt)
509508 if ((PrAmtWithdrawState == PrAmtWithdrawState))
510509 then {
511510 let state = if ((txId58 == ""))
640639 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
641640 let amountAssetAmount = order.amount
642641 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
643- let $t02837228584 = if ((order.orderType == Buy))
642+ let $t02815328365 = if ((order.orderType == Buy))
644643 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
645644 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
646- let amountAssetBalanceDelta = $t02837228584._1
647- let priceAssetBalanceDelta = $t02837228584._2
645+ let amountAssetBalanceDelta = $t02815328365._1
646+ let priceAssetBalanceDelta = $t02815328365._2
648647 if (if (if (isGlobalShutdown())
649648 then true
650649 else (cfgPoolStatus == PoolMatcherDisabled))
657656 then throw("Wrong order assets.")
658657 else {
659658 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
660- let $t02902429124 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
661- let unusedActions = $t02902429124._1
662- let kLpNew = $t02902429124._2
659+ let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
660+ let unusedActions = $t02880528905._1
661+ let kLpNew = $t02880528905._2
663662 let isOrderValid = (kLpNew >= kLp)
664663 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
665664 $Tuple2(isOrderValid, info)
738737 else if ((paymentAssetId == cfgPriceAssetId))
739738 then false
740739 else throwErr("invalid asset")
741- let $t03223732530 = if (isEval)
740+ let $t03201832311 = if (isEval)
742741 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
743742 else if (paymentInAmountAsset)
744743 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
745744 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
746- let amountBalanceOld = $t03223732530._1
747- let priceBalanceOld = $t03223732530._2
748- let $t03253432683 = if (paymentInAmountAsset)
745+ let amountBalanceOld = $t03201832311._1
746+ let priceBalanceOld = $t03201832311._2
747+ let $t03231532464 = if (paymentInAmountAsset)
749748 then $Tuple2(paymentAmountRaw, 0)
750749 else $Tuple2(0, paymentAmountRaw)
751- let amountAssetAmountRaw = $t03253432683._1
752- let priceAssetAmountRaw = $t03253432683._2
750+ let amountAssetAmountRaw = $t03231532464._1
751+ let priceAssetAmountRaw = $t03231532464._2
753752 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
754753 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
755- let $t03281532879 = takeFee(paymentAmountRaw, inFee)
756- let paymentAmount = $t03281532879._1
757- let feeAmount = $t03281532879._2
754+ let $t03259632660 = takeFee(paymentAmountRaw, inFee)
755+ let paymentAmount = $t03259632660._1
756+ let feeAmount = $t03259632660._2
758757 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
759758 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
760759 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
777776 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
778777 let priceOld = fromX18(priceOldX18, scale8)
779778 let loss = {
780- let $t03456034727 = if (paymentInAmountAsset)
779+ let $t03434134508 = if (paymentInAmountAsset)
781780 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
782781 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
783- let amount = $t03456034727._1
784- let balance = $t03456034727._2
782+ let amount = $t03434134508._1
783+ let balance = $t03434134508._2
785784 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
786785 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
787786 }
821820 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
822821 let redeemedBigInt = toBigInt(paymentAmount)
823822 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
824- let $t03680536861 = takeFee(amountRaw, outFee)
825- let totalAmount = $t03680536861._1
826- let feeAmount = $t03680536861._2
827- let $t03686537091 = if (outInAmountAsset)
823+ let $t03658636642 = takeFee(amountRaw, outFee)
824+ let totalAmount = $t03658636642._1
825+ let feeAmount = $t03658636642._2
826+ let $t03664636872 = if (outInAmountAsset)
828827 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
829828 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
830- let outAmAmount = $t03686537091._1
831- let outPrAmount = $t03686537091._2
832- let amBalanceNew = $t03686537091._3
833- let prBalanceNew = $t03686537091._4
829+ let outAmAmount = $t03664636872._1
830+ let outPrAmount = $t03664636872._2
831+ let amBalanceNew = $t03664636872._3
832+ let prBalanceNew = $t03664636872._4
834833 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
835834 let priceNew = fromX18(priceNewX18, scale8)
836835 let commonState = if (isEval)
902901
903902 @Callable(i)
904903 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
905- let $t03897739282 = if ((isReverse == false))
904+ let $t03875839063 = if ((isReverse == false))
906905 then {
907906 let assetOut = getStringOrFail(this, pa())
908907 let assetIn = getStringOrFail(this, aa())
913912 let assetIn = getStringOrFail(this, pa())
914913 $Tuple2(assetOut, assetIn)
915914 }
916- let assetOut = $t03897739282._1
917- let assetIn = $t03897739282._2
915+ let assetOut = $t03875839063._1
916+ let assetIn = $t03875839063._2
918917 let poolAssetInBalance = getAccBalance(assetIn)
919918 let poolAssetOutBalance = getAccBalance(assetOut)
920919 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
968967 let rebalanceState = rebalanceAsset(assetIn)
969968 if ((rebalanceState == rebalanceState))
970969 then {
971- let withdrawState = getWithdrawAssetState(assetOut, amountOut)
970+ let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
972971 if ((withdrawState == withdrawState))
973972 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
974973 else throw("Strict value is not equal to itself.")
10651064 else throw("Strict value is not equal to itself.")
10661065 }
10671066 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1068- let $t04432444786 = refreshKLpInternal(0, 0, 0)
1069- if (($t04432444786 == $t04432444786))
1067+ let $t04410944571 = refreshKLpInternal(0, 0, 0)
1068+ if (($t04410944571 == $t04410944571))
10701069 then {
1071- let updatedKLp = $t04432444786._2
1072- let refreshKLpActions = $t04432444786._1
1070+ let updatedKLp = $t04410944571._2
1071+ let refreshKLpActions = $t04410944571._1
10731072 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10741073 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10751074 then {
11061105 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11071106 if ((currentKLp == currentKLp))
11081107 then {
1109- let $t04539845463 = refreshKLpInternal(0, 0, 0)
1110- let refreshKLpActions = $t04539845463._1
1111- let updatedKLp = $t04539845463._2
1108+ let $t04518345248 = refreshKLpInternal(0, 0, 0)
1109+ let refreshKLpActions = $t04518345248._1
1110+ let updatedKLp = $t04518345248._2
11121111 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11131112 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11141113 then (state ++ refreshKLpActions)
11551154 then {
11561155 let userAddress = i.caller
11571156 let txId = i.transactionId
1158- let $t04665146803 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1159- if (($t04665146803 == $t04665146803))
1157+ let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1158+ if (($t04643646588 == $t04643646588))
11601159 then {
1161- let paymentInAmountAsset = $t04665146803._5
1162- let bonus = $t04665146803._4
1163- let feeAmount = $t04665146803._3
1164- let commonState = $t04665146803._2
1165- let emitAmountEstimated = $t04665146803._1
1160+ let paymentInAmountAsset = $t04643646588._5
1161+ let bonus = $t04643646588._4
1162+ let feeAmount = $t04643646588._3
1163+ let commonState = $t04643646588._2
1164+ let emitAmountEstimated = $t04643646588._1
11661165 let emitAmount = if (if ((minOutAmount > 0))
11671166 then (minOutAmount > emitAmountEstimated)
11681167 else false)
11821181 let sendFee = if ((feeAmount > 0))
11831182 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11841183 else nil
1185- let $t04738947586 = if ((this == feeCollectorAddress))
1184+ let $t04717447371 = if ((this == feeCollectorAddress))
11861185 then $Tuple2(0, 0)
11871186 else if (paymentInAmountAsset)
11881187 then $Tuple2(-(feeAmount), 0)
11891188 else $Tuple2(0, -(feeAmount))
1190- let amountAssetBalanceDelta = $t04738947586._1
1191- let priceAssetBalanceDelta = $t04738947586._2
1192- let $t04758947697 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1193- let refreshKLpActions = $t04758947697._1
1194- let updatedKLp = $t04758947697._2
1189+ let amountAssetBalanceDelta = $t04717447371._1
1190+ let priceAssetBalanceDelta = $t04717447371._2
1191+ let $t04737447482 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1192+ let refreshKLpActions = $t04737447482._1
1193+ let updatedKLp = $t04737447482._2
11951194 let kLp = value(getString(keyKLp))
11961195 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11971196 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12161215
12171216 @Callable(i)
12181217 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1219- let $t04805248209 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1220- let emitAmountEstimated = $t04805248209._1
1221- let commonState = $t04805248209._2
1222- let feeAmount = $t04805248209._3
1223- let bonus = $t04805248209._4
1224- let paymentInAmountAsset = $t04805248209._5
1218+ let $t04783747994 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1219+ let emitAmountEstimated = $t04783747994._1
1220+ let commonState = $t04783747994._2
1221+ let feeAmount = $t04783747994._3
1222+ let bonus = $t04783747994._4
1223+ let paymentInAmountAsset = $t04783747994._5
12251224 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12261225 }
12271226
12581257 then {
12591258 let userAddress = i.caller
12601259 let txId = i.transactionId
1261- let $t04909449247 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1262- if (($t04909449247 == $t04909449247))
1260+ let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1261+ if (($t04887949032 == $t04887949032))
12631262 then {
1264- let outInAmountAsset = $t04909449247._5
1265- let bonus = $t04909449247._4
1266- let feeAmount = $t04909449247._3
1267- let commonState = $t04909449247._2
1268- let amountEstimated = $t04909449247._1
1263+ let outInAmountAsset = $t04887949032._5
1264+ let bonus = $t04887949032._4
1265+ let feeAmount = $t04887949032._3
1266+ let commonState = $t04887949032._2
1267+ let amountEstimated = $t04887949032._1
12691268 let amount = if (if ((minOutAmount > 0))
12701269 then (minOutAmount > amountEstimated)
12711270 else false)
12741273 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12751274 if ((burnInv == burnInv))
12761275 then {
1277- let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
1276+ let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
12781277 if ((withdrawState == withdrawState))
12791278 then {
12801279 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12811280 let sendFee = if ((feeAmount > 0))
12821281 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12831282 else nil
1284- let $t04981750064 = {
1283+ let $t04960649853 = {
12851284 let feeAmountForCalc = if ((this == feeCollectorAddress))
12861285 then 0
12871286 else feeAmount
12891288 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12901289 else $Tuple2(0, -((amount + feeAmountForCalc)))
12911290 }
1292- let amountAssetBalanceDelta = $t04981750064._1
1293- let priceAssetBalanceDelta = $t04981750064._2
1294- let $t05006750175 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1295- let refreshKLpActions = $t05006750175._1
1296- let updatedKLp = $t05006750175._2
1291+ let amountAssetBalanceDelta = $t04960649853._1
1292+ let priceAssetBalanceDelta = $t04960649853._2
1293+ let $t04985649964 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1294+ let refreshKLpActions = $t04985649964._1
1295+ let updatedKLp = $t04985649964._2
12971296 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12981297 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12991298 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13141313
13151314 @Callable(i)
13161315 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1317- let $t05045350609 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1318- let amountEstimated = $t05045350609._1
1319- let commonState = $t05045350609._2
1320- let feeAmount = $t05045350609._3
1321- let bonus = $t05045350609._4
1322- let outInAmountAsset = $t05045350609._5
1316+ let $t05024250398 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1317+ let amountEstimated = $t05024250398._1
1318+ let commonState = $t05024250398._2
1319+ let feeAmount = $t05024250398._3
1320+ let bonus = $t05024250398._4
1321+ let outInAmountAsset = $t05024250398._5
13231322 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13241323 }
13251324
13561355 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13571356 if ((unstakeInv == unstakeInv))
13581357 then {
1359- let $t05151451665 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1360- if (($t05151451665 == $t05151451665))
1358+ let $t05130351454 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1359+ if (($t05130351454 == $t05130351454))
13611360 then {
1362- let outInAmountAsset = $t05151451665._5
1363- let bonus = $t05151451665._4
1364- let feeAmount = $t05151451665._3
1365- let commonState = $t05151451665._2
1366- let amountEstimated = $t05151451665._1
1361+ let outInAmountAsset = $t05130351454._5
1362+ let bonus = $t05130351454._4
1363+ let feeAmount = $t05130351454._3
1364+ let commonState = $t05130351454._2
1365+ let amountEstimated = $t05130351454._1
13671366 let amount = if (if ((minOutAmount > 0))
13681367 then (minOutAmount > amountEstimated)
13691368 else false)
13721371 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13731372 if ((burnInv == burnInv))
13741373 then {
1375- let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
1374+ let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
13761375 if ((withdrawState == withdrawState))
13771376 then {
13781377 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13791378 let sendFee = if ((feeAmount > 0))
13801379 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13811380 else nil
1382- let $t05223052477 = {
1381+ let $t05202352270 = {
13831382 let feeAmountForCalc = if ((this == feeCollectorAddress))
13841383 then 0
13851384 else feeAmount
13871386 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13881387 else $Tuple2(0, -((amount + feeAmountForCalc)))
13891388 }
1390- let amountAssetBalanceDelta = $t05223052477._1
1391- let priceAssetBalanceDelta = $t05223052477._2
1392- let $t05248052588 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1393- let refreshKLpActions = $t05248052588._1
1394- let updatedKLp = $t05248052588._2
1389+ let amountAssetBalanceDelta = $t05202352270._1
1390+ let priceAssetBalanceDelta = $t05202352270._2
1391+ let $t05227352381 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1392+ let refreshKLpActions = $t05227352381._1
1393+ let updatedKLp = $t05227352381._2
13951394 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13961395 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13971396 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14261425 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14271426 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14281427 then {
1429- let $t05355553637 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1430- let refreshKLpActions = $t05355553637._1
1431- let updatedKLp = $t05355553637._2
1428+ let $t05334853430 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1429+ let refreshKLpActions = $t05334853430._1
1430+ let updatedKLp = $t05334853430._2
14321431 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14331432 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14341433 then (state ++ refreshKLpActions)
14601459 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14611460 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14621461 then {
1463- let $t05458654667 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1464- let refreshKLpActions = $t05458654667._1
1465- let updatedKLp = $t05458654667._2
1462+ let $t05437954460 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1463+ let refreshKLpActions = $t05437954460._1
1464+ let updatedKLp = $t05437954460._2
14661465 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14671466 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14681467 then (state ++ refreshKLpActions)
15061505 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15071506 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15081507 then {
1509- let $t05579355874 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1510- let refreshKLpActions = $t05579355874._1
1511- let updatedKLp = $t05579355874._2
1508+ let $t05558655667 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1509+ let refreshKLpActions = $t05558655667._1
1510+ let updatedKLp = $t05558655667._2
15121511 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15131512 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15141513 then (state ++ refreshKLpActions)
15591558 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15601559 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15611560 then {
1562- let $t05716957250 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1563- let refreshKLpActions = $t05716957250._1
1564- let updatedKLp = $t05716957250._2
1561+ let $t05696257043 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1562+ let refreshKLpActions = $t05696257043._1
1563+ let updatedKLp = $t05696257043._2
15651564 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15661565 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15671566 then (state ++ refreshKLpActions)
15961595 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15971596 then {
15981597 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1599- let $t05843758501 = refreshKLpInternal(0, 0, 0)
1600- let kLpUpdateActions = $t05843758501._1
1601- let updatedKLp = $t05843758501._2
1598+ let $t05823058294 = refreshKLpInternal(0, 0, 0)
1599+ let kLpUpdateActions = $t05823058294._1
1600+ let updatedKLp = $t05823058294._2
16021601 let actions = if ((kLp != updatedKLp))
16031602 then kLpUpdateActions
16041603 else throwErr("nothing to refresh")
17731772 match tx {
17741773 case order: Order =>
17751774 let matcherPub = getMatcherPubOrFail()
1776- let $t06716367232 = validateMatcherOrderAllowed(order)
1777- let orderValid = $t06716367232._1
1778- let orderValidInfo = $t06716367232._2
1775+ let $t06695667025 = validateMatcherOrderAllowed(order)
1776+ let orderValid = $t06695667025._1
1777+ let orderValidInfo = $t06695667025._2
17791778 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17801779 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17811780 if (if (if (orderValid)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lPdecimals = 8
55
66 let scale8 = 100000000
77
88 let scale8BigInt = toBigInt(100000000)
99
1010 let scale18 = toBigInt(1000000000000000000)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let big0 = toBigInt(0)
1515
1616 let big1 = toBigInt(1)
1717
1818 let big2 = toBigInt(2)
1919
2020 let wavesString = "WAVES"
2121
2222 let SEP = "__"
2323
2424 let PoolActive = 1
2525
2626 let PoolPutDisabled = 2
2727
2828 let PoolMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
3232 let idxPoolAddress = 1
3333
3434 let idxPoolStatus = 2
3535
3636 let idxPoolLPAssetId = 3
3737
3838 let idxAmtAssetId = 4
3939
4040 let idxPriceAssetId = 5
4141
4242 let idxAmtAssetDcm = 6
4343
4444 let idxPriceAssetDcm = 7
4545
4646 let idxIAmtAssetId = 8
4747
4848 let idxIPriceAssetId = 9
4949
5050 let idxLPAssetDcm = 10
5151
5252 let idxPoolAmtAssetAmt = 1
5353
5454 let idxPoolPriceAssetAmt = 2
5555
5656 let idxPoolLPAssetAmt = 3
5757
5858 let idxFactoryStakingContract = 1
5959
6060 let idxFactorySlippageContract = 7
6161
6262 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult)
6666
6767
6868 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6969
7070
7171 func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
7272
7373
7474 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7575
7676
7777 func abs (val) = if ((0 > val))
7878 then -(val)
7979 else val
8080
8181
8282 func absBigInt (val) = if ((zeroBigInt > val))
8383 then -(val)
8484 else val
8585
8686
8787 func swapContract () = "%s__swapContract"
8888
8989
9090 func fc () = "%s__factoryContract"
9191
9292
9393 func mpk () = "%s__managerPublicKey"
9494
9595
9696 func pmpk () = "%s__pendingManagerPublicKey"
9797
9898
9999 func pl () = "%s%s__price__last"
100100
101101
102102 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
103103
104104
105105 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
106106
107107
108108 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
109109
110110
111111 func aa () = "%s__amountAsset"
112112
113113
114114 func pa () = "%s__priceAsset"
115115
116116
117117 let keyFee = "%s__fee"
118118
119119 let feeDefault = fraction(10, scale8, 10000)
120120
121121 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
122122
123123 let keyKLp = makeString(["%s", "kLp"], SEP)
124124
125125 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
126126
127127 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
128128
129129 let kLpRefreshDelayDefault = 30
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133133 func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134134
135135
136136 func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137137
138138
139139 func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
140140
141141
142142 func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
143143
144144
145145 func keyFactoryConfig () = "%s__factoryConfig"
146146
147147
148148 func keyMatcherPub () = "%s%s__matcher__publicKey"
149149
150150
151151 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
152152
153153
154154 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
155155
156156
157157 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
158158
159159
160160 func keyAllPoolsShutdown () = "%s__shutdown"
161161
162162
163163 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
164164
165165
166166 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
167167
168168
169169 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
170170
171171 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
172172
173173
174174 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
175175
176176
177177 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
178178
179179
180180 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
181181
182182
183183 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
184184
185185
186186 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
187187
188188 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
189189
190190 let inFee = {
191191 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
192192 if ($isInstanceOf(@, "Int"))
193193 then @
194194 else throw(($getType(@) + " couldn't be cast to Int"))
195195 }
196196
197197 let outFee = {
198198 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
199199 if ($isInstanceOf(@, "Int"))
200200 then @
201201 else throw(($getType(@) + " couldn't be cast to Int"))
202202 }
203203
204204 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
205205
206206
207207 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
208208
209209
210210 func getPoolConfig () = {
211211 let amtAsset = getStringOrFail(this, aa())
212212 let priceAsset = getStringOrFail(this, pa())
213213 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
214214 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
215215 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
216216 }
217217
218218
219219 func parseAssetId (input) = if ((input == wavesString))
220220 then unit
221221 else fromBase58String(input)
222222
223223
224224 func assetIdToString (input) = if ((input == unit))
225225 then wavesString
226226 else toBase58String(value(input))
227227
228228
229229 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]))
230230
231231
232232 let poolConfigParsed = parsePoolConfig(getPoolConfig())
233233
234234 let $t089629128 = poolConfigParsed
235235
236236 let cfgPoolAddress = $t089629128._1
237237
238238 let cfgPoolStatus = $t089629128._2
239239
240240 let cfgLpAssetId = $t089629128._3
241241
242242 let cfgAmountAssetId = $t089629128._4
243243
244244 let cfgPriceAssetId = $t089629128._5
245245
246246 let cfgAmountAssetDecimals = $t089629128._6
247247
248248 let cfgPriceAssetDecimals = $t089629128._7
249249
250250 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
251251
252252
253253 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
254254
255255 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
256256
257257 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)
258258
259259
260260 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)
261261
262262
263263 func getAccBalance (assetId) = {
264264 let balanceOnPool = if ((assetId == "WAVES"))
265265 then wavesBalance(this).available
266266 else assetBalance(this, fromBase58String(assetId))
267267 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
268268 max([0, totalBalance])
269269 }
270270
271271
272272 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
273273
274274
275275 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
276276
277277
278278 func getRate (proxy) = {
279279 let inv = invoke(proxy, "getRate", nil, nil)
280280 if ((inv == inv))
281281 then match inv {
282282 case r: Int =>
283283 r
284284 case _ =>
285285 throwErr("proxy.getRate() unexpected value")
286286 }
287287 else throw("Strict value is not equal to itself.")
288288 }
289289
290290
291291 func deposit (assetId,amount,stakingAssetId,proxy) = {
292292 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
293293 if ((currentAdditionalBalance == currentAdditionalBalance))
294294 then {
295295 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
296296 if ((currentStakingAssetBalance == currentStakingAssetBalance))
297297 then {
298298 let asset = parseAssetId(assetId)
299299 if ((amount > 0))
300300 then {
301301 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
302302 if ((depositInvoke == depositInvoke))
303303 then match depositInvoke {
304304 case receivedStakingAsset: Int =>
305305 let newAdditionalBalance = (currentAdditionalBalance + amount)
306306 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
307307 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
308308 case _ =>
309309 nil
310310 }
311311 else throw("Strict value is not equal to itself.")
312312 }
313313 else nil
314314 }
315315 else throw("Strict value is not equal to itself.")
316316 }
317317 else throw("Strict value is not equal to itself.")
318318 }
319319
320320
321321 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
322322 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
323323 if ((currentAdditionalBalance == currentAdditionalBalance))
324324 then {
325325 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
326326 if ((currentStakingAssetBalance == currentStakingAssetBalance))
327327 then {
328328 let currentProxyRate = getRate(proxy)
329329 if ((currentProxyRate == currentProxyRate))
330330 then {
331331 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
332332 let stakingAsset = parseAssetId(stakingAssetId)
333333 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
334334 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
335335 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
336336 if ((sendStakingAssetAmount > 0))
337337 then {
338338 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
339339 if ((withdrawInvoke == withdrawInvoke))
340340 then match withdrawInvoke {
341341 case receivedAssets: Int =>
342342 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
343343 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
344344 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
345345 case _ =>
346346 nil
347347 }
348348 else throw("Strict value is not equal to itself.")
349349 }
350350 else nil
351351 }
352352 else throw("Strict value is not equal to itself.")
353353 }
354354 else throw("Strict value is not equal to itself.")
355355 }
356356 else throw("Strict value is not equal to itself.")
357357 }
358358
359359
360-func getLeaseProxyConfig (assetId) = invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil)
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+}
361366
362367
363368 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
364369 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
365370 if ((currentAdditionalBalance == currentAdditionalBalance))
366371 then {
367372 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
368373 if ((currentStakingAssetBalance == currentStakingAssetBalance))
369374 then {
370375 let availableBalance = match parseAssetId(assetId) {
371376 case b: ByteVector =>
372377 assetBalance(this, b)
373378 case u: Unit =>
374379 wavesBalance(this).available
375380 case _ =>
376381 throw("Match error")
377382 }
378383 if ((availableBalance == availableBalance))
379384 then {
380385 let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
381386 let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
382387 let diff = (currentAdditionalBalance - targetAdditionalBalance)
383388 if ((diff == 0))
384389 then nil
385390 else if ((0 > diff))
386391 then {
387392 let sendAssetAmount = -(diff)
388393 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
389394 }
390395 else {
391396 let getAssetAmount = diff
392397 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
393398 }
394399 }
395400 else throw("Strict value is not equal to itself.")
396401 }
397402 else throw("Strict value is not equal to itself.")
398403 }
399404 else throw("Strict value is not equal to itself.")
400405 }
401406
402407
403-func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
404- case a: (Boolean, Int, Int, String, String, Int, String) =>
405- let $t01547915588 = a
406- let isLeasable = $t01547915588._1
407- let leasedRatio = $t01547915588._2
408- let minBalance = $t01547915588._3
409- let proxyAddress = $t01547915588._4
410- let proxyAssetId = $t01547915588._5
411- let proxyRateMul = $t01547915588._6
412- let stakingProfitAddress = $t01547915588._7
413- if (isLeasable)
414- then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
415- else nil
416- case _ =>
417- throwErr((("[" + assetId) + "] Rebalance error"))
418-}
408+func rebalanceAsset (assetId) = {
409+ let $t01552715663 = getLeaseProxyConfig(assetId)
410+ let isLeasable = $t01552715663._1
411+ let leasedRatio = $t01552715663._2
412+ let minBalance = $t01552715663._3
413+ let proxyAddress = $t01552715663._4
414+ let proxyAssetId = $t01552715663._5
415+ let proxyRateMul = $t01552715663._6
416+ let stakingProfitAddress = $t01552715663._7
417+ if (isLeasable)
418+ then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
419+ else nil
420+ }
419421
420422
421-func getWithdrawAssetState (assetId,getAmount) = match getLeaseProxyConfig(assetId) {
422- case a: (Boolean, Int, Int, String, String, Int, String) =>
423- let $t01618116290 = a
424- let isLeasable = $t01618116290._1
425- let leasedRatio = $t01618116290._2
426- let minBalance = $t01618116290._3
427- let proxyAddress = $t01618116290._4
428- let proxyAssetId = $t01618116290._5
429- let proxyRateMul = $t01618116290._6
430- let stakingProfitAddress = $t01618116290._7
431- if (isLeasable)
432- then {
433- let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
434- if ((newTotalCalcBalance == newTotalCalcBalance))
435- then {
436- let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
437- if ((newAdditionalBalance == newAdditionalBalance))
438- then {
439- let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
440- if ((withdrawAmount == withdrawAmount))
441- then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
442- else throw("Strict value is not equal to itself.")
443- }
444- else throw("Strict value is not equal to itself.")
445- }
446- else throw("Strict value is not equal to itself.")
447- }
448- else nil
449- case _ =>
450- throwErr((("[" + assetId) + "] getWithdrawAssetState() error"))
451-}
423+func withdrawAndRebalanceAsset (assetId,getAmount) = {
424+ let $t01605216188 = getLeaseProxyConfig(assetId)
425+ let isLeasable = $t01605216188._1
426+ let leasedRatio = $t01605216188._2
427+ let minBalance = $t01605216188._3
428+ let proxyAddress = $t01605216188._4
429+ let proxyAssetId = $t01605216188._5
430+ let proxyRateMul = $t01605216188._6
431+ let stakingProfitAddress = $t01605216188._7
432+ if (isLeasable)
433+ then {
434+ let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
435+ if ((newTotalCalcBalance == newTotalCalcBalance))
436+ then {
437+ let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
438+ if ((newAdditionalBalance == newAdditionalBalance))
439+ then {
440+ let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
441+ if ((withdrawAmount == withdrawAmount))
442+ then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
443+ else throw("Strict value is not equal to itself.")
444+ }
445+ else throw("Strict value is not equal to itself.")
446+ }
447+ else throw("Strict value is not equal to itself.")
448+ }
449+ else nil
450+ }
452451
453452
454453 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
455454 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
456455 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
457456 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
458457 }
459458
460459
461460 func calcPrices (amAmt,prAmt,lpAmt) = {
462461 let cfg = getPoolConfig()
463462 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
464463 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
465464 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
466465 let amAmtX18 = toX18(amAmt, amtAssetDcm)
467466 let prAmtX18 = toX18(prAmt, priceAssetDcm)
468467 let lpAmtX18 = toX18(lpAmt, scale8)
469468 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
470469 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
471470 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
472471 }
473472
474473
475474 func calculatePrices (amAmt,prAmt,lpAmt) = {
476475 let prices = calcPrices(amAmt, prAmt, lpAmt)
477476 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
478477 }
479478
480479
481480 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
482481 let cfg = getPoolConfig()
483482 let lpAssetId = cfg[idxPoolLPAssetId]
484483 let amAssetId = cfg[idxAmtAssetId]
485484 let prAssetId = cfg[idxPriceAssetId]
486485 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
487486 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
488487 let poolStatus = cfg[idxPoolStatus]
489488 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
490489 if ((lpAssetId != pmtAssetId))
491490 then throw("Invalid asset passed.")
492491 else {
493492 let amBalance = getAccBalance(amAssetId)
494493 let amBalanceX18 = toX18(amBalance, amAssetDcm)
495494 let prBalance = getAccBalance(prAssetId)
496495 let prBalanceX18 = toX18(prBalance, prAssetDcm)
497496 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
498497 let curPrice = fromX18(curPriceX18, scale8)
499498 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
500499 let lpEmissionX18 = toX18(lpEmission, scale8)
501500 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
502501 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
503502 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
504503 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
505- let AmAmtWithdrawState = getWithdrawAssetState(amAssetId, outAmAmt)
504+ let AmAmtWithdrawState = withdrawAndRebalanceAsset(amAssetId, outAmAmt)
506505 if ((AmAmtWithdrawState == AmAmtWithdrawState))
507506 then {
508- let PrAmtWithdrawState = getWithdrawAssetState(prAssetId, outPrAmt)
507+ let PrAmtWithdrawState = withdrawAndRebalanceAsset(prAssetId, outPrAmt)
509508 if ((PrAmtWithdrawState == PrAmtWithdrawState))
510509 then {
511510 let state = if ((txId58 == ""))
512511 then nil
513512 else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
514513 then unit
515514 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
516515 then unit
517516 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)])
518517 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
519518 }
520519 else throw("Strict value is not equal to itself.")
521520 }
522521 else throw("Strict value is not equal to itself.")
523522 }
524523 }
525524
526525
527526 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
528527 let cfg = getPoolConfig()
529528 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
530529 let amAssetIdStr = cfg[idxAmtAssetId]
531530 let prAssetIdStr = cfg[idxPriceAssetId]
532531 let iAmtAssetId = cfg[idxIAmtAssetId]
533532 let iPriceAssetId = cfg[idxIPriceAssetId]
534533 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
535534 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
536535 let poolStatus = cfg[idxPoolStatus]
537536 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
538537 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
539538 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
540539 if (if ((amAssetIdStr != inAmAssetIdStr))
541540 then true
542541 else (prAssetIdStr != inPrAssetIdStr))
543542 then throw("Invalid amt or price asset passed.")
544543 else {
545544 let amBalance = if (isEvaluate)
546545 then getAccBalance(amAssetIdStr)
547546 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
548547 let prBalance = if (isEvaluate)
549548 then getAccBalance(prAssetIdStr)
550549 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
551550 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
552551 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
553552 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
554553 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
555554 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
556555 let res = if ((lpEmission == 0))
557556 then {
558557 let curPriceX18 = zeroBigInt
559558 let slippageX18 = zeroBigInt
560559 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
561560 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
562561 }
563562 else {
564563 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
565564 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
566565 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
567566 if (if ((curPriceX18 != zeroBigInt))
568567 then (slippageX18 > slippageToleranceX18)
569568 else false)
570569 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
571570 else {
572571 let lpEmissionX18 = toX18(lpEmission, scale8)
573572 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
574573 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
575574 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
576575 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
577576 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
578577 let expAmtAssetAmtX18 = expectedAmts._1
579578 let expPriceAssetAmtX18 = expectedAmts._2
580579 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
581580 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
582581 }
583582 }
584583 let calcLpAmt = res._1
585584 let calcAmAssetPmt = res._2
586585 let calcPrAssetPmt = res._3
587586 let curPrice = fromX18(res._4, scale8)
588587 let slippageCalc = fromX18(res._5, scale8)
589588 if ((0 >= calcLpAmt))
590589 then throw("Invalid calculations. LP calculated is less than zero.")
591590 else {
592591 let emitLpAmt = if (!(emitLp))
593592 then 0
594593 else calcLpAmt
595594 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
596595 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
597596 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))]
598597 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
599598 }
600599 }
601600 }
602601
603602
604603 func calcKLp (amountBalance,priceBalance,lpEmission) = {
605604 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
606605 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
607606 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
608607 if ((lpEmission == big0))
609608 then big0
610609 else updatedKLp
611610 }
612611
613612
614613 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
615614 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
616615 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
617616 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
618617 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
619618 currentKLp
620619 }
621620
622621
623622 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
624623 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
625624 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
626625 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
627626 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
628627 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
629628 $Tuple2(actions, updatedKLp)
630629 }
631630
632631
633632 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
634633 then true
635634 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
636635
637636
638637 func validateMatcherOrderAllowed (order) = {
639638 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
640639 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
641640 let amountAssetAmount = order.amount
642641 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
643- let $t02837228584 = if ((order.orderType == Buy))
642+ let $t02815328365 = if ((order.orderType == Buy))
644643 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
645644 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
646- let amountAssetBalanceDelta = $t02837228584._1
647- let priceAssetBalanceDelta = $t02837228584._2
645+ let amountAssetBalanceDelta = $t02815328365._1
646+ let priceAssetBalanceDelta = $t02815328365._2
648647 if (if (if (isGlobalShutdown())
649648 then true
650649 else (cfgPoolStatus == PoolMatcherDisabled))
651650 then true
652651 else (cfgPoolStatus == PoolShutdown))
653652 then throw("Exchange operations disabled")
654653 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
655654 then true
656655 else (order.assetPair.priceAsset != cfgPriceAssetId))
657656 then throw("Wrong order assets.")
658657 else {
659658 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
660- let $t02902429124 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
661- let unusedActions = $t02902429124._1
662- let kLpNew = $t02902429124._2
659+ let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
660+ let unusedActions = $t02880528905._1
661+ let kLpNew = $t02880528905._2
663662 let isOrderValid = (kLpNew >= kLp)
664663 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
665664 $Tuple2(isOrderValid, info)
666665 }
667666 }
668667
669668
670669 func commonGet (i) = if ((size(i.payments) != 1))
671670 then throw("exactly 1 payment is expected")
672671 else {
673672 let pmt = value(i.payments[0])
674673 let pmtAssetId = value(pmt.assetId)
675674 let pmtAmt = pmt.amount
676675 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
677676 let outAmAmt = res._1
678677 let outPrAmt = res._2
679678 let poolStatus = parseIntValue(res._9)
680679 let state = res._10
681680 if (if (isGlobalShutdown())
682681 then true
683682 else (poolStatus == PoolShutdown))
684683 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
685684 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
686685 }
687686
688687
689688 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
690689 then throw("exactly 2 payments are expected")
691690 else {
692691 let amAssetPmt = value(i.payments[0])
693692 let prAssetPmt = value(i.payments[1])
694693 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
695694 let poolStatus = parseIntValue(estPut._8)
696695 if (if (if (isGlobalShutdown())
697696 then true
698697 else (poolStatus == PoolPutDisabled))
699698 then true
700699 else (poolStatus == PoolShutdown))
701700 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
702701 else estPut
703702 }
704703
705704
706705 func emit (amount) = {
707706 let emitInv = invoke(factoryContract, "emit", [amount], nil)
708707 if ((emitInv == emitInv))
709708 then {
710709 let emitInvLegacy = match emitInv {
711710 case legacyFactoryContract: Address =>
712711 invoke(legacyFactoryContract, "emit", [amount], nil)
713712 case _ =>
714713 unit
715714 }
716715 if ((emitInvLegacy == emitInvLegacy))
717716 then amount
718717 else throw("Strict value is not equal to itself.")
719718 }
720719 else throw("Strict value is not equal to itself.")
721720 }
722721
723722
724723 func takeFee (amount,fee) = {
725724 let feeAmount = if ((fee == 0))
726725 then 0
727726 else fraction(amount, fee, scale8)
728727 $Tuple2((amount - feeAmount), feeAmount)
729728 }
730729
731730
732731 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
733732 let isEval = (txId == unit)
734733 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
735734 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
736735 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
737736 then true
738737 else if ((paymentAssetId == cfgPriceAssetId))
739738 then false
740739 else throwErr("invalid asset")
741- let $t03223732530 = if (isEval)
740+ let $t03201832311 = if (isEval)
742741 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
743742 else if (paymentInAmountAsset)
744743 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
745744 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
746- let amountBalanceOld = $t03223732530._1
747- let priceBalanceOld = $t03223732530._2
748- let $t03253432683 = if (paymentInAmountAsset)
745+ let amountBalanceOld = $t03201832311._1
746+ let priceBalanceOld = $t03201832311._2
747+ let $t03231532464 = if (paymentInAmountAsset)
749748 then $Tuple2(paymentAmountRaw, 0)
750749 else $Tuple2(0, paymentAmountRaw)
751- let amountAssetAmountRaw = $t03253432683._1
752- let priceAssetAmountRaw = $t03253432683._2
750+ let amountAssetAmountRaw = $t03231532464._1
751+ let priceAssetAmountRaw = $t03231532464._2
753752 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
754753 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
755- let $t03281532879 = takeFee(paymentAmountRaw, inFee)
756- let paymentAmount = $t03281532879._1
757- let feeAmount = $t03281532879._2
754+ let $t03259632660 = takeFee(paymentAmountRaw, inFee)
755+ let paymentAmount = $t03259632660._1
756+ let feeAmount = $t03259632660._2
758757 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
759758 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
760759 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
761760 let priceNew = fromX18(priceNewX18, scale8)
762761 let paymentBalance = if (paymentInAmountAsset)
763762 then amountBalanceOld
764763 else priceBalanceOld
765764 let paymentBalanceBigInt = toBigInt(paymentBalance)
766765 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
767766 let chechSupply = if ((supplyBigInt > big0))
768767 then true
769768 else throwErr("initial deposit requires all coins")
770769 if ((chechSupply == chechSupply))
771770 then {
772771 let depositBigInt = toBigInt(paymentAmount)
773772 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
774773 let commonState = if (isEval)
775774 then nil
776775 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))]
777776 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
778777 let priceOld = fromX18(priceOldX18, scale8)
779778 let loss = {
780- let $t03456034727 = if (paymentInAmountAsset)
779+ let $t03434134508 = if (paymentInAmountAsset)
781780 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
782781 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
783- let amount = $t03456034727._1
784- let balance = $t03456034727._2
782+ let amount = $t03434134508._1
783+ let balance = $t03434134508._2
785784 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
786785 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
787786 }
788787 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
789788 }
790789 else throw("Strict value is not equal to itself.")
791790 }
792791
793792
794793 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
795794 let isEval = (txId == unit)
796795 let cfg = getPoolConfig()
797796 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
798797 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
799798 let checks = [if ((paymentAssetId == cfgLpAssetId))
800799 then true
801800 else throwErr("invalid lp asset")]
802801 if ((checks == checks))
803802 then {
804803 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
805804 then true
806805 else if ((outAssetId == cfgPriceAssetId))
807806 then false
808807 else throwErr("invalid asset")
809808 let balanceBigInt = if (outInAmountAsset)
810809 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
811810 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
812811 let outInAmountAssetDecimals = if (outInAmountAsset)
813812 then amtAssetDcm
814813 else priceAssetDcm
815814 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
816815 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
817816 let outBalance = if (outInAmountAsset)
818817 then amBalanceOld
819818 else prBalanceOld
820819 let outBalanceBigInt = toBigInt(outBalance)
821820 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
822821 let redeemedBigInt = toBigInt(paymentAmount)
823822 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
824- let $t03680536861 = takeFee(amountRaw, outFee)
825- let totalAmount = $t03680536861._1
826- let feeAmount = $t03680536861._2
827- let $t03686537091 = if (outInAmountAsset)
823+ let $t03658636642 = takeFee(amountRaw, outFee)
824+ let totalAmount = $t03658636642._1
825+ let feeAmount = $t03658636642._2
826+ let $t03664636872 = if (outInAmountAsset)
828827 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
829828 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
830- let outAmAmount = $t03686537091._1
831- let outPrAmount = $t03686537091._2
832- let amBalanceNew = $t03686537091._3
833- let prBalanceNew = $t03686537091._4
829+ let outAmAmount = $t03664636872._1
830+ let outPrAmount = $t03664636872._2
831+ let amBalanceNew = $t03664636872._3
832+ let prBalanceNew = $t03664636872._4
834833 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
835834 let priceNew = fromX18(priceNewX18, scale8)
836835 let commonState = if (isEval)
837836 then nil
838837 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)]
839838 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
840839 let priceOld = fromX18(priceOldX18, scale8)
841840 let loss = {
842841 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
843842 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
844843 }
845844 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
846845 }
847846 else throw("Strict value is not equal to itself.")
848847 }
849848
850849
851850 func managerPublicKeyOrUnit () = match getString(mpk()) {
852851 case s: String =>
853852 fromBase58String(s)
854853 case _: Unit =>
855854 unit
856855 case _ =>
857856 throw("Match error")
858857 }
859858
860859
861860 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
862861 case s: String =>
863862 fromBase58String(s)
864863 case _: Unit =>
865864 unit
866865 case _ =>
867866 throw("Match error")
868867 }
869868
870869
871870 func isManager (i) = match managerPublicKeyOrUnit() {
872871 case pk: ByteVector =>
873872 (i.callerPublicKey == pk)
874873 case _: Unit =>
875874 (i.caller == this)
876875 case _ =>
877876 throw("Match error")
878877 }
879878
880879
881880 func mustManager (i) = {
882881 let pd = throw("Permission denied")
883882 match managerPublicKeyOrUnit() {
884883 case pk: ByteVector =>
885884 if ((i.callerPublicKey == pk))
886885 then true
887886 else pd
888887 case _: Unit =>
889888 if ((i.caller == this))
890889 then true
891890 else pd
892891 case _ =>
893892 throw("Match error")
894893 }
895894 }
896895
897896
898897 @Callable(i)
899898 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
900899
901900
902901
903902 @Callable(i)
904903 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
905- let $t03897739282 = if ((isReverse == false))
904+ let $t03875839063 = if ((isReverse == false))
906905 then {
907906 let assetOut = getStringOrFail(this, pa())
908907 let assetIn = getStringOrFail(this, aa())
909908 $Tuple2(assetOut, assetIn)
910909 }
911910 else {
912911 let assetOut = getStringOrFail(this, aa())
913912 let assetIn = getStringOrFail(this, pa())
914913 $Tuple2(assetOut, assetIn)
915914 }
916- let assetOut = $t03897739282._1
917- let assetIn = $t03897739282._2
915+ let assetOut = $t03875839063._1
916+ let assetIn = $t03875839063._2
918917 let poolAssetInBalance = getAccBalance(assetIn)
919918 let poolAssetOutBalance = getAccBalance(assetOut)
920919 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
921920 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
922921 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
923922 let checkK = if ((newK >= oldK))
924923 then true
925924 else throw("new K is fewer error")
926925 if ((checkK == checkK))
927926 then $Tuple2(nil, amountOut)
928927 else throw("Strict value is not equal to itself.")
929928 }
930929
931930
932931
933932 @Callable(i)
934933 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
935934 let swapContact = {
936935 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
937936 if ($isInstanceOf(@, "String"))
938937 then @
939938 else throw(($getType(@) + " couldn't be cast to String"))
940939 }
941940 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
942941 then true
943942 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
944943 then true
945944 else throwErr("Permission denied")]
946945 if ((checks == checks))
947946 then {
948947 let pmt = value(i.payments[0])
949948 let assetIn = assetIdToString(pmt.assetId)
950949 let assetOut = if ((isReverse == false))
951950 then getStringOrFail(this, pa())
952951 else getStringOrFail(this, aa())
953952 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
954953 let poolAssetOutBalance = getAccBalance(assetOut)
955954 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
956955 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
957956 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
958957 let checkK = if ((newK >= oldK))
959958 then true
960959 else throw("new K is fewer error")
961960 if ((checkK == checkK))
962961 then {
963962 let checkMin = if ((amountOut >= amountOutMin))
964963 then true
965964 else throw("Exchange result is fewer coins than expected")
966965 if ((checkMin == checkMin))
967966 then {
968967 let rebalanceState = rebalanceAsset(assetIn)
969968 if ((rebalanceState == rebalanceState))
970969 then {
971- let withdrawState = getWithdrawAssetState(assetOut, amountOut)
970+ let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
972971 if ((withdrawState == withdrawState))
973972 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
974973 else throw("Strict value is not equal to itself.")
975974 }
976975 else throw("Strict value is not equal to itself.")
977976 }
978977 else throw("Strict value is not equal to itself.")
979978 }
980979 else throw("Strict value is not equal to itself.")
981980 }
982981 else throw("Strict value is not equal to itself.")
983982 }
984983
985984
986985
987986 @Callable(i)
988987 func setManager (pendingManagerPublicKey) = {
989988 let checkCaller = mustManager(i)
990989 if ((checkCaller == checkCaller))
991990 then {
992991 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
993992 if ((checkManagerPublicKey == checkManagerPublicKey))
994993 then [StringEntry(pmpk(), pendingManagerPublicKey)]
995994 else throw("Strict value is not equal to itself.")
996995 }
997996 else throw("Strict value is not equal to itself.")
998997 }
999998
1000999
10011000
10021001 @Callable(i)
10031002 func confirmManager () = {
10041003 let pm = pendingManagerPublicKeyOrUnit()
10051004 let hasPM = if (isDefined(pm))
10061005 then true
10071006 else throw("No pending manager")
10081007 if ((hasPM == hasPM))
10091008 then {
10101009 let checkPM = if ((i.callerPublicKey == value(pm)))
10111010 then true
10121011 else throw("You are not pending manager")
10131012 if ((checkPM == checkPM))
10141013 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
10151014 else throw("Strict value is not equal to itself.")
10161015 }
10171016 else throw("Strict value is not equal to itself.")
10181017 }
10191018
10201019
10211020
10221021 @Callable(i)
10231022 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10241023 then throw("Invalid slippageTolerance passed")
10251024 else {
10261025 let estPut = commonPut(i, slippageTolerance, true)
10271026 let emitLpAmt = estPut._2
10281027 let lpAssetId = estPut._7
10291028 let state = estPut._9
10301029 let amDiff = estPut._10
10311030 let prDiff = estPut._11
10321031 let amId = estPut._12
10331032 let prId = estPut._13
10341033 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10351034 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10361035 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10371036 if ((currentKLp == currentKLp))
10381037 then {
10391038 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10401039 if ((emitInv == emitInv))
10411040 then {
10421041 let emitInvLegacy = match emitInv {
10431042 case legacyFactoryContract: Address =>
10441043 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10451044 case _ =>
10461045 unit
10471046 }
10481047 if ((emitInvLegacy == emitInvLegacy))
10491048 then {
10501049 let slippageAInv = if ((amDiff > 0))
10511050 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10521051 else nil
10531052 if ((slippageAInv == slippageAInv))
10541053 then {
10551054 let slippagePInv = if ((prDiff > 0))
10561055 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10571056 else nil
10581057 if ((slippagePInv == slippagePInv))
10591058 then {
10601059 let lpTransfer = if (shouldAutoStake)
10611060 then {
10621061 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10631062 if ((slpStakeInv == slpStakeInv))
10641063 then nil
10651064 else throw("Strict value is not equal to itself.")
10661065 }
10671066 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1068- let $t04432444786 = refreshKLpInternal(0, 0, 0)
1069- if (($t04432444786 == $t04432444786))
1067+ let $t04410944571 = refreshKLpInternal(0, 0, 0)
1068+ if (($t04410944571 == $t04410944571))
10701069 then {
1071- let updatedKLp = $t04432444786._2
1072- let refreshKLpActions = $t04432444786._1
1070+ let updatedKLp = $t04410944571._2
1071+ let refreshKLpActions = $t04410944571._1
10731072 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10741073 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10751074 then {
10761075 let reb = invoke(this, "rebalance", nil, nil)
10771076 if ((reb == reb))
10781077 then ((state ++ lpTransfer) ++ refreshKLpActions)
10791078 else throw("Strict value is not equal to itself.")
10801079 }
10811080 else throw("Strict value is not equal to itself.")
10821081 }
10831082 else throw("Strict value is not equal to itself.")
10841083 }
10851084 else throw("Strict value is not equal to itself.")
10861085 }
10871086 else throw("Strict value is not equal to itself.")
10881087 }
10891088 else throw("Strict value is not equal to itself.")
10901089 }
10911090 else throw("Strict value is not equal to itself.")
10921091 }
10931092 else throw("Strict value is not equal to itself.")
10941093 }
10951094
10961095
10971096
10981097 @Callable(i)
10991098 func putForFree (maxSlippage) = if ((0 > maxSlippage))
11001099 then throw("Invalid value passed")
11011100 else {
11021101 let estPut = commonPut(i, maxSlippage, false)
11031102 let state = estPut._9
11041103 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
11051104 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
11061105 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11071106 if ((currentKLp == currentKLp))
11081107 then {
1109- let $t04539845463 = refreshKLpInternal(0, 0, 0)
1110- let refreshKLpActions = $t04539845463._1
1111- let updatedKLp = $t04539845463._2
1108+ let $t04518345248 = refreshKLpInternal(0, 0, 0)
1109+ let refreshKLpActions = $t04518345248._1
1110+ let updatedKLp = $t04518345248._2
11121111 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11131112 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11141113 then (state ++ refreshKLpActions)
11151114 else throw("Strict value is not equal to itself.")
11161115 }
11171116 else throw("Strict value is not equal to itself.")
11181117 }
11191118
11201119
11211120
11221121 @Callable(i)
11231122 func putOneTkn (minOutAmount,autoStake) = {
11241123 let isPoolOneTokenOperationsDisabled = {
11251124 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11261125 if ($isInstanceOf(@, "Boolean"))
11271126 then @
11281127 else throw(($getType(@) + " couldn't be cast to Boolean"))
11291128 }
11301129 let isPutDisabled = if (if (if (isGlobalShutdown())
11311130 then true
11321131 else (cfgPoolStatus == PoolPutDisabled))
11331132 then true
11341133 else (cfgPoolStatus == PoolShutdown))
11351134 then true
11361135 else isPoolOneTokenOperationsDisabled
11371136 let checks = [if (if (!(isPutDisabled))
11381137 then true
11391138 else isManager(i))
11401139 then true
11411140 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11421141 then true
11431142 else throwErr("exactly 1 payment are expected")]
11441143 if ((checks == checks))
11451144 then {
11461145 let payment = i.payments[0]
11471146 let paymentAssetId = payment.assetId
11481147 let paymentAmountRaw = payment.amount
11491148 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11501149 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11511150 else if ((paymentAssetId == cfgPriceAssetId))
11521151 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11531152 else throwErr("payment asset is not supported")
11541153 if ((currentKLp == currentKLp))
11551154 then {
11561155 let userAddress = i.caller
11571156 let txId = i.transactionId
1158- let $t04665146803 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1159- if (($t04665146803 == $t04665146803))
1157+ let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1158+ if (($t04643646588 == $t04643646588))
11601159 then {
1161- let paymentInAmountAsset = $t04665146803._5
1162- let bonus = $t04665146803._4
1163- let feeAmount = $t04665146803._3
1164- let commonState = $t04665146803._2
1165- let emitAmountEstimated = $t04665146803._1
1160+ let paymentInAmountAsset = $t04643646588._5
1161+ let bonus = $t04643646588._4
1162+ let feeAmount = $t04643646588._3
1163+ let commonState = $t04643646588._2
1164+ let emitAmountEstimated = $t04643646588._1
11661165 let emitAmount = if (if ((minOutAmount > 0))
11671166 then (minOutAmount > emitAmountEstimated)
11681167 else false)
11691168 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11701169 else emitAmountEstimated
11711170 let emitInv = emit(emitAmount)
11721171 if ((emitInv == emitInv))
11731172 then {
11741173 let lpTransfer = if (autoStake)
11751174 then {
11761175 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11771176 if ((stakeInv == stakeInv))
11781177 then nil
11791178 else throw("Strict value is not equal to itself.")
11801179 }
11811180 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11821181 let sendFee = if ((feeAmount > 0))
11831182 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11841183 else nil
1185- let $t04738947586 = if ((this == feeCollectorAddress))
1184+ let $t04717447371 = if ((this == feeCollectorAddress))
11861185 then $Tuple2(0, 0)
11871186 else if (paymentInAmountAsset)
11881187 then $Tuple2(-(feeAmount), 0)
11891188 else $Tuple2(0, -(feeAmount))
1190- let amountAssetBalanceDelta = $t04738947586._1
1191- let priceAssetBalanceDelta = $t04738947586._2
1192- let $t04758947697 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1193- let refreshKLpActions = $t04758947697._1
1194- let updatedKLp = $t04758947697._2
1189+ let amountAssetBalanceDelta = $t04717447371._1
1190+ let priceAssetBalanceDelta = $t04717447371._2
1191+ let $t04737447482 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1192+ let refreshKLpActions = $t04737447482._1
1193+ let updatedKLp = $t04737447482._2
11951194 let kLp = value(getString(keyKLp))
11961195 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11971196 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11981197 then {
11991198 let reb = invoke(this, "rebalance", nil, nil)
12001199 if ((reb == reb))
12011200 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
12021201 else throw("Strict value is not equal to itself.")
12031202 }
12041203 else throw("Strict value is not equal to itself.")
12051204 }
12061205 else throw("Strict value is not equal to itself.")
12071206 }
12081207 else throw("Strict value is not equal to itself.")
12091208 }
12101209 else throw("Strict value is not equal to itself.")
12111210 }
12121211 else throw("Strict value is not equal to itself.")
12131212 }
12141213
12151214
12161215
12171216 @Callable(i)
12181217 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1219- let $t04805248209 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1220- let emitAmountEstimated = $t04805248209._1
1221- let commonState = $t04805248209._2
1222- let feeAmount = $t04805248209._3
1223- let bonus = $t04805248209._4
1224- let paymentInAmountAsset = $t04805248209._5
1218+ let $t04783747994 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1219+ let emitAmountEstimated = $t04783747994._1
1220+ let commonState = $t04783747994._2
1221+ let feeAmount = $t04783747994._3
1222+ let bonus = $t04783747994._4
1223+ let paymentInAmountAsset = $t04783747994._5
12251224 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12261225 }
12271226
12281227
12291228
12301229 @Callable(i)
12311230 func getOneTkn (outAssetIdStr,minOutAmount) = {
12321231 let isPoolOneTokenOperationsDisabled = {
12331232 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12341233 if ($isInstanceOf(@, "Boolean"))
12351234 then @
12361235 else throw(($getType(@) + " couldn't be cast to Boolean"))
12371236 }
12381237 let isGetDisabled = if (if (isGlobalShutdown())
12391238 then true
12401239 else (cfgPoolStatus == PoolShutdown))
12411240 then true
12421241 else isPoolOneTokenOperationsDisabled
12431242 let checks = [if (if (!(isGetDisabled))
12441243 then true
12451244 else isManager(i))
12461245 then true
12471246 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12481247 then true
12491248 else throwErr("exactly 1 payment are expected")]
12501249 if ((checks == checks))
12511250 then {
12521251 let outAssetId = parseAssetId(outAssetIdStr)
12531252 let payment = i.payments[0]
12541253 let paymentAssetId = payment.assetId
12551254 let paymentAmount = payment.amount
12561255 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12571256 if ((currentKLp == currentKLp))
12581257 then {
12591258 let userAddress = i.caller
12601259 let txId = i.transactionId
1261- let $t04909449247 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1262- if (($t04909449247 == $t04909449247))
1260+ let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1261+ if (($t04887949032 == $t04887949032))
12631262 then {
1264- let outInAmountAsset = $t04909449247._5
1265- let bonus = $t04909449247._4
1266- let feeAmount = $t04909449247._3
1267- let commonState = $t04909449247._2
1268- let amountEstimated = $t04909449247._1
1263+ let outInAmountAsset = $t04887949032._5
1264+ let bonus = $t04887949032._4
1265+ let feeAmount = $t04887949032._3
1266+ let commonState = $t04887949032._2
1267+ let amountEstimated = $t04887949032._1
12691268 let amount = if (if ((minOutAmount > 0))
12701269 then (minOutAmount > amountEstimated)
12711270 else false)
12721271 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12731272 else amountEstimated
12741273 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12751274 if ((burnInv == burnInv))
12761275 then {
1277- let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
1276+ let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
12781277 if ((withdrawState == withdrawState))
12791278 then {
12801279 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12811280 let sendFee = if ((feeAmount > 0))
12821281 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12831282 else nil
1284- let $t04981750064 = {
1283+ let $t04960649853 = {
12851284 let feeAmountForCalc = if ((this == feeCollectorAddress))
12861285 then 0
12871286 else feeAmount
12881287 if (outInAmountAsset)
12891288 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12901289 else $Tuple2(0, -((amount + feeAmountForCalc)))
12911290 }
1292- let amountAssetBalanceDelta = $t04981750064._1
1293- let priceAssetBalanceDelta = $t04981750064._2
1294- let $t05006750175 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1295- let refreshKLpActions = $t05006750175._1
1296- let updatedKLp = $t05006750175._2
1291+ let amountAssetBalanceDelta = $t04960649853._1
1292+ let priceAssetBalanceDelta = $t04960649853._2
1293+ let $t04985649964 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1294+ let refreshKLpActions = $t04985649964._1
1295+ let updatedKLp = $t04985649964._2
12971296 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12981297 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12991298 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13001299 else throw("Strict value is not equal to itself.")
13011300 }
13021301 else throw("Strict value is not equal to itself.")
13031302 }
13041303 else throw("Strict value is not equal to itself.")
13051304 }
13061305 else throw("Strict value is not equal to itself.")
13071306 }
13081307 else throw("Strict value is not equal to itself.")
13091308 }
13101309 else throw("Strict value is not equal to itself.")
13111310 }
13121311
13131312
13141313
13151314 @Callable(i)
13161315 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1317- let $t05045350609 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1318- let amountEstimated = $t05045350609._1
1319- let commonState = $t05045350609._2
1320- let feeAmount = $t05045350609._3
1321- let bonus = $t05045350609._4
1322- let outInAmountAsset = $t05045350609._5
1316+ let $t05024250398 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1317+ let amountEstimated = $t05024250398._1
1318+ let commonState = $t05024250398._2
1319+ let feeAmount = $t05024250398._3
1320+ let bonus = $t05024250398._4
1321+ let outInAmountAsset = $t05024250398._5
13231322 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13241323 }
13251324
13261325
13271326
13281327 @Callable(i)
13291328 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13301329 let isPoolOneTokenOperationsDisabled = {
13311330 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13321331 if ($isInstanceOf(@, "Boolean"))
13331332 then @
13341333 else throw(($getType(@) + " couldn't be cast to Boolean"))
13351334 }
13361335 let isGetDisabled = if (if (isGlobalShutdown())
13371336 then true
13381337 else (cfgPoolStatus == PoolShutdown))
13391338 then true
13401339 else isPoolOneTokenOperationsDisabled
13411340 let checks = [if (if (!(isGetDisabled))
13421341 then true
13431342 else isManager(i))
13441343 then true
13451344 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13461345 then true
13471346 else throwErr("no payments are expected")]
13481347 if ((checks == checks))
13491348 then {
13501349 let outAssetId = parseAssetId(outAssetIdStr)
13511350 let userAddress = i.caller
13521351 let txId = i.transactionId
13531352 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13541353 if ((currentKLp == currentKLp))
13551354 then {
13561355 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13571356 if ((unstakeInv == unstakeInv))
13581357 then {
1359- let $t05151451665 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1360- if (($t05151451665 == $t05151451665))
1358+ let $t05130351454 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1359+ if (($t05130351454 == $t05130351454))
13611360 then {
1362- let outInAmountAsset = $t05151451665._5
1363- let bonus = $t05151451665._4
1364- let feeAmount = $t05151451665._3
1365- let commonState = $t05151451665._2
1366- let amountEstimated = $t05151451665._1
1361+ let outInAmountAsset = $t05130351454._5
1362+ let bonus = $t05130351454._4
1363+ let feeAmount = $t05130351454._3
1364+ let commonState = $t05130351454._2
1365+ let amountEstimated = $t05130351454._1
13671366 let amount = if (if ((minOutAmount > 0))
13681367 then (minOutAmount > amountEstimated)
13691368 else false)
13701369 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13711370 else amountEstimated
13721371 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13731372 if ((burnInv == burnInv))
13741373 then {
1375- let withdrawState = getWithdrawAssetState(outAssetIdStr, amount)
1374+ let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
13761375 if ((withdrawState == withdrawState))
13771376 then {
13781377 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13791378 let sendFee = if ((feeAmount > 0))
13801379 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13811380 else nil
1382- let $t05223052477 = {
1381+ let $t05202352270 = {
13831382 let feeAmountForCalc = if ((this == feeCollectorAddress))
13841383 then 0
13851384 else feeAmount
13861385 if (outInAmountAsset)
13871386 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13881387 else $Tuple2(0, -((amount + feeAmountForCalc)))
13891388 }
1390- let amountAssetBalanceDelta = $t05223052477._1
1391- let priceAssetBalanceDelta = $t05223052477._2
1392- let $t05248052588 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1393- let refreshKLpActions = $t05248052588._1
1394- let updatedKLp = $t05248052588._2
1389+ let amountAssetBalanceDelta = $t05202352270._1
1390+ let priceAssetBalanceDelta = $t05202352270._2
1391+ let $t05227352381 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1392+ let refreshKLpActions = $t05227352381._1
1393+ let updatedKLp = $t05227352381._2
13951394 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13961395 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13971396 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13981397 else throw("Strict value is not equal to itself.")
13991398 }
14001399 else throw("Strict value is not equal to itself.")
14011400 }
14021401 else throw("Strict value is not equal to itself.")
14031402 }
14041403 else throw("Strict value is not equal to itself.")
14051404 }
14061405 else throw("Strict value is not equal to itself.")
14071406 }
14081407 else throw("Strict value is not equal to itself.")
14091408 }
14101409 else throw("Strict value is not equal to itself.")
14111410 }
14121411
14131412
14141413
14151414 @Callable(i)
14161415 func get () = {
14171416 let res = commonGet(i)
14181417 let outAmtAmt = res._1
14191418 let outPrAmt = res._2
14201419 let pmtAmt = res._3
14211420 let pmtAssetId = res._4
14221421 let state = res._5
14231422 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14241423 if ((currentKLp == currentKLp))
14251424 then {
14261425 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14271426 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14281427 then {
1429- let $t05355553637 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1430- let refreshKLpActions = $t05355553637._1
1431- let updatedKLp = $t05355553637._2
1428+ let $t05334853430 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1429+ let refreshKLpActions = $t05334853430._1
1430+ let updatedKLp = $t05334853430._2
14321431 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14331432 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14341433 then (state ++ refreshKLpActions)
14351434 else throw("Strict value is not equal to itself.")
14361435 }
14371436 else throw("Strict value is not equal to itself.")
14381437 }
14391438 else throw("Strict value is not equal to itself.")
14401439 }
14411440
14421441
14431442
14441443 @Callable(i)
14451444 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14461445 let res = commonGet(i)
14471446 let outAmAmt = res._1
14481447 let outPrAmt = res._2
14491448 let pmtAmt = res._3
14501449 let pmtAssetId = res._4
14511450 let state = res._5
14521451 if ((noLessThenAmtAsset > outAmAmt))
14531452 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14541453 else if ((noLessThenPriceAsset > outPrAmt))
14551454 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14561455 else {
14571456 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14581457 if ((currentKLp == currentKLp))
14591458 then {
14601459 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14611460 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14621461 then {
1463- let $t05458654667 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1464- let refreshKLpActions = $t05458654667._1
1465- let updatedKLp = $t05458654667._2
1462+ let $t05437954460 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1463+ let refreshKLpActions = $t05437954460._1
1464+ let updatedKLp = $t05437954460._2
14661465 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14671466 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14681467 then (state ++ refreshKLpActions)
14691468 else throw("Strict value is not equal to itself.")
14701469 }
14711470 else throw("Strict value is not equal to itself.")
14721471 }
14731472 else throw("Strict value is not equal to itself.")
14741473 }
14751474 }
14761475
14771476
14781477
14791478 @Callable(i)
14801479 func unstakeAndGet (amount) = {
14811480 let checkPayments = if ((size(i.payments) != 0))
14821481 then throw("No payments are expected")
14831482 else true
14841483 if ((checkPayments == checkPayments))
14851484 then {
14861485 let cfg = getPoolConfig()
14871486 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14881487 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14891488 if ((currentKLp == currentKLp))
14901489 then {
14911490 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14921491 if ((unstakeInv == unstakeInv))
14931492 then {
14941493 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14951494 let outAmAmt = res._1
14961495 let outPrAmt = res._2
14971496 let poolStatus = parseIntValue(res._9)
14981497 let state = res._10
14991498 let checkPoolStatus = if (if (isGlobalShutdown())
15001499 then true
15011500 else (poolStatus == PoolShutdown))
15021501 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
15031502 else true
15041503 if ((checkPoolStatus == checkPoolStatus))
15051504 then {
15061505 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15071506 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15081507 then {
1509- let $t05579355874 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1510- let refreshKLpActions = $t05579355874._1
1511- let updatedKLp = $t05579355874._2
1508+ let $t05558655667 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1509+ let refreshKLpActions = $t05558655667._1
1510+ let updatedKLp = $t05558655667._2
15121511 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15131512 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15141513 then (state ++ refreshKLpActions)
15151514 else throw("Strict value is not equal to itself.")
15161515 }
15171516 else throw("Strict value is not equal to itself.")
15181517 }
15191518 else throw("Strict value is not equal to itself.")
15201519 }
15211520 else throw("Strict value is not equal to itself.")
15221521 }
15231522 else throw("Strict value is not equal to itself.")
15241523 }
15251524 else throw("Strict value is not equal to itself.")
15261525 }
15271526
15281527
15291528
15301529 @Callable(i)
15311530 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15321531 let isGetDisabled = if (isGlobalShutdown())
15331532 then true
15341533 else (cfgPoolStatus == PoolShutdown)
15351534 let checks = [if (!(isGetDisabled))
15361535 then true
15371536 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15381537 then true
15391538 else throw("no payments are expected")]
15401539 if ((checks == checks))
15411540 then {
15421541 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15431542 if ((currentKLp == currentKLp))
15441543 then {
15451544 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15461545 if ((unstakeInv == unstakeInv))
15471546 then {
15481547 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15491548 let outAmAmt = res._1
15501549 let outPrAmt = res._2
15511550 let state = res._10
15521551 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15531552 then true
15541553 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15551554 then true
15561555 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15571556 if ((checkAmounts == checkAmounts))
15581557 then {
15591558 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15601559 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15611560 then {
1562- let $t05716957250 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1563- let refreshKLpActions = $t05716957250._1
1564- let updatedKLp = $t05716957250._2
1561+ let $t05696257043 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1562+ let refreshKLpActions = $t05696257043._1
1563+ let updatedKLp = $t05696257043._2
15651564 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15661565 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15671566 then (state ++ refreshKLpActions)
15681567 else throw("Strict value is not equal to itself.")
15691568 }
15701569 else throw("Strict value is not equal to itself.")
15711570 }
15721571 else throw("Strict value is not equal to itself.")
15731572 }
15741573 else throw("Strict value is not equal to itself.")
15751574 }
15761575 else throw("Strict value is not equal to itself.")
15771576 }
15781577 else throw("Strict value is not equal to itself.")
15791578 }
15801579
15811580
15821581
15831582 @Callable(i)
15841583 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15851584 then throw("permissions denied")
15861585 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15871586
15881587
15891588
15901589 @Callable(i)
15911590 func refreshKLp () = {
15921591 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15931592 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15941593 then unit
15951594 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15961595 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15971596 then {
15981597 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1599- let $t05843758501 = refreshKLpInternal(0, 0, 0)
1600- let kLpUpdateActions = $t05843758501._1
1601- let updatedKLp = $t05843758501._2
1598+ let $t05823058294 = refreshKLpInternal(0, 0, 0)
1599+ let kLpUpdateActions = $t05823058294._1
1600+ let updatedKLp = $t05823058294._2
16021601 let actions = if ((kLp != updatedKLp))
16031602 then kLpUpdateActions
16041603 else throwErr("nothing to refresh")
16051604 $Tuple2(actions, toString(updatedKLp))
16061605 }
16071606 else throw("Strict value is not equal to itself.")
16081607 }
16091608
16101609
16111610
16121611 @Callable(i)
16131612 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
16141613
16151614
16161615
16171616 @Callable(i)
16181617 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16191618
16201619
16211620
16221621 @Callable(i)
16231622 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16241623 let prices = calcPrices(amAmt, prAmt, lpAmt)
16251624 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16261625 }
16271626
16281627
16291628
16301629 @Callable(i)
16311630 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16321631
16331632
16341633
16351634 @Callable(i)
16361635 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16371636
16381637
16391638
16401639 @Callable(i)
16411640 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16421641
16431642
16441643
16451644 @Callable(i)
16461645 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16471646
16481647
16491648
16501649 @Callable(i)
16511650 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16521651 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16531652 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16541653 }
16551654
16561655
16571656
16581657 @Callable(i)
16591658 func statsREADONLY () = {
16601659 let cfg = getPoolConfig()
16611660 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16621661 let amtAssetId = cfg[idxAmtAssetId]
16631662 let priceAssetId = cfg[idxPriceAssetId]
16641663 let iAmtAssetId = cfg[idxIAmtAssetId]
16651664 let iPriceAssetId = cfg[idxIPriceAssetId]
16661665 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16671666 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16681667 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16691668 let accAmtAssetBalance = getAccBalance(amtAssetId)
16701669 let accPriceAssetBalance = getAccBalance(priceAssetId)
16711670 let pricesList = if ((poolLPBalance == 0))
16721671 then [zeroBigInt, zeroBigInt, zeroBigInt]
16731672 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16741673 let curPrice = 0
16751674 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16761675 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16771676 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16781677 $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))
16791678 }
16801679
16811680
16821681
16831682 @Callable(i)
16841683 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16851684 let cfg = getPoolConfig()
16861685 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16871686 let amAssetIdStr = cfg[idxAmtAssetId]
16881687 let amAssetId = fromBase58String(amAssetIdStr)
16891688 let prAssetIdStr = cfg[idxPriceAssetId]
16901689 let prAssetId = fromBase58String(prAssetIdStr)
16911690 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16921691 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16931692 let poolStatus = cfg[idxPoolStatus]
16941693 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16951694 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16961695 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16971696 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16981697 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16991698 let curPriceX18 = if ((poolLPBalance == 0))
17001699 then zeroBigInt
17011700 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
17021701 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
17031702 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
17041703 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
17051704 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17061705 let calcLpAmt = estPut._1
17071706 let curPriceCalc = estPut._3
17081707 let amBalance = estPut._4
17091708 let prBalance = estPut._5
17101709 let lpEmission = estPut._6
17111710 $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))
17121711 }
17131712
17141713
17151714
17161715 @Callable(i)
17171716 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17181717 let cfg = getPoolConfig()
17191718 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17201719 let amAssetIdStr = cfg[idxAmtAssetId]
17211720 let amAssetId = fromBase58String(amAssetIdStr)
17221721 let prAssetIdStr = cfg[idxPriceAssetId]
17231722 let prAssetId = fromBase58String(prAssetIdStr)
17241723 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17251724 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17261725 let poolStatus = cfg[idxPoolStatus]
17271726 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17281727 let amBalanceRaw = getAccBalance(amAssetIdStr)
17291728 let prBalanceRaw = getAccBalance(prAssetIdStr)
17301729 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17311730 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17321731 let curPriceX18 = if ((poolLPBalance == 0))
17331732 then zeroBigInt
17341733 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17351734 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17361735 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17371736 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17381737 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17391738 let calcLpAmt = estPut._1
17401739 let curPriceCalc = estPut._3
17411740 let amBalance = estPut._4
17421741 let prBalance = estPut._5
17431742 let lpEmission = estPut._6
17441743 $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))
17451744 }
17461745
17471746
17481747
17491748 @Callable(i)
17501749 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17511750 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17521751 let outAmAmt = res._1
17531752 let outPrAmt = res._2
17541753 let amBalance = res._5
17551754 let prBalance = res._6
17561755 let lpEmission = res._7
17571756 let curPrice = res._8
17581757 let poolStatus = parseIntValue(res._9)
17591758 $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))
17601759 }
17611760
17621761
17631762 @Verifier(tx)
17641763 func verify () = {
17651764 let targetPublicKey = match managerPublicKeyOrUnit() {
17661765 case pk: ByteVector =>
17671766 pk
17681767 case _: Unit =>
17691768 tx.senderPublicKey
17701769 case _ =>
17711770 throw("Match error")
17721771 }
17731772 match tx {
17741773 case order: Order =>
17751774 let matcherPub = getMatcherPubOrFail()
1776- let $t06716367232 = validateMatcherOrderAllowed(order)
1777- let orderValid = $t06716367232._1
1778- let orderValidInfo = $t06716367232._2
1775+ let $t06695667025 = validateMatcherOrderAllowed(order)
1776+ let orderValid = $t06695667025._1
1777+ let orderValidInfo = $t06695667025._2
17791778 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17801779 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17811780 if (if (if (orderValid)
17821781 then senderValid
17831782 else false)
17841783 then matcherValid
17851784 else false)
17861785 then true
17871786 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17881787 case s: SetScriptTransaction =>
17891788 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17901789 then true
17911790 else {
17921791 let newHash = blake2b256(value(s.script))
17931792 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17941793 let currentHash = scriptHash(this)
17951794 if ((allowedHash == newHash))
17961795 then (currentHash != newHash)
17971796 else false
17981797 }
17991798 case _ =>
18001799 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
18011800 }
18021801 }
18031802

github/deemru/w8io/169f3d6 
342.97 ms