tx · 3qjAm3gQE4w2vMtyC4ikwy1CoegbXtebkirE6zQdTPK6

3N74GDduMoMAhHk7dApH6P9VDWKhFZ417FD:  -0.04200000 Waves

2023.07.11 16:29 [2661306] smart account 3N74GDduMoMAhHk7dApH6P9VDWKhFZ417FD > SELF 0.00000000 Waves

{ "type": 13, "id": "3qjAm3gQE4w2vMtyC4ikwy1CoegbXtebkirE6zQdTPK6", "fee": 4200000, "feeAssetId": null, "timestamp": 1689082204992, "version": 2, "chainId": 84, "sender": "3N74GDduMoMAhHk7dApH6P9VDWKhFZ417FD", "senderPublicKey": "C94AxUmoNDGMx49Ry1Q3s6UNv8WgGMUeBb6zhLbfFk8v", "proofs": [ "4g8L2usjGD7uKMcJSU8CKm57wov7dM9kmwonmFoTByMzsVc6AdvCAgFVzUNBxPDCzvctouZZUmCd7WtmJZk7Lvkb" ], "script": "base64:BgKYOAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhlQb29sUHV0QW5kTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXNzZXRJZ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EFAmRDCQDMCAIJAKQDAQUCZHoJAMwIAgkApgMBBQJkRgkAzAgCCQCkAwEFAmR5BQNuaWwFAWoBAmlpAQJpagAEAmlrBAJhUQkBAmduAAMJAAECBQJhUQIKQnl0ZVZlY3RvcgQCZ3EFAmFRBQJncQMJAAECBQJhUQIEVW5pdAgFAmlpD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yBAJhUQUCaWkDCQABAgUCYVECBU9yZGVyBAJlUQUCYVEEAmlsCQECYmoABAJpbQMJAQJlTQAJAJQKAgYCAAkBAmVQAQUCZVEEAmFLCAUCaW0CXzEEAmFMCAUCaW0CXzIEAmFNCQD0AwMIBQJlUQlib2R5Qnl0ZXMJAJEDAggFAmVRBnByb29mcwAACAUCZVEPc2VuZGVyUHVibGljS2V5BAJhTgkA9AMDCAUCZVEJYm9keUJ5dGVzCQCRAwIIBQJlUQZwcm9vZnMAAQUCaWwDAwMFAmFLBQJhTQcFAmFOBwYJAQJhSgQFAmFLBQJhTAUCYU0FAmFOAwkAAQIFAmFRAhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCYVYFAmFRAwkA9AMDCAUCaWkJYm9keUJ5dGVzCQCRAwIIBQJpaQZwcm9vZnMAAAUCaWsGBAJpbgkA9gMBCQEFdmFsdWUBCAUCYVYGc2NyaXB0BAJpbwkA2wQBCQEFdmFsdWUBCQCdCAIFAmJkCQECYUYABAJpcAkA8QcBBQR0aGlzAwkAAAIFAmlvBQJpbgkBAiE9AgUCaXAFAmluBwkA9AMDCAUCaWkJYm9keUJ5dGVzCQCRAwIIBQJpaQZwcm9vZnMAAAUCaWsrT1WL", "height": 2661306, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CnMKH5D9PH66EJvBJKshgKPbRJRCo6YWpx8sqypXLExq Next: AKbHEg7zXnAWLD29fmPhiPrt7Qz4tYZAz48i4o52hLxx Diff:
OldNewDifferences
2525
2626 let PoolPutDisabled = 2
2727
28-let PoolMatcherDisabled = 3
28+let PoolPutAndMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133-func keyStakedBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
133+func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134134
135135
136-func keyShareAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
136+func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137137
138138
139-func getStakedBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakedBalance(assetId)), 0)
139+func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
140140
141141
142-func getShareAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyShareAssetBalance(assetId)), 0)
142+func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
143143
144144
145145 func keyFactoryConfig () = "%s__factoryConfig"
258258
259259 let poolConfigParsed = parsePoolConfig(getPoolConfig())
260260
261-let $t095029668 = poolConfigParsed
261+let $t095499715 = poolConfigParsed
262262
263-let cfgPoolAddress = $t095029668._1
263+let cfgPoolAddress = $t095499715._1
264264
265-let cfgPoolStatus = $t095029668._2
265+let cfgPoolStatus = $t095499715._2
266266
267-let cfgLpAssetId = $t095029668._3
267+let cfgLpAssetId = $t095499715._3
268268
269-let cfgAmountAssetId = $t095029668._4
269+let cfgAmountAssetId = $t095499715._4
270270
271-let cfgPriceAssetId = $t095029668._5
271+let cfgPriceAssetId = $t095499715._5
272272
273-let cfgAmountAssetDecimals = $t095029668._6
273+let cfgAmountAssetDecimals = $t095499715._6
274274
275-let cfgPriceAssetDecimals = $t095029668._7
275+let cfgPriceAssetDecimals = $t095499715._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 + getStakedBalanceOrZero(assetId)) - getShareAssetBalanceOrZero(assetId))
294+ let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
295295 max([0, totalBalance])
296296 }
297297
315315 }
316316
317317
318-func deposit (assetId,amount,shareAssetId,proxy) = {
319- let currentStakedBalance = getStakedBalanceOrZero(assetId)
320- if ((currentStakedBalance == currentStakedBalance))
318+func deposit (assetId,amount,stakingAssetId,proxy) = {
319+ let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
320+ if ((currentAdditionalBalance == currentAdditionalBalance))
321321 then {
322- let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
323- if ((currentShareAssetBalance == currentShareAssetBalance))
322+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
323+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
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 receivedShareAsset: Int =>
332- let newStakedBalance = (currentStakedBalance + amount)
333- let newShareAssetBalance = (currentShareAssetBalance + receivedShareAsset)
334-[IntegerEntry(keyStakedBalance(assetId), newStakedBalance), IntegerEntry(keyShareAssetBalance(shareAssetId), newShareAssetBalance)]
331+ case receivedStakingAsset: Int =>
332+ let newAdditionalBalance = (currentAdditionalBalance + amount)
333+ let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
334+[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
335335 case _ =>
336336 nil
337337 }
345345 }
346346
347347
348-func withdraw (assetId,amount,shareAssetId,proxy,proxyRateMul,profitAddress) = {
349- let currentStakedBalance = getStakedBalanceOrZero(assetId)
350- if ((currentStakedBalance == currentStakedBalance))
348+func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
349+ let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
350+ if ((currentAdditionalBalance == currentAdditionalBalance))
351351 then {
352- let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
353- if ((currentShareAssetBalance == currentShareAssetBalance))
352+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
353+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
354354 then {
355355 let currentProxyRate = getRate(proxy)
356356 if ((currentProxyRate == currentProxyRate))
357357 then {
358- let oldRate = fraction(proxyRateMul, currentStakedBalance, currentShareAssetBalance)
359- let shareAsset = parseAssetId(shareAssetId)
358+ let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
359+ let stakingAsset = parseAssetId(stakingAssetId)
360360 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
361- let sendShareAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362- let profitAmount = max([0, (oldSendStakingAmount - sendShareAssetAmount)])
363- if ((sendShareAssetAmount > 0))
361+ let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362+ let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
363+ if ((sendStakingAssetAmount > 0))
364364 then {
365- let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(shareAsset, sendShareAssetAmount)])
365+ let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
366366 if ((withdrawInvoke == withdrawInvoke))
367367 then match withdrawInvoke {
368368 case receivedAssets: Int =>
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))]
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))]
374372 case _ =>
375373 nil
376374 }
394392 }
395393
396394
397-func rebalanceInternal (targetRatio,assetId,shareAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
398- let currentStakedBalance = getStakedBalanceOrZero(assetId)
399- if ((currentStakedBalance == currentStakedBalance))
395+func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
396+ let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
397+ if ((currentAdditionalBalance == currentAdditionalBalance))
400398 then {
401- let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
402- if ((currentShareAssetBalance == currentShareAssetBalance))
399+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
400+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
403401 then {
404402 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
405- let targetStakedBalance = fraction(targetRatio, leasableTotalBalance, 100)
406- let diff = (currentStakedBalance - targetStakedBalance)
403+ let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
404+ let diff = (currentAdditionalBalance - targetAdditionalBalance)
407405 if ((diff == 0))
408406 then nil
409407 else if ((0 > diff))
410408 then {
411409 let sendAssetAmount = -(diff)
412- deposit(assetId, sendAssetAmount, shareAssetId, proxy)
410+ deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
413411 }
414412 else {
415413 let getAssetAmount = diff
416- withdraw(assetId, getAssetAmount, shareAssetId, proxy, proxyRateMul, profitAddress)
414+ withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
417415 }
418416 }
419417 else throw("Strict value is not equal to itself.")
423421
424422
425423 func rebalanceAsset (assetId) = {
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
424+ let $t01595116087 = getLeaseProxyConfig(assetId)
425+ let isLeasable = $t01595116087._1
426+ let leasedRatio = $t01595116087._2
427+ let minBalance = $t01595116087._3
428+ let proxyAddress = $t01595116087._4
429+ let proxyAssetId = $t01595116087._5
430+ let proxyRateMul = $t01595116087._6
431+ let stakingProfitAddress = $t01595116087._7
434432 if (isLeasable)
435433 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
436434 else nil
438436
439437
440438 func withdrawAndRebalanceAsset (assetId,getAmount) = {
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
439+ let $t01648616622 = getLeaseProxyConfig(assetId)
440+ let isLeasable = $t01648616622._1
441+ let leasedRatio = $t01648616622._2
442+ let minBalance = $t01648616622._3
443+ let proxyAddress = $t01648616622._4
444+ let proxyAssetId = $t01648616622._5
445+ let proxyRateMul = $t01648616622._6
446+ let stakingProfitAddress = $t01648616622._7
449447 if (isLeasable)
450448 then {
451449 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
452450 if ((newTotalLeasableBalance == newTotalLeasableBalance))
453451 then {
454- let newStakedBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
455- if ((newStakedBalance == newStakedBalance))
452+ let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
453+ if ((newAdditionalBalance == newAdditionalBalance))
456454 then {
457- let withdrawAmount = (getStakedBalanceOrZero(assetId) - newStakedBalance)
455+ let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
458456 if ((withdrawAmount == withdrawAmount))
459457 then if ((0 > withdrawAmount))
460458 then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
648646 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
649647
650648
651-func validateUpdatedKLp (oldKLp,updatedKLp) = if (if ((updatedKLp == big0))
652- then true
653- else (updatedKLp >= oldKLp))
649+func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
654650 then true
655651 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
656652
660656 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
661657 let amountAssetAmount = order.amount
662658 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
663- let $t02885829070 = if ((order.orderType == Buy))
659+ let $t02901129223 = if ((order.orderType == Buy))
664660 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
665661 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
666- let amountAssetBalanceDelta = $t02885829070._1
667- let priceAssetBalanceDelta = $t02885829070._2
662+ let amountAssetBalanceDelta = $t02901129223._1
663+ let priceAssetBalanceDelta = $t02901129223._2
668664 if (if (if (isGlobalShutdown())
669665 then true
670- else (cfgPoolStatus == PoolMatcherDisabled))
666+ else (cfgPoolStatus == PoolPutAndMatcherDisabled))
671667 then true
672668 else (cfgPoolStatus == PoolShutdown))
673669 then throw("Exchange operations disabled")
677673 then throw("Wrong order assets.")
678674 else {
679675 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
680- let $t02951029610 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
681- let unusedActions = $t02951029610._1
682- let kLpNew = $t02951029610._2
676+ let $t02968529785 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677+ let unusedActions = $t02968529785._1
678+ let kLpNew = $t02968529785._2
683679 let isOrderValid = (kLpNew >= kLp)
684680 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
685681 $Tuple2(isOrderValid, info)
713709 let prAssetPmt = value(i.payments[1])
714710 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
715711 let poolStatus = parseIntValue(estPut._8)
716- if (if (if (isGlobalShutdown())
712+ if (if (if (if (isGlobalShutdown())
717713 then true
718714 else (poolStatus == PoolPutDisabled))
715+ then true
716+ else (poolStatus == PoolPutAndMatcherDisabled))
719717 then true
720718 else (poolStatus == PoolShutdown))
721719 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
758756 else if ((paymentAssetId == cfgPriceAssetId))
759757 then false
760758 else throwErr("invalid asset")
761- let $t03272333016 = if (isEval)
759+ let $t03297133264 = if (isEval)
762760 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
763761 else if (paymentInAmountAsset)
764762 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
765763 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
766- let amountBalanceOld = $t03272333016._1
767- let priceBalanceOld = $t03272333016._2
768- let $t03302033169 = if (paymentInAmountAsset)
764+ let amountBalanceOld = $t03297133264._1
765+ let priceBalanceOld = $t03297133264._2
766+ let $t03326833417 = if (paymentInAmountAsset)
769767 then $Tuple2(paymentAmountRaw, 0)
770768 else $Tuple2(0, paymentAmountRaw)
771- let amountAssetAmountRaw = $t03302033169._1
772- let priceAssetAmountRaw = $t03302033169._2
769+ let amountAssetAmountRaw = $t03326833417._1
770+ let priceAssetAmountRaw = $t03326833417._2
773771 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
774772 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
775- let $t03330133365 = takeFee(paymentAmountRaw, inFee)
776- let paymentAmount = $t03330133365._1
777- let feeAmount = $t03330133365._2
773+ let $t03354933613 = takeFee(paymentAmountRaw, inFee)
774+ let paymentAmount = $t03354933613._1
775+ let feeAmount = $t03354933613._2
778776 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
779777 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
780778 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
797795 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
798796 let priceOld = fromX18(priceOldX18, scale8)
799797 let loss = {
800- let $t03504635213 = if (paymentInAmountAsset)
798+ let $t03529435461 = if (paymentInAmountAsset)
801799 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
802800 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
803- let amount = $t03504635213._1
804- let balance = $t03504635213._2
801+ let amount = $t03529435461._1
802+ let balance = $t03529435461._2
805803 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
806804 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
807805 }
841839 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
842840 let redeemedBigInt = toBigInt(paymentAmount)
843841 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
844- let $t03729137347 = takeFee(amountRaw, outFee)
845- let totalAmount = $t03729137347._1
846- let feeAmount = $t03729137347._2
847- let $t03735137577 = if (outInAmountAsset)
842+ let $t03753937595 = takeFee(amountRaw, outFee)
843+ let totalAmount = $t03753937595._1
844+ let feeAmount = $t03753937595._2
845+ let $t03759937825 = if (outInAmountAsset)
848846 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
849847 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
850- let outAmAmount = $t03735137577._1
851- let outPrAmount = $t03735137577._2
852- let amBalanceNew = $t03735137577._3
853- let prBalanceNew = $t03735137577._4
848+ let outAmAmount = $t03759937825._1
849+ let outPrAmount = $t03759937825._2
850+ let amBalanceNew = $t03759937825._3
851+ let prBalanceNew = $t03759937825._4
854852 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
855853 let priceNew = fromX18(priceNewX18, scale8)
856854 let commonState = if (isEval)
915913
916914 @Callable(i)
917915 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
918- let $t03943539740 = if ((isReverse == false))
916+ let $t03968339988 = if ((isReverse == false))
919917 then {
920918 let assetOut = getStringOrFail(this, pa())
921919 let assetIn = getStringOrFail(this, aa())
926924 let assetIn = getStringOrFail(this, pa())
927925 $Tuple2(assetOut, assetIn)
928926 }
929- let assetOut = $t03943539740._1
930- let assetIn = $t03943539740._2
927+ let assetOut = $t03968339988._1
928+ let assetIn = $t03968339988._2
931929 let poolAssetInBalance = getAccBalance(assetIn)
932930 let poolAssetOutBalance = getAccBalance(assetOut)
933931 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10431041 else throw("Strict value is not equal to itself.")
10441042 }
10451043 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1046- let $t04424344705 = refreshKLpInternal(0, 0, 0)
1047- if (($t04424344705 == $t04424344705))
1044+ let $t04449144953 = refreshKLpInternal(0, 0, 0)
1045+ if (($t04449144953 == $t04449144953))
10481046 then {
1049- let updatedKLp = $t04424344705._2
1050- let refreshKLpActions = $t04424344705._1
1047+ let updatedKLp = $t04449144953._2
1048+ let refreshKLpActions = $t04449144953._1
10511049 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10521050 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10531051 then {
10841082 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10851083 if ((currentKLp == currentKLp))
10861084 then {
1087- let $t04531745382 = refreshKLpInternal(0, 0, 0)
1088- let refreshKLpActions = $t04531745382._1
1089- let updatedKLp = $t04531745382._2
1085+ let $t04556545630 = refreshKLpInternal(0, 0, 0)
1086+ let refreshKLpActions = $t04556545630._1
1087+ let updatedKLp = $t04556545630._2
10901088 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10911089 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10921090 then (state ++ refreshKLpActions)
11051103 then @
11061104 else throw(($getType(@) + " couldn't be cast to Boolean"))
11071105 }
1108- let isPutDisabled = if (if (if (isGlobalShutdown())
1106+ let isPutDisabled = if (if (if (if (isGlobalShutdown())
11091107 then true
11101108 else (cfgPoolStatus == PoolPutDisabled))
1109+ then true
1110+ else (cfgPoolStatus == PoolPutAndMatcherDisabled))
11111111 then true
11121112 else (cfgPoolStatus == PoolShutdown))
11131113 then true
11331133 then {
11341134 let userAddress = i.caller
11351135 let txId = i.transactionId
1136- let $t04657046722 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1137- if (($t04657046722 == $t04657046722))
1136+ let $t04688547037 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1137+ if (($t04688547037 == $t04688547037))
11381138 then {
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
1139+ let paymentInAmountAsset = $t04688547037._5
1140+ let bonus = $t04688547037._4
1141+ let feeAmount = $t04688547037._3
1142+ let commonState = $t04688547037._2
1143+ let emitAmountEstimated = $t04688547037._1
11441144 let emitAmount = if (if ((minOutAmount > 0))
11451145 then (minOutAmount > emitAmountEstimated)
11461146 else false)
11601160 let sendFee = if ((feeAmount > 0))
11611161 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11621162 else nil
1163- let $t04730847505 = if ((this == feeCollectorAddress))
1163+ let $t04762347820 = if ((this == feeCollectorAddress))
11641164 then $Tuple2(0, 0)
11651165 else if (paymentInAmountAsset)
11661166 then $Tuple2(-(feeAmount), 0)
11671167 else $Tuple2(0, -(feeAmount))
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
1168+ let amountAssetBalanceDelta = $t04762347820._1
1169+ let priceAssetBalanceDelta = $t04762347820._2
1170+ let $t04782347931 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1171+ let refreshKLpActions = $t04782347931._1
1172+ let updatedKLp = $t04782347931._2
11731173 let kLp = value(getString(keyKLp))
11741174 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11751175 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11941194
11951195 @Callable(i)
11961196 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
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
1197+ let $t04828648443 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1198+ let emitAmountEstimated = $t04828648443._1
1199+ let commonState = $t04828648443._2
1200+ let feeAmount = $t04828648443._3
1201+ let bonus = $t04828648443._4
1202+ let paymentInAmountAsset = $t04828648443._5
12031203 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12041204 }
12051205
12361236 then {
12371237 let userAddress = i.caller
12381238 let txId = i.transactionId
1239- let $t04901349166 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1240- if (($t04901349166 == $t04901349166))
1239+ let $t04932849481 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1240+ if (($t04932849481 == $t04932849481))
12411241 then {
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
1242+ let outInAmountAsset = $t04932849481._5
1243+ let bonus = $t04932849481._4
1244+ let feeAmount = $t04932849481._3
1245+ let commonState = $t04932849481._2
1246+ let amountEstimated = $t04932849481._1
12471247 let amount = if (if ((minOutAmount > 0))
12481248 then (minOutAmount > amountEstimated)
12491249 else false)
12571257 let sendFee = if ((feeAmount > 0))
12581258 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12591259 else nil
1260- let $t04983050077 = {
1260+ let $t05014550392 = {
12611261 let feeAmountForCalc = if ((this == feeCollectorAddress))
12621262 then 0
12631263 else feeAmount
12651265 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12661266 else $Tuple2(0, -((amount + feeAmountForCalc)))
12671267 }
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
1268+ let amountAssetBalanceDelta = $t05014550392._1
1269+ let priceAssetBalanceDelta = $t05014550392._2
1270+ let $t05039550503 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1271+ let refreshKLpActions = $t05039550503._1
1272+ let updatedKLp = $t05039550503._2
12731273 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12741274 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12751275 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12881288
12891289 @Callable(i)
12901290 func getOneTknREADONLY (outAssetId,paymentAmount) = {
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
1291+ let $t05078150937 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1292+ let amountEstimated = $t05078150937._1
1293+ let commonState = $t05078150937._2
1294+ let feeAmount = $t05078150937._3
1295+ let bonus = $t05078150937._4
1296+ let outInAmountAsset = $t05078150937._5
12971297 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12981298 }
12991299
13301330 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13311331 if ((unstakeInv == unstakeInv))
13321332 then {
1333- let $t05152751678 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1334- if (($t05152751678 == $t05152751678))
1333+ let $t05184251993 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1334+ if (($t05184251993 == $t05184251993))
13351335 then {
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
1336+ let outInAmountAsset = $t05184251993._5
1337+ let bonus = $t05184251993._4
1338+ let feeAmount = $t05184251993._3
1339+ let commonState = $t05184251993._2
1340+ let amountEstimated = $t05184251993._1
13411341 let amount = if (if ((minOutAmount > 0))
13421342 then (minOutAmount > amountEstimated)
13431343 else false)
13511351 let sendFee = if ((feeAmount > 0))
13521352 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13531353 else nil
1354- let $t05233752584 = {
1354+ let $t05265252899 = {
13551355 let feeAmountForCalc = if ((this == feeCollectorAddress))
13561356 then 0
13571357 else feeAmount
13591359 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13601360 else $Tuple2(0, -((amount + feeAmountForCalc)))
13611361 }
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
1362+ let amountAssetBalanceDelta = $t05265252899._1
1363+ let priceAssetBalanceDelta = $t05265252899._2
1364+ let $t05290253010 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1365+ let refreshKLpActions = $t05290253010._1
1366+ let updatedKLp = $t05290253010._2
13671367 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13681368 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13691369 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13971397 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13981398 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13991399 then {
1400- let $t05379053871 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1401- let refreshKLpActions = $t05379053871._1
1402- let updatedKLp = $t05379053871._2
1400+ let $t05410554186 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1401+ let refreshKLpActions = $t05410554186._1
1402+ let updatedKLp = $t05410554186._2
14031403 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14041404 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14051405 then ((withdrawState ++ state) ++ refreshKLpActions)
14321432 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14331433 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14341434 then {
1435- let $t05496655047 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1436- let refreshKLpActions = $t05496655047._1
1437- let updatedKLp = $t05496655047._2
1435+ let $t05528155362 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1436+ let refreshKLpActions = $t05528155362._1
1437+ let updatedKLp = $t05528155362._2
14381438 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14391439 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14401440 then ((withdrawState ++ state) ++ refreshKLpActions)
14791479 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14801480 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14811481 then {
1482- let $t05631956400 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1483- let refreshKLpActions = $t05631956400._1
1484- let updatedKLp = $t05631956400._2
1482+ let $t05663456715 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1483+ let refreshKLpActions = $t05663456715._1
1484+ let updatedKLp = $t05663456715._2
14851485 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14861486 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14871487 then ((withdrawState ++ state) ++ refreshKLpActions)
15331533 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15341534 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15351535 then {
1536- let $t05784157922 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1537- let refreshKLpActions = $t05784157922._1
1538- let updatedKLp = $t05784157922._2
1536+ let $t05815658237 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1537+ let refreshKLpActions = $t05815658237._1
1538+ let updatedKLp = $t05815658237._2
15391539 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15401540 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15411541 then ((withdrawState ++ state) ++ refreshKLpActions)
15701570 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15711571 then {
15721572 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1573- let $t05912659190 = refreshKLpInternal(0, 0, 0)
1574- let kLpUpdateActions = $t05912659190._1
1575- let updatedKLp = $t05912659190._2
1573+ let $t05944159505 = refreshKLpInternal(0, 0, 0)
1574+ let kLpUpdateActions = $t05944159505._1
1575+ let updatedKLp = $t05944159505._2
15761576 let actions = if ((kLp != updatedKLp))
15771577 then kLpUpdateActions
15781578 else throwErr("nothing to refresh")
17471747 match tx {
17481748 case order: Order =>
17491749 let matcherPub = getMatcherPubOrFail()
1750- let $t06785267969 = if (skipOrderValidation())
1750+ let $t06816768284 = if (skipOrderValidation())
17511751 then $Tuple2(true, "")
17521752 else validateMatcherOrderAllowed(order)
1753- let orderValid = $t06785267969._1
1754- let orderValidInfo = $t06785267969._2
1753+ let orderValid = $t06816768284._1
1754+ let orderValidInfo = $t06816768284._2
17551755 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17561756 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17571757 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
28-let PoolMatcherDisabled = 3
28+let PoolPutAndMatcherDisabled = 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 keyStakedBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
133+func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134134
135135
136-func keyShareAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
136+func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137137
138138
139-func getStakedBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakedBalance(assetId)), 0)
139+func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
140140
141141
142-func getShareAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyShareAssetBalance(assetId)), 0)
142+func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
143143
144144
145145 func keyFactoryConfig () = "%s__factoryConfig"
146146
147147
148148 func keyMatcherPub () = "%s%s__matcher__publicKey"
149149
150150
151151 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
152152
153153
154154 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
155155
156156
157157 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
158158
159159
160160 func keyAllPoolsShutdown () = "%s__shutdown"
161161
162162
163163 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
164164
165165
166166 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
167167
168168
169169 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
170170
171171 func 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 $t095029668 = poolConfigParsed
261+let $t095499715 = poolConfigParsed
262262
263-let cfgPoolAddress = $t095029668._1
263+let cfgPoolAddress = $t095499715._1
264264
265-let cfgPoolStatus = $t095029668._2
265+let cfgPoolStatus = $t095499715._2
266266
267-let cfgLpAssetId = $t095029668._3
267+let cfgLpAssetId = $t095499715._3
268268
269-let cfgAmountAssetId = $t095029668._4
269+let cfgAmountAssetId = $t095499715._4
270270
271-let cfgPriceAssetId = $t095029668._5
271+let cfgPriceAssetId = $t095499715._5
272272
273-let cfgAmountAssetDecimals = $t095029668._6
273+let cfgAmountAssetDecimals = $t095499715._6
274274
275-let cfgPriceAssetDecimals = $t095029668._7
275+let cfgPriceAssetDecimals = $t095499715._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 + getStakedBalanceOrZero(assetId)) - getShareAssetBalanceOrZero(assetId))
294+ let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(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,shareAssetId,proxy) = {
319- let currentStakedBalance = getStakedBalanceOrZero(assetId)
320- if ((currentStakedBalance == currentStakedBalance))
318+func deposit (assetId,amount,stakingAssetId,proxy) = {
319+ let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
320+ if ((currentAdditionalBalance == currentAdditionalBalance))
321321 then {
322- let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
323- if ((currentShareAssetBalance == currentShareAssetBalance))
322+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
323+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
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 receivedShareAsset: Int =>
332- let newStakedBalance = (currentStakedBalance + amount)
333- let newShareAssetBalance = (currentShareAssetBalance + receivedShareAsset)
334-[IntegerEntry(keyStakedBalance(assetId), newStakedBalance), IntegerEntry(keyShareAssetBalance(shareAssetId), newShareAssetBalance)]
331+ case receivedStakingAsset: Int =>
332+ let newAdditionalBalance = (currentAdditionalBalance + amount)
333+ let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
334+[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
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,shareAssetId,proxy,proxyRateMul,profitAddress) = {
349- let currentStakedBalance = getStakedBalanceOrZero(assetId)
350- if ((currentStakedBalance == currentStakedBalance))
348+func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
349+ let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
350+ if ((currentAdditionalBalance == currentAdditionalBalance))
351351 then {
352- let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
353- if ((currentShareAssetBalance == currentShareAssetBalance))
352+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
353+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
354354 then {
355355 let currentProxyRate = getRate(proxy)
356356 if ((currentProxyRate == currentProxyRate))
357357 then {
358- let oldRate = fraction(proxyRateMul, currentStakedBalance, currentShareAssetBalance)
359- let shareAsset = parseAssetId(shareAssetId)
358+ let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
359+ let stakingAsset = parseAssetId(stakingAssetId)
360360 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
361- let sendShareAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362- let profitAmount = max([0, (oldSendStakingAmount - sendShareAssetAmount)])
363- if ((sendShareAssetAmount > 0))
361+ let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362+ let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
363+ if ((sendStakingAssetAmount > 0))
364364 then {
365- let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(shareAsset, sendShareAssetAmount)])
365+ let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
366366 if ((withdrawInvoke == withdrawInvoke))
367367 then match withdrawInvoke {
368368 case receivedAssets: Int =>
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))]
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))]
374372 case _ =>
375373 nil
376374 }
377375 else throw("Strict value is not equal to itself.")
378376 }
379377 else nil
380378 }
381379 else throw("Strict value is not equal to itself.")
382380 }
383381 else throw("Strict value is not equal to itself.")
384382 }
385383 else throw("Strict value is not equal to itself.")
386384 }
387385
388386
389387 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
390388 case a: (Boolean, Int, Int, String, String, Int, String) =>
391389 a
392390 case _ =>
393391 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
394392 }
395393
396394
397-func rebalanceInternal (targetRatio,assetId,shareAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
398- let currentStakedBalance = getStakedBalanceOrZero(assetId)
399- if ((currentStakedBalance == currentStakedBalance))
395+func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
396+ let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
397+ if ((currentAdditionalBalance == currentAdditionalBalance))
400398 then {
401- let currentShareAssetBalance = getShareAssetBalanceOrZero(shareAssetId)
402- if ((currentShareAssetBalance == currentShareAssetBalance))
399+ let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
400+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
403401 then {
404402 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
405- let targetStakedBalance = fraction(targetRatio, leasableTotalBalance, 100)
406- let diff = (currentStakedBalance - targetStakedBalance)
403+ let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
404+ let diff = (currentAdditionalBalance - targetAdditionalBalance)
407405 if ((diff == 0))
408406 then nil
409407 else if ((0 > diff))
410408 then {
411409 let sendAssetAmount = -(diff)
412- deposit(assetId, sendAssetAmount, shareAssetId, proxy)
410+ deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
413411 }
414412 else {
415413 let getAssetAmount = diff
416- withdraw(assetId, getAssetAmount, shareAssetId, proxy, proxyRateMul, profitAddress)
414+ withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
417415 }
418416 }
419417 else throw("Strict value is not equal to itself.")
420418 }
421419 else throw("Strict value is not equal to itself.")
422420 }
423421
424422
425423 func rebalanceAsset (assetId) = {
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
424+ let $t01595116087 = getLeaseProxyConfig(assetId)
425+ let isLeasable = $t01595116087._1
426+ let leasedRatio = $t01595116087._2
427+ let minBalance = $t01595116087._3
428+ let proxyAddress = $t01595116087._4
429+ let proxyAssetId = $t01595116087._5
430+ let proxyRateMul = $t01595116087._6
431+ let stakingProfitAddress = $t01595116087._7
434432 if (isLeasable)
435433 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
436434 else nil
437435 }
438436
439437
440438 func withdrawAndRebalanceAsset (assetId,getAmount) = {
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
439+ let $t01648616622 = getLeaseProxyConfig(assetId)
440+ let isLeasable = $t01648616622._1
441+ let leasedRatio = $t01648616622._2
442+ let minBalance = $t01648616622._3
443+ let proxyAddress = $t01648616622._4
444+ let proxyAssetId = $t01648616622._5
445+ let proxyRateMul = $t01648616622._6
446+ let stakingProfitAddress = $t01648616622._7
449447 if (isLeasable)
450448 then {
451449 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
452450 if ((newTotalLeasableBalance == newTotalLeasableBalance))
453451 then {
454- let newStakedBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
455- if ((newStakedBalance == newStakedBalance))
452+ let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
453+ if ((newAdditionalBalance == newAdditionalBalance))
456454 then {
457- let withdrawAmount = (getStakedBalanceOrZero(assetId) - newStakedBalance)
455+ let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
458456 if ((withdrawAmount == withdrawAmount))
459457 then if ((0 > withdrawAmount))
460458 then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
461459 else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
462460 else throw("Strict value is not equal to itself.")
463461 }
464462 else throw("Strict value is not equal to itself.")
465463 }
466464 else throw("Strict value is not equal to itself.")
467465 }
468466 else nil
469467 }
470468
471469
472470 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
473471 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
474472 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
475473 (AmAmtWithdrawState ++ PrAmtWithdrawState)
476474 }
477475
478476
479477 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
480478 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
481479 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
482480 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
483481 }
484482
485483
486484 func calcPrices (amAmt,prAmt,lpAmt) = {
487485 let cfg = getPoolConfig()
488486 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
489487 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
490488 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
491489 let amAmtX18 = toX18(amAmt, amtAssetDcm)
492490 let prAmtX18 = toX18(prAmt, priceAssetDcm)
493491 let lpAmtX18 = toX18(lpAmt, scale8)
494492 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
495493 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
496494 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
497495 }
498496
499497
500498 func calculatePrices (amAmt,prAmt,lpAmt) = {
501499 let prices = calcPrices(amAmt, prAmt, lpAmt)
502500 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
503501 }
504502
505503
506504 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
507505 let cfg = getPoolConfig()
508506 let lpAssetId = cfg[idxPoolLPAssetId]
509507 let amAssetId = cfg[idxAmtAssetId]
510508 let prAssetId = cfg[idxPriceAssetId]
511509 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
512510 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
513511 let poolStatus = cfg[idxPoolStatus]
514512 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
515513 if ((lpAssetId != pmtAssetId))
516514 then throw("Invalid asset passed.")
517515 else {
518516 let amBalance = getAccBalance(amAssetId)
519517 let amBalanceX18 = toX18(amBalance, amAssetDcm)
520518 let prBalance = getAccBalance(prAssetId)
521519 let prBalanceX18 = toX18(prBalance, prAssetDcm)
522520 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
523521 let curPrice = fromX18(curPriceX18, scale8)
524522 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
525523 let lpEmissionX18 = toX18(lpEmission, scale8)
526524 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
527525 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
528526 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
529527 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
530528 let state = if ((txId58 == ""))
531529 then nil
532530 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
533531 then unit
534532 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
535533 then unit
536534 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)]
537535 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
538536 }
539537 }
540538
541539
542540 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
543541 let cfg = getPoolConfig()
544542 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
545543 let amAssetIdStr = cfg[idxAmtAssetId]
546544 let prAssetIdStr = cfg[idxPriceAssetId]
547545 let iAmtAssetId = cfg[idxIAmtAssetId]
548546 let iPriceAssetId = cfg[idxIPriceAssetId]
549547 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
550548 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
551549 let poolStatus = cfg[idxPoolStatus]
552550 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
553551 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
554552 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
555553 if (if ((amAssetIdStr != inAmAssetIdStr))
556554 then true
557555 else (prAssetIdStr != inPrAssetIdStr))
558556 then throw("Invalid amt or price asset passed.")
559557 else {
560558 let amBalance = if (isEvaluate)
561559 then getAccBalance(amAssetIdStr)
562560 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
563561 let prBalance = if (isEvaluate)
564562 then getAccBalance(prAssetIdStr)
565563 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
566564 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
567565 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
568566 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
569567 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
570568 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
571569 let res = if ((lpEmission == 0))
572570 then {
573571 let curPriceX18 = zeroBigInt
574572 let slippageX18 = zeroBigInt
575573 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
576574 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
577575 }
578576 else {
579577 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
580578 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
581579 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
582580 if (if ((curPriceX18 != zeroBigInt))
583581 then (slippageX18 > slippageToleranceX18)
584582 else false)
585583 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
586584 else {
587585 let lpEmissionX18 = toX18(lpEmission, scale8)
588586 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
589587 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
590588 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
591589 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
592590 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
593591 let expAmtAssetAmtX18 = expectedAmts._1
594592 let expPriceAssetAmtX18 = expectedAmts._2
595593 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
596594 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
597595 }
598596 }
599597 let calcLpAmt = res._1
600598 let calcAmAssetPmt = res._2
601599 let calcPrAssetPmt = res._3
602600 let curPrice = fromX18(res._4, scale8)
603601 let slippageCalc = fromX18(res._5, scale8)
604602 if ((0 >= calcLpAmt))
605603 then throw("Invalid calculations. LP calculated is less than zero.")
606604 else {
607605 let emitLpAmt = if (!(emitLp))
608606 then 0
609607 else calcLpAmt
610608 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
611609 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
612610 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))]
613611 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
614612 }
615613 }
616614 }
617615
618616
619617 func calcKLp (amountBalance,priceBalance,lpEmission) = {
620618 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
621619 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
622620 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
623621 if ((lpEmission == big0))
624622 then big0
625623 else updatedKLp
626624 }
627625
628626
629627 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
630628 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
631629 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
632630 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
633631 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
634632 currentKLp
635633 }
636634
637635
638636 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
639637 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
640638 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
641639 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
642640 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
643641 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
644642 $Tuple2(actions, updatedKLp)
645643 }
646644
647645
648646 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
649647
650648
651-func validateUpdatedKLp (oldKLp,updatedKLp) = if (if ((updatedKLp == big0))
652- then true
653- else (updatedKLp >= oldKLp))
649+func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
654650 then true
655651 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
656652
657653
658654 func validateMatcherOrderAllowed (order) = {
659655 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
660656 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
661657 let amountAssetAmount = order.amount
662658 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
663- let $t02885829070 = if ((order.orderType == Buy))
659+ let $t02901129223 = if ((order.orderType == Buy))
664660 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
665661 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
666- let amountAssetBalanceDelta = $t02885829070._1
667- let priceAssetBalanceDelta = $t02885829070._2
662+ let amountAssetBalanceDelta = $t02901129223._1
663+ let priceAssetBalanceDelta = $t02901129223._2
668664 if (if (if (isGlobalShutdown())
669665 then true
670- else (cfgPoolStatus == PoolMatcherDisabled))
666+ else (cfgPoolStatus == PoolPutAndMatcherDisabled))
671667 then true
672668 else (cfgPoolStatus == PoolShutdown))
673669 then throw("Exchange operations disabled")
674670 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
675671 then true
676672 else (order.assetPair.priceAsset != cfgPriceAssetId))
677673 then throw("Wrong order assets.")
678674 else {
679675 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
680- let $t02951029610 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
681- let unusedActions = $t02951029610._1
682- let kLpNew = $t02951029610._2
676+ let $t02968529785 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677+ let unusedActions = $t02968529785._1
678+ let kLpNew = $t02968529785._2
683679 let isOrderValid = (kLpNew >= kLp)
684680 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
685681 $Tuple2(isOrderValid, info)
686682 }
687683 }
688684
689685
690686 func commonGet (i) = if ((size(i.payments) != 1))
691687 then throw("exactly 1 payment is expected")
692688 else {
693689 let pmt = value(i.payments[0])
694690 let pmtAssetId = value(pmt.assetId)
695691 let pmtAmt = pmt.amount
696692 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
697693 let outAmAmt = res._1
698694 let outPrAmt = res._2
699695 let poolStatus = parseIntValue(res._9)
700696 let state = res._10
701697 if (if (isGlobalShutdown())
702698 then true
703699 else (poolStatus == PoolShutdown))
704700 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
705701 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
706702 }
707703
708704
709705 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
710706 then throw("exactly 2 payments are expected")
711707 else {
712708 let amAssetPmt = value(i.payments[0])
713709 let prAssetPmt = value(i.payments[1])
714710 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
715711 let poolStatus = parseIntValue(estPut._8)
716- if (if (if (isGlobalShutdown())
712+ if (if (if (if (isGlobalShutdown())
717713 then true
718714 else (poolStatus == PoolPutDisabled))
715+ then true
716+ else (poolStatus == PoolPutAndMatcherDisabled))
719717 then true
720718 else (poolStatus == PoolShutdown))
721719 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
722720 else estPut
723721 }
724722
725723
726724 func emit (amount) = {
727725 let emitInv = invoke(factoryContract, "emit", [amount], nil)
728726 if ((emitInv == emitInv))
729727 then {
730728 let emitInvLegacy = match emitInv {
731729 case legacyFactoryContract: Address =>
732730 invoke(legacyFactoryContract, "emit", [amount], nil)
733731 case _ =>
734732 unit
735733 }
736734 if ((emitInvLegacy == emitInvLegacy))
737735 then amount
738736 else throw("Strict value is not equal to itself.")
739737 }
740738 else throw("Strict value is not equal to itself.")
741739 }
742740
743741
744742 func takeFee (amount,fee) = {
745743 let feeAmount = if ((fee == 0))
746744 then 0
747745 else fraction(amount, fee, scale8)
748746 $Tuple2((amount - feeAmount), feeAmount)
749747 }
750748
751749
752750 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
753751 let isEval = (txId == unit)
754752 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
755753 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
756754 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
757755 then true
758756 else if ((paymentAssetId == cfgPriceAssetId))
759757 then false
760758 else throwErr("invalid asset")
761- let $t03272333016 = if (isEval)
759+ let $t03297133264 = if (isEval)
762760 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
763761 else if (paymentInAmountAsset)
764762 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
765763 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
766- let amountBalanceOld = $t03272333016._1
767- let priceBalanceOld = $t03272333016._2
768- let $t03302033169 = if (paymentInAmountAsset)
764+ let amountBalanceOld = $t03297133264._1
765+ let priceBalanceOld = $t03297133264._2
766+ let $t03326833417 = if (paymentInAmountAsset)
769767 then $Tuple2(paymentAmountRaw, 0)
770768 else $Tuple2(0, paymentAmountRaw)
771- let amountAssetAmountRaw = $t03302033169._1
772- let priceAssetAmountRaw = $t03302033169._2
769+ let amountAssetAmountRaw = $t03326833417._1
770+ let priceAssetAmountRaw = $t03326833417._2
773771 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
774772 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
775- let $t03330133365 = takeFee(paymentAmountRaw, inFee)
776- let paymentAmount = $t03330133365._1
777- let feeAmount = $t03330133365._2
773+ let $t03354933613 = takeFee(paymentAmountRaw, inFee)
774+ let paymentAmount = $t03354933613._1
775+ let feeAmount = $t03354933613._2
778776 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
779777 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
780778 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
781779 let priceNew = fromX18(priceNewX18, scale8)
782780 let paymentBalance = if (paymentInAmountAsset)
783781 then amountBalanceOld
784782 else priceBalanceOld
785783 let paymentBalanceBigInt = toBigInt(paymentBalance)
786784 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
787785 let chechSupply = if ((supplyBigInt > big0))
788786 then true
789787 else throwErr("initial deposit requires all coins")
790788 if ((chechSupply == chechSupply))
791789 then {
792790 let depositBigInt = toBigInt(paymentAmount)
793791 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
794792 let commonState = if (isEval)
795793 then nil
796794 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))]
797795 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
798796 let priceOld = fromX18(priceOldX18, scale8)
799797 let loss = {
800- let $t03504635213 = if (paymentInAmountAsset)
798+ let $t03529435461 = if (paymentInAmountAsset)
801799 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
802800 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
803- let amount = $t03504635213._1
804- let balance = $t03504635213._2
801+ let amount = $t03529435461._1
802+ let balance = $t03529435461._2
805803 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
806804 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
807805 }
808806 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
809807 }
810808 else throw("Strict value is not equal to itself.")
811809 }
812810
813811
814812 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
815813 let isEval = (txId == unit)
816814 let cfg = getPoolConfig()
817815 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
818816 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
819817 let checks = [if ((paymentAssetId == cfgLpAssetId))
820818 then true
821819 else throwErr("invalid lp asset")]
822820 if ((checks == checks))
823821 then {
824822 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
825823 then true
826824 else if ((outAssetId == cfgPriceAssetId))
827825 then false
828826 else throwErr("invalid asset")
829827 let balanceBigInt = if (outInAmountAsset)
830828 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
831829 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
832830 let outInAmountAssetDecimals = if (outInAmountAsset)
833831 then amtAssetDcm
834832 else priceAssetDcm
835833 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
836834 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
837835 let outBalance = if (outInAmountAsset)
838836 then amBalanceOld
839837 else prBalanceOld
840838 let outBalanceBigInt = toBigInt(outBalance)
841839 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
842840 let redeemedBigInt = toBigInt(paymentAmount)
843841 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
844- let $t03729137347 = takeFee(amountRaw, outFee)
845- let totalAmount = $t03729137347._1
846- let feeAmount = $t03729137347._2
847- let $t03735137577 = if (outInAmountAsset)
842+ let $t03753937595 = takeFee(amountRaw, outFee)
843+ let totalAmount = $t03753937595._1
844+ let feeAmount = $t03753937595._2
845+ let $t03759937825 = if (outInAmountAsset)
848846 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
849847 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
850- let outAmAmount = $t03735137577._1
851- let outPrAmount = $t03735137577._2
852- let amBalanceNew = $t03735137577._3
853- let prBalanceNew = $t03735137577._4
848+ let outAmAmount = $t03759937825._1
849+ let outPrAmount = $t03759937825._2
850+ let amBalanceNew = $t03759937825._3
851+ let prBalanceNew = $t03759937825._4
854852 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
855853 let priceNew = fromX18(priceNewX18, scale8)
856854 let commonState = if (isEval)
857855 then nil
858856 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)]
859857 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
860858 let priceOld = fromX18(priceOldX18, scale8)
861859 let loss = {
862860 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
863861 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
864862 }
865863 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
866864 }
867865 else throw("Strict value is not equal to itself.")
868866 }
869867
870868
871869 func managerPublicKeyOrUnit () = {
872870 let managerVaultAddress = getManagerVaultAddressOrThis()
873871 match getString(managerVaultAddress, keyManagerPublicKey()) {
874872 case s: String =>
875873 fromBase58String(s)
876874 case _: Unit =>
877875 unit
878876 case _ =>
879877 throw("Match error")
880878 }
881879 }
882880
883881
884882 func isManager (i) = match managerPublicKeyOrUnit() {
885883 case pk: ByteVector =>
886884 (i.callerPublicKey == pk)
887885 case _: Unit =>
888886 (i.caller == this)
889887 case _ =>
890888 throw("Match error")
891889 }
892890
893891
894892 func mustManager (i) = {
895893 let pd = throw("Permission denied")
896894 match managerPublicKeyOrUnit() {
897895 case pk: ByteVector =>
898896 if ((i.callerPublicKey == pk))
899897 then true
900898 else pd
901899 case _: Unit =>
902900 if ((i.caller == this))
903901 then true
904902 else pd
905903 case _ =>
906904 throw("Match error")
907905 }
908906 }
909907
910908
911909 @Callable(i)
912910 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
913911
914912
915913
916914 @Callable(i)
917915 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
918- let $t03943539740 = if ((isReverse == false))
916+ let $t03968339988 = if ((isReverse == false))
919917 then {
920918 let assetOut = getStringOrFail(this, pa())
921919 let assetIn = getStringOrFail(this, aa())
922920 $Tuple2(assetOut, assetIn)
923921 }
924922 else {
925923 let assetOut = getStringOrFail(this, aa())
926924 let assetIn = getStringOrFail(this, pa())
927925 $Tuple2(assetOut, assetIn)
928926 }
929- let assetOut = $t03943539740._1
930- let assetIn = $t03943539740._2
927+ let assetOut = $t03968339988._1
928+ let assetIn = $t03968339988._2
931929 let poolAssetInBalance = getAccBalance(assetIn)
932930 let poolAssetOutBalance = getAccBalance(assetOut)
933931 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
934932 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
935933 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
936934 let checkK = if ((newK >= oldK))
937935 then true
938936 else throw("new K is fewer error")
939937 if ((checkK == checkK))
940938 then $Tuple2(nil, amountOut)
941939 else throw("Strict value is not equal to itself.")
942940 }
943941
944942
945943
946944 @Callable(i)
947945 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
948946 let swapContact = {
949947 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
950948 if ($isInstanceOf(@, "String"))
951949 then @
952950 else throw(($getType(@) + " couldn't be cast to String"))
953951 }
954952 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
955953 then true
956954 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
957955 then true
958956 else throwErr("Permission denied")]
959957 if ((checks == checks))
960958 then {
961959 let pmt = value(i.payments[0])
962960 let assetIn = assetIdToString(pmt.assetId)
963961 let assetOut = if ((isReverse == false))
964962 then getStringOrFail(this, pa())
965963 else getStringOrFail(this, aa())
966964 let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount)
967965 let poolAssetOutBalance = getAccBalance(assetOut)
968966 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
969967 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
970968 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
971969 let checkK = if ((newK >= oldK))
972970 then true
973971 else throw("new K is fewer error")
974972 if ((checkK == checkK))
975973 then {
976974 let checkMin = if ((amountOut >= amountOutMin))
977975 then true
978976 else throw("Exchange result is fewer coins than expected")
979977 if ((checkMin == checkMin))
980978 then {
981979 let rebalanceState = rebalanceAsset(assetIn)
982980 if ((rebalanceState == rebalanceState))
983981 then {
984982 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
985983 if ((withdrawState == withdrawState))
986984 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
987985 else throw("Strict value is not equal to itself.")
988986 }
989987 else throw("Strict value is not equal to itself.")
990988 }
991989 else throw("Strict value is not equal to itself.")
992990 }
993991 else throw("Strict value is not equal to itself.")
994992 }
995993 else throw("Strict value is not equal to itself.")
996994 }
997995
998996
999997
1000998 @Callable(i)
1001999 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10021000 then throw("Invalid slippageTolerance passed")
10031001 else {
10041002 let estPut = commonPut(i, slippageTolerance, true)
10051003 let emitLpAmt = estPut._2
10061004 let lpAssetId = estPut._7
10071005 let state = estPut._9
10081006 let amDiff = estPut._10
10091007 let prDiff = estPut._11
10101008 let amId = estPut._12
10111009 let prId = estPut._13
10121010 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10131011 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10141012 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10151013 if ((currentKLp == currentKLp))
10161014 then {
10171015 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10181016 if ((emitInv == emitInv))
10191017 then {
10201018 let emitInvLegacy = match emitInv {
10211019 case legacyFactoryContract: Address =>
10221020 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10231021 case _ =>
10241022 unit
10251023 }
10261024 if ((emitInvLegacy == emitInvLegacy))
10271025 then {
10281026 let slippageAInv = if ((amDiff > 0))
10291027 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10301028 else nil
10311029 if ((slippageAInv == slippageAInv))
10321030 then {
10331031 let slippagePInv = if ((prDiff > 0))
10341032 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10351033 else nil
10361034 if ((slippagePInv == slippagePInv))
10371035 then {
10381036 let lpTransfer = if (shouldAutoStake)
10391037 then {
10401038 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10411039 if ((slpStakeInv == slpStakeInv))
10421040 then nil
10431041 else throw("Strict value is not equal to itself.")
10441042 }
10451043 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1046- let $t04424344705 = refreshKLpInternal(0, 0, 0)
1047- if (($t04424344705 == $t04424344705))
1044+ let $t04449144953 = refreshKLpInternal(0, 0, 0)
1045+ if (($t04449144953 == $t04449144953))
10481046 then {
1049- let updatedKLp = $t04424344705._2
1050- let refreshKLpActions = $t04424344705._1
1047+ let updatedKLp = $t04449144953._2
1048+ let refreshKLpActions = $t04449144953._1
10511049 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10521050 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10531051 then {
10541052 let reb = invoke(this, "rebalance", nil, nil)
10551053 if ((reb == reb))
10561054 then ((state ++ lpTransfer) ++ refreshKLpActions)
10571055 else throw("Strict value is not equal to itself.")
10581056 }
10591057 else throw("Strict value is not equal to itself.")
10601058 }
10611059 else throw("Strict value is not equal to itself.")
10621060 }
10631061 else throw("Strict value is not equal to itself.")
10641062 }
10651063 else throw("Strict value is not equal to itself.")
10661064 }
10671065 else throw("Strict value is not equal to itself.")
10681066 }
10691067 else throw("Strict value is not equal to itself.")
10701068 }
10711069 else throw("Strict value is not equal to itself.")
10721070 }
10731071
10741072
10751073
10761074 @Callable(i)
10771075 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10781076 then throw("Invalid value passed")
10791077 else {
10801078 let estPut = commonPut(i, maxSlippage, false)
10811079 let state = estPut._9
10821080 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10831081 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10841082 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10851083 if ((currentKLp == currentKLp))
10861084 then {
1087- let $t04531745382 = refreshKLpInternal(0, 0, 0)
1088- let refreshKLpActions = $t04531745382._1
1089- let updatedKLp = $t04531745382._2
1085+ let $t04556545630 = refreshKLpInternal(0, 0, 0)
1086+ let refreshKLpActions = $t04556545630._1
1087+ let updatedKLp = $t04556545630._2
10901088 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10911089 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10921090 then (state ++ refreshKLpActions)
10931091 else throw("Strict value is not equal to itself.")
10941092 }
10951093 else throw("Strict value is not equal to itself.")
10961094 }
10971095
10981096
10991097
11001098 @Callable(i)
11011099 func putOneTkn (minOutAmount,autoStake) = {
11021100 let isPoolOneTokenOperationsDisabled = {
11031101 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11041102 if ($isInstanceOf(@, "Boolean"))
11051103 then @
11061104 else throw(($getType(@) + " couldn't be cast to Boolean"))
11071105 }
1108- let isPutDisabled = if (if (if (isGlobalShutdown())
1106+ let isPutDisabled = if (if (if (if (isGlobalShutdown())
11091107 then true
11101108 else (cfgPoolStatus == PoolPutDisabled))
1109+ then true
1110+ else (cfgPoolStatus == PoolPutAndMatcherDisabled))
11111111 then true
11121112 else (cfgPoolStatus == PoolShutdown))
11131113 then true
11141114 else isPoolOneTokenOperationsDisabled
11151115 let checks = [if (if (!(isPutDisabled))
11161116 then true
11171117 else isManager(i))
11181118 then true
11191119 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11201120 then true
11211121 else throwErr("exactly 1 payment are expected")]
11221122 if ((checks == checks))
11231123 then {
11241124 let payment = i.payments[0]
11251125 let paymentAssetId = payment.assetId
11261126 let paymentAmountRaw = payment.amount
11271127 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11281128 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11291129 else if ((paymentAssetId == cfgPriceAssetId))
11301130 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11311131 else throwErr("payment asset is not supported")
11321132 if ((currentKLp == currentKLp))
11331133 then {
11341134 let userAddress = i.caller
11351135 let txId = i.transactionId
1136- let $t04657046722 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1137- if (($t04657046722 == $t04657046722))
1136+ let $t04688547037 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1137+ if (($t04688547037 == $t04688547037))
11381138 then {
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
1139+ let paymentInAmountAsset = $t04688547037._5
1140+ let bonus = $t04688547037._4
1141+ let feeAmount = $t04688547037._3
1142+ let commonState = $t04688547037._2
1143+ let emitAmountEstimated = $t04688547037._1
11441144 let emitAmount = if (if ((minOutAmount > 0))
11451145 then (minOutAmount > emitAmountEstimated)
11461146 else false)
11471147 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11481148 else emitAmountEstimated
11491149 let emitInv = emit(emitAmount)
11501150 if ((emitInv == emitInv))
11511151 then {
11521152 let lpTransfer = if (autoStake)
11531153 then {
11541154 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11551155 if ((stakeInv == stakeInv))
11561156 then nil
11571157 else throw("Strict value is not equal to itself.")
11581158 }
11591159 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11601160 let sendFee = if ((feeAmount > 0))
11611161 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11621162 else nil
1163- let $t04730847505 = if ((this == feeCollectorAddress))
1163+ let $t04762347820 = if ((this == feeCollectorAddress))
11641164 then $Tuple2(0, 0)
11651165 else if (paymentInAmountAsset)
11661166 then $Tuple2(-(feeAmount), 0)
11671167 else $Tuple2(0, -(feeAmount))
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
1168+ let amountAssetBalanceDelta = $t04762347820._1
1169+ let priceAssetBalanceDelta = $t04762347820._2
1170+ let $t04782347931 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1171+ let refreshKLpActions = $t04782347931._1
1172+ let updatedKLp = $t04782347931._2
11731173 let kLp = value(getString(keyKLp))
11741174 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11751175 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11761176 then {
11771177 let reb = invoke(this, "rebalance", nil, nil)
11781178 if ((reb == reb))
11791179 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11801180 else throw("Strict value is not equal to itself.")
11811181 }
11821182 else throw("Strict value is not equal to itself.")
11831183 }
11841184 else throw("Strict value is not equal to itself.")
11851185 }
11861186 else throw("Strict value is not equal to itself.")
11871187 }
11881188 else throw("Strict value is not equal to itself.")
11891189 }
11901190 else throw("Strict value is not equal to itself.")
11911191 }
11921192
11931193
11941194
11951195 @Callable(i)
11961196 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
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
1197+ let $t04828648443 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1198+ let emitAmountEstimated = $t04828648443._1
1199+ let commonState = $t04828648443._2
1200+ let feeAmount = $t04828648443._3
1201+ let bonus = $t04828648443._4
1202+ let paymentInAmountAsset = $t04828648443._5
12031203 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12041204 }
12051205
12061206
12071207
12081208 @Callable(i)
12091209 func getOneTkn (outAssetIdStr,minOutAmount) = {
12101210 let isPoolOneTokenOperationsDisabled = {
12111211 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12121212 if ($isInstanceOf(@, "Boolean"))
12131213 then @
12141214 else throw(($getType(@) + " couldn't be cast to Boolean"))
12151215 }
12161216 let isGetDisabled = if (if (isGlobalShutdown())
12171217 then true
12181218 else (cfgPoolStatus == PoolShutdown))
12191219 then true
12201220 else isPoolOneTokenOperationsDisabled
12211221 let checks = [if (if (!(isGetDisabled))
12221222 then true
12231223 else isManager(i))
12241224 then true
12251225 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12261226 then true
12271227 else throwErr("exactly 1 payment are expected")]
12281228 if ((checks == checks))
12291229 then {
12301230 let outAssetId = parseAssetId(outAssetIdStr)
12311231 let payment = i.payments[0]
12321232 let paymentAssetId = payment.assetId
12331233 let paymentAmount = payment.amount
12341234 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12351235 if ((currentKLp == currentKLp))
12361236 then {
12371237 let userAddress = i.caller
12381238 let txId = i.transactionId
1239- let $t04901349166 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1240- if (($t04901349166 == $t04901349166))
1239+ let $t04932849481 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1240+ if (($t04932849481 == $t04932849481))
12411241 then {
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
1242+ let outInAmountAsset = $t04932849481._5
1243+ let bonus = $t04932849481._4
1244+ let feeAmount = $t04932849481._3
1245+ let commonState = $t04932849481._2
1246+ let amountEstimated = $t04932849481._1
12471247 let amount = if (if ((minOutAmount > 0))
12481248 then (minOutAmount > amountEstimated)
12491249 else false)
12501250 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12511251 else amountEstimated
12521252 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12531253 if ((burnInv == burnInv))
12541254 then {
12551255 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12561256 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12571257 let sendFee = if ((feeAmount > 0))
12581258 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12591259 else nil
1260- let $t04983050077 = {
1260+ let $t05014550392 = {
12611261 let feeAmountForCalc = if ((this == feeCollectorAddress))
12621262 then 0
12631263 else feeAmount
12641264 if (outInAmountAsset)
12651265 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12661266 else $Tuple2(0, -((amount + feeAmountForCalc)))
12671267 }
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
1268+ let amountAssetBalanceDelta = $t05014550392._1
1269+ let priceAssetBalanceDelta = $t05014550392._2
1270+ let $t05039550503 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1271+ let refreshKLpActions = $t05039550503._1
1272+ let updatedKLp = $t05039550503._2
12731273 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12741274 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12751275 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12761276 else throw("Strict value is not equal to itself.")
12771277 }
12781278 else throw("Strict value is not equal to itself.")
12791279 }
12801280 else throw("Strict value is not equal to itself.")
12811281 }
12821282 else throw("Strict value is not equal to itself.")
12831283 }
12841284 else throw("Strict value is not equal to itself.")
12851285 }
12861286
12871287
12881288
12891289 @Callable(i)
12901290 func getOneTknREADONLY (outAssetId,paymentAmount) = {
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
1291+ let $t05078150937 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1292+ let amountEstimated = $t05078150937._1
1293+ let commonState = $t05078150937._2
1294+ let feeAmount = $t05078150937._3
1295+ let bonus = $t05078150937._4
1296+ let outInAmountAsset = $t05078150937._5
12971297 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12981298 }
12991299
13001300
13011301
13021302 @Callable(i)
13031303 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13041304 let isPoolOneTokenOperationsDisabled = {
13051305 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13061306 if ($isInstanceOf(@, "Boolean"))
13071307 then @
13081308 else throw(($getType(@) + " couldn't be cast to Boolean"))
13091309 }
13101310 let isGetDisabled = if (if (isGlobalShutdown())
13111311 then true
13121312 else (cfgPoolStatus == PoolShutdown))
13131313 then true
13141314 else isPoolOneTokenOperationsDisabled
13151315 let checks = [if (if (!(isGetDisabled))
13161316 then true
13171317 else isManager(i))
13181318 then true
13191319 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13201320 then true
13211321 else throwErr("no payments are expected")]
13221322 if ((checks == checks))
13231323 then {
13241324 let outAssetId = parseAssetId(outAssetIdStr)
13251325 let userAddress = i.caller
13261326 let txId = i.transactionId
13271327 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13281328 if ((currentKLp == currentKLp))
13291329 then {
13301330 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13311331 if ((unstakeInv == unstakeInv))
13321332 then {
1333- let $t05152751678 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1334- if (($t05152751678 == $t05152751678))
1333+ let $t05184251993 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1334+ if (($t05184251993 == $t05184251993))
13351335 then {
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
1336+ let outInAmountAsset = $t05184251993._5
1337+ let bonus = $t05184251993._4
1338+ let feeAmount = $t05184251993._3
1339+ let commonState = $t05184251993._2
1340+ let amountEstimated = $t05184251993._1
13411341 let amount = if (if ((minOutAmount > 0))
13421342 then (minOutAmount > amountEstimated)
13431343 else false)
13441344 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13451345 else amountEstimated
13461346 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13471347 if ((burnInv == burnInv))
13481348 then {
13491349 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13501350 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13511351 let sendFee = if ((feeAmount > 0))
13521352 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13531353 else nil
1354- let $t05233752584 = {
1354+ let $t05265252899 = {
13551355 let feeAmountForCalc = if ((this == feeCollectorAddress))
13561356 then 0
13571357 else feeAmount
13581358 if (outInAmountAsset)
13591359 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13601360 else $Tuple2(0, -((amount + feeAmountForCalc)))
13611361 }
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
1362+ let amountAssetBalanceDelta = $t05265252899._1
1363+ let priceAssetBalanceDelta = $t05265252899._2
1364+ let $t05290253010 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1365+ let refreshKLpActions = $t05290253010._1
1366+ let updatedKLp = $t05290253010._2
13671367 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13681368 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13691369 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13701370 else throw("Strict value is not equal to itself.")
13711371 }
13721372 else throw("Strict value is not equal to itself.")
13731373 }
13741374 else throw("Strict value is not equal to itself.")
13751375 }
13761376 else throw("Strict value is not equal to itself.")
13771377 }
13781378 else throw("Strict value is not equal to itself.")
13791379 }
13801380 else throw("Strict value is not equal to itself.")
13811381 }
13821382
13831383
13841384
13851385 @Callable(i)
13861386 func get () = {
13871387 let res = commonGet(i)
13881388 let outAmAmt = res._1
13891389 let outPrAmt = res._2
13901390 let pmtAmt = res._3
13911391 let pmtAssetId = res._4
13921392 let state = res._5
13931393 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
13941394 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13951395 if ((currentKLp == currentKLp))
13961396 then {
13971397 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13981398 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13991399 then {
1400- let $t05379053871 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1401- let refreshKLpActions = $t05379053871._1
1402- let updatedKLp = $t05379053871._2
1400+ let $t05410554186 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1401+ let refreshKLpActions = $t05410554186._1
1402+ let updatedKLp = $t05410554186._2
14031403 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14041404 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14051405 then ((withdrawState ++ state) ++ refreshKLpActions)
14061406 else throw("Strict value is not equal to itself.")
14071407 }
14081408 else throw("Strict value is not equal to itself.")
14091409 }
14101410 else throw("Strict value is not equal to itself.")
14111411 }
14121412
14131413
14141414
14151415 @Callable(i)
14161416 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14171417 let res = commonGet(i)
14181418 let outAmAmt = res._1
14191419 let outPrAmt = res._2
14201420 let pmtAmt = res._3
14211421 let pmtAssetId = res._4
14221422 let state = res._5
14231423 if ((noLessThenAmtAsset > outAmAmt))
14241424 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14251425 else if ((noLessThenPriceAsset > outPrAmt))
14261426 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14271427 else {
14281428 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14291429 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14301430 if ((currentKLp == currentKLp))
14311431 then {
14321432 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14331433 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14341434 then {
1435- let $t05496655047 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1436- let refreshKLpActions = $t05496655047._1
1437- let updatedKLp = $t05496655047._2
1435+ let $t05528155362 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1436+ let refreshKLpActions = $t05528155362._1
1437+ let updatedKLp = $t05528155362._2
14381438 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14391439 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14401440 then ((withdrawState ++ state) ++ refreshKLpActions)
14411441 else throw("Strict value is not equal to itself.")
14421442 }
14431443 else throw("Strict value is not equal to itself.")
14441444 }
14451445 else throw("Strict value is not equal to itself.")
14461446 }
14471447 }
14481448
14491449
14501450
14511451 @Callable(i)
14521452 func unstakeAndGet (amount) = {
14531453 let checkPayments = if ((size(i.payments) != 0))
14541454 then throw("No payments are expected")
14551455 else true
14561456 if ((checkPayments == checkPayments))
14571457 then {
14581458 let cfg = getPoolConfig()
14591459 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14601460 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14611461 if ((currentKLp == currentKLp))
14621462 then {
14631463 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14641464 if ((unstakeInv == unstakeInv))
14651465 then {
14661466 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14671467 let outAmAmt = res._1
14681468 let outPrAmt = res._2
14691469 let poolStatus = parseIntValue(res._9)
14701470 let state = res._10
14711471 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14721472 let checkPoolStatus = if (if (isGlobalShutdown())
14731473 then true
14741474 else (poolStatus == PoolShutdown))
14751475 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14761476 else true
14771477 if ((checkPoolStatus == checkPoolStatus))
14781478 then {
14791479 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14801480 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14811481 then {
1482- let $t05631956400 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1483- let refreshKLpActions = $t05631956400._1
1484- let updatedKLp = $t05631956400._2
1482+ let $t05663456715 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1483+ let refreshKLpActions = $t05663456715._1
1484+ let updatedKLp = $t05663456715._2
14851485 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14861486 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14871487 then ((withdrawState ++ state) ++ refreshKLpActions)
14881488 else throw("Strict value is not equal to itself.")
14891489 }
14901490 else throw("Strict value is not equal to itself.")
14911491 }
14921492 else throw("Strict value is not equal to itself.")
14931493 }
14941494 else throw("Strict value is not equal to itself.")
14951495 }
14961496 else throw("Strict value is not equal to itself.")
14971497 }
14981498 else throw("Strict value is not equal to itself.")
14991499 }
15001500
15011501
15021502
15031503 @Callable(i)
15041504 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15051505 let isGetDisabled = if (isGlobalShutdown())
15061506 then true
15071507 else (cfgPoolStatus == PoolShutdown)
15081508 let checks = [if (!(isGetDisabled))
15091509 then true
15101510 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15111511 then true
15121512 else throw("no payments are expected")]
15131513 if ((checks == checks))
15141514 then {
15151515 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15161516 if ((currentKLp == currentKLp))
15171517 then {
15181518 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15191519 if ((unstakeInv == unstakeInv))
15201520 then {
15211521 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15221522 let outAmAmt = res._1
15231523 let outPrAmt = res._2
15241524 let state = res._10
15251525 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15261526 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15271527 then true
15281528 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15291529 then true
15301530 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15311531 if ((checkAmounts == checkAmounts))
15321532 then {
15331533 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15341534 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15351535 then {
1536- let $t05784157922 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1537- let refreshKLpActions = $t05784157922._1
1538- let updatedKLp = $t05784157922._2
1536+ let $t05815658237 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1537+ let refreshKLpActions = $t05815658237._1
1538+ let updatedKLp = $t05815658237._2
15391539 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15401540 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15411541 then ((withdrawState ++ state) ++ refreshKLpActions)
15421542 else throw("Strict value is not equal to itself.")
15431543 }
15441544 else throw("Strict value is not equal to itself.")
15451545 }
15461546 else throw("Strict value is not equal to itself.")
15471547 }
15481548 else throw("Strict value is not equal to itself.")
15491549 }
15501550 else throw("Strict value is not equal to itself.")
15511551 }
15521552 else throw("Strict value is not equal to itself.")
15531553 }
15541554
15551555
15561556
15571557 @Callable(i)
15581558 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15591559 then throw("permissions denied")
15601560 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15611561
15621562
15631563
15641564 @Callable(i)
15651565 func refreshKLp () = {
15661566 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15671567 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15681568 then unit
15691569 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15701570 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15711571 then {
15721572 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1573- let $t05912659190 = refreshKLpInternal(0, 0, 0)
1574- let kLpUpdateActions = $t05912659190._1
1575- let updatedKLp = $t05912659190._2
1573+ let $t05944159505 = refreshKLpInternal(0, 0, 0)
1574+ let kLpUpdateActions = $t05944159505._1
1575+ let updatedKLp = $t05944159505._2
15761576 let actions = if ((kLp != updatedKLp))
15771577 then kLpUpdateActions
15781578 else throwErr("nothing to refresh")
15791579 $Tuple2(actions, toString(updatedKLp))
15801580 }
15811581 else throw("Strict value is not equal to itself.")
15821582 }
15831583
15841584
15851585
15861586 @Callable(i)
15871587 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
15881588
15891589
15901590
15911591 @Callable(i)
15921592 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
15931593
15941594
15951595
15961596 @Callable(i)
15971597 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
15981598 let prices = calcPrices(amAmt, prAmt, lpAmt)
15991599 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16001600 }
16011601
16021602
16031603
16041604 @Callable(i)
16051605 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16061606
16071607
16081608
16091609 @Callable(i)
16101610 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16111611
16121612
16131613
16141614 @Callable(i)
16151615 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16161616
16171617
16181618
16191619 @Callable(i)
16201620 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16211621
16221622
16231623
16241624 @Callable(i)
16251625 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16261626 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16271627 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16281628 }
16291629
16301630
16311631
16321632 @Callable(i)
16331633 func statsREADONLY () = {
16341634 let cfg = getPoolConfig()
16351635 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16361636 let amtAssetId = cfg[idxAmtAssetId]
16371637 let priceAssetId = cfg[idxPriceAssetId]
16381638 let iAmtAssetId = cfg[idxIAmtAssetId]
16391639 let iPriceAssetId = cfg[idxIPriceAssetId]
16401640 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16411641 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16421642 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16431643 let accAmtAssetBalance = getAccBalance(amtAssetId)
16441644 let accPriceAssetBalance = getAccBalance(priceAssetId)
16451645 let pricesList = if ((poolLPBalance == 0))
16461646 then [zeroBigInt, zeroBigInt, zeroBigInt]
16471647 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16481648 let curPrice = 0
16491649 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16501650 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16511651 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16521652 $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))
16531653 }
16541654
16551655
16561656
16571657 @Callable(i)
16581658 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16591659 let cfg = getPoolConfig()
16601660 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16611661 let amAssetIdStr = cfg[idxAmtAssetId]
16621662 let amAssetId = fromBase58String(amAssetIdStr)
16631663 let prAssetIdStr = cfg[idxPriceAssetId]
16641664 let prAssetId = fromBase58String(prAssetIdStr)
16651665 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16661666 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16671667 let poolStatus = cfg[idxPoolStatus]
16681668 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16691669 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16701670 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16711671 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16721672 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16731673 let curPriceX18 = if ((poolLPBalance == 0))
16741674 then zeroBigInt
16751675 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16761676 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16771677 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16781678 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16791679 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16801680 let calcLpAmt = estPut._1
16811681 let curPriceCalc = estPut._3
16821682 let amBalance = estPut._4
16831683 let prBalance = estPut._5
16841684 let lpEmission = estPut._6
16851685 $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))
16861686 }
16871687
16881688
16891689
16901690 @Callable(i)
16911691 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
16921692 let cfg = getPoolConfig()
16931693 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16941694 let amAssetIdStr = cfg[idxAmtAssetId]
16951695 let amAssetId = fromBase58String(amAssetIdStr)
16961696 let prAssetIdStr = cfg[idxPriceAssetId]
16971697 let prAssetId = fromBase58String(prAssetIdStr)
16981698 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16991699 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17001700 let poolStatus = cfg[idxPoolStatus]
17011701 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17021702 let amBalanceRaw = getAccBalance(amAssetIdStr)
17031703 let prBalanceRaw = getAccBalance(prAssetIdStr)
17041704 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17051705 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17061706 let curPriceX18 = if ((poolLPBalance == 0))
17071707 then zeroBigInt
17081708 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17091709 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17101710 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17111711 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17121712 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17131713 let calcLpAmt = estPut._1
17141714 let curPriceCalc = estPut._3
17151715 let amBalance = estPut._4
17161716 let prBalance = estPut._5
17171717 let lpEmission = estPut._6
17181718 $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))
17191719 }
17201720
17211721
17221722
17231723 @Callable(i)
17241724 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17251725 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17261726 let outAmAmt = res._1
17271727 let outPrAmt = res._2
17281728 let amBalance = res._5
17291729 let prBalance = res._6
17301730 let lpEmission = res._7
17311731 let curPrice = res._8
17321732 let poolStatus = parseIntValue(res._9)
17331733 $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))
17341734 }
17351735
17361736
17371737 @Verifier(tx)
17381738 func verify () = {
17391739 let targetPublicKey = match managerPublicKeyOrUnit() {
17401740 case pk: ByteVector =>
17411741 pk
17421742 case _: Unit =>
17431743 tx.senderPublicKey
17441744 case _ =>
17451745 throw("Match error")
17461746 }
17471747 match tx {
17481748 case order: Order =>
17491749 let matcherPub = getMatcherPubOrFail()
1750- let $t06785267969 = if (skipOrderValidation())
1750+ let $t06816768284 = if (skipOrderValidation())
17511751 then $Tuple2(true, "")
17521752 else validateMatcherOrderAllowed(order)
1753- let orderValid = $t06785267969._1
1754- let orderValidInfo = $t06785267969._2
1753+ let orderValid = $t06816768284._1
1754+ let orderValidInfo = $t06816768284._2
17551755 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17561756 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17571757 if (if (if (orderValid)
17581758 then senderValid
17591759 else false)
17601760 then matcherValid
17611761 else false)
17621762 then true
17631763 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17641764 case s: SetScriptTransaction =>
17651765 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17661766 then true
17671767 else {
17681768 let newHash = blake2b256(value(s.script))
17691769 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17701770 let currentHash = scriptHash(this)
17711771 if ((allowedHash == newHash))
17721772 then (currentHash != newHash)
17731773 else false
17741774 }
17751775 case _ =>
17761776 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17771777 }
17781778 }
17791779

github/deemru/w8io/fabc49c 
248.38 ms