tx · 3XtxydZJnAjbtzauVaGnZeP3Pkm6iHojMh3rtZf5MhTw

3MqQePEGCGcVB1sTeVS794mVncQAvH67uBr:  -0.04200000 Waves

2023.07.10 14:48 [2659769] smart account 3MqQePEGCGcVB1sTeVS794mVncQAvH67uBr > SELF 0.00000000 Waves

{ "type": 13, "id": "3XtxydZJnAjbtzauVaGnZeP3Pkm6iHojMh3rtZf5MhTw", "fee": 4200000, "feeAssetId": null, "timestamp": 1688989698105, "version": 2, "chainId": 84, "sender": "3MqQePEGCGcVB1sTeVS794mVncQAvH67uBr", "senderPublicKey": "7vwS2vY6tZXdJVS1n3rwZ5PN51TEVqJPzurwGtWw3mu6", "proofs": [ "3aYtufKurBrJWasu7bQ9Qq9BVgz8A9pmgh9kc6hR5ntoeZnybR2aeLNJ9WzaUT5rvaAYHCXgWyYm4oNpjU69GWri" ], "script": "base64:BgLuNwgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXNzZXRJZCIQaWR4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FAmRDCQDMCAIJAKQDAQUCZHoJAMwIAgkApgMBBQJkRgkAzAgCCQCkAwEFAmR5BQNuaWwFAWoBAmlpAQJpagAEAmlrBAJhUQkBAmduAAMJAAECBQJhUQIKQnl0ZVZlY3RvcgQCZ3EFAmFRBQJncQMJAAECBQJhUQIEVW5pdAgFAmlpD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yBAJhUQUCaWkDCQABAgUCYVECBU9yZGVyBAJlUQUCYVEEAmlsCQECYmoABAJpbQMJAQJlTQAJAJQKAgYCAAkBAmVQAQUCZVEEAmFLCAUCaW0CXzEEAmFMCAUCaW0CXzIEAmFNCQD0AwMIBQJlUQlib2R5Qnl0ZXMJAJEDAggFAmVRBnByb29mcwAACAUCZVEPc2VuZGVyUHVibGljS2V5BAJhTgkA9AMDCAUCZVEJYm9keUJ5dGVzCQCRAwIIBQJlUQZwcm9vZnMAAQUCaWwDAwMFAmFLBQJhTQcFAmFOBwYJAQJhSgQFAmFLBQJhTAUCYU0FAmFOAwkAAQIFAmFRAhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCYVYFAmFRAwkA9AMDCAUCaWkJYm9keUJ5dGVzCQCRAwIIBQJpaQZwcm9vZnMAAAUCaWsGBAJpbgkA9gMBCQEFdmFsdWUBCAUCYVYGc2NyaXB0BAJpbwkA2wQBCQEFdmFsdWUBCQCdCAIFAmJkCQECYUYABAJpcAkA8QcBBQR0aGlzAwkAAAIFAmlvBQJpbgkBAiE9AgUCaXAFAmluBwkA9AMDCAUCaWkJYm9keUJ5dGVzCQCRAwIIBQJpaQZwcm9vZnMAAAUCaWulx7Lz", "height": 2659769, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B9zgfAyqQhQ6R2NRcq9cXyMTpvQ57sS9ykJYdyD8N3WB Next: 2KFEs5L1R4VDtb2Ph4eXJTy5HpjUqjMYcGofd7jeDkJe Diff:
OldNewDifferences
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133-func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
133+func keyStakedBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134134
135135
136-func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
136+func keyShareAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137137
138138
139-func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
139+func getStakedBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakedBalance(assetId)), 0)
140140
141141
142-func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
142+func getShareAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyShareAssetBalance(assetId)), 0)
143143
144144
145145 func keyFactoryConfig () = "%s__factoryConfig"
258258
259259 let poolConfigParsed = parsePoolConfig(getPoolConfig())
260260
261-let $t095299695 = poolConfigParsed
261+let $t095029668 = poolConfigParsed
262262
263-let cfgPoolAddress = $t095299695._1
263+let cfgPoolAddress = $t095029668._1
264264
265-let cfgPoolStatus = $t095299695._2
265+let cfgPoolStatus = $t095029668._2
266266
267-let cfgLpAssetId = $t095299695._3
267+let cfgLpAssetId = $t095029668._3
268268
269-let cfgAmountAssetId = $t095299695._4
269+let cfgAmountAssetId = $t095029668._4
270270
271-let cfgPriceAssetId = $t095299695._5
271+let cfgPriceAssetId = $t095029668._5
272272
273-let cfgAmountAssetDecimals = $t095299695._6
273+let cfgAmountAssetDecimals = $t095029668._6
274274
275-let cfgPriceAssetDecimals = $t095299695._7
275+let cfgPriceAssetDecimals = $t095029668._7
276276
277277 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
278278
291291 let balanceOnPool = if ((assetId == "WAVES"))
292292 then wavesBalance(this).available
293293 else assetBalance(this, fromBase58String(assetId))
294- let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
294+ let totalBalance = ((balanceOnPool + getStakedBalanceOrZero(assetId)) - getShareAssetBalanceOrZero(assetId))
295295 max([0, totalBalance])
296296 }
297297
315315 }
316316
317317
318-func deposit (assetId,amount,stakingAssetId,proxy) = {
319- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
320- if ((currentAdditionalBalance == currentAdditionalBalance))
318+func deposit (assetId,amount,shareAssetId,proxy) = {
319+ let currentStakedBalance = getStakedBalanceOrZero(assetId)
320+ if ((currentStakedBalance == currentStakedBalance))
321321 then {
322- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
323- if ((currentStakingAssetBalance == currentStakingAssetBalance))
322+ let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
323+ if ((currentShareAssetBalance == currentShareAssetBalance))
324324 then {
325325 let asset = parseAssetId(assetId)
326326 if ((amount > 0))
328328 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
329329 if ((depositInvoke == depositInvoke))
330330 then match depositInvoke {
331- case receivedStakingAsset: Int =>
332- let newAdditionalBalance = (currentAdditionalBalance + amount)
333- let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
334-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
331+ case receivedShareAsset: Int =>
332+ let newStakedBalance = (currentStakedBalance + amount)
333+ let newShareAssetBalance = (currentShareAssetBalance + receivedShareAsset)
334+[IntegerEntry(keyStakedBalance(assetId), newStakedBalance), IntegerEntry(keyShareAssetBalance(shareAssetId), newShareAssetBalance)]
335335 case _ =>
336336 nil
337337 }
345345 }
346346
347347
348-func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
349- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
350- if ((currentAdditionalBalance == currentAdditionalBalance))
348+func withdraw (assetId,amount,shareAssetId,proxy,proxyRateMul,profitAddress) = {
349+ let currentStakedBalance = getStakedBalanceOrZero(assetId)
350+ if ((currentStakedBalance == currentStakedBalance))
351351 then {
352- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
353- if ((currentStakingAssetBalance == currentStakingAssetBalance))
352+ let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
353+ if ((currentShareAssetBalance == currentShareAssetBalance))
354354 then {
355355 let currentProxyRate = getRate(proxy)
356356 if ((currentProxyRate == currentProxyRate))
357357 then {
358- let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
359- let stakingAsset = parseAssetId(stakingAssetId)
358+ let oldRate = fraction(proxyRateMul, currentStakedBalance, currentShareAssetBalance)
359+ let shareAsset = parseAssetId(shareAssetId)
360360 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
361- let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362- let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
363- if ((sendStakingAssetAmount > 0))
361+ let sendShareAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362+ let profitAmount = max([0, (oldSendStakingAmount - sendShareAssetAmount)])
363+ if ((sendShareAssetAmount > 0))
364364 then {
365- let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
365+ let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(shareAsset, sendShareAssetAmount)])
366366 if ((withdrawInvoke == withdrawInvoke))
367367 then match withdrawInvoke {
368368 case receivedAssets: Int =>
369- let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
370- let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
371-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
369+ let newShareAssetBalance = ((currentShareAssetBalance - sendShareAssetAmount) - profitAmount)
370+ let newStakedBalance = if ((newShareAssetBalance == 0))
371+ then 0
372+ else (currentStakedBalance - receivedAssets)
373+[IntegerEntry(keyStakedBalance(assetId), newStakedBalance), IntegerEntry(keyShareAssetBalance(shareAssetId), newShareAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(shareAssetId))]
372374 case _ =>
373375 nil
374376 }
392394 }
393395
394396
395-func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
396- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
397- if ((currentAdditionalBalance == currentAdditionalBalance))
397+func rebalanceInternal (targetRatio,assetId,shareAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
398+ let currentStakedBalance = getStakedBalanceOrZero(assetId)
399+ if ((currentStakedBalance == currentStakedBalance))
398400 then {
399- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
400- if ((currentStakingAssetBalance == currentStakingAssetBalance))
401+ let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
402+ if ((currentShareAssetBalance == currentShareAssetBalance))
401403 then {
402404 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
403- let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
404- let diff = (currentAdditionalBalance - targetAdditionalBalance)
405+ let targetStakedBalance = fraction(targetRatio, leasableTotalBalance, 100)
406+ let diff = (currentStakedBalance - targetStakedBalance)
405407 if ((diff == 0))
406408 then nil
407409 else if ((0 > diff))
408410 then {
409411 let sendAssetAmount = -(diff)
410- deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
412+ deposit(assetId, sendAssetAmount, shareAssetId, proxy)
411413 }
412414 else {
413415 let getAssetAmount = diff
414- withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
416+ withdraw(assetId, getAssetAmount, shareAssetId, proxy, proxyRateMul, profitAddress)
415417 }
416418 }
417419 else throw("Strict value is not equal to itself.")
421423
422424
423425 func rebalanceAsset (assetId) = {
424- let $t01593116067 = getLeaseProxyConfig(assetId)
425- let isLeasable = $t01593116067._1
426- let leasedRatio = $t01593116067._2
427- let minBalance = $t01593116067._3
428- let proxyAddress = $t01593116067._4
429- let proxyAssetId = $t01593116067._5
430- let proxyRateMul = $t01593116067._6
431- let stakingProfitAddress = $t01593116067._7
426+ let $t01578815924 = getLeaseProxyConfig(assetId)
427+ let isLeasable = $t01578815924._1
428+ let leasedRatio = $t01578815924._2
429+ let minBalance = $t01578815924._3
430+ let proxyAddress = $t01578815924._4
431+ let proxyAssetId = $t01578815924._5
432+ let proxyRateMul = $t01578815924._6
433+ let stakingProfitAddress = $t01578815924._7
432434 if (isLeasable)
433435 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434436 else nil
436438
437439
438440 func withdrawAndRebalanceAsset (assetId,getAmount) = {
439- let $t01646616602 = getLeaseProxyConfig(assetId)
440- let isLeasable = $t01646616602._1
441- let leasedRatio = $t01646616602._2
442- let minBalance = $t01646616602._3
443- let proxyAddress = $t01646616602._4
444- let proxyAssetId = $t01646616602._5
445- let proxyRateMul = $t01646616602._6
446- let stakingProfitAddress = $t01646616602._7
441+ let $t01632316459 = getLeaseProxyConfig(assetId)
442+ let isLeasable = $t01632316459._1
443+ let leasedRatio = $t01632316459._2
444+ let minBalance = $t01632316459._3
445+ let proxyAddress = $t01632316459._4
446+ let proxyAssetId = $t01632316459._5
447+ let proxyRateMul = $t01632316459._6
448+ let stakingProfitAddress = $t01632316459._7
447449 if (isLeasable)
448450 then {
449451 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
450452 if ((newTotalLeasableBalance == newTotalLeasableBalance))
451453 then {
452- let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
453- if ((newAdditionalBalance == newAdditionalBalance))
454+ let newStakedBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
455+ if ((newStakedBalance == newStakedBalance))
454456 then {
455- let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
457+ let withdrawAmount = (getStakedBalanceOrZero(assetId) - newStakedBalance)
456458 if ((withdrawAmount == withdrawAmount))
457459 then if ((0 > withdrawAmount))
458460 then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
658660 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
659661 let amountAssetAmount = order.amount
660662 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
661- let $t02901329225 = if ((order.orderType == Buy))
663+ let $t02885829070 = if ((order.orderType == Buy))
662664 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
663665 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
664- let amountAssetBalanceDelta = $t02901329225._1
665- let priceAssetBalanceDelta = $t02901329225._2
666+ let amountAssetBalanceDelta = $t02885829070._1
667+ let priceAssetBalanceDelta = $t02885829070._2
666668 if (if (if (isGlobalShutdown())
667669 then true
668670 else (cfgPoolStatus == PoolMatcherDisabled))
675677 then throw("Wrong order assets.")
676678 else {
677679 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
678- let $t02966529765 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
679- let unusedActions = $t02966529765._1
680- let kLpNew = $t02966529765._2
680+ let $t02951029610 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
681+ let unusedActions = $t02951029610._1
682+ let kLpNew = $t02951029610._2
681683 let isOrderValid = (kLpNew >= kLp)
682684 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
683685 $Tuple2(isOrderValid, info)
756758 else if ((paymentAssetId == cfgPriceAssetId))
757759 then false
758760 else throwErr("invalid asset")
759- let $t03287833171 = if (isEval)
761+ let $t03272333016 = if (isEval)
760762 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
761763 else if (paymentInAmountAsset)
762764 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
763765 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
764- let amountBalanceOld = $t03287833171._1
765- let priceBalanceOld = $t03287833171._2
766- let $t03317533324 = if (paymentInAmountAsset)
766+ let amountBalanceOld = $t03272333016._1
767+ let priceBalanceOld = $t03272333016._2
768+ let $t03302033169 = if (paymentInAmountAsset)
767769 then $Tuple2(paymentAmountRaw, 0)
768770 else $Tuple2(0, paymentAmountRaw)
769- let amountAssetAmountRaw = $t03317533324._1
770- let priceAssetAmountRaw = $t03317533324._2
771+ let amountAssetAmountRaw = $t03302033169._1
772+ let priceAssetAmountRaw = $t03302033169._2
771773 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
772774 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
773- let $t03345633520 = takeFee(paymentAmountRaw, inFee)
774- let paymentAmount = $t03345633520._1
775- let feeAmount = $t03345633520._2
775+ let $t03330133365 = takeFee(paymentAmountRaw, inFee)
776+ let paymentAmount = $t03330133365._1
777+ let feeAmount = $t03330133365._2
776778 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
777779 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
778780 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
795797 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
796798 let priceOld = fromX18(priceOldX18, scale8)
797799 let loss = {
798- let $t03520135368 = if (paymentInAmountAsset)
800+ let $t03504635213 = if (paymentInAmountAsset)
799801 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
800802 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
801- let amount = $t03520135368._1
802- let balance = $t03520135368._2
803+ let amount = $t03504635213._1
804+ let balance = $t03504635213._2
803805 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
804806 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
805807 }
839841 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
840842 let redeemedBigInt = toBigInt(paymentAmount)
841843 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
842- let $t03744637502 = takeFee(amountRaw, outFee)
843- let totalAmount = $t03744637502._1
844- let feeAmount = $t03744637502._2
845- let $t03750637732 = if (outInAmountAsset)
844+ let $t03729137347 = takeFee(amountRaw, outFee)
845+ let totalAmount = $t03729137347._1
846+ let feeAmount = $t03729137347._2
847+ let $t03735137577 = if (outInAmountAsset)
846848 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
847849 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
848- let outAmAmount = $t03750637732._1
849- let outPrAmount = $t03750637732._2
850- let amBalanceNew = $t03750637732._3
851- let prBalanceNew = $t03750637732._4
850+ let outAmAmount = $t03735137577._1
851+ let outPrAmount = $t03735137577._2
852+ let amBalanceNew = $t03735137577._3
853+ let prBalanceNew = $t03735137577._4
852854 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
853855 let priceNew = fromX18(priceNewX18, scale8)
854856 let commonState = if (isEval)
913915
914916 @Callable(i)
915917 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
916- let $t03959039895 = if ((isReverse == false))
918+ let $t03943539740 = if ((isReverse == false))
917919 then {
918920 let assetOut = getStringOrFail(this, pa())
919921 let assetIn = getStringOrFail(this, aa())
924926 let assetIn = getStringOrFail(this, pa())
925927 $Tuple2(assetOut, assetIn)
926928 }
927- let assetOut = $t03959039895._1
928- let assetIn = $t03959039895._2
929+ let assetOut = $t03943539740._1
930+ let assetIn = $t03943539740._2
929931 let poolAssetInBalance = getAccBalance(assetIn)
930932 let poolAssetOutBalance = getAccBalance(assetOut)
931933 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10411043 else throw("Strict value is not equal to itself.")
10421044 }
10431045 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1044- let $t04439844860 = refreshKLpInternal(0, 0, 0)
1045- if (($t04439844860 == $t04439844860))
1046+ let $t04424344705 = refreshKLpInternal(0, 0, 0)
1047+ if (($t04424344705 == $t04424344705))
10461048 then {
1047- let updatedKLp = $t04439844860._2
1048- let refreshKLpActions = $t04439844860._1
1049+ let updatedKLp = $t04424344705._2
1050+ let refreshKLpActions = $t04424344705._1
10491051 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10501052 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10511053 then {
10821084 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10831085 if ((currentKLp == currentKLp))
10841086 then {
1085- let $t04547245537 = refreshKLpInternal(0, 0, 0)
1086- let refreshKLpActions = $t04547245537._1
1087- let updatedKLp = $t04547245537._2
1087+ let $t04531745382 = refreshKLpInternal(0, 0, 0)
1088+ let refreshKLpActions = $t04531745382._1
1089+ let updatedKLp = $t04531745382._2
10881090 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10891091 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10901092 then (state ++ refreshKLpActions)
11311133 then {
11321134 let userAddress = i.caller
11331135 let txId = i.transactionId
1134- let $t04672546877 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1135- if (($t04672546877 == $t04672546877))
1136+ let $t04657046722 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1137+ if (($t04657046722 == $t04657046722))
11361138 then {
1137- let paymentInAmountAsset = $t04672546877._5
1138- let bonus = $t04672546877._4
1139- let feeAmount = $t04672546877._3
1140- let commonState = $t04672546877._2
1141- let emitAmountEstimated = $t04672546877._1
1139+ let paymentInAmountAsset = $t04657046722._5
1140+ let bonus = $t04657046722._4
1141+ let feeAmount = $t04657046722._3
1142+ let commonState = $t04657046722._2
1143+ let emitAmountEstimated = $t04657046722._1
11421144 let emitAmount = if (if ((minOutAmount > 0))
11431145 then (minOutAmount > emitAmountEstimated)
11441146 else false)
11581160 let sendFee = if ((feeAmount > 0))
11591161 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11601162 else nil
1161- let $t04746347660 = if ((this == feeCollectorAddress))
1163+ let $t04730847505 = if ((this == feeCollectorAddress))
11621164 then $Tuple2(0, 0)
11631165 else if (paymentInAmountAsset)
11641166 then $Tuple2(-(feeAmount), 0)
11651167 else $Tuple2(0, -(feeAmount))
1166- let amountAssetBalanceDelta = $t04746347660._1
1167- let priceAssetBalanceDelta = $t04746347660._2
1168- let $t04766347771 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1169- let refreshKLpActions = $t04766347771._1
1170- let updatedKLp = $t04766347771._2
1168+ let amountAssetBalanceDelta = $t04730847505._1
1169+ let priceAssetBalanceDelta = $t04730847505._2
1170+ let $t04750847616 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1171+ let refreshKLpActions = $t04750847616._1
1172+ let updatedKLp = $t04750847616._2
11711173 let kLp = value(getString(keyKLp))
11721174 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11731175 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11921194
11931195 @Callable(i)
11941196 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1195- let $t04812648283 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1196- let emitAmountEstimated = $t04812648283._1
1197- let commonState = $t04812648283._2
1198- let feeAmount = $t04812648283._3
1199- let bonus = $t04812648283._4
1200- let paymentInAmountAsset = $t04812648283._5
1197+ let $t04797148128 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1198+ let emitAmountEstimated = $t04797148128._1
1199+ let commonState = $t04797148128._2
1200+ let feeAmount = $t04797148128._3
1201+ let bonus = $t04797148128._4
1202+ let paymentInAmountAsset = $t04797148128._5
12011203 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12021204 }
12031205
12341236 then {
12351237 let userAddress = i.caller
12361238 let txId = i.transactionId
1237- let $t04916849321 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1238- if (($t04916849321 == $t04916849321))
1239+ let $t04901349166 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1240+ if (($t04901349166 == $t04901349166))
12391241 then {
1240- let outInAmountAsset = $t04916849321._5
1241- let bonus = $t04916849321._4
1242- let feeAmount = $t04916849321._3
1243- let commonState = $t04916849321._2
1244- let amountEstimated = $t04916849321._1
1242+ let outInAmountAsset = $t04901349166._5
1243+ let bonus = $t04901349166._4
1244+ let feeAmount = $t04901349166._3
1245+ let commonState = $t04901349166._2
1246+ let amountEstimated = $t04901349166._1
12451247 let amount = if (if ((minOutAmount > 0))
12461248 then (minOutAmount > amountEstimated)
12471249 else false)
12551257 let sendFee = if ((feeAmount > 0))
12561258 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12571259 else nil
1258- let $t04998550232 = {
1260+ let $t04983050077 = {
12591261 let feeAmountForCalc = if ((this == feeCollectorAddress))
12601262 then 0
12611263 else feeAmount
12631265 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12641266 else $Tuple2(0, -((amount + feeAmountForCalc)))
12651267 }
1266- let amountAssetBalanceDelta = $t04998550232._1
1267- let priceAssetBalanceDelta = $t04998550232._2
1268- let $t05023550343 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1269- let refreshKLpActions = $t05023550343._1
1270- let updatedKLp = $t05023550343._2
1268+ let amountAssetBalanceDelta = $t04983050077._1
1269+ let priceAssetBalanceDelta = $t04983050077._2
1270+ let $t05008050188 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1271+ let refreshKLpActions = $t05008050188._1
1272+ let updatedKLp = $t05008050188._2
12711273 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12721274 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12731275 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12861288
12871289 @Callable(i)
12881290 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1289- let $t05062150777 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1290- let amountEstimated = $t05062150777._1
1291- let commonState = $t05062150777._2
1292- let feeAmount = $t05062150777._3
1293- let bonus = $t05062150777._4
1294- let outInAmountAsset = $t05062150777._5
1291+ let $t05046650622 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1292+ let amountEstimated = $t05046650622._1
1293+ let commonState = $t05046650622._2
1294+ let feeAmount = $t05046650622._3
1295+ let bonus = $t05046650622._4
1296+ let outInAmountAsset = $t05046650622._5
12951297 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12961298 }
12971299
13281330 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13291331 if ((unstakeInv == unstakeInv))
13301332 then {
1331- let $t05168251833 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1332- if (($t05168251833 == $t05168251833))
1333+ let $t05152751678 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1334+ if (($t05152751678 == $t05152751678))
13331335 then {
1334- let outInAmountAsset = $t05168251833._5
1335- let bonus = $t05168251833._4
1336- let feeAmount = $t05168251833._3
1337- let commonState = $t05168251833._2
1338- let amountEstimated = $t05168251833._1
1336+ let outInAmountAsset = $t05152751678._5
1337+ let bonus = $t05152751678._4
1338+ let feeAmount = $t05152751678._3
1339+ let commonState = $t05152751678._2
1340+ let amountEstimated = $t05152751678._1
13391341 let amount = if (if ((minOutAmount > 0))
13401342 then (minOutAmount > amountEstimated)
13411343 else false)
13491351 let sendFee = if ((feeAmount > 0))
13501352 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13511353 else nil
1352- let $t05249252739 = {
1354+ let $t05233752584 = {
13531355 let feeAmountForCalc = if ((this == feeCollectorAddress))
13541356 then 0
13551357 else feeAmount
13571359 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13581360 else $Tuple2(0, -((amount + feeAmountForCalc)))
13591361 }
1360- let amountAssetBalanceDelta = $t05249252739._1
1361- let priceAssetBalanceDelta = $t05249252739._2
1362- let $t05274252850 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1363- let refreshKLpActions = $t05274252850._1
1364- let updatedKLp = $t05274252850._2
1362+ let amountAssetBalanceDelta = $t05233752584._1
1363+ let priceAssetBalanceDelta = $t05233752584._2
1364+ let $t05258752695 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1365+ let refreshKLpActions = $t05258752695._1
1366+ let updatedKLp = $t05258752695._2
13651367 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13661368 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13671369 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13951397 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13961398 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13971399 then {
1398- let $t05394554026 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1399- let refreshKLpActions = $t05394554026._1
1400- let updatedKLp = $t05394554026._2
1400+ let $t05379053871 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1401+ let refreshKLpActions = $t05379053871._1
1402+ let updatedKLp = $t05379053871._2
14011403 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14021404 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14031405 then ((withdrawState ++ state) ++ refreshKLpActions)
14301432 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14311433 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14321434 then {
1433- let $t05512155202 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1434- let refreshKLpActions = $t05512155202._1
1435- let updatedKLp = $t05512155202._2
1435+ let $t05496655047 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1436+ let refreshKLpActions = $t05496655047._1
1437+ let updatedKLp = $t05496655047._2
14361438 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14371439 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14381440 then ((withdrawState ++ state) ++ refreshKLpActions)
14771479 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14781480 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14791481 then {
1480- let $t05647456555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1481- let refreshKLpActions = $t05647456555._1
1482- let updatedKLp = $t05647456555._2
1482+ let $t05631956400 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1483+ let refreshKLpActions = $t05631956400._1
1484+ let updatedKLp = $t05631956400._2
14831485 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14841486 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14851487 then ((withdrawState ++ state) ++ refreshKLpActions)
15311533 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15321534 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15331535 then {
1534- let $t05799658077 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1535- let refreshKLpActions = $t05799658077._1
1536- let updatedKLp = $t05799658077._2
1536+ let $t05784157922 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1537+ let refreshKLpActions = $t05784157922._1
1538+ let updatedKLp = $t05784157922._2
15371539 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15381540 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15391541 then ((withdrawState ++ state) ++ refreshKLpActions)
15681570 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15691571 then {
15701572 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1571- let $t05928159345 = refreshKLpInternal(0, 0, 0)
1572- let kLpUpdateActions = $t05928159345._1
1573- let updatedKLp = $t05928159345._2
1573+ let $t05912659190 = refreshKLpInternal(0, 0, 0)
1574+ let kLpUpdateActions = $t05912659190._1
1575+ let updatedKLp = $t05912659190._2
15741576 let actions = if ((kLp != updatedKLp))
15751577 then kLpUpdateActions
15761578 else throwErr("nothing to refresh")
17451747 match tx {
17461748 case order: Order =>
17471749 let matcherPub = getMatcherPubOrFail()
1748- let $t06800768124 = if (skipOrderValidation())
1750+ let $t06785267969 = if (skipOrderValidation())
17491751 then $Tuple2(true, "")
17501752 else validateMatcherOrderAllowed(order)
1751- let orderValid = $t06800768124._1
1752- let orderValidInfo = $t06800768124._2
1753+ let orderValid = $t06785267969._1
1754+ let orderValidInfo = $t06785267969._2
17531755 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17541756 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17551757 if (if (if (orderValid)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lPdecimals = 8
55
66 let scale8 = 100000000
77
88 let scale8BigInt = toBigInt(100000000)
99
1010 let scale18 = toBigInt(1000000000000000000)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let big0 = toBigInt(0)
1515
1616 let big1 = toBigInt(1)
1717
1818 let big2 = toBigInt(2)
1919
2020 let wavesString = "WAVES"
2121
2222 let SEP = "__"
2323
2424 let PoolActive = 1
2525
2626 let PoolPutDisabled = 2
2727
2828 let PoolMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
3232 let idxPoolAddress = 1
3333
3434 let idxPoolStatus = 2
3535
3636 let idxPoolLPAssetId = 3
3737
3838 let idxAmtAssetId = 4
3939
4040 let idxPriceAssetId = 5
4141
4242 let idxAmtAssetDcm = 6
4343
4444 let idxPriceAssetDcm = 7
4545
4646 let idxIAmtAssetId = 8
4747
4848 let idxIPriceAssetId = 9
4949
5050 let idxLPAssetDcm = 10
5151
5252 let idxPoolAmtAssetAmt = 1
5353
5454 let idxPoolPriceAssetAmt = 2
5555
5656 let idxPoolLPAssetAmt = 3
5757
5858 let idxFactoryStakingContract = 1
5959
6060 let idxFactorySlippageContract = 7
6161
6262 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult)
6666
6767
6868 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6969
7070
7171 func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
7272
7373
7474 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7575
7676
7777 func abs (val) = if ((0 > val))
7878 then -(val)
7979 else val
8080
8181
8282 func absBigInt (val) = if ((zeroBigInt > val))
8383 then -(val)
8484 else val
8585
8686
8787 func swapContract () = "%s__swapContract"
8888
8989
9090 func fc () = "%s__factoryContract"
9191
9292
9393 func keyManagerPublicKey () = "%s__managerPublicKey"
9494
9595
9696 func keyManagerVaultAddress () = "%s__managerVaultAddress"
9797
9898
9999 func pl () = "%s%s__price__last"
100100
101101
102102 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
103103
104104
105105 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
106106
107107
108108 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
109109
110110
111111 func aa () = "%s__amountAsset"
112112
113113
114114 func pa () = "%s__priceAsset"
115115
116116
117117 let keyFee = "%s__fee"
118118
119119 let feeDefault = fraction(10, scale8, 10000)
120120
121121 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
122122
123123 let keyKLp = makeString(["%s", "kLp"], SEP)
124124
125125 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
126126
127127 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
128128
129129 let kLpRefreshDelayDefault = 30
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133-func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
133+func keyStakedBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134134
135135
136-func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
136+func keyShareAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137137
138138
139-func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
139+func getStakedBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakedBalance(assetId)), 0)
140140
141141
142-func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
142+func getShareAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyShareAssetBalance(assetId)), 0)
143143
144144
145145 func keyFactoryConfig () = "%s__factoryConfig"
146146
147147
148148 func keyMatcherPub () = "%s%s__matcher__publicKey"
149149
150150
151151 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
152152
153153
154154 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
155155
156156
157157 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
158158
159159
160160 func keyAllPoolsShutdown () = "%s__shutdown"
161161
162162
163163 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
164164
165165
166166 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
167167
168168
169169 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
170170
171171 func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress)
172172
173173
174174 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
175175
176176
177177 func addressFromStringOrThis (addressString) = match addressFromString(addressString) {
178178 case a: Address =>
179179 a
180180 case _ =>
181181 this
182182 }
183183
184184
185185 func getManagerVaultAddressOrThis () = {
186186 let factoryAddress = match getString(fc()) {
187187 case fca: String =>
188188 addressFromStringOrThis(fca)
189189 case _ =>
190190 this
191191 }
192192 match getString(factoryAddress, keyManagerVaultAddress()) {
193193 case s: String =>
194194 addressFromStringOrThis(s)
195195 case _ =>
196196 this
197197 }
198198 }
199199
200200
201201 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
202202
203203
204204 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
205205
206206
207207 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
208208
209209
210210 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
211211
212212
213213 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
214214
215215 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
216216
217217 let inFee = {
218218 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
219219 if ($isInstanceOf(@, "Int"))
220220 then @
221221 else throw(($getType(@) + " couldn't be cast to Int"))
222222 }
223223
224224 let outFee = {
225225 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
226226 if ($isInstanceOf(@, "Int"))
227227 then @
228228 else throw(($getType(@) + " couldn't be cast to Int"))
229229 }
230230
231231 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
232232
233233
234234 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
235235
236236
237237 func getPoolConfig () = {
238238 let amtAsset = getStringOrFail(this, aa())
239239 let priceAsset = getStringOrFail(this, pa())
240240 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
241241 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
242242 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
243243 }
244244
245245
246246 func parseAssetId (input) = if ((input == wavesString))
247247 then unit
248248 else fromBase58String(input)
249249
250250
251251 func assetIdToString (input) = if ((input == unit))
252252 then wavesString
253253 else toBase58String(value(input))
254254
255255
256256 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]))
257257
258258
259259 let poolConfigParsed = parsePoolConfig(getPoolConfig())
260260
261-let $t095299695 = poolConfigParsed
261+let $t095029668 = poolConfigParsed
262262
263-let cfgPoolAddress = $t095299695._1
263+let cfgPoolAddress = $t095029668._1
264264
265-let cfgPoolStatus = $t095299695._2
265+let cfgPoolStatus = $t095029668._2
266266
267-let cfgLpAssetId = $t095299695._3
267+let cfgLpAssetId = $t095029668._3
268268
269-let cfgAmountAssetId = $t095299695._4
269+let cfgAmountAssetId = $t095029668._4
270270
271-let cfgPriceAssetId = $t095299695._5
271+let cfgPriceAssetId = $t095029668._5
272272
273-let cfgAmountAssetDecimals = $t095299695._6
273+let cfgAmountAssetDecimals = $t095029668._6
274274
275-let cfgPriceAssetDecimals = $t095299695._7
275+let cfgPriceAssetDecimals = $t095029668._7
276276
277277 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
278278
279279
280280 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
281281
282282 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
283283
284284 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)
285285
286286
287287 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)
288288
289289
290290 func getAccBalance (assetId) = {
291291 let balanceOnPool = if ((assetId == "WAVES"))
292292 then wavesBalance(this).available
293293 else assetBalance(this, fromBase58String(assetId))
294- let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
294+ let totalBalance = ((balanceOnPool + getStakedBalanceOrZero(assetId)) - getShareAssetBalanceOrZero(assetId))
295295 max([0, totalBalance])
296296 }
297297
298298
299299 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
300300
301301
302302 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
303303
304304
305305 func getRate (proxy) = {
306306 let inv = invoke(proxy, "getRate", nil, nil)
307307 if ((inv == inv))
308308 then match inv {
309309 case r: Int =>
310310 r
311311 case _ =>
312312 throwErr("proxy.getRate() unexpected value")
313313 }
314314 else throw("Strict value is not equal to itself.")
315315 }
316316
317317
318-func deposit (assetId,amount,stakingAssetId,proxy) = {
319- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
320- if ((currentAdditionalBalance == currentAdditionalBalance))
318+func deposit (assetId,amount,shareAssetId,proxy) = {
319+ let currentStakedBalance = getStakedBalanceOrZero(assetId)
320+ if ((currentStakedBalance == currentStakedBalance))
321321 then {
322- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
323- if ((currentStakingAssetBalance == currentStakingAssetBalance))
322+ let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
323+ if ((currentShareAssetBalance == currentShareAssetBalance))
324324 then {
325325 let asset = parseAssetId(assetId)
326326 if ((amount > 0))
327327 then {
328328 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
329329 if ((depositInvoke == depositInvoke))
330330 then match depositInvoke {
331- case receivedStakingAsset: Int =>
332- let newAdditionalBalance = (currentAdditionalBalance + amount)
333- let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
334-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
331+ case receivedShareAsset: Int =>
332+ let newStakedBalance = (currentStakedBalance + amount)
333+ let newShareAssetBalance = (currentShareAssetBalance + receivedShareAsset)
334+[IntegerEntry(keyStakedBalance(assetId), newStakedBalance), IntegerEntry(keyShareAssetBalance(shareAssetId), newShareAssetBalance)]
335335 case _ =>
336336 nil
337337 }
338338 else throw("Strict value is not equal to itself.")
339339 }
340340 else nil
341341 }
342342 else throw("Strict value is not equal to itself.")
343343 }
344344 else throw("Strict value is not equal to itself.")
345345 }
346346
347347
348-func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
349- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
350- if ((currentAdditionalBalance == currentAdditionalBalance))
348+func withdraw (assetId,amount,shareAssetId,proxy,proxyRateMul,profitAddress) = {
349+ let currentStakedBalance = getStakedBalanceOrZero(assetId)
350+ if ((currentStakedBalance == currentStakedBalance))
351351 then {
352- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
353- if ((currentStakingAssetBalance == currentStakingAssetBalance))
352+ let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
353+ if ((currentShareAssetBalance == currentShareAssetBalance))
354354 then {
355355 let currentProxyRate = getRate(proxy)
356356 if ((currentProxyRate == currentProxyRate))
357357 then {
358- let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
359- let stakingAsset = parseAssetId(stakingAssetId)
358+ let oldRate = fraction(proxyRateMul, currentStakedBalance, currentShareAssetBalance)
359+ let shareAsset = parseAssetId(shareAssetId)
360360 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
361- let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362- let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
363- if ((sendStakingAssetAmount > 0))
361+ let sendShareAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362+ let profitAmount = max([0, (oldSendStakingAmount - sendShareAssetAmount)])
363+ if ((sendShareAssetAmount > 0))
364364 then {
365- let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
365+ let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(shareAsset, sendShareAssetAmount)])
366366 if ((withdrawInvoke == withdrawInvoke))
367367 then match withdrawInvoke {
368368 case receivedAssets: Int =>
369- let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
370- let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
371-[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
369+ let newShareAssetBalance = ((currentShareAssetBalance - sendShareAssetAmount) - profitAmount)
370+ let newStakedBalance = if ((newShareAssetBalance == 0))
371+ then 0
372+ else (currentStakedBalance - receivedAssets)
373+[IntegerEntry(keyStakedBalance(assetId), newStakedBalance), IntegerEntry(keyShareAssetBalance(shareAssetId), newShareAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(shareAssetId))]
372374 case _ =>
373375 nil
374376 }
375377 else throw("Strict value is not equal to itself.")
376378 }
377379 else nil
378380 }
379381 else throw("Strict value is not equal to itself.")
380382 }
381383 else throw("Strict value is not equal to itself.")
382384 }
383385 else throw("Strict value is not equal to itself.")
384386 }
385387
386388
387389 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
388390 case a: (Boolean, Int, Int, String, String, Int, String) =>
389391 a
390392 case _ =>
391393 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
392394 }
393395
394396
395-func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
396- let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
397- if ((currentAdditionalBalance == currentAdditionalBalance))
397+func rebalanceInternal (targetRatio,assetId,shareAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
398+ let currentStakedBalance = getStakedBalanceOrZero(assetId)
399+ if ((currentStakedBalance == currentStakedBalance))
398400 then {
399- let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
400- if ((currentStakingAssetBalance == currentStakingAssetBalance))
401+ let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
402+ if ((currentShareAssetBalance == currentShareAssetBalance))
401403 then {
402404 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
403- let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
404- let diff = (currentAdditionalBalance - targetAdditionalBalance)
405+ let targetStakedBalance = fraction(targetRatio, leasableTotalBalance, 100)
406+ let diff = (currentStakedBalance - targetStakedBalance)
405407 if ((diff == 0))
406408 then nil
407409 else if ((0 > diff))
408410 then {
409411 let sendAssetAmount = -(diff)
410- deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
412+ deposit(assetId, sendAssetAmount, shareAssetId, proxy)
411413 }
412414 else {
413415 let getAssetAmount = diff
414- withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
416+ withdraw(assetId, getAssetAmount, shareAssetId, proxy, proxyRateMul, profitAddress)
415417 }
416418 }
417419 else throw("Strict value is not equal to itself.")
418420 }
419421 else throw("Strict value is not equal to itself.")
420422 }
421423
422424
423425 func rebalanceAsset (assetId) = {
424- let $t01593116067 = getLeaseProxyConfig(assetId)
425- let isLeasable = $t01593116067._1
426- let leasedRatio = $t01593116067._2
427- let minBalance = $t01593116067._3
428- let proxyAddress = $t01593116067._4
429- let proxyAssetId = $t01593116067._5
430- let proxyRateMul = $t01593116067._6
431- let stakingProfitAddress = $t01593116067._7
426+ let $t01578815924 = getLeaseProxyConfig(assetId)
427+ let isLeasable = $t01578815924._1
428+ let leasedRatio = $t01578815924._2
429+ let minBalance = $t01578815924._3
430+ let proxyAddress = $t01578815924._4
431+ let proxyAssetId = $t01578815924._5
432+ let proxyRateMul = $t01578815924._6
433+ let stakingProfitAddress = $t01578815924._7
432434 if (isLeasable)
433435 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434436 else nil
435437 }
436438
437439
438440 func withdrawAndRebalanceAsset (assetId,getAmount) = {
439- let $t01646616602 = getLeaseProxyConfig(assetId)
440- let isLeasable = $t01646616602._1
441- let leasedRatio = $t01646616602._2
442- let minBalance = $t01646616602._3
443- let proxyAddress = $t01646616602._4
444- let proxyAssetId = $t01646616602._5
445- let proxyRateMul = $t01646616602._6
446- let stakingProfitAddress = $t01646616602._7
441+ let $t01632316459 = getLeaseProxyConfig(assetId)
442+ let isLeasable = $t01632316459._1
443+ let leasedRatio = $t01632316459._2
444+ let minBalance = $t01632316459._3
445+ let proxyAddress = $t01632316459._4
446+ let proxyAssetId = $t01632316459._5
447+ let proxyRateMul = $t01632316459._6
448+ let stakingProfitAddress = $t01632316459._7
447449 if (isLeasable)
448450 then {
449451 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
450452 if ((newTotalLeasableBalance == newTotalLeasableBalance))
451453 then {
452- let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
453- if ((newAdditionalBalance == newAdditionalBalance))
454+ let newStakedBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
455+ if ((newStakedBalance == newStakedBalance))
454456 then {
455- let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
457+ let withdrawAmount = (getStakedBalanceOrZero(assetId) - newStakedBalance)
456458 if ((withdrawAmount == withdrawAmount))
457459 then if ((0 > withdrawAmount))
458460 then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
459461 else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
460462 else throw("Strict value is not equal to itself.")
461463 }
462464 else throw("Strict value is not equal to itself.")
463465 }
464466 else throw("Strict value is not equal to itself.")
465467 }
466468 else nil
467469 }
468470
469471
470472 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
471473 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
472474 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
473475 (AmAmtWithdrawState ++ PrAmtWithdrawState)
474476 }
475477
476478
477479 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
478480 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
479481 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
480482 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
481483 }
482484
483485
484486 func calcPrices (amAmt,prAmt,lpAmt) = {
485487 let cfg = getPoolConfig()
486488 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
487489 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
488490 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
489491 let amAmtX18 = toX18(amAmt, amtAssetDcm)
490492 let prAmtX18 = toX18(prAmt, priceAssetDcm)
491493 let lpAmtX18 = toX18(lpAmt, scale8)
492494 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
493495 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
494496 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
495497 }
496498
497499
498500 func calculatePrices (amAmt,prAmt,lpAmt) = {
499501 let prices = calcPrices(amAmt, prAmt, lpAmt)
500502 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
501503 }
502504
503505
504506 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
505507 let cfg = getPoolConfig()
506508 let lpAssetId = cfg[idxPoolLPAssetId]
507509 let amAssetId = cfg[idxAmtAssetId]
508510 let prAssetId = cfg[idxPriceAssetId]
509511 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
510512 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
511513 let poolStatus = cfg[idxPoolStatus]
512514 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
513515 if ((lpAssetId != pmtAssetId))
514516 then throw("Invalid asset passed.")
515517 else {
516518 let amBalance = getAccBalance(amAssetId)
517519 let amBalanceX18 = toX18(amBalance, amAssetDcm)
518520 let prBalance = getAccBalance(prAssetId)
519521 let prBalanceX18 = toX18(prBalance, prAssetDcm)
520522 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
521523 let curPrice = fromX18(curPriceX18, scale8)
522524 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
523525 let lpEmissionX18 = toX18(lpEmission, scale8)
524526 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
525527 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
526528 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
527529 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
528530 let state = if ((txId58 == ""))
529531 then nil
530532 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
531533 then unit
532534 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
533535 then unit
534536 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)]
535537 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
536538 }
537539 }
538540
539541
540542 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
541543 let cfg = getPoolConfig()
542544 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
543545 let amAssetIdStr = cfg[idxAmtAssetId]
544546 let prAssetIdStr = cfg[idxPriceAssetId]
545547 let iAmtAssetId = cfg[idxIAmtAssetId]
546548 let iPriceAssetId = cfg[idxIPriceAssetId]
547549 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
548550 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
549551 let poolStatus = cfg[idxPoolStatus]
550552 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
551553 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
552554 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
553555 if (if ((amAssetIdStr != inAmAssetIdStr))
554556 then true
555557 else (prAssetIdStr != inPrAssetIdStr))
556558 then throw("Invalid amt or price asset passed.")
557559 else {
558560 let amBalance = if (isEvaluate)
559561 then getAccBalance(amAssetIdStr)
560562 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
561563 let prBalance = if (isEvaluate)
562564 then getAccBalance(prAssetIdStr)
563565 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
564566 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
565567 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
566568 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
567569 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
568570 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
569571 let res = if ((lpEmission == 0))
570572 then {
571573 let curPriceX18 = zeroBigInt
572574 let slippageX18 = zeroBigInt
573575 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
574576 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
575577 }
576578 else {
577579 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
578580 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
579581 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
580582 if (if ((curPriceX18 != zeroBigInt))
581583 then (slippageX18 > slippageToleranceX18)
582584 else false)
583585 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
584586 else {
585587 let lpEmissionX18 = toX18(lpEmission, scale8)
586588 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
587589 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
588590 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
589591 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
590592 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
591593 let expAmtAssetAmtX18 = expectedAmts._1
592594 let expPriceAssetAmtX18 = expectedAmts._2
593595 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
594596 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
595597 }
596598 }
597599 let calcLpAmt = res._1
598600 let calcAmAssetPmt = res._2
599601 let calcPrAssetPmt = res._3
600602 let curPrice = fromX18(res._4, scale8)
601603 let slippageCalc = fromX18(res._5, scale8)
602604 if ((0 >= calcLpAmt))
603605 then throw("Invalid calculations. LP calculated is less than zero.")
604606 else {
605607 let emitLpAmt = if (!(emitLp))
606608 then 0
607609 else calcLpAmt
608610 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
609611 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
610612 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))]
611613 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
612614 }
613615 }
614616 }
615617
616618
617619 func calcKLp (amountBalance,priceBalance,lpEmission) = {
618620 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
619621 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
620622 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
621623 if ((lpEmission == big0))
622624 then big0
623625 else updatedKLp
624626 }
625627
626628
627629 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
628630 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
629631 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
630632 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
631633 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
632634 currentKLp
633635 }
634636
635637
636638 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
637639 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
638640 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
639641 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
640642 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
641643 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
642644 $Tuple2(actions, updatedKLp)
643645 }
644646
645647
646648 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
647649
648650
649651 func validateUpdatedKLp (oldKLp,updatedKLp) = if (if ((updatedKLp == big0))
650652 then true
651653 else (updatedKLp >= oldKLp))
652654 then true
653655 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
654656
655657
656658 func validateMatcherOrderAllowed (order) = {
657659 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
658660 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
659661 let amountAssetAmount = order.amount
660662 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
661- let $t02901329225 = if ((order.orderType == Buy))
663+ let $t02885829070 = if ((order.orderType == Buy))
662664 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
663665 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
664- let amountAssetBalanceDelta = $t02901329225._1
665- let priceAssetBalanceDelta = $t02901329225._2
666+ let amountAssetBalanceDelta = $t02885829070._1
667+ let priceAssetBalanceDelta = $t02885829070._2
666668 if (if (if (isGlobalShutdown())
667669 then true
668670 else (cfgPoolStatus == PoolMatcherDisabled))
669671 then true
670672 else (cfgPoolStatus == PoolShutdown))
671673 then throw("Exchange operations disabled")
672674 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
673675 then true
674676 else (order.assetPair.priceAsset != cfgPriceAssetId))
675677 then throw("Wrong order assets.")
676678 else {
677679 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
678- let $t02966529765 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
679- let unusedActions = $t02966529765._1
680- let kLpNew = $t02966529765._2
680+ let $t02951029610 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
681+ let unusedActions = $t02951029610._1
682+ let kLpNew = $t02951029610._2
681683 let isOrderValid = (kLpNew >= kLp)
682684 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
683685 $Tuple2(isOrderValid, info)
684686 }
685687 }
686688
687689
688690 func commonGet (i) = if ((size(i.payments) != 1))
689691 then throw("exactly 1 payment is expected")
690692 else {
691693 let pmt = value(i.payments[0])
692694 let pmtAssetId = value(pmt.assetId)
693695 let pmtAmt = pmt.amount
694696 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
695697 let outAmAmt = res._1
696698 let outPrAmt = res._2
697699 let poolStatus = parseIntValue(res._9)
698700 let state = res._10
699701 if (if (isGlobalShutdown())
700702 then true
701703 else (poolStatus == PoolShutdown))
702704 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
703705 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
704706 }
705707
706708
707709 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
708710 then throw("exactly 2 payments are expected")
709711 else {
710712 let amAssetPmt = value(i.payments[0])
711713 let prAssetPmt = value(i.payments[1])
712714 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
713715 let poolStatus = parseIntValue(estPut._8)
714716 if (if (if (isGlobalShutdown())
715717 then true
716718 else (poolStatus == PoolPutDisabled))
717719 then true
718720 else (poolStatus == PoolShutdown))
719721 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
720722 else estPut
721723 }
722724
723725
724726 func emit (amount) = {
725727 let emitInv = invoke(factoryContract, "emit", [amount], nil)
726728 if ((emitInv == emitInv))
727729 then {
728730 let emitInvLegacy = match emitInv {
729731 case legacyFactoryContract: Address =>
730732 invoke(legacyFactoryContract, "emit", [amount], nil)
731733 case _ =>
732734 unit
733735 }
734736 if ((emitInvLegacy == emitInvLegacy))
735737 then amount
736738 else throw("Strict value is not equal to itself.")
737739 }
738740 else throw("Strict value is not equal to itself.")
739741 }
740742
741743
742744 func takeFee (amount,fee) = {
743745 let feeAmount = if ((fee == 0))
744746 then 0
745747 else fraction(amount, fee, scale8)
746748 $Tuple2((amount - feeAmount), feeAmount)
747749 }
748750
749751
750752 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
751753 let isEval = (txId == unit)
752754 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
753755 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
754756 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
755757 then true
756758 else if ((paymentAssetId == cfgPriceAssetId))
757759 then false
758760 else throwErr("invalid asset")
759- let $t03287833171 = if (isEval)
761+ let $t03272333016 = if (isEval)
760762 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
761763 else if (paymentInAmountAsset)
762764 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
763765 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
764- let amountBalanceOld = $t03287833171._1
765- let priceBalanceOld = $t03287833171._2
766- let $t03317533324 = if (paymentInAmountAsset)
766+ let amountBalanceOld = $t03272333016._1
767+ let priceBalanceOld = $t03272333016._2
768+ let $t03302033169 = if (paymentInAmountAsset)
767769 then $Tuple2(paymentAmountRaw, 0)
768770 else $Tuple2(0, paymentAmountRaw)
769- let amountAssetAmountRaw = $t03317533324._1
770- let priceAssetAmountRaw = $t03317533324._2
771+ let amountAssetAmountRaw = $t03302033169._1
772+ let priceAssetAmountRaw = $t03302033169._2
771773 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
772774 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
773- let $t03345633520 = takeFee(paymentAmountRaw, inFee)
774- let paymentAmount = $t03345633520._1
775- let feeAmount = $t03345633520._2
775+ let $t03330133365 = takeFee(paymentAmountRaw, inFee)
776+ let paymentAmount = $t03330133365._1
777+ let feeAmount = $t03330133365._2
776778 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
777779 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
778780 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
779781 let priceNew = fromX18(priceNewX18, scale8)
780782 let paymentBalance = if (paymentInAmountAsset)
781783 then amountBalanceOld
782784 else priceBalanceOld
783785 let paymentBalanceBigInt = toBigInt(paymentBalance)
784786 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
785787 let chechSupply = if ((supplyBigInt > big0))
786788 then true
787789 else throwErr("initial deposit requires all coins")
788790 if ((chechSupply == chechSupply))
789791 then {
790792 let depositBigInt = toBigInt(paymentAmount)
791793 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
792794 let commonState = if (isEval)
793795 then nil
794796 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))]
795797 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
796798 let priceOld = fromX18(priceOldX18, scale8)
797799 let loss = {
798- let $t03520135368 = if (paymentInAmountAsset)
800+ let $t03504635213 = if (paymentInAmountAsset)
799801 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
800802 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
801- let amount = $t03520135368._1
802- let balance = $t03520135368._2
803+ let amount = $t03504635213._1
804+ let balance = $t03504635213._2
803805 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
804806 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
805807 }
806808 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
807809 }
808810 else throw("Strict value is not equal to itself.")
809811 }
810812
811813
812814 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
813815 let isEval = (txId == unit)
814816 let cfg = getPoolConfig()
815817 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
816818 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
817819 let checks = [if ((paymentAssetId == cfgLpAssetId))
818820 then true
819821 else throwErr("invalid lp asset")]
820822 if ((checks == checks))
821823 then {
822824 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
823825 then true
824826 else if ((outAssetId == cfgPriceAssetId))
825827 then false
826828 else throwErr("invalid asset")
827829 let balanceBigInt = if (outInAmountAsset)
828830 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
829831 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
830832 let outInAmountAssetDecimals = if (outInAmountAsset)
831833 then amtAssetDcm
832834 else priceAssetDcm
833835 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
834836 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
835837 let outBalance = if (outInAmountAsset)
836838 then amBalanceOld
837839 else prBalanceOld
838840 let outBalanceBigInt = toBigInt(outBalance)
839841 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
840842 let redeemedBigInt = toBigInt(paymentAmount)
841843 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
842- let $t03744637502 = takeFee(amountRaw, outFee)
843- let totalAmount = $t03744637502._1
844- let feeAmount = $t03744637502._2
845- let $t03750637732 = if (outInAmountAsset)
844+ let $t03729137347 = takeFee(amountRaw, outFee)
845+ let totalAmount = $t03729137347._1
846+ let feeAmount = $t03729137347._2
847+ let $t03735137577 = if (outInAmountAsset)
846848 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
847849 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
848- let outAmAmount = $t03750637732._1
849- let outPrAmount = $t03750637732._2
850- let amBalanceNew = $t03750637732._3
851- let prBalanceNew = $t03750637732._4
850+ let outAmAmount = $t03735137577._1
851+ let outPrAmount = $t03735137577._2
852+ let amBalanceNew = $t03735137577._3
853+ let prBalanceNew = $t03735137577._4
852854 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
853855 let priceNew = fromX18(priceNewX18, scale8)
854856 let commonState = if (isEval)
855857 then nil
856858 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)]
857859 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
858860 let priceOld = fromX18(priceOldX18, scale8)
859861 let loss = {
860862 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
861863 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
862864 }
863865 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
864866 }
865867 else throw("Strict value is not equal to itself.")
866868 }
867869
868870
869871 func managerPublicKeyOrUnit () = {
870872 let managerVaultAddress = getManagerVaultAddressOrThis()
871873 match getString(managerVaultAddress, keyManagerPublicKey()) {
872874 case s: String =>
873875 fromBase58String(s)
874876 case _: Unit =>
875877 unit
876878 case _ =>
877879 throw("Match error")
878880 }
879881 }
880882
881883
882884 func isManager (i) = match managerPublicKeyOrUnit() {
883885 case pk: ByteVector =>
884886 (i.callerPublicKey == pk)
885887 case _: Unit =>
886888 (i.caller == this)
887889 case _ =>
888890 throw("Match error")
889891 }
890892
891893
892894 func mustManager (i) = {
893895 let pd = throw("Permission denied")
894896 match managerPublicKeyOrUnit() {
895897 case pk: ByteVector =>
896898 if ((i.callerPublicKey == pk))
897899 then true
898900 else pd
899901 case _: Unit =>
900902 if ((i.caller == this))
901903 then true
902904 else pd
903905 case _ =>
904906 throw("Match error")
905907 }
906908 }
907909
908910
909911 @Callable(i)
910912 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
911913
912914
913915
914916 @Callable(i)
915917 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
916- let $t03959039895 = if ((isReverse == false))
918+ let $t03943539740 = if ((isReverse == false))
917919 then {
918920 let assetOut = getStringOrFail(this, pa())
919921 let assetIn = getStringOrFail(this, aa())
920922 $Tuple2(assetOut, assetIn)
921923 }
922924 else {
923925 let assetOut = getStringOrFail(this, aa())
924926 let assetIn = getStringOrFail(this, pa())
925927 $Tuple2(assetOut, assetIn)
926928 }
927- let assetOut = $t03959039895._1
928- let assetIn = $t03959039895._2
929+ let assetOut = $t03943539740._1
930+ let assetIn = $t03943539740._2
929931 let poolAssetInBalance = getAccBalance(assetIn)
930932 let poolAssetOutBalance = getAccBalance(assetOut)
931933 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
932934 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
933935 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
934936 let checkK = if ((newK >= oldK))
935937 then true
936938 else throw("new K is fewer error")
937939 if ((checkK == checkK))
938940 then $Tuple2(nil, amountOut)
939941 else throw("Strict value is not equal to itself.")
940942 }
941943
942944
943945
944946 @Callable(i)
945947 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
946948 let swapContact = {
947949 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
948950 if ($isInstanceOf(@, "String"))
949951 then @
950952 else throw(($getType(@) + " couldn't be cast to String"))
951953 }
952954 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
953955 then true
954956 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
955957 then true
956958 else throwErr("Permission denied")]
957959 if ((checks == checks))
958960 then {
959961 let pmt = value(i.payments[0])
960962 let assetIn = assetIdToString(pmt.assetId)
961963 let assetOut = if ((isReverse == false))
962964 then getStringOrFail(this, pa())
963965 else getStringOrFail(this, aa())
964966 let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount)
965967 let poolAssetOutBalance = getAccBalance(assetOut)
966968 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
967969 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
968970 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
969971 let checkK = if ((newK >= oldK))
970972 then true
971973 else throw("new K is fewer error")
972974 if ((checkK == checkK))
973975 then {
974976 let checkMin = if ((amountOut >= amountOutMin))
975977 then true
976978 else throw("Exchange result is fewer coins than expected")
977979 if ((checkMin == checkMin))
978980 then {
979981 let rebalanceState = rebalanceAsset(assetIn)
980982 if ((rebalanceState == rebalanceState))
981983 then {
982984 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
983985 if ((withdrawState == withdrawState))
984986 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
985987 else throw("Strict value is not equal to itself.")
986988 }
987989 else throw("Strict value is not equal to itself.")
988990 }
989991 else throw("Strict value is not equal to itself.")
990992 }
991993 else throw("Strict value is not equal to itself.")
992994 }
993995 else throw("Strict value is not equal to itself.")
994996 }
995997
996998
997999
9981000 @Callable(i)
9991001 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10001002 then throw("Invalid slippageTolerance passed")
10011003 else {
10021004 let estPut = commonPut(i, slippageTolerance, true)
10031005 let emitLpAmt = estPut._2
10041006 let lpAssetId = estPut._7
10051007 let state = estPut._9
10061008 let amDiff = estPut._10
10071009 let prDiff = estPut._11
10081010 let amId = estPut._12
10091011 let prId = estPut._13
10101012 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10111013 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10121014 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10131015 if ((currentKLp == currentKLp))
10141016 then {
10151017 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10161018 if ((emitInv == emitInv))
10171019 then {
10181020 let emitInvLegacy = match emitInv {
10191021 case legacyFactoryContract: Address =>
10201022 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10211023 case _ =>
10221024 unit
10231025 }
10241026 if ((emitInvLegacy == emitInvLegacy))
10251027 then {
10261028 let slippageAInv = if ((amDiff > 0))
10271029 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10281030 else nil
10291031 if ((slippageAInv == slippageAInv))
10301032 then {
10311033 let slippagePInv = if ((prDiff > 0))
10321034 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10331035 else nil
10341036 if ((slippagePInv == slippagePInv))
10351037 then {
10361038 let lpTransfer = if (shouldAutoStake)
10371039 then {
10381040 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10391041 if ((slpStakeInv == slpStakeInv))
10401042 then nil
10411043 else throw("Strict value is not equal to itself.")
10421044 }
10431045 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1044- let $t04439844860 = refreshKLpInternal(0, 0, 0)
1045- if (($t04439844860 == $t04439844860))
1046+ let $t04424344705 = refreshKLpInternal(0, 0, 0)
1047+ if (($t04424344705 == $t04424344705))
10461048 then {
1047- let updatedKLp = $t04439844860._2
1048- let refreshKLpActions = $t04439844860._1
1049+ let updatedKLp = $t04424344705._2
1050+ let refreshKLpActions = $t04424344705._1
10491051 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10501052 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10511053 then {
10521054 let reb = invoke(this, "rebalance", nil, nil)
10531055 if ((reb == reb))
10541056 then ((state ++ lpTransfer) ++ refreshKLpActions)
10551057 else throw("Strict value is not equal to itself.")
10561058 }
10571059 else throw("Strict value is not equal to itself.")
10581060 }
10591061 else throw("Strict value is not equal to itself.")
10601062 }
10611063 else throw("Strict value is not equal to itself.")
10621064 }
10631065 else throw("Strict value is not equal to itself.")
10641066 }
10651067 else throw("Strict value is not equal to itself.")
10661068 }
10671069 else throw("Strict value is not equal to itself.")
10681070 }
10691071 else throw("Strict value is not equal to itself.")
10701072 }
10711073
10721074
10731075
10741076 @Callable(i)
10751077 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10761078 then throw("Invalid value passed")
10771079 else {
10781080 let estPut = commonPut(i, maxSlippage, false)
10791081 let state = estPut._9
10801082 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10811083 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10821084 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10831085 if ((currentKLp == currentKLp))
10841086 then {
1085- let $t04547245537 = refreshKLpInternal(0, 0, 0)
1086- let refreshKLpActions = $t04547245537._1
1087- let updatedKLp = $t04547245537._2
1087+ let $t04531745382 = refreshKLpInternal(0, 0, 0)
1088+ let refreshKLpActions = $t04531745382._1
1089+ let updatedKLp = $t04531745382._2
10881090 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10891091 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10901092 then (state ++ refreshKLpActions)
10911093 else throw("Strict value is not equal to itself.")
10921094 }
10931095 else throw("Strict value is not equal to itself.")
10941096 }
10951097
10961098
10971099
10981100 @Callable(i)
10991101 func putOneTkn (minOutAmount,autoStake) = {
11001102 let isPoolOneTokenOperationsDisabled = {
11011103 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11021104 if ($isInstanceOf(@, "Boolean"))
11031105 then @
11041106 else throw(($getType(@) + " couldn't be cast to Boolean"))
11051107 }
11061108 let isPutDisabled = if (if (if (isGlobalShutdown())
11071109 then true
11081110 else (cfgPoolStatus == PoolPutDisabled))
11091111 then true
11101112 else (cfgPoolStatus == PoolShutdown))
11111113 then true
11121114 else isPoolOneTokenOperationsDisabled
11131115 let checks = [if (if (!(isPutDisabled))
11141116 then true
11151117 else isManager(i))
11161118 then true
11171119 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11181120 then true
11191121 else throwErr("exactly 1 payment are expected")]
11201122 if ((checks == checks))
11211123 then {
11221124 let payment = i.payments[0]
11231125 let paymentAssetId = payment.assetId
11241126 let paymentAmountRaw = payment.amount
11251127 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11261128 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11271129 else if ((paymentAssetId == cfgPriceAssetId))
11281130 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11291131 else throwErr("payment asset is not supported")
11301132 if ((currentKLp == currentKLp))
11311133 then {
11321134 let userAddress = i.caller
11331135 let txId = i.transactionId
1134- let $t04672546877 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1135- if (($t04672546877 == $t04672546877))
1136+ let $t04657046722 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1137+ if (($t04657046722 == $t04657046722))
11361138 then {
1137- let paymentInAmountAsset = $t04672546877._5
1138- let bonus = $t04672546877._4
1139- let feeAmount = $t04672546877._3
1140- let commonState = $t04672546877._2
1141- let emitAmountEstimated = $t04672546877._1
1139+ let paymentInAmountAsset = $t04657046722._5
1140+ let bonus = $t04657046722._4
1141+ let feeAmount = $t04657046722._3
1142+ let commonState = $t04657046722._2
1143+ let emitAmountEstimated = $t04657046722._1
11421144 let emitAmount = if (if ((minOutAmount > 0))
11431145 then (minOutAmount > emitAmountEstimated)
11441146 else false)
11451147 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11461148 else emitAmountEstimated
11471149 let emitInv = emit(emitAmount)
11481150 if ((emitInv == emitInv))
11491151 then {
11501152 let lpTransfer = if (autoStake)
11511153 then {
11521154 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11531155 if ((stakeInv == stakeInv))
11541156 then nil
11551157 else throw("Strict value is not equal to itself.")
11561158 }
11571159 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11581160 let sendFee = if ((feeAmount > 0))
11591161 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11601162 else nil
1161- let $t04746347660 = if ((this == feeCollectorAddress))
1163+ let $t04730847505 = if ((this == feeCollectorAddress))
11621164 then $Tuple2(0, 0)
11631165 else if (paymentInAmountAsset)
11641166 then $Tuple2(-(feeAmount), 0)
11651167 else $Tuple2(0, -(feeAmount))
1166- let amountAssetBalanceDelta = $t04746347660._1
1167- let priceAssetBalanceDelta = $t04746347660._2
1168- let $t04766347771 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1169- let refreshKLpActions = $t04766347771._1
1170- let updatedKLp = $t04766347771._2
1168+ let amountAssetBalanceDelta = $t04730847505._1
1169+ let priceAssetBalanceDelta = $t04730847505._2
1170+ let $t04750847616 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1171+ let refreshKLpActions = $t04750847616._1
1172+ let updatedKLp = $t04750847616._2
11711173 let kLp = value(getString(keyKLp))
11721174 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11731175 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11741176 then {
11751177 let reb = invoke(this, "rebalance", nil, nil)
11761178 if ((reb == reb))
11771179 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11781180 else throw("Strict value is not equal to itself.")
11791181 }
11801182 else throw("Strict value is not equal to itself.")
11811183 }
11821184 else throw("Strict value is not equal to itself.")
11831185 }
11841186 else throw("Strict value is not equal to itself.")
11851187 }
11861188 else throw("Strict value is not equal to itself.")
11871189 }
11881190 else throw("Strict value is not equal to itself.")
11891191 }
11901192
11911193
11921194
11931195 @Callable(i)
11941196 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1195- let $t04812648283 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1196- let emitAmountEstimated = $t04812648283._1
1197- let commonState = $t04812648283._2
1198- let feeAmount = $t04812648283._3
1199- let bonus = $t04812648283._4
1200- let paymentInAmountAsset = $t04812648283._5
1197+ let $t04797148128 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1198+ let emitAmountEstimated = $t04797148128._1
1199+ let commonState = $t04797148128._2
1200+ let feeAmount = $t04797148128._3
1201+ let bonus = $t04797148128._4
1202+ let paymentInAmountAsset = $t04797148128._5
12011203 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12021204 }
12031205
12041206
12051207
12061208 @Callable(i)
12071209 func getOneTkn (outAssetIdStr,minOutAmount) = {
12081210 let isPoolOneTokenOperationsDisabled = {
12091211 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12101212 if ($isInstanceOf(@, "Boolean"))
12111213 then @
12121214 else throw(($getType(@) + " couldn't be cast to Boolean"))
12131215 }
12141216 let isGetDisabled = if (if (isGlobalShutdown())
12151217 then true
12161218 else (cfgPoolStatus == PoolShutdown))
12171219 then true
12181220 else isPoolOneTokenOperationsDisabled
12191221 let checks = [if (if (!(isGetDisabled))
12201222 then true
12211223 else isManager(i))
12221224 then true
12231225 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12241226 then true
12251227 else throwErr("exactly 1 payment are expected")]
12261228 if ((checks == checks))
12271229 then {
12281230 let outAssetId = parseAssetId(outAssetIdStr)
12291231 let payment = i.payments[0]
12301232 let paymentAssetId = payment.assetId
12311233 let paymentAmount = payment.amount
12321234 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12331235 if ((currentKLp == currentKLp))
12341236 then {
12351237 let userAddress = i.caller
12361238 let txId = i.transactionId
1237- let $t04916849321 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1238- if (($t04916849321 == $t04916849321))
1239+ let $t04901349166 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1240+ if (($t04901349166 == $t04901349166))
12391241 then {
1240- let outInAmountAsset = $t04916849321._5
1241- let bonus = $t04916849321._4
1242- let feeAmount = $t04916849321._3
1243- let commonState = $t04916849321._2
1244- let amountEstimated = $t04916849321._1
1242+ let outInAmountAsset = $t04901349166._5
1243+ let bonus = $t04901349166._4
1244+ let feeAmount = $t04901349166._3
1245+ let commonState = $t04901349166._2
1246+ let amountEstimated = $t04901349166._1
12451247 let amount = if (if ((minOutAmount > 0))
12461248 then (minOutAmount > amountEstimated)
12471249 else false)
12481250 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12491251 else amountEstimated
12501252 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12511253 if ((burnInv == burnInv))
12521254 then {
12531255 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12541256 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12551257 let sendFee = if ((feeAmount > 0))
12561258 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12571259 else nil
1258- let $t04998550232 = {
1260+ let $t04983050077 = {
12591261 let feeAmountForCalc = if ((this == feeCollectorAddress))
12601262 then 0
12611263 else feeAmount
12621264 if (outInAmountAsset)
12631265 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12641266 else $Tuple2(0, -((amount + feeAmountForCalc)))
12651267 }
1266- let amountAssetBalanceDelta = $t04998550232._1
1267- let priceAssetBalanceDelta = $t04998550232._2
1268- let $t05023550343 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1269- let refreshKLpActions = $t05023550343._1
1270- let updatedKLp = $t05023550343._2
1268+ let amountAssetBalanceDelta = $t04983050077._1
1269+ let priceAssetBalanceDelta = $t04983050077._2
1270+ let $t05008050188 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1271+ let refreshKLpActions = $t05008050188._1
1272+ let updatedKLp = $t05008050188._2
12711273 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12721274 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12731275 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12741276 else throw("Strict value is not equal to itself.")
12751277 }
12761278 else throw("Strict value is not equal to itself.")
12771279 }
12781280 else throw("Strict value is not equal to itself.")
12791281 }
12801282 else throw("Strict value is not equal to itself.")
12811283 }
12821284 else throw("Strict value is not equal to itself.")
12831285 }
12841286
12851287
12861288
12871289 @Callable(i)
12881290 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1289- let $t05062150777 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1290- let amountEstimated = $t05062150777._1
1291- let commonState = $t05062150777._2
1292- let feeAmount = $t05062150777._3
1293- let bonus = $t05062150777._4
1294- let outInAmountAsset = $t05062150777._5
1291+ let $t05046650622 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1292+ let amountEstimated = $t05046650622._1
1293+ let commonState = $t05046650622._2
1294+ let feeAmount = $t05046650622._3
1295+ let bonus = $t05046650622._4
1296+ let outInAmountAsset = $t05046650622._5
12951297 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12961298 }
12971299
12981300
12991301
13001302 @Callable(i)
13011303 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13021304 let isPoolOneTokenOperationsDisabled = {
13031305 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13041306 if ($isInstanceOf(@, "Boolean"))
13051307 then @
13061308 else throw(($getType(@) + " couldn't be cast to Boolean"))
13071309 }
13081310 let isGetDisabled = if (if (isGlobalShutdown())
13091311 then true
13101312 else (cfgPoolStatus == PoolShutdown))
13111313 then true
13121314 else isPoolOneTokenOperationsDisabled
13131315 let checks = [if (if (!(isGetDisabled))
13141316 then true
13151317 else isManager(i))
13161318 then true
13171319 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13181320 then true
13191321 else throwErr("no payments are expected")]
13201322 if ((checks == checks))
13211323 then {
13221324 let outAssetId = parseAssetId(outAssetIdStr)
13231325 let userAddress = i.caller
13241326 let txId = i.transactionId
13251327 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13261328 if ((currentKLp == currentKLp))
13271329 then {
13281330 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13291331 if ((unstakeInv == unstakeInv))
13301332 then {
1331- let $t05168251833 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1332- if (($t05168251833 == $t05168251833))
1333+ let $t05152751678 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1334+ if (($t05152751678 == $t05152751678))
13331335 then {
1334- let outInAmountAsset = $t05168251833._5
1335- let bonus = $t05168251833._4
1336- let feeAmount = $t05168251833._3
1337- let commonState = $t05168251833._2
1338- let amountEstimated = $t05168251833._1
1336+ let outInAmountAsset = $t05152751678._5
1337+ let bonus = $t05152751678._4
1338+ let feeAmount = $t05152751678._3
1339+ let commonState = $t05152751678._2
1340+ let amountEstimated = $t05152751678._1
13391341 let amount = if (if ((minOutAmount > 0))
13401342 then (minOutAmount > amountEstimated)
13411343 else false)
13421344 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13431345 else amountEstimated
13441346 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13451347 if ((burnInv == burnInv))
13461348 then {
13471349 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13481350 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13491351 let sendFee = if ((feeAmount > 0))
13501352 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13511353 else nil
1352- let $t05249252739 = {
1354+ let $t05233752584 = {
13531355 let feeAmountForCalc = if ((this == feeCollectorAddress))
13541356 then 0
13551357 else feeAmount
13561358 if (outInAmountAsset)
13571359 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13581360 else $Tuple2(0, -((amount + feeAmountForCalc)))
13591361 }
1360- let amountAssetBalanceDelta = $t05249252739._1
1361- let priceAssetBalanceDelta = $t05249252739._2
1362- let $t05274252850 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1363- let refreshKLpActions = $t05274252850._1
1364- let updatedKLp = $t05274252850._2
1362+ let amountAssetBalanceDelta = $t05233752584._1
1363+ let priceAssetBalanceDelta = $t05233752584._2
1364+ let $t05258752695 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1365+ let refreshKLpActions = $t05258752695._1
1366+ let updatedKLp = $t05258752695._2
13651367 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13661368 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13671369 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13681370 else throw("Strict value is not equal to itself.")
13691371 }
13701372 else throw("Strict value is not equal to itself.")
13711373 }
13721374 else throw("Strict value is not equal to itself.")
13731375 }
13741376 else throw("Strict value is not equal to itself.")
13751377 }
13761378 else throw("Strict value is not equal to itself.")
13771379 }
13781380 else throw("Strict value is not equal to itself.")
13791381 }
13801382
13811383
13821384
13831385 @Callable(i)
13841386 func get () = {
13851387 let res = commonGet(i)
13861388 let outAmAmt = res._1
13871389 let outPrAmt = res._2
13881390 let pmtAmt = res._3
13891391 let pmtAssetId = res._4
13901392 let state = res._5
13911393 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
13921394 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13931395 if ((currentKLp == currentKLp))
13941396 then {
13951397 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13961398 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13971399 then {
1398- let $t05394554026 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1399- let refreshKLpActions = $t05394554026._1
1400- let updatedKLp = $t05394554026._2
1400+ let $t05379053871 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1401+ let refreshKLpActions = $t05379053871._1
1402+ let updatedKLp = $t05379053871._2
14011403 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14021404 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14031405 then ((withdrawState ++ state) ++ refreshKLpActions)
14041406 else throw("Strict value is not equal to itself.")
14051407 }
14061408 else throw("Strict value is not equal to itself.")
14071409 }
14081410 else throw("Strict value is not equal to itself.")
14091411 }
14101412
14111413
14121414
14131415 @Callable(i)
14141416 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14151417 let res = commonGet(i)
14161418 let outAmAmt = res._1
14171419 let outPrAmt = res._2
14181420 let pmtAmt = res._3
14191421 let pmtAssetId = res._4
14201422 let state = res._5
14211423 if ((noLessThenAmtAsset > outAmAmt))
14221424 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14231425 else if ((noLessThenPriceAsset > outPrAmt))
14241426 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14251427 else {
14261428 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14271429 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14281430 if ((currentKLp == currentKLp))
14291431 then {
14301432 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14311433 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14321434 then {
1433- let $t05512155202 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1434- let refreshKLpActions = $t05512155202._1
1435- let updatedKLp = $t05512155202._2
1435+ let $t05496655047 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1436+ let refreshKLpActions = $t05496655047._1
1437+ let updatedKLp = $t05496655047._2
14361438 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14371439 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14381440 then ((withdrawState ++ state) ++ refreshKLpActions)
14391441 else throw("Strict value is not equal to itself.")
14401442 }
14411443 else throw("Strict value is not equal to itself.")
14421444 }
14431445 else throw("Strict value is not equal to itself.")
14441446 }
14451447 }
14461448
14471449
14481450
14491451 @Callable(i)
14501452 func unstakeAndGet (amount) = {
14511453 let checkPayments = if ((size(i.payments) != 0))
14521454 then throw("No payments are expected")
14531455 else true
14541456 if ((checkPayments == checkPayments))
14551457 then {
14561458 let cfg = getPoolConfig()
14571459 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14581460 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14591461 if ((currentKLp == currentKLp))
14601462 then {
14611463 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14621464 if ((unstakeInv == unstakeInv))
14631465 then {
14641466 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14651467 let outAmAmt = res._1
14661468 let outPrAmt = res._2
14671469 let poolStatus = parseIntValue(res._9)
14681470 let state = res._10
14691471 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14701472 let checkPoolStatus = if (if (isGlobalShutdown())
14711473 then true
14721474 else (poolStatus == PoolShutdown))
14731475 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14741476 else true
14751477 if ((checkPoolStatus == checkPoolStatus))
14761478 then {
14771479 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14781480 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14791481 then {
1480- let $t05647456555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1481- let refreshKLpActions = $t05647456555._1
1482- let updatedKLp = $t05647456555._2
1482+ let $t05631956400 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1483+ let refreshKLpActions = $t05631956400._1
1484+ let updatedKLp = $t05631956400._2
14831485 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14841486 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14851487 then ((withdrawState ++ state) ++ refreshKLpActions)
14861488 else throw("Strict value is not equal to itself.")
14871489 }
14881490 else throw("Strict value is not equal to itself.")
14891491 }
14901492 else throw("Strict value is not equal to itself.")
14911493 }
14921494 else throw("Strict value is not equal to itself.")
14931495 }
14941496 else throw("Strict value is not equal to itself.")
14951497 }
14961498 else throw("Strict value is not equal to itself.")
14971499 }
14981500
14991501
15001502
15011503 @Callable(i)
15021504 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15031505 let isGetDisabled = if (isGlobalShutdown())
15041506 then true
15051507 else (cfgPoolStatus == PoolShutdown)
15061508 let checks = [if (!(isGetDisabled))
15071509 then true
15081510 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15091511 then true
15101512 else throw("no payments are expected")]
15111513 if ((checks == checks))
15121514 then {
15131515 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15141516 if ((currentKLp == currentKLp))
15151517 then {
15161518 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15171519 if ((unstakeInv == unstakeInv))
15181520 then {
15191521 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15201522 let outAmAmt = res._1
15211523 let outPrAmt = res._2
15221524 let state = res._10
15231525 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15241526 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15251527 then true
15261528 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15271529 then true
15281530 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15291531 if ((checkAmounts == checkAmounts))
15301532 then {
15311533 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15321534 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15331535 then {
1534- let $t05799658077 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1535- let refreshKLpActions = $t05799658077._1
1536- let updatedKLp = $t05799658077._2
1536+ let $t05784157922 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1537+ let refreshKLpActions = $t05784157922._1
1538+ let updatedKLp = $t05784157922._2
15371539 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15381540 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15391541 then ((withdrawState ++ state) ++ refreshKLpActions)
15401542 else throw("Strict value is not equal to itself.")
15411543 }
15421544 else throw("Strict value is not equal to itself.")
15431545 }
15441546 else throw("Strict value is not equal to itself.")
15451547 }
15461548 else throw("Strict value is not equal to itself.")
15471549 }
15481550 else throw("Strict value is not equal to itself.")
15491551 }
15501552 else throw("Strict value is not equal to itself.")
15511553 }
15521554
15531555
15541556
15551557 @Callable(i)
15561558 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15571559 then throw("permissions denied")
15581560 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15591561
15601562
15611563
15621564 @Callable(i)
15631565 func refreshKLp () = {
15641566 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15651567 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15661568 then unit
15671569 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15681570 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15691571 then {
15701572 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1571- let $t05928159345 = refreshKLpInternal(0, 0, 0)
1572- let kLpUpdateActions = $t05928159345._1
1573- let updatedKLp = $t05928159345._2
1573+ let $t05912659190 = refreshKLpInternal(0, 0, 0)
1574+ let kLpUpdateActions = $t05912659190._1
1575+ let updatedKLp = $t05912659190._2
15741576 let actions = if ((kLp != updatedKLp))
15751577 then kLpUpdateActions
15761578 else throwErr("nothing to refresh")
15771579 $Tuple2(actions, toString(updatedKLp))
15781580 }
15791581 else throw("Strict value is not equal to itself.")
15801582 }
15811583
15821584
15831585
15841586 @Callable(i)
15851587 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
15861588
15871589
15881590
15891591 @Callable(i)
15901592 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
15911593
15921594
15931595
15941596 @Callable(i)
15951597 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
15961598 let prices = calcPrices(amAmt, prAmt, lpAmt)
15971599 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
15981600 }
15991601
16001602
16011603
16021604 @Callable(i)
16031605 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16041606
16051607
16061608
16071609 @Callable(i)
16081610 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16091611
16101612
16111613
16121614 @Callable(i)
16131615 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16141616
16151617
16161618
16171619 @Callable(i)
16181620 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16191621
16201622
16211623
16221624 @Callable(i)
16231625 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16241626 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16251627 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16261628 }
16271629
16281630
16291631
16301632 @Callable(i)
16311633 func statsREADONLY () = {
16321634 let cfg = getPoolConfig()
16331635 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16341636 let amtAssetId = cfg[idxAmtAssetId]
16351637 let priceAssetId = cfg[idxPriceAssetId]
16361638 let iAmtAssetId = cfg[idxIAmtAssetId]
16371639 let iPriceAssetId = cfg[idxIPriceAssetId]
16381640 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16391641 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16401642 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16411643 let accAmtAssetBalance = getAccBalance(amtAssetId)
16421644 let accPriceAssetBalance = getAccBalance(priceAssetId)
16431645 let pricesList = if ((poolLPBalance == 0))
16441646 then [zeroBigInt, zeroBigInt, zeroBigInt]
16451647 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16461648 let curPrice = 0
16471649 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16481650 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16491651 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16501652 $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))
16511653 }
16521654
16531655
16541656
16551657 @Callable(i)
16561658 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16571659 let cfg = getPoolConfig()
16581660 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16591661 let amAssetIdStr = cfg[idxAmtAssetId]
16601662 let amAssetId = fromBase58String(amAssetIdStr)
16611663 let prAssetIdStr = cfg[idxPriceAssetId]
16621664 let prAssetId = fromBase58String(prAssetIdStr)
16631665 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16641666 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16651667 let poolStatus = cfg[idxPoolStatus]
16661668 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16671669 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16681670 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16691671 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16701672 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16711673 let curPriceX18 = if ((poolLPBalance == 0))
16721674 then zeroBigInt
16731675 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16741676 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16751677 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16761678 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16771679 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16781680 let calcLpAmt = estPut._1
16791681 let curPriceCalc = estPut._3
16801682 let amBalance = estPut._4
16811683 let prBalance = estPut._5
16821684 let lpEmission = estPut._6
16831685 $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))
16841686 }
16851687
16861688
16871689
16881690 @Callable(i)
16891691 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
16901692 let cfg = getPoolConfig()
16911693 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16921694 let amAssetIdStr = cfg[idxAmtAssetId]
16931695 let amAssetId = fromBase58String(amAssetIdStr)
16941696 let prAssetIdStr = cfg[idxPriceAssetId]
16951697 let prAssetId = fromBase58String(prAssetIdStr)
16961698 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16971699 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16981700 let poolStatus = cfg[idxPoolStatus]
16991701 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17001702 let amBalanceRaw = getAccBalance(amAssetIdStr)
17011703 let prBalanceRaw = getAccBalance(prAssetIdStr)
17021704 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17031705 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17041706 let curPriceX18 = if ((poolLPBalance == 0))
17051707 then zeroBigInt
17061708 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17071709 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17081710 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17091711 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17101712 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17111713 let calcLpAmt = estPut._1
17121714 let curPriceCalc = estPut._3
17131715 let amBalance = estPut._4
17141716 let prBalance = estPut._5
17151717 let lpEmission = estPut._6
17161718 $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))
17171719 }
17181720
17191721
17201722
17211723 @Callable(i)
17221724 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17231725 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17241726 let outAmAmt = res._1
17251727 let outPrAmt = res._2
17261728 let amBalance = res._5
17271729 let prBalance = res._6
17281730 let lpEmission = res._7
17291731 let curPrice = res._8
17301732 let poolStatus = parseIntValue(res._9)
17311733 $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))
17321734 }
17331735
17341736
17351737 @Verifier(tx)
17361738 func verify () = {
17371739 let targetPublicKey = match managerPublicKeyOrUnit() {
17381740 case pk: ByteVector =>
17391741 pk
17401742 case _: Unit =>
17411743 tx.senderPublicKey
17421744 case _ =>
17431745 throw("Match error")
17441746 }
17451747 match tx {
17461748 case order: Order =>
17471749 let matcherPub = getMatcherPubOrFail()
1748- let $t06800768124 = if (skipOrderValidation())
1750+ let $t06785267969 = if (skipOrderValidation())
17491751 then $Tuple2(true, "")
17501752 else validateMatcherOrderAllowed(order)
1751- let orderValid = $t06800768124._1
1752- let orderValidInfo = $t06800768124._2
1753+ let orderValid = $t06785267969._1
1754+ let orderValidInfo = $t06785267969._2
17531755 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17541756 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17551757 if (if (if (orderValid)
17561758 then senderValid
17571759 else false)
17581760 then matcherValid
17591761 else false)
17601762 then true
17611763 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17621764 case s: SetScriptTransaction =>
17631765 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17641766 then true
17651767 else {
17661768 let newHash = blake2b256(value(s.script))
17671769 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17681770 let currentHash = scriptHash(this)
17691771 if ((allowedHash == newHash))
17701772 then (currentHash != newHash)
17711773 else false
17721774 }
17731775 case _ =>
17741776 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17751777 }
17761778 }
17771779

github/deemru/w8io/026f985 
237.15 ms