tx · BLBA3vLtiyjHLKUWVmc5JyN14V8SNLfPTG6x3vXsqt3o

3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT:  -0.03500000 Waves

2022.12.06 18:09 [2348646] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves

{ "type": 13, "id": "BLBA3vLtiyjHLKUWVmc5JyN14V8SNLfPTG6x3vXsqt3o", "fee": 3500000, "feeAssetId": null, "timestamp": 1670339382661, "version": 1, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "4unsf7LTYYEnakd78V7uMR4twWN9cV5vkgcZLsAbBdGtr5YfJ8jsYDvDjdvWo9UwJbyBXMBPcW96kZhG8mihGHDY" ], "script": "base64:BgKAKAgCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgRiaWczIgRiaWc0IgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2lke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CaEYDCQABAgUCYUUCBU9yZGVyBAJlUQUCYUUEAmhJCQECYVEABAJoSgkBAmVQAQUCZVEEAmhLCQD0AwMIBQJlUQlib2R5Qnl0ZXMJAJEDAggFAmVRBnByb29mcwAACAUCZVEPc2VuZGVyUHVibGljS2V5BAJoTAkA9AMDCAUCZVEJYm9keUJ5dGVzCQCRAwIIBQJlUQZwcm9vZnMAAQUCaEkDAwMFAmhKBQJoSwcFAmhMBwYJAQJhegMFAmhKBQJoSwUCaEwDCQABAgUCYUUCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJkSQUCYUUEAmhNCQD2AwEJAQV2YWx1ZQEIBQJkSQZzY3JpcHQEAmhOCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYU4JAQJheAAEAmhPCQDxBwEFBHRoaXMDAwkAAAIFAmhOBQJoTQkBAiE9AgUCaE8FAmhNBwYJAPQDAwgFAmhGCWJvZHlCeXRlcwkAkQMCCAUCaEYGcHJvb2ZzAAAFAmhICQD0AwMIBQJoRglib2R5Qnl0ZXMJAJEDAggFAmhGBnByb29mcwAABQJoSDmji/g=", "chainId": 84, "height": 2348646, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: xmkCj8qLuG41Q2sm6CVKrntUn2QmHnvmDXCPfSQFBAa Next: 8XtwNRnqagiFsG2VJMyMrqKe1KecPcFJcoWiXNXrbZev Diff:
OldNewDifferences
1414 let big1 = toBigInt(1)
1515
1616 let big2 = toBigInt(2)
17+
18+let big3 = toBigInt(3)
19+
20+let big4 = toBigInt(4)
1721
1822 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
1923
209213
210214 let poolConfigParsed = parsePoolConfig(gpc())
211215
212-let $t072087394 = poolConfigParsed
216+let $t072567442 = poolConfigParsed
213217
214-let cfgPoolAddress = $t072087394._1
218+let cfgPoolAddress = $t072567442._1
215219
216-let cfgPoolStatus = $t072087394._2
220+let cfgPoolStatus = $t072567442._2
217221
218-let cfgLpAssetId = $t072087394._3
222+let cfgLpAssetId = $t072567442._3
219223
220-let cfgAmountAssetId = $t072087394._4
224+let cfgAmountAssetId = $t072567442._4
221225
222-let cfgPriceAssetId = $t072087394._5
226+let cfgPriceAssetId = $t072567442._5
223227
224-let cfgAmountAssetDecimals = $t072087394._6
228+let cfgAmountAssetDecimals = $t072567442._6
225229
226-let cfgPriceAssetDecimals = $t072087394._7
230+let cfgPriceAssetDecimals = $t072567442._7
227231
228232 func gfc () = split(strf(fca, fcfg()), SEP)
229233
418422 else calcLpAmt
419423 let amDiff = (inAmAmt - calcAmAssetPmt)
420424 let prDiff = (inPrAmt - calcPrAssetPmt)
421- let $t01782518170 = if (if (isOneAsset)
425+ let $t01787318218 = if (if (isOneAsset)
422426 then (pmtId == amIdStr)
423427 else false)
424428 then $Tuple2(pmtAmt, 0)
427431 else false)
428432 then $Tuple2(0, pmtAmt)
429433 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
430- let writeAmAmt = $t01782518170._1
431- let writePrAmt = $t01782518170._2
434+ let writeAmAmt = $t01787318218._1
435+ let writePrAmt = $t01787318218._2
432436 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
433437 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
434438 }
435439 }
436440
437441
442+func getD (xp) = {
443+ let xp0 = xp[0]
444+ let xp1 = xp[1]
445+ let s = (xp0 + xp1)
446+ if ((s == big0))
447+ then big0
448+ else {
449+ let a = parseIntValue(A)
450+ let ann = (a * 2)
451+ let p = fraction(xp0, xp1, big1)
452+ let xp0_xp1_n_n = fraction(p, big4, big1)
453+ let ann_s = fraction(toBigInt(ann), s, big1)
454+ let ann_1 = toBigInt((ann - 1))
455+ func calcDNext (d) = {
456+ let dd = fraction(d, d, big1)
457+ let ddd = fraction(dd, d, big1)
458+ let dp = fraction(ddd, big1, xp0_xp1_n_n)
459+ fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1)))
460+ }
461+
462+ func calc (acc,i) = if (acc._2)
463+ then acc
464+ else {
465+ let d = acc._1
466+ let dNext = calcDNext(d)
467+ let dDiffRaw = toInt((dNext - value(d)))
468+ let dDiff = if ((0 > dDiffRaw))
469+ then -(dDiffRaw)
470+ else dDiffRaw
471+ if ((1 >= dDiff))
472+ then $Tuple2(dNext, true)
473+ else $Tuple2(dNext, false)
474+ }
475+
476+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
477+ let $t02012920177 = {
478+ let $l = arr
479+ let $s = size($l)
480+ let $acc0 = $Tuple2(s, false)
481+ func $f0_1 ($a,$i) = if (($i >= $s))
482+ then $a
483+ else calc($a, $l[$i])
484+
485+ func $f0_2 ($a,$i) = if (($i >= $s))
486+ then $a
487+ else throw("List size exceeds 15")
488+
489+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
490+ }
491+ let d = $t02012920177._1
492+ let found = $t02012920177._2
493+ if (found)
494+ then d
495+ else throw(("D calculation error, D = " + toString(d)))
496+ }
497+ }
498+
499+
500+func getYD (xp,i,D) = {
501+ let n = big2
502+ let x = xp[if ((i == 0))
503+ then 1
504+ else 0]
505+ let aPrecision = parseBigIntValue(Amult)
506+ let a = (parseBigIntValue(A) * aPrecision)
507+ let s = x
508+ let ann = (a * n)
509+ let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
510+ let b = ((s + ((D * aPrecision) / ann)) - D)
511+ func calc (acc,cur) = {
512+ let $t02066920689 = acc
513+ let y = $t02066920689._1
514+ let found = $t02066920689._2
515+ if ((found != unit))
516+ then acc
517+ else {
518+ let yNext = (((y * y) + c) / ((big2 * y) + b))
519+ let yDiff = absBigInt((yNext - value(y)))
520+ if ((big1 >= yDiff))
521+ then $Tuple2(yNext, cur)
522+ else $Tuple2(yNext, unit)
523+ }
524+ }
525+
526+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
527+ let $t02099621043 = {
528+ let $l = arr
529+ let $s = size($l)
530+ let $acc0 = $Tuple2(D, unit)
531+ func $f0_1 ($a,$i) = if (($i >= $s))
532+ then $a
533+ else calc($a, $l[$i])
534+
535+ func $f0_2 ($a,$i) = if (($i >= $s))
536+ then $a
537+ else throw("List size exceeds 15")
538+
539+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
540+ }
541+ let y = $t02099621043._1
542+ let found = $t02099621043._2
543+ if ((found != unit))
544+ then y
545+ else throw(("Y calculation error, Y = " + toString(y)))
546+ }
547+
548+
438549 func calcDLp (amountBalance,priceBalance,lpEmission) = {
439- let updatedDLp = fraction((amountBalance * priceBalance), scale18, lpEmission)
550+ let updatedDLp = fraction(getD([amountBalance, priceBalance]), scale18, lpEmission)
440551 updatedDLp
441552 }
442553
465576 else throwErr("updated KLp lower than current KLp")
466577
467578
468-func moa (order) = {
579+func validateMatcherOrderAllowed (order) = {
469580 let amountAssetAmount = order.amount
470- let priceAssetAmount = fraction(order.amount, order.price, scale8)
471- let $t02077820990 = if ((order.orderType == Buy))
581+ let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
582+ let $t02294323155 = if ((order.orderType == Buy))
472583 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
473584 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
474- let amountAssetBalanceDelta = $t02077820990._1
475- let priceAssetBalanceDelta = $t02077820990._2
585+ let amountAssetBalanceDelta = $t02294323155._1
586+ let priceAssetBalanceDelta = $t02294323155._2
476587 if (if (if (igs())
477588 then true
478589 else (cfgPoolStatus == PoolMatcherDis))
484595 else (order.assetPair.priceAsset != cfgPriceAssetId))
485596 then throw("Wr assets")
486597 else {
487- let dLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyDLp), fmtErr("dLp is required"))), fmtErr("invalid dLp"))
488- let $t02141721517 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
489- let unusedActions = $t02141721517._1
490- let dLpNew = $t02141721517._2
598+ let dLp = parseBigIntValue(getStringValue(this, keyDLp))
599+ let $t02348523585 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
600+ let unusedActions = $t02348523585._1
601+ let dLpNew = $t02348523585._2
491602 let isOrderValid = (dLpNew > dLp)
492603 isOrderValid
493604 }
526637 }
527638
528639
529-func getD (xp) = {
530- let n = big2
531- let xp0 = xp[0]
532- let xp1 = xp[1]
533- let aPrecision = parseBigIntValue(Amult)
534- let a = (parseBigIntValue(A) * aPrecision)
535- let s = (xp0 + xp1)
536- if ((s == big0))
537- then big0
538- else {
539- let ann = (a * n)
540- let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
541- let ann_s_aPrecision = ((ann * s) / aPrecision)
542- let ann_aPrecision = (ann - aPrecision)
543- let n1 = (n + big1)
544- func calc (acc,cur) = {
545- let $t02367023690 = acc
546- let d = $t02367023690._1
547- let found = $t02367023690._2
548- if ((found != unit))
549- then acc
550- else {
551- let dp = (((d * d) * d) / xp0_xp1_n_n)
552- let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
553- let dDiff = absBigInt((dNext - value(d)))
554- if ((big1 >= dDiff))
555- then $Tuple2(dNext, cur)
556- else $Tuple2(dNext, unit)
557- }
558- }
559-
560- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
561- let $t02411124158 = {
562- let $l = arr
563- let $s = size($l)
564- let $acc0 = $Tuple2(s, unit)
565- func $f0_1 ($a,$i) = if (($i >= $s))
566- then $a
567- else calc($a, $l[$i])
568-
569- func $f0_2 ($a,$i) = if (($i >= $s))
570- then $a
571- else throw("List size exceeds 15")
572-
573- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
574- }
575- let d = $t02411124158._1
576- let found = $t02411124158._2
577- if ((found != unit))
578- then d
579- else throw(("D calculation error, D = " + toString(d)))
580- }
581- }
582-
583-
584-func getYD (xp,i,D) = {
585- let n = big2
586- let x = xp[if ((i == 0))
587- then 1
588- else 0]
589- let aPrecision = parseBigIntValue(Amult)
590- let a = (parseBigIntValue(A) * aPrecision)
591- let s = x
592- let ann = (a * n)
593- let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
594- let b = ((s + ((D * aPrecision) / ann)) - D)
595- func calc (acc,cur) = {
596- let $t02465824678 = acc
597- let y = $t02465824678._1
598- let found = $t02465824678._2
599- if ((found != unit))
600- then acc
601- else {
602- let yNext = (((y * y) + c) / ((big2 * y) + b))
603- let yDiff = absBigInt((yNext - value(y)))
604- if ((big1 >= yDiff))
605- then $Tuple2(yNext, cur)
606- else $Tuple2(yNext, unit)
607- }
608- }
609-
610- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
611- let $t02498525032 = {
612- let $l = arr
613- let $s = size($l)
614- let $acc0 = $Tuple2(D, unit)
615- func $f0_1 ($a,$i) = if (($i >= $s))
616- then $a
617- else calc($a, $l[$i])
618-
619- func $f0_2 ($a,$i) = if (($i >= $s))
620- then $a
621- else throw("List size exceeds 15")
622-
623- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
624- }
625- let y = $t02498525032._1
626- let found = $t02498525032._2
627- if ((found != unit))
628- then y
629- else throw(("Y calculation error, Y = " + toString(y)))
630- }
631-
632-
633640 func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = {
634641 let poolConfig = gpc()
635642 let amId = poolConfig[idxAmAsId]
645652 then {
646653 let amBalance = getAccBalance(amId)
647654 let prBalance = getAccBalance(prId)
648- let $t02581526277 = if ((txId == ""))
655+ let $t02590126363 = if ((txId == ""))
649656 then $Tuple2(amBalance, prBalance)
650657 else if ((pmtAssetId == amId))
651658 then if ((pmtAmtRaw > amBalance))
656663 then throw("invalid payment amount")
657664 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
658665 else throw("wrong pmtAssetId")
659- let amBalanceOld = $t02581526277._1
660- let prBalanceOld = $t02581526277._2
661- let $t02628326459 = if ((pmtAssetId == amId))
666+ let amBalanceOld = $t02590126363._1
667+ let prBalanceOld = $t02590126363._2
668+ let $t02636926545 = if ((pmtAssetId == amId))
662669 then $Tuple2(pmtAmtRaw, 0)
663670 else if ((pmtAssetId == prId))
664671 then $Tuple2(0, pmtAmtRaw)
665672 else throw("invalid payment")
666- let amAmountRaw = $t02628326459._1
667- let prAmountRaw = $t02628326459._2
668- let $t02646326702 = if (withTakeFee)
673+ let amAmountRaw = $t02636926545._1
674+ let prAmountRaw = $t02636926545._2
675+ let $t02654926788 = if (withTakeFee)
669676 then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
670677 else $Tuple3(amAmountRaw, prAmountRaw, 0)
671- let amAmount = $t02646326702._1
672- let prAmount = $t02646326702._2
673- let feeAmount = $t02646326702._3
678+ let amAmount = $t02654926788._1
679+ let prAmount = $t02654926788._2
680+ let feeAmount = $t02654926788._3
674681 let amBalanceNew = (amBalanceOld + amAmount)
675682 let prBalanceNew = (prBalanceOld + prAmount)
676683 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
717724 else {
718725 let amBalance = getAccBalance(amId)
719726 let prBalance = getAccBalance(prId)
720- let $t02878628897 = {
727+ let $t02887228983 = {
721728 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
722729 if ($isInstanceOf(@, "(Int, Int)"))
723730 then @
724731 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
725732 }
726- if (($t02878628897 == $t02878628897))
733+ if (($t02887228983 == $t02887228983))
727734 then {
728- let feeAmount = $t02878628897._2
729- let totalGet = $t02878628897._1
735+ let feeAmount = $t02887228983._2
736+ let totalGet = $t02887228983._1
730737 let totalAmount = if (if ((minOutAmount > 0))
731738 then (minOutAmount > totalGet)
732739 else false)
733740 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
734741 else totalGet
735- let $t02908729394 = if ((outAssetId == amId))
742+ let $t02917329480 = if ((outAssetId == amId))
736743 then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
737744 else if ((outAssetId == prId))
738745 then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
739746 else throw("invalid out asset id")
740- let outAm = $t02908729394._1
741- let outPr = $t02908729394._2
742- let amBalanceNew = $t02908729394._3
743- let prBalanceNew = $t02908729394._4
747+ let outAm = $t02917329480._1
748+ let outPr = $t02917329480._2
749+ let amBalanceNew = $t02917329480._3
750+ let prBalanceNew = $t02917329480._4
744751 let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
745752 let curPr = f1(curPrX18, scale8)
746753 let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
755762 let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
756763 if ((burn == burn))
757764 then {
758- let $t03017930529 = {
765+ let $t03026530615 = {
759766 let feeAmountForCalc = if ((this == feeCollectorAddress))
760767 then 0
761768 else feeAmount
766773 then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
767774 else $Tuple2(0, -((totalGet + feeAmountForCalc)))
768775 }
769- let amountAssetBalanceDelta = $t03017930529._1
770- let priceAssetBalanceDelta = $t03017930529._2
771- let $t03053230640 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
772- let refreshDLpActions = $t03053230640._1
773- let updatedDLp = $t03053230640._2
776+ let amountAssetBalanceDelta = $t03026530615._1
777+ let priceAssetBalanceDelta = $t03026530615._2
778+ let $t03061830726 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
779+ let refreshDLpActions = $t03061830726._1
780+ let updatedDLp = $t03061830726._2
774781 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
775782 if ((isUpdatedDLpValid == isUpdatedDLpValid))
776783 then $Tuple2((state ++ refreshDLpActions), totalAmount)
928935 else throw("Strict value is not equal to itself.")
929936 }
930937 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
931- let $t03449634561 = refreshDLpInternal(0, 0, 0)
932- let refreshDLpActions = $t03449634561._1
933- let updatedDLp = $t03449634561._2
938+ let $t03458234647 = refreshDLpInternal(0, 0, 0)
939+ let refreshDLpActions = $t03458234647._1
940+ let updatedDLp = $t03458234647._2
934941 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
935942 if ((isUpdatedDLpValid == isUpdatedDLpValid))
936943 then ((state ++ lpTrnsfr) ++ refreshDLpActions)
986993 let pmt = value(i.payments[0])
987994 let pmtAssetId = toBase58String(value(pmt.assetId))
988995 let pmtAmt = pmt.amount
989- let $t03569835856 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
990- if (($t03569835856 == $t03569835856))
996+ let $t03578435942 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
997+ if (($t03578435942 == $t03578435942))
991998 then {
992- let feeAmount = $t03569835856._3
993- let state = $t03569835856._2
994- let estimLP = $t03569835856._1
999+ let feeAmount = $t03578435942._3
1000+ let state = $t03578435942._2
1001+ let estimLP = $t03578435942._1
9951002 let emitLpAmt = if (if ((minOutAmount > 0))
9961003 then (minOutAmount > estimLP)
9971004 else false)
10191026 let sendFeeToMatcher = if ((feeAmount > 0))
10201027 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
10211028 else nil
1022- let $t03667137020 = if ((this == feeCollectorAddress))
1029+ let $t03675737106 = if ((this == feeCollectorAddress))
10231030 then $Tuple2(0, 0)
10241031 else {
10251032 let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
10291036 then $Tuple2(-(feeAmount), 0)
10301037 else $Tuple2(0, -(feeAmount))
10311038 }
1032- let amountAssetBalanceDelta = $t03667137020._1
1033- let priceAssetBalanceDelta = $t03667137020._2
1034- let $t03702337131 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1035- let refreshDLpActions = $t03702337131._1
1036- let updatedDLp = $t03702337131._2
1039+ let amountAssetBalanceDelta = $t03675737106._1
1040+ let priceAssetBalanceDelta = $t03675737106._2
1041+ let $t03710937217 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1042+ let refreshDLpActions = $t03710937217._1
1043+ let updatedDLp = $t03710937217._2
10371044 $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
10381045 }
10391046 else throw("Strict value is not equal to itself.")
10601067 let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
10611068 if ((currentDLp == currentDLp))
10621069 then {
1063- let $t03809038155 = refreshDLpInternal(0, 0, 0)
1064- let refreshDLpActions = $t03809038155._1
1065- let updatedDLp = $t03809038155._2
1070+ let $t03817638241 = refreshDLpInternal(0, 0, 0)
1071+ let refreshDLpActions = $t03817638241._1
1072+ let updatedDLp = $t03817638241._2
10661073 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
10671074 if ((isUpdatedDLpValid == isUpdatedDLpValid))
10681075 then (state ++ refreshDLpActions)
10851092 if ((b == b))
10861093 then {
10871094 let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
1088- let $t03894439026 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1089- let refreshDLpActions = $t03894439026._1
1090- let updatedDLp = $t03894439026._2
1095+ let $t03903039112 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1096+ let refreshDLpActions = $t03903039112._1
1097+ let updatedDLp = $t03903039112._2
10911098 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
10921099 if ((isUpdatedDLpValid == isUpdatedDLpValid))
10931100 then (state ++ refreshDLpActions)
11201127 else throwErr("exactly 1 payment are expected")]
11211128 if ((checks == checks))
11221129 then {
1123- let $t03964439799 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1124- let state = $t03964439799._1
1125- let totalAmount = $t03964439799._2
1130+ let $t03973039885 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1131+ let state = $t03973039885._1
1132+ let totalAmount = $t03973039885._2
11261133 $Tuple2(state, totalAmount)
11271134 }
11281135 else throw("Strict value is not equal to itself.")
11391146 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
11401147 then {
11411148 let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1142- let $t04032340387 = refreshDLpInternal(0, 0, 0)
1143- let dLpUpdateActions = $t04032340387._1
1144- let updatedDLp = $t04032340387._2
1149+ let $t04040940473 = refreshDLpInternal(0, 0, 0)
1150+ let dLpUpdateActions = $t04040940473._1
1151+ let updatedDLp = $t04040940473._2
11451152 let actions = if ((dLp != updatedDLp))
11461153 then dLpUpdateActions
11471154 else throwErr("nothing to refresh")
11701177 let newY = getYD(xp, index, D1)
11711178 let dy = (xp[index] - newY)
11721179 let totalGetRaw = max([0, toInt((dy - big1))])
1173- let $t04128741336 = takeFee(totalGetRaw)
1174- let totalGet = $t04128741336._1
1175- let feeAmount = $t04128741336._2
1180+ let $t04137341422 = takeFee(totalGetRaw)
1181+ let totalGet = $t04137341422._1
1182+ let feeAmount = $t04137341422._2
11761183 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
11771184 }
11781185
11861193 let lpId = poolConfig[idxLPAsId]
11871194 let amBalance = getAccBalance(amId)
11881195 let prBalance = getAccBalance(prId)
1189- let $t04168141796 = {
1196+ let $t04176741882 = {
11901197 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
11911198 if ($isInstanceOf(@, "(Int, Int)"))
11921199 then @
11931200 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
11941201 }
1195- let totalGet = $t04168141796._1
1196- let feeAmount = $t04168141796._2
1202+ let totalGet = $t04176741882._1
1203+ let feeAmount = $t04176741882._2
11971204 let r = ego("", lpId, lpAssetAmount, this)
11981205 let outAmAmt = r._1
11991206 let outPrAmt = r._2
12251232 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12261233 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12271234 then {
1228- let $t04296443045 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1229- let refreshDLpActions = $t04296443045._1
1230- let updatedDLp = $t04296443045._2
1235+ let $t04305043131 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1236+ let refreshDLpActions = $t04305043131._1
1237+ let updatedDLp = $t04305043131._2
12311238 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
12321239 if ((isUpdatedDLpValid == isUpdatedDLpValid))
12331240 then (state ++ refreshDLpActions)
12691276 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
12701277 if ((burnA == burnA))
12711278 then {
1272- let $t04410844189 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1273- let refreshDLpActions = $t04410844189._1
1274- let updatedDLp = $t04410844189._2
1279+ let $t04419444275 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1280+ let refreshDLpActions = $t04419444275._1
1281+ let updatedDLp = $t04419444275._2
12751282 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
12761283 if ((isUpdatedDLpValid == isUpdatedDLpValid))
12771284 then (state ++ refreshDLpActions)
13181325 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13191326 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13201327 then {
1321- let $t04543745518 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1322- let refreshDLpActions = $t04543745518._1
1323- let updatedDLp = $t04543745518._2
1328+ let $t04552345604 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1329+ let refreshDLpActions = $t04552345604._1
1330+ let updatedDLp = $t04552345604._2
13241331 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
13251332 if ((isUpdatedDLpValid == isUpdatedDLpValid))
13261333 then (state ++ refreshDLpActions)
13661373 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
13671374 if ((unstakeInv == unstakeInv))
13681375 then {
1369- let $t04645246640 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1370- let state = $t04645246640._1
1371- let totalAmount = $t04645246640._2
1376+ let $t04653846726 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1377+ let state = $t04653846726._1
1378+ let totalAmount = $t04653846726._2
13721379 $Tuple2(state, totalAmount)
13731380 }
13741381 else throw("Strict value is not equal to itself.")
13841391 let amId = poolConfig[idxAmAsId]
13851392 let prId = poolConfig[idxPrAsId]
13861393 let lpId = poolConfig[idxLPAsId]
1387- let $t04689947002 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1388- let lpAmount = $t04689947002._1
1389- let state = $t04689947002._2
1390- let feeAmount = $t04689947002._3
1391- let bonus = $t04689947002._4
1394+ let $t04698547088 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1395+ let lpAmount = $t04698547088._1
1396+ let state = $t04698547088._2
1397+ let feeAmount = $t04698547088._3
1398+ let bonus = $t04698547088._4
13921399 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13931400 }
13941401
14001407 let amId = poolConfig[idxAmAsId]
14011408 let prId = poolConfig[idxPrAsId]
14021409 let lpId = poolConfig[idxLPAsId]
1403- let $t04728147385 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1404- let lpAmount = $t04728147385._1
1405- let state = $t04728147385._2
1406- let feeAmount = $t04728147385._3
1407- let bonus = $t04728147385._4
1410+ let $t04736747471 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1411+ let lpAmount = $t04736747471._1
1412+ let state = $t04736747471._2
1413+ let feeAmount = $t04736747471._3
1414+ let bonus = $t04736747471._4
14081415 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
14091416 }
14101417
14941501 match tx {
14951502 case order: Order =>
14961503 let matcherPub = mp()
1497- let orderValid = moa(order)
1504+ let orderValid = validateMatcherOrderAllowed(order)
14981505 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14991506 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
15001507 if (if (if (orderValid)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let scale8 = 100000000
55
66 let scale8BigInt = toBigInt(100000000)
77
88 let scale18 = toBigInt(1000000000000000000)
99
1010 let zeroBigInt = toBigInt(0)
1111
1212 let big0 = toBigInt(0)
1313
1414 let big1 = toBigInt(1)
1515
1616 let big2 = toBigInt(2)
17+
18+let big3 = toBigInt(3)
19+
20+let big4 = toBigInt(4)
1721
1822 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
1923
2024 let wavesString = "WAVES"
2125
2226 let Amult = "100"
2327
2428 let Dconv = "1"
2529
2630 let SEP = "__"
2731
2832 let EMPTY = ""
2933
3034 let PoolActive = 1
3135
3236 let PoolPutDis = 2
3337
3438 let PoolMatcherDis = 3
3539
3640 let PoolShutdown = 4
3741
3842 let idxPoolAddress = 1
3943
4044 let idxPoolSt = 2
4145
4246 let idxLPAsId = 3
4347
4448 let idxAmAsId = 4
4549
4650 let idxPrAsId = 5
4751
4852 let idxAmtAsDcm = 6
4953
5054 let idxPriceAsDcm = 7
5155
5256 let idxIAmtAsId = 8
5357
5458 let idxIPriceAsId = 9
5559
5660 let idxFactStakCntr = 1
5761
5862 let idxFactoryRestCntr = 6
5963
6064 let idxFactSlippCntr = 7
6165
6266 let idxFactGwxRewCntr = 10
6367
6468 let feeDefault = fraction(10, scale8, 10000)
6569
6670 func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6771
6872
6973 func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
7074
7175
7276 func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7377
7478
7579 func abs (val) = if ((zeroBigInt > val))
7680 then -(val)
7781 else val
7882
7983
8084 func absBigInt (val) = if ((zeroBigInt > val))
8185 then -(val)
8286 else val
8387
8488
8589 func fc () = "%s__factoryContract"
8690
8791
8892 func mpk () = "%s__managerPublicKey"
8993
9094
9195 func pmpk () = "%s__pendingManagerPublicKey"
9296
9397
9498 func pl () = "%s%s__price__last"
9599
96100
97101 func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
98102
99103
100104 func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
101105
102106
103107 func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
104108
105109
106110 func aa () = "%s__amountAsset"
107111
108112
109113 func pa () = "%s__priceAsset"
110114
111115
112116 func amp () = "%s__amp"
113117
114118
115119 func ada () = "%s__addonAddr"
116120
117121
118122 let keyFee = "%s__fee"
119123
120124 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
121125
122126 let keyDLp = makeString(["%s", "dLp"], SEP)
123127
124128 let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP)
125129
126130 let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP)
127131
128132 let dLpRefreshDelayDefault = 30
129133
130134 let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault)
131135
132136 func fcfg () = "%s__factoryConfig"
133137
134138
135139 func mtpk () = "%s%s__matcher__publicKey"
136140
137141
138142 func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
139143
140144
141145 func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
142146
143147
144148 func aps () = "%s__shutdown"
145149
146150
147151 func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash"
148152
149153
150154 func keyFeeCollectorAddress () = "%s__feeCollectorAddress"
151155
152156
153157 func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
154158
155159
156160 func str (val) = match val {
157161 case valStr: String =>
158162 valStr
159163 case _ =>
160164 throw("fail cast to String")
161165 }
162166
163167
164168 func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
165169
166170
167171 func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
168172
169173
170174 func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " "))
171175
172176
173177 func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ")
174178
175179
176180 let fca = addressFromStringValue(strf(this, fc()))
177181
178182 let A = strf(this, amp())
179183
180184 func igs () = valueOrElse(getBoolean(fca, aps()), false)
181185
182186
183187 func mp () = fromBase58String(strf(fca, mtpk()))
184188
185189
186190 let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress()))
187191
188192 func gpc () = {
189193 let amtAs = strf(this, aa())
190194 let priceAs = strf(this, pa())
191195 let iPriceAs = intf(fca, mba(priceAs))
192196 let iAmtAs = intf(fca, mba(amtAs))
193197 split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
194198 }
195199
196200
197201 func parseAssetId (input) = if ((input == wavesString))
198202 then unit
199203 else fromBase58String(input)
200204
201205
202206 func assetIdToString (input) = if ((input == unit))
203207 then wavesString
204208 else toBase58String(value(input))
205209
206210
207211 func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm]))
208212
209213
210214 let poolConfigParsed = parsePoolConfig(gpc())
211215
212-let $t072087394 = poolConfigParsed
216+let $t072567442 = poolConfigParsed
213217
214-let cfgPoolAddress = $t072087394._1
218+let cfgPoolAddress = $t072567442._1
215219
216-let cfgPoolStatus = $t072087394._2
220+let cfgPoolStatus = $t072567442._2
217221
218-let cfgLpAssetId = $t072087394._3
222+let cfgLpAssetId = $t072567442._3
219223
220-let cfgAmountAssetId = $t072087394._4
224+let cfgAmountAssetId = $t072567442._4
221225
222-let cfgPriceAssetId = $t072087394._5
226+let cfgPriceAssetId = $t072567442._5
223227
224-let cfgAmountAssetDecimals = $t072087394._6
228+let cfgAmountAssetDecimals = $t072567442._6
225229
226-let cfgPriceAssetDecimals = $t072087394._7
230+let cfgPriceAssetDecimals = $t072567442._7
227231
228232 func gfc () = split(strf(fca, fcfg()), SEP)
229233
230234
231235 let factoryConfig = gfc()
232236
233237 let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address")
234238
235239 let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address")
236240
237241 let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address")
238242
239243 let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address")
240244
241245 func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP)
242246
243247
244248 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)
245249
246250
247251 func getAccBalance (assetId) = if ((assetId == "WAVES"))
248252 then wavesBalance(this).available
249253 else assetBalance(this, fromBase58String(assetId))
250254
251255
252256 func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
253257
254258
255259 func vad (A1,A2,slippage) = {
256260 let diff = fraction((A1 - A2), scale8BigInt, A2)
257261 let pass = ((slippage - abs(diff)) > zeroBigInt)
258262 if (!(pass))
259263 then throw(("Big slpg: " + toString(diff)))
260264 else $Tuple2(pass, min([A1, A2]))
261265 }
262266
263267
264268 func vd (D1,D0,slpg) = {
265269 let diff = fraction(D0, scale8BigInt, D1)
266270 let fail = (slpg > diff)
267271 if (if (fail)
268272 then true
269273 else (D0 > D1))
270274 then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
271275 else fail
272276 }
273277
274278
275279 func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
276280 let amtAsAmtX18 = t1(amAmt, amAssetDcm)
277281 let prAsAmtX18 = t1(prAmt, prAssetDcm)
278282 cpbi(prAsAmtX18, amtAsAmtX18)
279283 }
280284
281285
282286 func calcPrices (amAmt,prAmt,lpAmt) = {
283287 let cfg = gpc()
284288 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
285289 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
286290 let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
287291 let amAmtX18 = t1(amAmt, amtAsDcm)
288292 let prAmtX18 = t1(prAmt, prAsDcm)
289293 let lpAmtX18 = t1(lpAmt, scale8)
290294 let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
291295 let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
292296 [priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
293297 }
294298
295299
296300 func calculatePrices (amAmt,prAmt,lpAmt) = {
297301 let p = calcPrices(amAmt, prAmt, lpAmt)
298302 [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
299303 }
300304
301305
302306 func takeFee (amount) = {
303307 let feeAmount = fraction(amount, fee, scale8)
304308 $Tuple2((amount - feeAmount), feeAmount)
305309 }
306310
307311
308312 func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
309313 let cfg = gpc()
310314 let lpId = cfg[idxLPAsId]
311315 let amId = cfg[idxAmAsId]
312316 let prId = cfg[idxPrAsId]
313317 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
314318 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
315319 let sts = cfg[idxPoolSt]
316320 let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
317321 if ((lpId != pmtAssetId))
318322 then throw("Wrong pmt asset")
319323 else {
320324 let amBalance = getAccBalance(amId)
321325 let amBalanceX18 = t1(amBalance, amDcm)
322326 let prBalance = getAccBalance(prId)
323327 let prBalanceX18 = t1(prBalance, prDcm)
324328 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
325329 let curPrice = f1(curPriceX18, scale8)
326330 let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
327331 let lpEmissX18 = t1(lpEmiss, scale8)
328332 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
329333 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
330334 let outAmAmt = f1(outAmAmtX18, amDcm)
331335 let outPrAmt = f1(outPrAmtX18, prDcm)
332336 let state = if ((txId58 == ""))
333337 then nil
334338 else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
335339 then unit
336340 else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
337341 then unit
338342 else fromBase58String(prId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)]
339343 $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
340344 }
341345 }
342346
343347
344348 func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
345349 let cfg = gpc()
346350 let lpId = fromBase58String(cfg[idxLPAsId])
347351 let amIdStr = cfg[idxAmAsId]
348352 let prIdStr = cfg[idxPrAsId]
349353 let inAmIdStr = cfg[idxIAmtAsId]
350354 let inPrIdStr = cfg[idxIPriceAsId]
351355 let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
352356 let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
353357 let sts = cfg[idxPoolSt]
354358 let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
355359 let amBalance = if (isEval)
356360 then getAccBalance(amIdStr)
357361 else if (if (isOneAsset)
358362 then (pmtId == amIdStr)
359363 else false)
360364 then (getAccBalance(amIdStr) - pmtAmt)
361365 else if (isOneAsset)
362366 then getAccBalance(amIdStr)
363367 else (getAccBalance(amIdStr) - inAmAmt)
364368 let prBalance = if (isEval)
365369 then getAccBalance(prIdStr)
366370 else if (if (isOneAsset)
367371 then (pmtId == prIdStr)
368372 else false)
369373 then (getAccBalance(prIdStr) - pmtAmt)
370374 else if (isOneAsset)
371375 then getAccBalance(prIdStr)
372376 else (getAccBalance(prIdStr) - inPrAmt)
373377 let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
374378 let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
375379 let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
376380 let amBalanceX18 = t1(amBalance, amtDcm)
377381 let prBalanceX18 = t1(prBalance, priceDcm)
378382 let r = if ((lpEm == 0))
379383 then {
380384 let curPriceX18 = zeroBigInt
381385 let slippageX18 = zeroBigInt
382386 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
383387 $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
384388 }
385389 else {
386390 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
387391 let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
388392 let slippageX18 = t1(slippage, scale8)
389393 if (if (if (validateSlippage)
390394 then (curPriceX18 != zeroBigInt)
391395 else false)
392396 then (slippageRealX18 > slippageX18)
393397 else false)
394398 then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
395399 else {
396400 let lpEmissionX18 = t1(lpEm, scale8)
397401 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
398402 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
399403 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
400404 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
401405 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
402406 let expAmtAssetAmtX18 = expectedAmts._1
403407 let expPriceAssetAmtX18 = expectedAmts._2
404408 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
405409 $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
406410 }
407411 }
408412 let calcLpAmt = r._1
409413 let calcAmAssetPmt = r._2
410414 let calcPrAssetPmt = r._3
411415 let curPrice = f1(r._4, scale8)
412416 let slippageCalc = f1(r._5, scale8)
413417 if ((0 >= calcLpAmt))
414418 then throw("LP <= 0")
415419 else {
416420 let emitLpAmt = if (!(emitLp))
417421 then 0
418422 else calcLpAmt
419423 let amDiff = (inAmAmt - calcAmAssetPmt)
420424 let prDiff = (inPrAmt - calcPrAssetPmt)
421- let $t01782518170 = if (if (isOneAsset)
425+ let $t01787318218 = if (if (isOneAsset)
422426 then (pmtId == amIdStr)
423427 else false)
424428 then $Tuple2(pmtAmt, 0)
425429 else if (if (isOneAsset)
426430 then (pmtId == prIdStr)
427431 else false)
428432 then $Tuple2(0, pmtAmt)
429433 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
430- let writeAmAmt = $t01782518170._1
431- let writePrAmt = $t01782518170._2
434+ let writeAmAmt = $t01787318218._1
435+ let writePrAmt = $t01787318218._2
432436 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
433437 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
434438 }
435439 }
436440
437441
442+func getD (xp) = {
443+ let xp0 = xp[0]
444+ let xp1 = xp[1]
445+ let s = (xp0 + xp1)
446+ if ((s == big0))
447+ then big0
448+ else {
449+ let a = parseIntValue(A)
450+ let ann = (a * 2)
451+ let p = fraction(xp0, xp1, big1)
452+ let xp0_xp1_n_n = fraction(p, big4, big1)
453+ let ann_s = fraction(toBigInt(ann), s, big1)
454+ let ann_1 = toBigInt((ann - 1))
455+ func calcDNext (d) = {
456+ let dd = fraction(d, d, big1)
457+ let ddd = fraction(dd, d, big1)
458+ let dp = fraction(ddd, big1, xp0_xp1_n_n)
459+ fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1)))
460+ }
461+
462+ func calc (acc,i) = if (acc._2)
463+ then acc
464+ else {
465+ let d = acc._1
466+ let dNext = calcDNext(d)
467+ let dDiffRaw = toInt((dNext - value(d)))
468+ let dDiff = if ((0 > dDiffRaw))
469+ then -(dDiffRaw)
470+ else dDiffRaw
471+ if ((1 >= dDiff))
472+ then $Tuple2(dNext, true)
473+ else $Tuple2(dNext, false)
474+ }
475+
476+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
477+ let $t02012920177 = {
478+ let $l = arr
479+ let $s = size($l)
480+ let $acc0 = $Tuple2(s, false)
481+ func $f0_1 ($a,$i) = if (($i >= $s))
482+ then $a
483+ else calc($a, $l[$i])
484+
485+ func $f0_2 ($a,$i) = if (($i >= $s))
486+ then $a
487+ else throw("List size exceeds 15")
488+
489+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
490+ }
491+ let d = $t02012920177._1
492+ let found = $t02012920177._2
493+ if (found)
494+ then d
495+ else throw(("D calculation error, D = " + toString(d)))
496+ }
497+ }
498+
499+
500+func getYD (xp,i,D) = {
501+ let n = big2
502+ let x = xp[if ((i == 0))
503+ then 1
504+ else 0]
505+ let aPrecision = parseBigIntValue(Amult)
506+ let a = (parseBigIntValue(A) * aPrecision)
507+ let s = x
508+ let ann = (a * n)
509+ let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
510+ let b = ((s + ((D * aPrecision) / ann)) - D)
511+ func calc (acc,cur) = {
512+ let $t02066920689 = acc
513+ let y = $t02066920689._1
514+ let found = $t02066920689._2
515+ if ((found != unit))
516+ then acc
517+ else {
518+ let yNext = (((y * y) + c) / ((big2 * y) + b))
519+ let yDiff = absBigInt((yNext - value(y)))
520+ if ((big1 >= yDiff))
521+ then $Tuple2(yNext, cur)
522+ else $Tuple2(yNext, unit)
523+ }
524+ }
525+
526+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
527+ let $t02099621043 = {
528+ let $l = arr
529+ let $s = size($l)
530+ let $acc0 = $Tuple2(D, unit)
531+ func $f0_1 ($a,$i) = if (($i >= $s))
532+ then $a
533+ else calc($a, $l[$i])
534+
535+ func $f0_2 ($a,$i) = if (($i >= $s))
536+ then $a
537+ else throw("List size exceeds 15")
538+
539+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
540+ }
541+ let y = $t02099621043._1
542+ let found = $t02099621043._2
543+ if ((found != unit))
544+ then y
545+ else throw(("Y calculation error, Y = " + toString(y)))
546+ }
547+
548+
438549 func calcDLp (amountBalance,priceBalance,lpEmission) = {
439- let updatedDLp = fraction((amountBalance * priceBalance), scale18, lpEmission)
550+ let updatedDLp = fraction(getD([amountBalance, priceBalance]), scale18, lpEmission)
440551 updatedDLp
441552 }
442553
443554
444555 func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
445556 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
446557 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
447558 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
448559 let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
449560 currentDLp
450561 }
451562
452563
453564 func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
454565 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
455566 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
456567 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
457568 let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
458569 let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))]
459570 $Tuple2(actions, updatedDLp)
460571 }
461572
462573
463574 func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp))
464575 then true
465576 else throwErr("updated KLp lower than current KLp")
466577
467578
468-func moa (order) = {
579+func validateMatcherOrderAllowed (order) = {
469580 let amountAssetAmount = order.amount
470- let priceAssetAmount = fraction(order.amount, order.price, scale8)
471- let $t02077820990 = if ((order.orderType == Buy))
581+ let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
582+ let $t02294323155 = if ((order.orderType == Buy))
472583 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
473584 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
474- let amountAssetBalanceDelta = $t02077820990._1
475- let priceAssetBalanceDelta = $t02077820990._2
585+ let amountAssetBalanceDelta = $t02294323155._1
586+ let priceAssetBalanceDelta = $t02294323155._2
476587 if (if (if (igs())
477588 then true
478589 else (cfgPoolStatus == PoolMatcherDis))
479590 then true
480591 else (cfgPoolStatus == PoolShutdown))
481592 then throw("Admin blocked")
482593 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
483594 then true
484595 else (order.assetPair.priceAsset != cfgPriceAssetId))
485596 then throw("Wr assets")
486597 else {
487- let dLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyDLp), fmtErr("dLp is required"))), fmtErr("invalid dLp"))
488- let $t02141721517 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
489- let unusedActions = $t02141721517._1
490- let dLpNew = $t02141721517._2
598+ let dLp = parseBigIntValue(getStringValue(this, keyDLp))
599+ let $t02348523585 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
600+ let unusedActions = $t02348523585._1
601+ let dLpNew = $t02348523585._2
491602 let isOrderValid = (dLpNew > dLp)
492603 isOrderValid
493604 }
494605 }
495606
496607
497608 func cg (i) = if ((size(i.payments) != 1))
498609 then throw("1 pmnt exp")
499610 else {
500611 let pmt = value(i.payments[0])
501612 let pmtAssetId = value(pmt.assetId)
502613 let pmtAmt = pmt.amount
503614 let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
504615 let outAmAmt = r._1
505616 let outPrAmt = r._2
506617 let sts = parseIntValue(r._9)
507618 let state = r._10
508619 if (if (igs())
509620 then true
510621 else (sts == PoolShutdown))
511622 then throw(("Admin blocked: " + toString(sts)))
512623 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
513624 }
514625
515626
516627 func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
517628 let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId)
518629 let sts = parseIntValue(r._8)
519630 if (if (if (igs())
520631 then true
521632 else (sts == PoolPutDis))
522633 then true
523634 else (sts == PoolShutdown))
524635 then throw(("Blocked:" + toString(sts)))
525636 else r
526637 }
527638
528639
529-func getD (xp) = {
530- let n = big2
531- let xp0 = xp[0]
532- let xp1 = xp[1]
533- let aPrecision = parseBigIntValue(Amult)
534- let a = (parseBigIntValue(A) * aPrecision)
535- let s = (xp0 + xp1)
536- if ((s == big0))
537- then big0
538- else {
539- let ann = (a * n)
540- let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
541- let ann_s_aPrecision = ((ann * s) / aPrecision)
542- let ann_aPrecision = (ann - aPrecision)
543- let n1 = (n + big1)
544- func calc (acc,cur) = {
545- let $t02367023690 = acc
546- let d = $t02367023690._1
547- let found = $t02367023690._2
548- if ((found != unit))
549- then acc
550- else {
551- let dp = (((d * d) * d) / xp0_xp1_n_n)
552- let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
553- let dDiff = absBigInt((dNext - value(d)))
554- if ((big1 >= dDiff))
555- then $Tuple2(dNext, cur)
556- else $Tuple2(dNext, unit)
557- }
558- }
559-
560- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
561- let $t02411124158 = {
562- let $l = arr
563- let $s = size($l)
564- let $acc0 = $Tuple2(s, unit)
565- func $f0_1 ($a,$i) = if (($i >= $s))
566- then $a
567- else calc($a, $l[$i])
568-
569- func $f0_2 ($a,$i) = if (($i >= $s))
570- then $a
571- else throw("List size exceeds 15")
572-
573- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
574- }
575- let d = $t02411124158._1
576- let found = $t02411124158._2
577- if ((found != unit))
578- then d
579- else throw(("D calculation error, D = " + toString(d)))
580- }
581- }
582-
583-
584-func getYD (xp,i,D) = {
585- let n = big2
586- let x = xp[if ((i == 0))
587- then 1
588- else 0]
589- let aPrecision = parseBigIntValue(Amult)
590- let a = (parseBigIntValue(A) * aPrecision)
591- let s = x
592- let ann = (a * n)
593- let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
594- let b = ((s + ((D * aPrecision) / ann)) - D)
595- func calc (acc,cur) = {
596- let $t02465824678 = acc
597- let y = $t02465824678._1
598- let found = $t02465824678._2
599- if ((found != unit))
600- then acc
601- else {
602- let yNext = (((y * y) + c) / ((big2 * y) + b))
603- let yDiff = absBigInt((yNext - value(y)))
604- if ((big1 >= yDiff))
605- then $Tuple2(yNext, cur)
606- else $Tuple2(yNext, unit)
607- }
608- }
609-
610- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
611- let $t02498525032 = {
612- let $l = arr
613- let $s = size($l)
614- let $acc0 = $Tuple2(D, unit)
615- func $f0_1 ($a,$i) = if (($i >= $s))
616- then $a
617- else calc($a, $l[$i])
618-
619- func $f0_2 ($a,$i) = if (($i >= $s))
620- then $a
621- else throw("List size exceeds 15")
622-
623- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
624- }
625- let y = $t02498525032._1
626- let found = $t02498525032._2
627- if ((found != unit))
628- then y
629- else throw(("Y calculation error, Y = " + toString(y)))
630- }
631-
632-
633640 func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = {
634641 let poolConfig = gpc()
635642 let amId = poolConfig[idxAmAsId]
636643 let prId = poolConfig[idxPrAsId]
637644 let lpId = poolConfig[idxLPAsId]
638645 let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm])
639646 let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm])
640647 let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
641648 let chechEmission = if ((lpAssetEmission > big0))
642649 then true
643650 else throw("initial deposit requires all coins")
644651 if ((chechEmission == chechEmission))
645652 then {
646653 let amBalance = getAccBalance(amId)
647654 let prBalance = getAccBalance(prId)
648- let $t02581526277 = if ((txId == ""))
655+ let $t02590126363 = if ((txId == ""))
649656 then $Tuple2(amBalance, prBalance)
650657 else if ((pmtAssetId == amId))
651658 then if ((pmtAmtRaw > amBalance))
652659 then throw("invalid payment amount")
653660 else $Tuple2((amBalance - pmtAmtRaw), prBalance)
654661 else if ((pmtAssetId == prId))
655662 then if ((pmtAmtRaw > prBalance))
656663 then throw("invalid payment amount")
657664 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
658665 else throw("wrong pmtAssetId")
659- let amBalanceOld = $t02581526277._1
660- let prBalanceOld = $t02581526277._2
661- let $t02628326459 = if ((pmtAssetId == amId))
666+ let amBalanceOld = $t02590126363._1
667+ let prBalanceOld = $t02590126363._2
668+ let $t02636926545 = if ((pmtAssetId == amId))
662669 then $Tuple2(pmtAmtRaw, 0)
663670 else if ((pmtAssetId == prId))
664671 then $Tuple2(0, pmtAmtRaw)
665672 else throw("invalid payment")
666- let amAmountRaw = $t02628326459._1
667- let prAmountRaw = $t02628326459._2
668- let $t02646326702 = if (withTakeFee)
673+ let amAmountRaw = $t02636926545._1
674+ let prAmountRaw = $t02636926545._2
675+ let $t02654926788 = if (withTakeFee)
669676 then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
670677 else $Tuple3(amAmountRaw, prAmountRaw, 0)
671- let amAmount = $t02646326702._1
672- let prAmount = $t02646326702._2
673- let feeAmount = $t02646326702._3
678+ let amAmount = $t02654926788._1
679+ let prAmount = $t02654926788._2
680+ let feeAmount = $t02654926788._3
674681 let amBalanceNew = (amBalanceOld + amAmount)
675682 let prBalanceNew = (prBalanceOld + prAmount)
676683 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
677684 let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
678685 let checkD = if ((D1 > D0))
679686 then true
680687 else throw()
681688 if ((checkD == checkD))
682689 then {
683690 let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0)
684691 let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8)
685692 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmountRaw, prAmountRaw, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))]
686693 let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
687694 let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8))
688695 let priceAssetPart = (pmtAmtRaw - amountAssetPart)
689696 let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
690697 let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth))
691698 $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus)
692699 }
693700 else throw("Strict value is not equal to itself.")
694701 }
695702 else throw("Strict value is not equal to itself.")
696703 }
697704
698705
699706 func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = {
700707 let poolConfig = gpc()
701708 let lpId = poolConfig[idxLPAsId]
702709 let amId = poolConfig[idxAmAsId]
703710 let prId = poolConfig[idxPrAsId]
704711 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
705712 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
706713 let poolStatus = poolConfig[idxPoolSt]
707714 let userAddress = if ((caller == restContract))
708715 then originCaller
709716 else caller
710717 let pmt = value(payments[0])
711718 let pmtAssetId = value(pmt.assetId)
712719 let pmtAmt = pmt.amount
713720 let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
714721 let txId58 = toBase58String(transactionId)
715722 if ((lpId != toBase58String(pmtAssetId)))
716723 then throw("Wrong LP")
717724 else {
718725 let amBalance = getAccBalance(amId)
719726 let prBalance = getAccBalance(prId)
720- let $t02878628897 = {
727+ let $t02887228983 = {
721728 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
722729 if ($isInstanceOf(@, "(Int, Int)"))
723730 then @
724731 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
725732 }
726- if (($t02878628897 == $t02878628897))
733+ if (($t02887228983 == $t02887228983))
727734 then {
728- let feeAmount = $t02878628897._2
729- let totalGet = $t02878628897._1
735+ let feeAmount = $t02887228983._2
736+ let totalGet = $t02887228983._1
730737 let totalAmount = if (if ((minOutAmount > 0))
731738 then (minOutAmount > totalGet)
732739 else false)
733740 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
734741 else totalGet
735- let $t02908729394 = if ((outAssetId == amId))
742+ let $t02917329480 = if ((outAssetId == amId))
736743 then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
737744 else if ((outAssetId == prId))
738745 then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
739746 else throw("invalid out asset id")
740- let outAm = $t02908729394._1
741- let outPr = $t02908729394._2
742- let amBalanceNew = $t02908729394._3
743- let prBalanceNew = $t02908729394._4
747+ let outAm = $t02917329480._1
748+ let outPr = $t02917329480._2
749+ let amBalanceNew = $t02917329480._3
750+ let prBalanceNew = $t02917329480._4
744751 let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
745752 let curPr = f1(curPrX18, scale8)
746753 let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
747754 then unit
748755 else fromBase58String(outAssetId)
749756 let sendFeeToMatcher = if ((feeAmount > 0))
750757 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
751758 else nil
752759 let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher)
753760 if ((state == state))
754761 then {
755762 let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
756763 if ((burn == burn))
757764 then {
758- let $t03017930529 = {
765+ let $t03026530615 = {
759766 let feeAmountForCalc = if ((this == feeCollectorAddress))
760767 then 0
761768 else feeAmount
762769 let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId))
763770 then true
764771 else false
765772 if (outInAmountAsset)
766773 then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
767774 else $Tuple2(0, -((totalGet + feeAmountForCalc)))
768775 }
769- let amountAssetBalanceDelta = $t03017930529._1
770- let priceAssetBalanceDelta = $t03017930529._2
771- let $t03053230640 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
772- let refreshDLpActions = $t03053230640._1
773- let updatedDLp = $t03053230640._2
776+ let amountAssetBalanceDelta = $t03026530615._1
777+ let priceAssetBalanceDelta = $t03026530615._2
778+ let $t03061830726 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
779+ let refreshDLpActions = $t03061830726._1
780+ let updatedDLp = $t03061830726._2
774781 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
775782 if ((isUpdatedDLpValid == isUpdatedDLpValid))
776783 then $Tuple2((state ++ refreshDLpActions), totalAmount)
777784 else throw("Strict value is not equal to itself.")
778785 }
779786 else throw("Strict value is not equal to itself.")
780787 }
781788 else throw("Strict value is not equal to itself.")
782789 }
783790 else throw("Strict value is not equal to itself.")
784791 }
785792 }
786793
787794
788795 func m () = match getString(mpk()) {
789796 case s: String =>
790797 fromBase58String(s)
791798 case _: Unit =>
792799 unit
793800 case _ =>
794801 throw("Match error")
795802 }
796803
797804
798805 func pm () = match getString(pmpk()) {
799806 case s: String =>
800807 fromBase58String(s)
801808 case _: Unit =>
802809 unit
803810 case _ =>
804811 throw("Match error")
805812 }
806813
807814
808815 let pd = throw("Permission denied")
809816
810817 func isManager (i) = match m() {
811818 case pk: ByteVector =>
812819 (i.callerPublicKey == pk)
813820 case _: Unit =>
814821 (i.caller == this)
815822 case _ =>
816823 throw("Match error")
817824 }
818825
819826
820827 func mm (i) = match m() {
821828 case pk: ByteVector =>
822829 if ((i.callerPublicKey == pk))
823830 then true
824831 else pd
825832 case _: Unit =>
826833 if ((i.caller == this))
827834 then true
828835 else pd
829836 case _ =>
830837 throw("Match error")
831838 }
832839
833840
834841 @Callable(i)
835842 func constructor (fc) = {
836843 let c = mm(i)
837844 if ((c == c))
838845 then [StringEntry(fc(), fc)]
839846 else throw("Strict value is not equal to itself.")
840847 }
841848
842849
843850
844851 @Callable(i)
845852 func setManager (pendingManagerPublicKey) = {
846853 let c = mm(i)
847854 if ((c == c))
848855 then {
849856 let cm = fromBase58String(pendingManagerPublicKey)
850857 if ((cm == cm))
851858 then [StringEntry(pmpk(), pendingManagerPublicKey)]
852859 else throw("Strict value is not equal to itself.")
853860 }
854861 else throw("Strict value is not equal to itself.")
855862 }
856863
857864
858865
859866 @Callable(i)
860867 func confirmManager () = {
861868 let p = pm()
862869 let hpm = if (isDefined(p))
863870 then true
864871 else throw("No pending manager")
865872 if ((hpm == hpm))
866873 then {
867874 let cpm = if ((i.callerPublicKey == value(p)))
868875 then true
869876 else throw("You are not pending manager")
870877 if ((cpm == cpm))
871878 then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
872879 else throw("Strict value is not equal to itself.")
873880 }
874881 else throw("Strict value is not equal to itself.")
875882 }
876883
877884
878885
879886 @Callable(i)
880887 func put (slip,autoStake) = {
881888 let factCfg = gfc()
882889 let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
883890 let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
884891 if ((0 > slip))
885892 then throw("Wrong slippage")
886893 else if ((size(i.payments) != 2))
887894 then throw("2 pmnts expd")
888895 else {
889896 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
890897 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
891898 let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
892899 if ((currentDLp == currentDLp))
893900 then {
894901 let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "")
895902 let emitLpAmt = e._2
896903 let lpAssetId = e._7
897904 let state = e._9
898905 let amDiff = e._10
899906 let prDiff = e._11
900907 let amId = e._12
901908 let prId = e._13
902909 let r = invoke(fca, "emit", [emitLpAmt], nil)
903910 if ((r == r))
904911 then {
905912 let el = match r {
906913 case legacy: Address =>
907914 invoke(legacy, "emit", [emitLpAmt], nil)
908915 case _ =>
909916 unit
910917 }
911918 if ((el == el))
912919 then {
913920 let sa = if ((amDiff > 0))
914921 then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
915922 else nil
916923 if ((sa == sa))
917924 then {
918925 let sp = if ((prDiff > 0))
919926 then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
920927 else nil
921928 if ((sp == sp))
922929 then {
923930 let lpTrnsfr = if (autoStake)
924931 then {
925932 let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
926933 if ((ss == ss))
927934 then nil
928935 else throw("Strict value is not equal to itself.")
929936 }
930937 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
931- let $t03449634561 = refreshDLpInternal(0, 0, 0)
932- let refreshDLpActions = $t03449634561._1
933- let updatedDLp = $t03449634561._2
938+ let $t03458234647 = refreshDLpInternal(0, 0, 0)
939+ let refreshDLpActions = $t03458234647._1
940+ let updatedDLp = $t03458234647._2
934941 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
935942 if ((isUpdatedDLpValid == isUpdatedDLpValid))
936943 then ((state ++ lpTrnsfr) ++ refreshDLpActions)
937944 else throw("Strict value is not equal to itself.")
938945 }
939946 else throw("Strict value is not equal to itself.")
940947 }
941948 else throw("Strict value is not equal to itself.")
942949 }
943950 else throw("Strict value is not equal to itself.")
944951 }
945952 else throw("Strict value is not equal to itself.")
946953 }
947954 else throw("Strict value is not equal to itself.")
948955 }
949956 }
950957
951958
952959
953960 @Callable(i)
954961 func putOneTknV2 (minOutAmount,autoStake) = {
955962 let isPoolOneTokenOperationsDisabled = {
956963 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
957964 if ($isInstanceOf(@, "Boolean"))
958965 then @
959966 else throw(($getType(@) + " couldn't be cast to Boolean"))
960967 }
961968 let isPutDisabled = if (if (if (igs())
962969 then true
963970 else (cfgPoolStatus == PoolPutDis))
964971 then true
965972 else (cfgPoolStatus == PoolShutdown))
966973 then true
967974 else isPoolOneTokenOperationsDisabled
968975 let checks = [if (if (!(isPutDisabled))
969976 then true
970977 else isManager(i))
971978 then true
972979 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
973980 then true
974981 else throwErr("exactly 1 payment are expected")]
975982 if ((checks == checks))
976983 then {
977984 let poolConfig = gpc()
978985 let amId = poolConfig[idxAmAsId]
979986 let prId = poolConfig[idxPrAsId]
980987 let lpId = fromBase58String(poolConfig[idxLPAsId])
981988 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
982989 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
983990 let userAddress = if ((i.caller == this))
984991 then i.originCaller
985992 else i.caller
986993 let pmt = value(i.payments[0])
987994 let pmtAssetId = toBase58String(value(pmt.assetId))
988995 let pmtAmt = pmt.amount
989- let $t03569835856 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
990- if (($t03569835856 == $t03569835856))
996+ let $t03578435942 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
997+ if (($t03578435942 == $t03578435942))
991998 then {
992- let feeAmount = $t03569835856._3
993- let state = $t03569835856._2
994- let estimLP = $t03569835856._1
999+ let feeAmount = $t03578435942._3
1000+ let state = $t03578435942._2
1001+ let estimLP = $t03578435942._1
9951002 let emitLpAmt = if (if ((minOutAmount > 0))
9961003 then (minOutAmount > estimLP)
9971004 else false)
9981005 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
9991006 else estimLP
10001007 let e = invoke(fca, "emit", [emitLpAmt], nil)
10011008 if ((e == e))
10021009 then {
10031010 let el = match e {
10041011 case legacy: Address =>
10051012 invoke(legacy, "emit", [emitLpAmt], nil)
10061013 case _ =>
10071014 unit
10081015 }
10091016 if ((el == el))
10101017 then {
10111018 let lpTrnsfr = if (autoStake)
10121019 then {
10131020 let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
10141021 if ((ss == ss))
10151022 then nil
10161023 else throw("Strict value is not equal to itself.")
10171024 }
10181025 else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
10191026 let sendFeeToMatcher = if ((feeAmount > 0))
10201027 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
10211028 else nil
1022- let $t03667137020 = if ((this == feeCollectorAddress))
1029+ let $t03675737106 = if ((this == feeCollectorAddress))
10231030 then $Tuple2(0, 0)
10241031 else {
10251032 let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
10261033 then true
10271034 else false
10281035 if (paymentInAmountAsset)
10291036 then $Tuple2(-(feeAmount), 0)
10301037 else $Tuple2(0, -(feeAmount))
10311038 }
1032- let amountAssetBalanceDelta = $t03667137020._1
1033- let priceAssetBalanceDelta = $t03667137020._2
1034- let $t03702337131 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1035- let refreshDLpActions = $t03702337131._1
1036- let updatedDLp = $t03702337131._2
1039+ let amountAssetBalanceDelta = $t03675737106._1
1040+ let priceAssetBalanceDelta = $t03675737106._2
1041+ let $t03710937217 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1042+ let refreshDLpActions = $t03710937217._1
1043+ let updatedDLp = $t03710937217._2
10371044 $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
10381045 }
10391046 else throw("Strict value is not equal to itself.")
10401047 }
10411048 else throw("Strict value is not equal to itself.")
10421049 }
10431050 else throw("Strict value is not equal to itself.")
10441051 }
10451052 else throw("Strict value is not equal to itself.")
10461053 }
10471054
10481055
10491056
10501057 @Callable(i)
10511058 func putForFree (maxSlpg) = if ((0 > maxSlpg))
10521059 then throw("Wrong slpg")
10531060 else if ((size(i.payments) != 2))
10541061 then throw("2 pmnts expd")
10551062 else {
10561063 let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "")
10571064 let state = estPut._9
10581065 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10591066 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10601067 let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
10611068 if ((currentDLp == currentDLp))
10621069 then {
1063- let $t03809038155 = refreshDLpInternal(0, 0, 0)
1064- let refreshDLpActions = $t03809038155._1
1065- let updatedDLp = $t03809038155._2
1070+ let $t03817638241 = refreshDLpInternal(0, 0, 0)
1071+ let refreshDLpActions = $t03817638241._1
1072+ let updatedDLp = $t03817638241._2
10661073 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
10671074 if ((isUpdatedDLpValid == isUpdatedDLpValid))
10681075 then (state ++ refreshDLpActions)
10691076 else throw("Strict value is not equal to itself.")
10701077 }
10711078 else throw("Strict value is not equal to itself.")
10721079 }
10731080
10741081
10751082
10761083 @Callable(i)
10771084 func get () = {
10781085 let r = cg(i)
10791086 let outAmtAmt = r._1
10801087 let outPrAmt = r._2
10811088 let pmtAmt = r._3
10821089 let pmtAssetId = r._4
10831090 let state = r._5
10841091 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10851092 if ((b == b))
10861093 then {
10871094 let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
1088- let $t03894439026 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1089- let refreshDLpActions = $t03894439026._1
1090- let updatedDLp = $t03894439026._2
1095+ let $t03903039112 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1096+ let refreshDLpActions = $t03903039112._1
1097+ let updatedDLp = $t03903039112._2
10911098 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
10921099 if ((isUpdatedDLpValid == isUpdatedDLpValid))
10931100 then (state ++ refreshDLpActions)
10941101 else throw("Strict value is not equal to itself.")
10951102 }
10961103 else throw("Strict value is not equal to itself.")
10971104 }
10981105
10991106
11001107
11011108 @Callable(i)
11021109 func getOneTknV2 (outAssetId,minOutAmount) = {
11031110 let isPoolOneTokenOperationsDisabled = {
11041111 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11051112 if ($isInstanceOf(@, "Boolean"))
11061113 then @
11071114 else throw(($getType(@) + " couldn't be cast to Boolean"))
11081115 }
11091116 let isGetDisabled = if (if (igs())
11101117 then true
11111118 else (cfgPoolStatus == PoolShutdown))
11121119 then true
11131120 else isPoolOneTokenOperationsDisabled
11141121 let checks = [if (if (!(isGetDisabled))
11151122 then true
11161123 else isManager(i))
11171124 then true
11181125 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
11191126 then true
11201127 else throwErr("exactly 1 payment are expected")]
11211128 if ((checks == checks))
11221129 then {
1123- let $t03964439799 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1124- let state = $t03964439799._1
1125- let totalAmount = $t03964439799._2
1130+ let $t03973039885 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1131+ let state = $t03973039885._1
1132+ let totalAmount = $t03973039885._2
11261133 $Tuple2(state, totalAmount)
11271134 }
11281135 else throw("Strict value is not equal to itself.")
11291136 }
11301137
11311138
11321139
11331140 @Callable(i)
11341141 func refreshDLp () = {
11351142 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
11361143 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
11371144 then unit
11381145 else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
11391146 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
11401147 then {
11411148 let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1142- let $t04032340387 = refreshDLpInternal(0, 0, 0)
1143- let dLpUpdateActions = $t04032340387._1
1144- let updatedDLp = $t04032340387._2
1149+ let $t04040940473 = refreshDLpInternal(0, 0, 0)
1150+ let dLpUpdateActions = $t04040940473._1
1151+ let updatedDLp = $t04040940473._2
11451152 let actions = if ((dLp != updatedDLp))
11461153 then dLpUpdateActions
11471154 else throwErr("nothing to refresh")
11481155 $Tuple2(actions, toString(updatedDLp))
11491156 }
11501157 else throw("Strict value is not equal to itself.")
11511158 }
11521159
11531160
11541161
11551162 @Callable(i)
11561163 func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
11571164 let poolConfig = gpc()
11581165 let amId = poolConfig[idxAmAsId]
11591166 let prId = poolConfig[idxPrAsId]
11601167 let lpId = poolConfig[idxLPAsId]
11611168 let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))]
11621169 let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
11631170 let D0 = getD(xp)
11641171 let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission))
11651172 let index = if ((outAssetId == amId))
11661173 then 0
11671174 else if ((outAssetId == prId))
11681175 then 1
11691176 else throw("invalid out asset id")
11701177 let newY = getYD(xp, index, D1)
11711178 let dy = (xp[index] - newY)
11721179 let totalGetRaw = max([0, toInt((dy - big1))])
1173- let $t04128741336 = takeFee(totalGetRaw)
1174- let totalGet = $t04128741336._1
1175- let feeAmount = $t04128741336._2
1180+ let $t04137341422 = takeFee(totalGetRaw)
1181+ let totalGet = $t04137341422._1
1182+ let feeAmount = $t04137341422._2
11761183 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
11771184 }
11781185
11791186
11801187
11811188 @Callable(i)
11821189 func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = {
11831190 let poolConfig = gpc()
11841191 let amId = poolConfig[idxAmAsId]
11851192 let prId = poolConfig[idxPrAsId]
11861193 let lpId = poolConfig[idxLPAsId]
11871194 let amBalance = getAccBalance(amId)
11881195 let prBalance = getAccBalance(prId)
1189- let $t04168141796 = {
1196+ let $t04176741882 = {
11901197 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
11911198 if ($isInstanceOf(@, "(Int, Int)"))
11921199 then @
11931200 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
11941201 }
1195- let totalGet = $t04168141796._1
1196- let feeAmount = $t04168141796._2
1202+ let totalGet = $t04176741882._1
1203+ let feeAmount = $t04176741882._2
11971204 let r = ego("", lpId, lpAssetAmount, this)
11981205 let outAmAmt = r._1
11991206 let outPrAmt = r._2
12001207 let sumOfGetAssets = (outAmAmt + outPrAmt)
12011208 let bonus = if ((sumOfGetAssets == 0))
12021209 then if ((totalGet == 0))
12031210 then 0
12041211 else throw("bonus calculation error")
12051212 else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets)
12061213 $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus))
12071214 }
12081215
12091216
12101217
12111218 @Callable(i)
12121219 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
12131220 let r = cg(i)
12141221 let outAmAmt = r._1
12151222 let outPrAmt = r._2
12161223 let pmtAmt = r._3
12171224 let pmtAssetId = r._4
12181225 let state = r._5
12191226 if ((noLessThenAmtAsset > outAmAmt))
12201227 then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
12211228 else if ((noLessThenPriceAsset > outPrAmt))
12221229 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
12231230 else {
12241231 let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
12251232 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12261233 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12271234 then {
1228- let $t04296443045 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1229- let refreshDLpActions = $t04296443045._1
1230- let updatedDLp = $t04296443045._2
1235+ let $t04305043131 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1236+ let refreshDLpActions = $t04305043131._1
1237+ let updatedDLp = $t04305043131._2
12311238 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
12321239 if ((isUpdatedDLpValid == isUpdatedDLpValid))
12331240 then (state ++ refreshDLpActions)
12341241 else throw("Strict value is not equal to itself.")
12351242 }
12361243 else throw("Strict value is not equal to itself.")
12371244 }
12381245 }
12391246
12401247
12411248
12421249 @Callable(i)
12431250 func unstakeAndGet (amount) = {
12441251 let checkPayments = if ((size(i.payments) != 0))
12451252 then throw("No pmnts expd")
12461253 else true
12471254 if ((checkPayments == checkPayments))
12481255 then {
12491256 let cfg = gpc()
12501257 let factoryCfg = gfc()
12511258 let lpAssetId = fromBase58String(cfg[idxLPAsId])
12521259 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
12531260 let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
12541261 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
12551262 if ((unstakeInv == unstakeInv))
12561263 then {
12571264 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
12581265 let outAmAmt = r._1
12591266 let outPrAmt = r._2
12601267 let sts = parseIntValue(r._9)
12611268 let state = r._10
12621269 let v = if (if (igs())
12631270 then true
12641271 else (sts == PoolShutdown))
12651272 then throw(("Blocked: " + toString(sts)))
12661273 else true
12671274 if ((v == v))
12681275 then {
12691276 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
12701277 if ((burnA == burnA))
12711278 then {
1272- let $t04410844189 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1273- let refreshDLpActions = $t04410844189._1
1274- let updatedDLp = $t04410844189._2
1279+ let $t04419444275 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1280+ let refreshDLpActions = $t04419444275._1
1281+ let updatedDLp = $t04419444275._2
12751282 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
12761283 if ((isUpdatedDLpValid == isUpdatedDLpValid))
12771284 then (state ++ refreshDLpActions)
12781285 else throw("Strict value is not equal to itself.")
12791286 }
12801287 else throw("Strict value is not equal to itself.")
12811288 }
12821289 else throw("Strict value is not equal to itself.")
12831290 }
12841291 else throw("Strict value is not equal to itself.")
12851292 }
12861293 else throw("Strict value is not equal to itself.")
12871294 }
12881295
12891296
12901297
12911298 @Callable(i)
12921299 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
12931300 let isGetDisabled = if (igs())
12941301 then true
12951302 else (cfgPoolStatus == PoolShutdown)
12961303 let checks = [if (!(isGetDisabled))
12971304 then true
12981305 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
12991306 then true
13001307 else throw("no payments are expected")]
13011308 if ((checks == checks))
13021309 then {
13031310 let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
13041311 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13051312 if ((unstakeInv == unstakeInv))
13061313 then {
13071314 let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
13081315 let outAmAmt = res._1
13091316 let outPrAmt = res._2
13101317 let state = res._10
13111318 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
13121319 then true
13131320 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
13141321 then true
13151322 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
13161323 if ((checkAmounts == checkAmounts))
13171324 then {
13181325 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13191326 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13201327 then {
1321- let $t04543745518 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1322- let refreshDLpActions = $t04543745518._1
1323- let updatedDLp = $t04543745518._2
1328+ let $t04552345604 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1329+ let refreshDLpActions = $t04552345604._1
1330+ let updatedDLp = $t04552345604._2
13241331 let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
13251332 if ((isUpdatedDLpValid == isUpdatedDLpValid))
13261333 then (state ++ refreshDLpActions)
13271334 else throw("Strict value is not equal to itself.")
13281335 }
13291336 else throw("Strict value is not equal to itself.")
13301337 }
13311338 else throw("Strict value is not equal to itself.")
13321339 }
13331340 else throw("Strict value is not equal to itself.")
13341341 }
13351342 else throw("Strict value is not equal to itself.")
13361343 }
13371344
13381345
13391346
13401347 @Callable(i)
13411348 func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = {
13421349 let isPoolOneTokenOperationsDisabled = {
13431350 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13441351 if ($isInstanceOf(@, "Boolean"))
13451352 then @
13461353 else throw(($getType(@) + " couldn't be cast to Boolean"))
13471354 }
13481355 let isGetDisabled = if (if (igs())
13491356 then true
13501357 else (cfgPoolStatus == PoolShutdown))
13511358 then true
13521359 else isPoolOneTokenOperationsDisabled
13531360 let checks = [if (if (!(isGetDisabled))
13541361 then true
13551362 else isManager(i))
13561363 then true
13571364 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13581365 then true
13591366 else throwErr("no payments are expected")]
13601367 if ((checks == checks))
13611368 then {
13621369 let cfg = gpc()
13631370 let factoryCfg = gfc()
13641371 let lpAssetId = fromBase58String(cfg[idxLPAsId])
13651372 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
13661373 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
13671374 if ((unstakeInv == unstakeInv))
13681375 then {
1369- let $t04645246640 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1370- let state = $t04645246640._1
1371- let totalAmount = $t04645246640._2
1376+ let $t04653846726 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1377+ let state = $t04653846726._1
1378+ let totalAmount = $t04653846726._2
13721379 $Tuple2(state, totalAmount)
13731380 }
13741381 else throw("Strict value is not equal to itself.")
13751382 }
13761383 else throw("Strict value is not equal to itself.")
13771384 }
13781385
13791386
13801387
13811388 @Callable(i)
13821389 func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = {
13831390 let poolConfig = gpc()
13841391 let amId = poolConfig[idxAmAsId]
13851392 let prId = poolConfig[idxPrAsId]
13861393 let lpId = poolConfig[idxLPAsId]
1387- let $t04689947002 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1388- let lpAmount = $t04689947002._1
1389- let state = $t04689947002._2
1390- let feeAmount = $t04689947002._3
1391- let bonus = $t04689947002._4
1394+ let $t04698547088 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1395+ let lpAmount = $t04698547088._1
1396+ let state = $t04698547088._2
1397+ let feeAmount = $t04698547088._3
1398+ let bonus = $t04698547088._4
13921399 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13931400 }
13941401
13951402
13961403
13971404 @Callable(i)
13981405 func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = {
13991406 let poolConfig = gpc()
14001407 let amId = poolConfig[idxAmAsId]
14011408 let prId = poolConfig[idxPrAsId]
14021409 let lpId = poolConfig[idxLPAsId]
1403- let $t04728147385 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1404- let lpAmount = $t04728147385._1
1405- let state = $t04728147385._2
1406- let feeAmount = $t04728147385._3
1407- let bonus = $t04728147385._4
1410+ let $t04736747471 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1411+ let lpAmount = $t04736747471._1
1412+ let state = $t04736747471._2
1413+ let feeAmount = $t04736747471._3
1414+ let bonus = $t04736747471._4
14081415 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
14091416 }
14101417
14111418
14121419
14131420 @Callable(i)
14141421 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
14151422 then throw("denied")
14161423 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
14171424
14181425
14191426
14201427 @Callable(i)
14211428 func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
14221429 then pd
14231430 else [StringEntry(k, v)]
14241431
14251432
14261433
14271434 @Callable(i)
14281435 func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
14291436 then pd
14301437 else [IntegerEntry(k, v)]
14311438
14321439
14331440
14341441 @Callable(i)
14351442 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
14361443
14371444
14381445
14391446 @Callable(i)
14401447 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
14411448
14421449
14431450
14441451 @Callable(i)
14451452 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
14461453 let pr = calcPrices(amAmt, prAmt, lpAmt)
14471454 $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
14481455 }
14491456
14501457
14511458
14521459 @Callable(i)
14531460 func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
14541461
14551462
14561463
14571464 @Callable(i)
14581465 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
14591466
14601467
14611468
14621469 @Callable(i)
14631470 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
14641471
14651472
14661473
14671474 @Callable(i)
14681475 func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, ""))
14691476
14701477
14711478
14721479 @Callable(i)
14731480 func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
14741481 let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
14751482 $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
14761483 }
14771484
14781485
14791486
14801487 @Callable(i)
14811488 func getFeeREADONLY () = $Tuple2(nil, fee)
14821489
14831490
14841491 @Verifier(tx)
14851492 func verify () = {
14861493 let targetPublicKey = match m() {
14871494 case pk: ByteVector =>
14881495 pk
14891496 case _: Unit =>
14901497 tx.senderPublicKey
14911498 case _ =>
14921499 throw("Match error")
14931500 }
14941501 match tx {
14951502 case order: Order =>
14961503 let matcherPub = mp()
1497- let orderValid = moa(order)
1504+ let orderValid = validateMatcherOrderAllowed(order)
14981505 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14991506 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
15001507 if (if (if (orderValid)
15011508 then senderValid
15021509 else false)
15031510 then matcherValid
15041511 else false)
15051512 then true
15061513 else toe(orderValid, senderValid, matcherValid)
15071514 case s: SetScriptTransaction =>
15081515 let newHash = blake2b256(value(s.script))
15091516 let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash())))
15101517 let currentHash = scriptHash(this)
15111518 if (if ((allowedHash == newHash))
15121519 then (currentHash != newHash)
15131520 else false)
15141521 then true
15151522 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
15161523 case _ =>
15171524 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
15181525 }
15191526 }
15201527

github/deemru/w8io/026f985 
192.79 ms