tx · GeeLpr2MVCgfxu71jKgqYUCk7CLhEygxGkDFUWwkTQkt

3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA:  -0.03500000 Waves

2022.12.06 17:11 [2348589] smart account 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA > SELF 0.00000000 Waves

{ "type": 13, "id": "GeeLpr2MVCgfxu71jKgqYUCk7CLhEygxGkDFUWwkTQkt", "fee": 3500000, "feeAssetId": null, "timestamp": 1670335798373, "version": 1, "sender": "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA", "senderPublicKey": "35yd3qw1gxKDxKwGAykHN9fANbXNWwseaUwbWDj24o3x", "proofs": [ "vDcrStJggsSimq48ZX7dNp7PDVwfhNqN1WAwxwunfVQ5thE6wamGmBcpBmSP89bdTZTZEY5Pt5EznSBwzpp5C2E" ], "script": "base64:BgLlJwgCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2lkeEZhY3RTdGFrQ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tleQkAAgECC01hdGNoIGVycm9yBAJhQwUCaEIDCQABAgUCYUMCBU9yZGVyBAJkVwUCYUMEAmhFCQECYU8ABAJoRgkBAmRWAQUCZFcEAmhHCQD0AwMIBQJkVwlib2R5Qnl0ZXMJAJEDAggFAmRXBnByb29mcwAACAUCZFcPc2VuZGVyUHVibGljS2V5BAJoSAkA9AMDCAUCZFcJYm9keUJ5dGVzCQCRAwIIBQJkVwZwcm9vZnMAAQUCaEUDAwMFAmhGBQJoRwcFAmhIBwYJAQJheAMFAmhGBQJoRwUCaEgDCQABAgUCYUMCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJldAUCYUMEAmhJCQD2AwEJAQV2YWx1ZQEIBQJldAZzY3JpcHQEAmhKCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUwJAQJhdgAEAmhLCQDxBwEFBHRoaXMDAwkAAAIFAmhKBQJoSQkBAiE9AgUCaEsFAmhJBwYJAPQDAwgFAmhCCWJvZHlCeXRlcwkAkQMCCAUCaEIGcHJvb2ZzAAAFAmhECQD0AwMIBQJoQglib2R5Qnl0ZXMJAJEDAggFAmhCBnByb29mcwAABQJoRKTlpdI=", "chainId": 84, "height": 2348589, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8MQryXfK2FdewNGx4Hznoda3F54nzg9ADvjeNBvvF7BZ Next: 2yG191nzau8mvTTHSDuFboSpdgtNfDY2dpu8ixeLLDKV Diff:
OldNewDifferences
441441 }
442442
443443
444+func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
445+ let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
446+ let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
447+ let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
448+ let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
449+ currentDLp
450+ }
451+
452+
444453 func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
445454 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
446455 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
451460 }
452461
453462
454-func validateUpdatedDLp (updatedDLp) = {
455- let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
456- let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
457- let lpAssetEmission = value(assetInfo(cfgLpAssetId)).quantity
458- let currentDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
459- if ((updatedDLp >= currentDLp))
460- then true
461- else throwErr("updated DLp lower than current DLp")
462- }
463+func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp))
464+ then true
465+ else throwErr("updated KLp lower than current KLp")
463466
464467
465468 func moa (order) = {
466469 let amountAssetAmount = order.amount
467470 let priceAssetAmount = fraction(order.amount, order.price, scale8)
468- let $t02058520797 = if ((order.orderType == Buy))
471+ let $t02077820990 = if ((order.orderType == Buy))
469472 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
470473 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
471- let amountAssetBalanceDelta = $t02058520797._1
472- let priceAssetBalanceDelta = $t02058520797._2
474+ let amountAssetBalanceDelta = $t02077820990._1
475+ let priceAssetBalanceDelta = $t02077820990._2
473476 if (if (if (igs())
474477 then true
475478 else (cfgPoolStatus == PoolMatcherDis))
482485 then throw("Wr assets")
483486 else {
484487 let dLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyDLp), fmtErr("dLp is required"))), fmtErr("invalid dLp"))
485- let $t02122421324 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
486- let unusedActions = $t02122421324._1
487- let dLpNew = $t02122421324._2
488+ let $t02141721517 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
489+ let unusedActions = $t02141721517._1
490+ let dLpNew = $t02141721517._2
488491 let isOrderValid = (dLpNew > dLp)
489492 isOrderValid
490493 }
539542 let ann_aPrecision = (ann - aPrecision)
540543 let n1 = (n + big1)
541544 func calc (acc,cur) = {
542- let $t02347723497 = acc
543- let d = $t02347723497._1
544- let found = $t02347723497._2
545+ let $t02367023690 = acc
546+ let d = $t02367023690._1
547+ let found = $t02367023690._2
545548 if ((found != unit))
546549 then acc
547550 else {
555558 }
556559
557560 let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
558- let $t02391823965 = {
561+ let $t02411124158 = {
559562 let $l = arr
560563 let $s = size($l)
561564 let $acc0 = $Tuple2(s, unit)
569572
570573 $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)
571574 }
572- let d = $t02391823965._1
573- let found = $t02391823965._2
575+ let d = $t02411124158._1
576+ let found = $t02411124158._2
574577 if ((found != unit))
575578 then d
576579 else throw(("D calculation error, D = " + toString(d)))
590593 let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
591594 let b = ((s + ((D * aPrecision) / ann)) - D)
592595 func calc (acc,cur) = {
593- let $t02446524485 = acc
594- let y = $t02446524485._1
595- let found = $t02446524485._2
596+ let $t02465824678 = acc
597+ let y = $t02465824678._1
598+ let found = $t02465824678._2
596599 if ((found != unit))
597600 then acc
598601 else {
605608 }
606609
607610 let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
608- let $t02479224839 = {
611+ let $t02498525032 = {
609612 let $l = arr
610613 let $s = size($l)
611614 let $acc0 = $Tuple2(D, unit)
619622
620623 $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)
621624 }
622- let y = $t02479224839._1
623- let found = $t02479224839._2
625+ let y = $t02498525032._1
626+ let found = $t02498525032._2
624627 if ((found != unit))
625628 then y
626629 else throw(("Y calculation error, Y = " + toString(y)))
642645 then {
643646 let amBalance = getAccBalance(amId)
644647 let prBalance = getAccBalance(prId)
645- let $t02562226084 = if ((txId == ""))
648+ let $t02581526277 = if ((txId == ""))
646649 then $Tuple2(amBalance, prBalance)
647650 else if ((pmtAssetId == amId))
648651 then if ((pmtAmtRaw > amBalance))
653656 then throw("invalid payment amount")
654657 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
655658 else throw("wrong pmtAssetId")
656- let amBalanceOld = $t02562226084._1
657- let prBalanceOld = $t02562226084._2
658- let $t02609026266 = if ((pmtAssetId == amId))
659+ let amBalanceOld = $t02581526277._1
660+ let prBalanceOld = $t02581526277._2
661+ let $t02628326459 = if ((pmtAssetId == amId))
659662 then $Tuple2(pmtAmtRaw, 0)
660663 else if ((pmtAssetId == prId))
661664 then $Tuple2(0, pmtAmtRaw)
662665 else throw("invalid payment")
663- let amAmountRaw = $t02609026266._1
664- let prAmountRaw = $t02609026266._2
665- let $t02627026509 = if (withTakeFee)
666+ let amAmountRaw = $t02628326459._1
667+ let prAmountRaw = $t02628326459._2
668+ let $t02646326702 = if (withTakeFee)
666669 then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
667670 else $Tuple3(amAmountRaw, prAmountRaw, 0)
668- let amAmount = $t02627026509._1
669- let prAmount = $t02627026509._2
670- let feeAmount = $t02627026509._3
671+ let amAmount = $t02646326702._1
672+ let prAmount = $t02646326702._2
673+ let feeAmount = $t02646326702._3
671674 let amBalanceNew = (amBalanceOld + amAmount)
672675 let prBalanceNew = (prBalanceOld + prAmount)
673676 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
707710 let pmt = value(payments[0])
708711 let pmtAssetId = value(pmt.assetId)
709712 let pmtAmt = pmt.amount
713+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
710714 let txId58 = toBase58String(transactionId)
711715 if ((lpId != toBase58String(pmtAssetId)))
712716 then throw("Wrong LP")
713717 else {
714718 let amBalance = getAccBalance(amId)
715719 let prBalance = getAccBalance(prId)
716- let $t02851128622 = {
720+ let $t02878628897 = {
717721 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
718722 if ($isInstanceOf(@, "(Int, Int)"))
719723 then @
720724 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
721725 }
722- if (($t02851128622 == $t02851128622))
726+ if (($t02878628897 == $t02878628897))
723727 then {
724- let feeAmount = $t02851128622._2
725- let totalGet = $t02851128622._1
728+ let feeAmount = $t02878628897._2
729+ let totalGet = $t02878628897._1
726730 let totalAmount = if (if ((minOutAmount > 0))
727731 then (minOutAmount > totalGet)
728732 else false)
729733 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
730734 else totalGet
731- let $t02881229119 = if ((outAssetId == amId))
735+ let $t02908729394 = if ((outAssetId == amId))
732736 then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
733737 else if ((outAssetId == prId))
734738 then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
735739 else throw("invalid out asset id")
736- let outAm = $t02881229119._1
737- let outPr = $t02881229119._2
738- let amBalanceNew = $t02881229119._3
739- let prBalanceNew = $t02881229119._4
740+ let outAm = $t02908729394._1
741+ let outPr = $t02908729394._2
742+ let amBalanceNew = $t02908729394._3
743+ let prBalanceNew = $t02908729394._4
740744 let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
741745 let curPr = f1(curPrX18, scale8)
742746 let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
751755 let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
752756 if ((burn == burn))
753757 then {
754- let $t02990430254 = {
758+ let $t03017930529 = {
755759 let feeAmountForCalc = if ((this == feeCollectorAddress))
756760 then 0
757761 else feeAmount
762766 then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
763767 else $Tuple2(0, -((totalGet + feeAmountForCalc)))
764768 }
765- let amountAssetBalanceDelta = $t02990430254._1
766- let priceAssetBalanceDelta = $t02990430254._2
767- let $t03025730365 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
768- let refreshDLpActions = $t03025730365._1
769- let updatedDLp = $t03025730365._2
770- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
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
774+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
771775 if ((isUpdatedDLpValid == isUpdatedDLpValid))
772776 then $Tuple2((state ++ refreshDLpActions), totalAmount)
773777 else throw("Strict value is not equal to itself.")
882886 else if ((size(i.payments) != 2))
883887 then throw("2 pmnts expd")
884888 else {
885- 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, "")
886- let emitLpAmt = e._2
887- let lpAssetId = e._7
888- let state = e._9
889- let amDiff = e._10
890- let prDiff = e._11
891- let amId = e._12
892- let prId = e._13
893- let r = invoke(fca, "emit", [emitLpAmt], nil)
894- if ((r == r))
889+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
890+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
891+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
892+ if ((currentDLp == currentDLp))
895893 then {
896- let el = match r {
897- case legacy: Address =>
898- invoke(legacy, "emit", [emitLpAmt], nil)
899- case _ =>
900- unit
901- }
902- if ((el == el))
894+ 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, "")
895+ let emitLpAmt = e._2
896+ let lpAssetId = e._7
897+ let state = e._9
898+ let amDiff = e._10
899+ let prDiff = e._11
900+ let amId = e._12
901+ let prId = e._13
902+ let r = invoke(fca, "emit", [emitLpAmt], nil)
903+ if ((r == r))
903904 then {
904- let sa = if ((amDiff > 0))
905- then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
906- else nil
907- if ((sa == sa))
905+ let el = match r {
906+ case legacy: Address =>
907+ invoke(legacy, "emit", [emitLpAmt], nil)
908+ case _ =>
909+ unit
910+ }
911+ if ((el == el))
908912 then {
909- let sp = if ((prDiff > 0))
910- then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
913+ let sa = if ((amDiff > 0))
914+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
911915 else nil
912- if ((sp == sp))
916+ if ((sa == sa))
913917 then {
914- let lpTrnsfr = if (autoStake)
918+ let sp = if ((prDiff > 0))
919+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
920+ else nil
921+ if ((sp == sp))
915922 then {
916- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
917- if ((ss == ss))
918- then nil
923+ let lpTrnsfr = if (autoStake)
924+ then {
925+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
926+ if ((ss == ss))
927+ then nil
928+ else throw("Strict value is not equal to itself.")
929+ }
930+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
931+ let $t03449634561 = refreshDLpInternal(0, 0, 0)
932+ let refreshDLpActions = $t03449634561._1
933+ let updatedDLp = $t03449634561._2
934+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
935+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
936+ then ((state ++ lpTrnsfr) ++ refreshDLpActions)
919937 else throw("Strict value is not equal to itself.")
920938 }
921- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
922- let $t03400834073 = refreshDLpInternal(0, 0, 0)
923- let refreshDLpActions = $t03400834073._1
924- let updatedDLp = $t03400834073._2
925- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
926- if ((isUpdatedDLpValid == isUpdatedDLpValid))
927- then ((state ++ lpTrnsfr) ++ refreshDLpActions)
928939 else throw("Strict value is not equal to itself.")
929940 }
930941 else throw("Strict value is not equal to itself.")
975986 let pmt = value(i.payments[0])
976987 let pmtAssetId = toBase58String(value(pmt.assetId))
977988 let pmtAmt = pmt.amount
978- let $t03519835356 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
979- if (($t03519835356 == $t03519835356))
989+ let $t03569835856 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
990+ if (($t03569835856 == $t03569835856))
980991 then {
981- let feeAmount = $t03519835356._3
982- let state = $t03519835356._2
983- let estimLP = $t03519835356._1
992+ let feeAmount = $t03569835856._3
993+ let state = $t03569835856._2
994+ let estimLP = $t03569835856._1
984995 let emitLpAmt = if (if ((minOutAmount > 0))
985996 then (minOutAmount > estimLP)
986997 else false)
10081019 let sendFeeToMatcher = if ((feeAmount > 0))
10091020 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
10101021 else nil
1011- let $t03617136520 = if ((this == feeCollectorAddress))
1022+ let $t03667137020 = if ((this == feeCollectorAddress))
10121023 then $Tuple2(0, 0)
10131024 else {
10141025 let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
10181029 then $Tuple2(-(feeAmount), 0)
10191030 else $Tuple2(0, -(feeAmount))
10201031 }
1021- let amountAssetBalanceDelta = $t03617136520._1
1022- let priceAssetBalanceDelta = $t03617136520._2
1023- let $t03652336631 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1024- let refreshDLpActions = $t03652336631._1
1025- let updatedDLp = $t03652336631._2
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
10261037 $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
10271038 }
10281039 else throw("Strict value is not equal to itself.")
10441055 else {
10451056 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, "")
10461057 let state = estPut._9
1047- let $t03738937454 = refreshDLpInternal(0, 0, 0)
1048- let refreshDLpActions = $t03738937454._1
1049- let updatedDLp = $t03738937454._2
1050- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1051- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1052- then (state ++ refreshDLpActions)
1058+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1059+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1060+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
1061+ if ((currentDLp == currentDLp))
1062+ then {
1063+ let $t03809038155 = refreshDLpInternal(0, 0, 0)
1064+ let refreshDLpActions = $t03809038155._1
1065+ let updatedDLp = $t03809038155._2
1066+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1067+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1068+ then (state ++ refreshDLpActions)
1069+ else throw("Strict value is not equal to itself.")
1070+ }
10531071 else throw("Strict value is not equal to itself.")
10541072 }
10551073
10661084 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10671085 if ((b == b))
10681086 then {
1069- let $t03814938231 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1070- let refreshDLpActions = $t03814938231._1
1071- let updatedDLp = $t03814938231._2
1072- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1087+ 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
1091+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
10731092 if ((isUpdatedDLpValid == isUpdatedDLpValid))
10741093 then (state ++ refreshDLpActions)
10751094 else throw("Strict value is not equal to itself.")
11011120 else throwErr("exactly 1 payment are expected")]
11021121 if ((checks == checks))
11031122 then {
1104- let $t03883738992 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1105- let state = $t03883738992._1
1106- let totalAmount = $t03883738992._2
1123+ let $t03964439799 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1124+ let state = $t03964439799._1
1125+ let totalAmount = $t03964439799._2
11071126 $Tuple2(state, totalAmount)
11081127 }
11091128 else throw("Strict value is not equal to itself.")
11201139 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
11211140 then {
11221141 let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1123- let $t03951639580 = refreshDLpInternal(0, 0, 0)
1124- let dLpUpdateActions = $t03951639580._1
1125- let updatedDLp = $t03951639580._2
1142+ let $t04032340387 = refreshDLpInternal(0, 0, 0)
1143+ let dLpUpdateActions = $t04032340387._1
1144+ let updatedDLp = $t04032340387._2
11261145 let actions = if ((dLp != updatedDLp))
11271146 then dLpUpdateActions
11281147 else throwErr("nothing to refresh")
11511170 let newY = getYD(xp, index, D1)
11521171 let dy = (xp[index] - newY)
11531172 let totalGetRaw = max([0, toInt((dy - big1))])
1154- let $t04048040529 = takeFee(totalGetRaw)
1155- let totalGet = $t04048040529._1
1156- let feeAmount = $t04048040529._2
1173+ let $t04128741336 = takeFee(totalGetRaw)
1174+ let totalGet = $t04128741336._1
1175+ let feeAmount = $t04128741336._2
11571176 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
11581177 }
11591178
11671186 let lpId = poolConfig[idxLPAsId]
11681187 let amBalance = getAccBalance(amId)
11691188 let prBalance = getAccBalance(prId)
1170- let $t04087440989 = {
1189+ let $t04168141796 = {
11711190 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
11721191 if ($isInstanceOf(@, "(Int, Int)"))
11731192 then @
11741193 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
11751194 }
1176- let totalGet = $t04087440989._1
1177- let feeAmount = $t04087440989._2
1195+ let totalGet = $t04168141796._1
1196+ let feeAmount = $t04168141796._2
11781197 let r = ego("", lpId, lpAssetAmount, this)
11791198 let outAmAmt = r._1
11801199 let outPrAmt = r._2
12021221 else if ((noLessThenPriceAsset > outPrAmt))
12031222 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
12041223 else {
1224+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
12051225 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12061226 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12071227 then {
1208- let $t04207542156 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1209- let refreshDLpActions = $t04207542156._1
1210- let updatedDLp = $t04207542156._2
1211- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1228+ let $t04296443045 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1229+ let refreshDLpActions = $t04296443045._1
1230+ let updatedDLp = $t04296443045._2
1231+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
12121232 if ((isUpdatedDLpValid == isUpdatedDLpValid))
12131233 then (state ++ refreshDLpActions)
12141234 else throw("Strict value is not equal to itself.")
12301250 let factoryCfg = gfc()
12311251 let lpAssetId = fromBase58String(cfg[idxLPAsId])
12321252 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1253+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
12331254 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
12341255 if ((unstakeInv == unstakeInv))
12351256 then {
12481269 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
12491270 if ((burnA == burnA))
12501271 then {
1251- let $t04313043211 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1252- let refreshDLpActions = $t04313043211._1
1253- let updatedDLp = $t04313043211._2
1254- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1272+ let $t04410844189 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1273+ let refreshDLpActions = $t04410844189._1
1274+ let updatedDLp = $t04410844189._2
1275+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
12551276 if ((isUpdatedDLpValid == isUpdatedDLpValid))
12561277 then (state ++ refreshDLpActions)
12571278 else throw("Strict value is not equal to itself.")
12791300 else throw("no payments are expected")]
12801301 if ((checks == checks))
12811302 then {
1303+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
12821304 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
12831305 if ((unstakeInv == unstakeInv))
12841306 then {
12961318 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
12971319 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12981320 then {
1299- let $t04437044451 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1300- let refreshDLpActions = $t04437044451._1
1301- let updatedDLp = $t04437044451._2
1302- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1321+ let $t04543745518 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1322+ let refreshDLpActions = $t04543745518._1
1323+ let updatedDLp = $t04543745518._2
1324+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
13031325 if ((isUpdatedDLpValid == isUpdatedDLpValid))
13041326 then (state ++ refreshDLpActions)
13051327 else throw("Strict value is not equal to itself.")
13441366 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
13451367 if ((unstakeInv == unstakeInv))
13461368 then {
1347- let $t04537345561 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1348- let state = $t04537345561._1
1349- let totalAmount = $t04537345561._2
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
13501372 $Tuple2(state, totalAmount)
13511373 }
13521374 else throw("Strict value is not equal to itself.")
13621384 let amId = poolConfig[idxAmAsId]
13631385 let prId = poolConfig[idxPrAsId]
13641386 let lpId = poolConfig[idxLPAsId]
1365- let $t04582045923 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1366- let lpAmount = $t04582045923._1
1367- let state = $t04582045923._2
1368- let feeAmount = $t04582045923._3
1369- let bonus = $t04582045923._4
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
13701392 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13711393 }
13721394
13781400 let amId = poolConfig[idxAmAsId]
13791401 let prId = poolConfig[idxPrAsId]
13801402 let lpId = poolConfig[idxLPAsId]
1381- let $t04620246306 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1382- let lpAmount = $t04620246306._1
1383- let state = $t04620246306._2
1384- let feeAmount = $t04620246306._3
1385- let bonus = $t04620246306._4
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
13861408 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13871409 }
13881410
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)
1717
1818 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
1919
2020 let wavesString = "WAVES"
2121
2222 let Amult = "100"
2323
2424 let Dconv = "1"
2525
2626 let SEP = "__"
2727
2828 let EMPTY = ""
2929
3030 let PoolActive = 1
3131
3232 let PoolPutDis = 2
3333
3434 let PoolMatcherDis = 3
3535
3636 let PoolShutdown = 4
3737
3838 let idxPoolAddress = 1
3939
4040 let idxPoolSt = 2
4141
4242 let idxLPAsId = 3
4343
4444 let idxAmAsId = 4
4545
4646 let idxPrAsId = 5
4747
4848 let idxAmtAsDcm = 6
4949
5050 let idxPriceAsDcm = 7
5151
5252 let idxIAmtAsId = 8
5353
5454 let idxIPriceAsId = 9
5555
5656 let idxFactStakCntr = 1
5757
5858 let idxFactoryRestCntr = 6
5959
6060 let idxFactSlippCntr = 7
6161
6262 let idxFactGwxRewCntr = 10
6363
6464 let feeDefault = fraction(10, scale8, 10000)
6565
6666 func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6767
6868
6969 func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
7070
7171
7272 func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7373
7474
7575 func abs (val) = if ((zeroBigInt > val))
7676 then -(val)
7777 else val
7878
7979
8080 func absBigInt (val) = if ((zeroBigInt > val))
8181 then -(val)
8282 else val
8383
8484
8585 func fc () = "%s__factoryContract"
8686
8787
8888 func mpk () = "%s__managerPublicKey"
8989
9090
9191 func pmpk () = "%s__pendingManagerPublicKey"
9292
9393
9494 func pl () = "%s%s__price__last"
9595
9696
9797 func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
9898
9999
100100 func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
101101
102102
103103 func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
104104
105105
106106 func aa () = "%s__amountAsset"
107107
108108
109109 func pa () = "%s__priceAsset"
110110
111111
112112 func amp () = "%s__amp"
113113
114114
115115 func ada () = "%s__addonAddr"
116116
117117
118118 let keyFee = "%s__fee"
119119
120120 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
121121
122122 let keyDLp = makeString(["%s", "dLp"], SEP)
123123
124124 let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP)
125125
126126 let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP)
127127
128128 let dLpRefreshDelayDefault = 30
129129
130130 let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault)
131131
132132 func fcfg () = "%s__factoryConfig"
133133
134134
135135 func mtpk () = "%s%s__matcher__publicKey"
136136
137137
138138 func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
139139
140140
141141 func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
142142
143143
144144 func aps () = "%s__shutdown"
145145
146146
147147 func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash"
148148
149149
150150 func keyFeeCollectorAddress () = "%s__feeCollectorAddress"
151151
152152
153153 func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
154154
155155
156156 func str (val) = match val {
157157 case valStr: String =>
158158 valStr
159159 case _ =>
160160 throw("fail cast to String")
161161 }
162162
163163
164164 func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
165165
166166
167167 func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
168168
169169
170170 func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " "))
171171
172172
173173 func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ")
174174
175175
176176 let fca = addressFromStringValue(strf(this, fc()))
177177
178178 let A = strf(this, amp())
179179
180180 func igs () = valueOrElse(getBoolean(fca, aps()), false)
181181
182182
183183 func mp () = fromBase58String(strf(fca, mtpk()))
184184
185185
186186 let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress()))
187187
188188 func gpc () = {
189189 let amtAs = strf(this, aa())
190190 let priceAs = strf(this, pa())
191191 let iPriceAs = intf(fca, mba(priceAs))
192192 let iAmtAs = intf(fca, mba(amtAs))
193193 split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
194194 }
195195
196196
197197 func parseAssetId (input) = if ((input == wavesString))
198198 then unit
199199 else fromBase58String(input)
200200
201201
202202 func assetIdToString (input) = if ((input == unit))
203203 then wavesString
204204 else toBase58String(value(input))
205205
206206
207207 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]))
208208
209209
210210 let poolConfigParsed = parsePoolConfig(gpc())
211211
212212 let $t072087394 = poolConfigParsed
213213
214214 let cfgPoolAddress = $t072087394._1
215215
216216 let cfgPoolStatus = $t072087394._2
217217
218218 let cfgLpAssetId = $t072087394._3
219219
220220 let cfgAmountAssetId = $t072087394._4
221221
222222 let cfgPriceAssetId = $t072087394._5
223223
224224 let cfgAmountAssetDecimals = $t072087394._6
225225
226226 let cfgPriceAssetDecimals = $t072087394._7
227227
228228 func gfc () = split(strf(fca, fcfg()), SEP)
229229
230230
231231 let factoryConfig = gfc()
232232
233233 let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address")
234234
235235 let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address")
236236
237237 let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address")
238238
239239 let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address")
240240
241241 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)
242242
243243
244244 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)
245245
246246
247247 func getAccBalance (assetId) = if ((assetId == "WAVES"))
248248 then wavesBalance(this).available
249249 else assetBalance(this, fromBase58String(assetId))
250250
251251
252252 func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
253253
254254
255255 func vad (A1,A2,slippage) = {
256256 let diff = fraction((A1 - A2), scale8BigInt, A2)
257257 let pass = ((slippage - abs(diff)) > zeroBigInt)
258258 if (!(pass))
259259 then throw(("Big slpg: " + toString(diff)))
260260 else $Tuple2(pass, min([A1, A2]))
261261 }
262262
263263
264264 func vd (D1,D0,slpg) = {
265265 let diff = fraction(D0, scale8BigInt, D1)
266266 let fail = (slpg > diff)
267267 if (if (fail)
268268 then true
269269 else (D0 > D1))
270270 then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
271271 else fail
272272 }
273273
274274
275275 func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
276276 let amtAsAmtX18 = t1(amAmt, amAssetDcm)
277277 let prAsAmtX18 = t1(prAmt, prAssetDcm)
278278 cpbi(prAsAmtX18, amtAsAmtX18)
279279 }
280280
281281
282282 func calcPrices (amAmt,prAmt,lpAmt) = {
283283 let cfg = gpc()
284284 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
285285 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
286286 let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
287287 let amAmtX18 = t1(amAmt, amtAsDcm)
288288 let prAmtX18 = t1(prAmt, prAsDcm)
289289 let lpAmtX18 = t1(lpAmt, scale8)
290290 let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
291291 let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
292292 [priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
293293 }
294294
295295
296296 func calculatePrices (amAmt,prAmt,lpAmt) = {
297297 let p = calcPrices(amAmt, prAmt, lpAmt)
298298 [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
299299 }
300300
301301
302302 func takeFee (amount) = {
303303 let feeAmount = fraction(amount, fee, scale8)
304304 $Tuple2((amount - feeAmount), feeAmount)
305305 }
306306
307307
308308 func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
309309 let cfg = gpc()
310310 let lpId = cfg[idxLPAsId]
311311 let amId = cfg[idxAmAsId]
312312 let prId = cfg[idxPrAsId]
313313 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
314314 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
315315 let sts = cfg[idxPoolSt]
316316 let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
317317 if ((lpId != pmtAssetId))
318318 then throw("Wrong pmt asset")
319319 else {
320320 let amBalance = getAccBalance(amId)
321321 let amBalanceX18 = t1(amBalance, amDcm)
322322 let prBalance = getAccBalance(prId)
323323 let prBalanceX18 = t1(prBalance, prDcm)
324324 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
325325 let curPrice = f1(curPriceX18, scale8)
326326 let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
327327 let lpEmissX18 = t1(lpEmiss, scale8)
328328 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
329329 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
330330 let outAmAmt = f1(outAmAmtX18, amDcm)
331331 let outPrAmt = f1(outPrAmtX18, prDcm)
332332 let state = if ((txId58 == ""))
333333 then nil
334334 else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
335335 then unit
336336 else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
337337 then unit
338338 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)]
339339 $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
340340 }
341341 }
342342
343343
344344 func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
345345 let cfg = gpc()
346346 let lpId = fromBase58String(cfg[idxLPAsId])
347347 let amIdStr = cfg[idxAmAsId]
348348 let prIdStr = cfg[idxPrAsId]
349349 let inAmIdStr = cfg[idxIAmtAsId]
350350 let inPrIdStr = cfg[idxIPriceAsId]
351351 let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
352352 let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
353353 let sts = cfg[idxPoolSt]
354354 let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
355355 let amBalance = if (isEval)
356356 then getAccBalance(amIdStr)
357357 else if (if (isOneAsset)
358358 then (pmtId == amIdStr)
359359 else false)
360360 then (getAccBalance(amIdStr) - pmtAmt)
361361 else if (isOneAsset)
362362 then getAccBalance(amIdStr)
363363 else (getAccBalance(amIdStr) - inAmAmt)
364364 let prBalance = if (isEval)
365365 then getAccBalance(prIdStr)
366366 else if (if (isOneAsset)
367367 then (pmtId == prIdStr)
368368 else false)
369369 then (getAccBalance(prIdStr) - pmtAmt)
370370 else if (isOneAsset)
371371 then getAccBalance(prIdStr)
372372 else (getAccBalance(prIdStr) - inPrAmt)
373373 let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
374374 let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
375375 let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
376376 let amBalanceX18 = t1(amBalance, amtDcm)
377377 let prBalanceX18 = t1(prBalance, priceDcm)
378378 let r = if ((lpEm == 0))
379379 then {
380380 let curPriceX18 = zeroBigInt
381381 let slippageX18 = zeroBigInt
382382 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
383383 $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
384384 }
385385 else {
386386 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
387387 let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
388388 let slippageX18 = t1(slippage, scale8)
389389 if (if (if (validateSlippage)
390390 then (curPriceX18 != zeroBigInt)
391391 else false)
392392 then (slippageRealX18 > slippageX18)
393393 else false)
394394 then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
395395 else {
396396 let lpEmissionX18 = t1(lpEm, scale8)
397397 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
398398 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
399399 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
400400 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
401401 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
402402 let expAmtAssetAmtX18 = expectedAmts._1
403403 let expPriceAssetAmtX18 = expectedAmts._2
404404 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
405405 $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
406406 }
407407 }
408408 let calcLpAmt = r._1
409409 let calcAmAssetPmt = r._2
410410 let calcPrAssetPmt = r._3
411411 let curPrice = f1(r._4, scale8)
412412 let slippageCalc = f1(r._5, scale8)
413413 if ((0 >= calcLpAmt))
414414 then throw("LP <= 0")
415415 else {
416416 let emitLpAmt = if (!(emitLp))
417417 then 0
418418 else calcLpAmt
419419 let amDiff = (inAmAmt - calcAmAssetPmt)
420420 let prDiff = (inPrAmt - calcPrAssetPmt)
421421 let $t01782518170 = if (if (isOneAsset)
422422 then (pmtId == amIdStr)
423423 else false)
424424 then $Tuple2(pmtAmt, 0)
425425 else if (if (isOneAsset)
426426 then (pmtId == prIdStr)
427427 else false)
428428 then $Tuple2(0, pmtAmt)
429429 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
430430 let writeAmAmt = $t01782518170._1
431431 let writePrAmt = $t01782518170._2
432432 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))]
433433 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
434434 }
435435 }
436436
437437
438438 func calcDLp (amountBalance,priceBalance,lpEmission) = {
439439 let updatedDLp = fraction((amountBalance * priceBalance), scale18, lpEmission)
440440 updatedDLp
441441 }
442442
443443
444+func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
445+ let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
446+ let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
447+ let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
448+ let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
449+ currentDLp
450+ }
451+
452+
444453 func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
445454 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
446455 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
447456 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
448457 let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
449458 let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))]
450459 $Tuple2(actions, updatedDLp)
451460 }
452461
453462
454-func validateUpdatedDLp (updatedDLp) = {
455- let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
456- let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
457- let lpAssetEmission = value(assetInfo(cfgLpAssetId)).quantity
458- let currentDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
459- if ((updatedDLp >= currentDLp))
460- then true
461- else throwErr("updated DLp lower than current DLp")
462- }
463+func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp))
464+ then true
465+ else throwErr("updated KLp lower than current KLp")
463466
464467
465468 func moa (order) = {
466469 let amountAssetAmount = order.amount
467470 let priceAssetAmount = fraction(order.amount, order.price, scale8)
468- let $t02058520797 = if ((order.orderType == Buy))
471+ let $t02077820990 = if ((order.orderType == Buy))
469472 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
470473 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
471- let amountAssetBalanceDelta = $t02058520797._1
472- let priceAssetBalanceDelta = $t02058520797._2
474+ let amountAssetBalanceDelta = $t02077820990._1
475+ let priceAssetBalanceDelta = $t02077820990._2
473476 if (if (if (igs())
474477 then true
475478 else (cfgPoolStatus == PoolMatcherDis))
476479 then true
477480 else (cfgPoolStatus == PoolShutdown))
478481 then throw("Admin blocked")
479482 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
480483 then true
481484 else (order.assetPair.priceAsset != cfgPriceAssetId))
482485 then throw("Wr assets")
483486 else {
484487 let dLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyDLp), fmtErr("dLp is required"))), fmtErr("invalid dLp"))
485- let $t02122421324 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
486- let unusedActions = $t02122421324._1
487- let dLpNew = $t02122421324._2
488+ let $t02141721517 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
489+ let unusedActions = $t02141721517._1
490+ let dLpNew = $t02141721517._2
488491 let isOrderValid = (dLpNew > dLp)
489492 isOrderValid
490493 }
491494 }
492495
493496
494497 func cg (i) = if ((size(i.payments) != 1))
495498 then throw("1 pmnt exp")
496499 else {
497500 let pmt = value(i.payments[0])
498501 let pmtAssetId = value(pmt.assetId)
499502 let pmtAmt = pmt.amount
500503 let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
501504 let outAmAmt = r._1
502505 let outPrAmt = r._2
503506 let sts = parseIntValue(r._9)
504507 let state = r._10
505508 if (if (igs())
506509 then true
507510 else (sts == PoolShutdown))
508511 then throw(("Admin blocked: " + toString(sts)))
509512 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
510513 }
511514
512515
513516 func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
514517 let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId)
515518 let sts = parseIntValue(r._8)
516519 if (if (if (igs())
517520 then true
518521 else (sts == PoolPutDis))
519522 then true
520523 else (sts == PoolShutdown))
521524 then throw(("Blocked:" + toString(sts)))
522525 else r
523526 }
524527
525528
526529 func getD (xp) = {
527530 let n = big2
528531 let xp0 = xp[0]
529532 let xp1 = xp[1]
530533 let aPrecision = parseBigIntValue(Amult)
531534 let a = (parseBigIntValue(A) * aPrecision)
532535 let s = (xp0 + xp1)
533536 if ((s == big0))
534537 then big0
535538 else {
536539 let ann = (a * n)
537540 let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
538541 let ann_s_aPrecision = ((ann * s) / aPrecision)
539542 let ann_aPrecision = (ann - aPrecision)
540543 let n1 = (n + big1)
541544 func calc (acc,cur) = {
542- let $t02347723497 = acc
543- let d = $t02347723497._1
544- let found = $t02347723497._2
545+ let $t02367023690 = acc
546+ let d = $t02367023690._1
547+ let found = $t02367023690._2
545548 if ((found != unit))
546549 then acc
547550 else {
548551 let dp = (((d * d) * d) / xp0_xp1_n_n)
549552 let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
550553 let dDiff = absBigInt((dNext - value(d)))
551554 if ((big1 >= dDiff))
552555 then $Tuple2(dNext, cur)
553556 else $Tuple2(dNext, unit)
554557 }
555558 }
556559
557560 let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
558- let $t02391823965 = {
561+ let $t02411124158 = {
559562 let $l = arr
560563 let $s = size($l)
561564 let $acc0 = $Tuple2(s, unit)
562565 func $f0_1 ($a,$i) = if (($i >= $s))
563566 then $a
564567 else calc($a, $l[$i])
565568
566569 func $f0_2 ($a,$i) = if (($i >= $s))
567570 then $a
568571 else throw("List size exceeds 15")
569572
570573 $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)
571574 }
572- let d = $t02391823965._1
573- let found = $t02391823965._2
575+ let d = $t02411124158._1
576+ let found = $t02411124158._2
574577 if ((found != unit))
575578 then d
576579 else throw(("D calculation error, D = " + toString(d)))
577580 }
578581 }
579582
580583
581584 func getYD (xp,i,D) = {
582585 let n = big2
583586 let x = xp[if ((i == 0))
584587 then 1
585588 else 0]
586589 let aPrecision = parseBigIntValue(Amult)
587590 let a = (parseBigIntValue(A) * aPrecision)
588591 let s = x
589592 let ann = (a * n)
590593 let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
591594 let b = ((s + ((D * aPrecision) / ann)) - D)
592595 func calc (acc,cur) = {
593- let $t02446524485 = acc
594- let y = $t02446524485._1
595- let found = $t02446524485._2
596+ let $t02465824678 = acc
597+ let y = $t02465824678._1
598+ let found = $t02465824678._2
596599 if ((found != unit))
597600 then acc
598601 else {
599602 let yNext = (((y * y) + c) / ((big2 * y) + b))
600603 let yDiff = absBigInt((yNext - value(y)))
601604 if ((big1 >= yDiff))
602605 then $Tuple2(yNext, cur)
603606 else $Tuple2(yNext, unit)
604607 }
605608 }
606609
607610 let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
608- let $t02479224839 = {
611+ let $t02498525032 = {
609612 let $l = arr
610613 let $s = size($l)
611614 let $acc0 = $Tuple2(D, unit)
612615 func $f0_1 ($a,$i) = if (($i >= $s))
613616 then $a
614617 else calc($a, $l[$i])
615618
616619 func $f0_2 ($a,$i) = if (($i >= $s))
617620 then $a
618621 else throw("List size exceeds 15")
619622
620623 $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)
621624 }
622- let y = $t02479224839._1
623- let found = $t02479224839._2
625+ let y = $t02498525032._1
626+ let found = $t02498525032._2
624627 if ((found != unit))
625628 then y
626629 else throw(("Y calculation error, Y = " + toString(y)))
627630 }
628631
629632
630633 func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = {
631634 let poolConfig = gpc()
632635 let amId = poolConfig[idxAmAsId]
633636 let prId = poolConfig[idxPrAsId]
634637 let lpId = poolConfig[idxLPAsId]
635638 let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm])
636639 let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm])
637640 let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
638641 let chechEmission = if ((lpAssetEmission > big0))
639642 then true
640643 else throw("initial deposit requires all coins")
641644 if ((chechEmission == chechEmission))
642645 then {
643646 let amBalance = getAccBalance(amId)
644647 let prBalance = getAccBalance(prId)
645- let $t02562226084 = if ((txId == ""))
648+ let $t02581526277 = if ((txId == ""))
646649 then $Tuple2(amBalance, prBalance)
647650 else if ((pmtAssetId == amId))
648651 then if ((pmtAmtRaw > amBalance))
649652 then throw("invalid payment amount")
650653 else $Tuple2((amBalance - pmtAmtRaw), prBalance)
651654 else if ((pmtAssetId == prId))
652655 then if ((pmtAmtRaw > prBalance))
653656 then throw("invalid payment amount")
654657 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
655658 else throw("wrong pmtAssetId")
656- let amBalanceOld = $t02562226084._1
657- let prBalanceOld = $t02562226084._2
658- let $t02609026266 = if ((pmtAssetId == amId))
659+ let amBalanceOld = $t02581526277._1
660+ let prBalanceOld = $t02581526277._2
661+ let $t02628326459 = if ((pmtAssetId == amId))
659662 then $Tuple2(pmtAmtRaw, 0)
660663 else if ((pmtAssetId == prId))
661664 then $Tuple2(0, pmtAmtRaw)
662665 else throw("invalid payment")
663- let amAmountRaw = $t02609026266._1
664- let prAmountRaw = $t02609026266._2
665- let $t02627026509 = if (withTakeFee)
666+ let amAmountRaw = $t02628326459._1
667+ let prAmountRaw = $t02628326459._2
668+ let $t02646326702 = if (withTakeFee)
666669 then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
667670 else $Tuple3(amAmountRaw, prAmountRaw, 0)
668- let amAmount = $t02627026509._1
669- let prAmount = $t02627026509._2
670- let feeAmount = $t02627026509._3
671+ let amAmount = $t02646326702._1
672+ let prAmount = $t02646326702._2
673+ let feeAmount = $t02646326702._3
671674 let amBalanceNew = (amBalanceOld + amAmount)
672675 let prBalanceNew = (prBalanceOld + prAmount)
673676 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
674677 let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
675678 let checkD = if ((D1 > D0))
676679 then true
677680 else throw()
678681 if ((checkD == checkD))
679682 then {
680683 let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0)
681684 let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8)
682685 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))]
683686 let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
684687 let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8))
685688 let priceAssetPart = (pmtAmtRaw - amountAssetPart)
686689 let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
687690 let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth))
688691 $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus)
689692 }
690693 else throw("Strict value is not equal to itself.")
691694 }
692695 else throw("Strict value is not equal to itself.")
693696 }
694697
695698
696699 func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = {
697700 let poolConfig = gpc()
698701 let lpId = poolConfig[idxLPAsId]
699702 let amId = poolConfig[idxAmAsId]
700703 let prId = poolConfig[idxPrAsId]
701704 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
702705 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
703706 let poolStatus = poolConfig[idxPoolSt]
704707 let userAddress = if ((caller == restContract))
705708 then originCaller
706709 else caller
707710 let pmt = value(payments[0])
708711 let pmtAssetId = value(pmt.assetId)
709712 let pmtAmt = pmt.amount
713+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
710714 let txId58 = toBase58String(transactionId)
711715 if ((lpId != toBase58String(pmtAssetId)))
712716 then throw("Wrong LP")
713717 else {
714718 let amBalance = getAccBalance(amId)
715719 let prBalance = getAccBalance(prId)
716- let $t02851128622 = {
720+ let $t02878628897 = {
717721 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
718722 if ($isInstanceOf(@, "(Int, Int)"))
719723 then @
720724 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
721725 }
722- if (($t02851128622 == $t02851128622))
726+ if (($t02878628897 == $t02878628897))
723727 then {
724- let feeAmount = $t02851128622._2
725- let totalGet = $t02851128622._1
728+ let feeAmount = $t02878628897._2
729+ let totalGet = $t02878628897._1
726730 let totalAmount = if (if ((minOutAmount > 0))
727731 then (minOutAmount > totalGet)
728732 else false)
729733 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
730734 else totalGet
731- let $t02881229119 = if ((outAssetId == amId))
735+ let $t02908729394 = if ((outAssetId == amId))
732736 then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
733737 else if ((outAssetId == prId))
734738 then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
735739 else throw("invalid out asset id")
736- let outAm = $t02881229119._1
737- let outPr = $t02881229119._2
738- let amBalanceNew = $t02881229119._3
739- let prBalanceNew = $t02881229119._4
740+ let outAm = $t02908729394._1
741+ let outPr = $t02908729394._2
742+ let amBalanceNew = $t02908729394._3
743+ let prBalanceNew = $t02908729394._4
740744 let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
741745 let curPr = f1(curPrX18, scale8)
742746 let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
743747 then unit
744748 else fromBase58String(outAssetId)
745749 let sendFeeToMatcher = if ((feeAmount > 0))
746750 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
747751 else nil
748752 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)
749753 if ((state == state))
750754 then {
751755 let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
752756 if ((burn == burn))
753757 then {
754- let $t02990430254 = {
758+ let $t03017930529 = {
755759 let feeAmountForCalc = if ((this == feeCollectorAddress))
756760 then 0
757761 else feeAmount
758762 let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId))
759763 then true
760764 else false
761765 if (outInAmountAsset)
762766 then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
763767 else $Tuple2(0, -((totalGet + feeAmountForCalc)))
764768 }
765- let amountAssetBalanceDelta = $t02990430254._1
766- let priceAssetBalanceDelta = $t02990430254._2
767- let $t03025730365 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
768- let refreshDLpActions = $t03025730365._1
769- let updatedDLp = $t03025730365._2
770- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
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
774+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
771775 if ((isUpdatedDLpValid == isUpdatedDLpValid))
772776 then $Tuple2((state ++ refreshDLpActions), totalAmount)
773777 else throw("Strict value is not equal to itself.")
774778 }
775779 else throw("Strict value is not equal to itself.")
776780 }
777781 else throw("Strict value is not equal to itself.")
778782 }
779783 else throw("Strict value is not equal to itself.")
780784 }
781785 }
782786
783787
784788 func m () = match getString(mpk()) {
785789 case s: String =>
786790 fromBase58String(s)
787791 case _: Unit =>
788792 unit
789793 case _ =>
790794 throw("Match error")
791795 }
792796
793797
794798 func pm () = match getString(pmpk()) {
795799 case s: String =>
796800 fromBase58String(s)
797801 case _: Unit =>
798802 unit
799803 case _ =>
800804 throw("Match error")
801805 }
802806
803807
804808 let pd = throw("Permission denied")
805809
806810 func isManager (i) = match m() {
807811 case pk: ByteVector =>
808812 (i.callerPublicKey == pk)
809813 case _: Unit =>
810814 (i.caller == this)
811815 case _ =>
812816 throw("Match error")
813817 }
814818
815819
816820 func mm (i) = match m() {
817821 case pk: ByteVector =>
818822 if ((i.callerPublicKey == pk))
819823 then true
820824 else pd
821825 case _: Unit =>
822826 if ((i.caller == this))
823827 then true
824828 else pd
825829 case _ =>
826830 throw("Match error")
827831 }
828832
829833
830834 @Callable(i)
831835 func constructor (fc) = {
832836 let c = mm(i)
833837 if ((c == c))
834838 then [StringEntry(fc(), fc)]
835839 else throw("Strict value is not equal to itself.")
836840 }
837841
838842
839843
840844 @Callable(i)
841845 func setManager (pendingManagerPublicKey) = {
842846 let c = mm(i)
843847 if ((c == c))
844848 then {
845849 let cm = fromBase58String(pendingManagerPublicKey)
846850 if ((cm == cm))
847851 then [StringEntry(pmpk(), pendingManagerPublicKey)]
848852 else throw("Strict value is not equal to itself.")
849853 }
850854 else throw("Strict value is not equal to itself.")
851855 }
852856
853857
854858
855859 @Callable(i)
856860 func confirmManager () = {
857861 let p = pm()
858862 let hpm = if (isDefined(p))
859863 then true
860864 else throw("No pending manager")
861865 if ((hpm == hpm))
862866 then {
863867 let cpm = if ((i.callerPublicKey == value(p)))
864868 then true
865869 else throw("You are not pending manager")
866870 if ((cpm == cpm))
867871 then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
868872 else throw("Strict value is not equal to itself.")
869873 }
870874 else throw("Strict value is not equal to itself.")
871875 }
872876
873877
874878
875879 @Callable(i)
876880 func put (slip,autoStake) = {
877881 let factCfg = gfc()
878882 let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
879883 let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
880884 if ((0 > slip))
881885 then throw("Wrong slippage")
882886 else if ((size(i.payments) != 2))
883887 then throw("2 pmnts expd")
884888 else {
885- 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, "")
886- let emitLpAmt = e._2
887- let lpAssetId = e._7
888- let state = e._9
889- let amDiff = e._10
890- let prDiff = e._11
891- let amId = e._12
892- let prId = e._13
893- let r = invoke(fca, "emit", [emitLpAmt], nil)
894- if ((r == r))
889+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
890+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
891+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
892+ if ((currentDLp == currentDLp))
895893 then {
896- let el = match r {
897- case legacy: Address =>
898- invoke(legacy, "emit", [emitLpAmt], nil)
899- case _ =>
900- unit
901- }
902- if ((el == el))
894+ 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, "")
895+ let emitLpAmt = e._2
896+ let lpAssetId = e._7
897+ let state = e._9
898+ let amDiff = e._10
899+ let prDiff = e._11
900+ let amId = e._12
901+ let prId = e._13
902+ let r = invoke(fca, "emit", [emitLpAmt], nil)
903+ if ((r == r))
903904 then {
904- let sa = if ((amDiff > 0))
905- then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
906- else nil
907- if ((sa == sa))
905+ let el = match r {
906+ case legacy: Address =>
907+ invoke(legacy, "emit", [emitLpAmt], nil)
908+ case _ =>
909+ unit
910+ }
911+ if ((el == el))
908912 then {
909- let sp = if ((prDiff > 0))
910- then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
913+ let sa = if ((amDiff > 0))
914+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
911915 else nil
912- if ((sp == sp))
916+ if ((sa == sa))
913917 then {
914- let lpTrnsfr = if (autoStake)
918+ let sp = if ((prDiff > 0))
919+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
920+ else nil
921+ if ((sp == sp))
915922 then {
916- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
917- if ((ss == ss))
918- then nil
923+ let lpTrnsfr = if (autoStake)
924+ then {
925+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
926+ if ((ss == ss))
927+ then nil
928+ else throw("Strict value is not equal to itself.")
929+ }
930+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
931+ let $t03449634561 = refreshDLpInternal(0, 0, 0)
932+ let refreshDLpActions = $t03449634561._1
933+ let updatedDLp = $t03449634561._2
934+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
935+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
936+ then ((state ++ lpTrnsfr) ++ refreshDLpActions)
919937 else throw("Strict value is not equal to itself.")
920938 }
921- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
922- let $t03400834073 = refreshDLpInternal(0, 0, 0)
923- let refreshDLpActions = $t03400834073._1
924- let updatedDLp = $t03400834073._2
925- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
926- if ((isUpdatedDLpValid == isUpdatedDLpValid))
927- then ((state ++ lpTrnsfr) ++ refreshDLpActions)
928939 else throw("Strict value is not equal to itself.")
929940 }
930941 else throw("Strict value is not equal to itself.")
931942 }
932943 else throw("Strict value is not equal to itself.")
933944 }
934945 else throw("Strict value is not equal to itself.")
935946 }
936947 else throw("Strict value is not equal to itself.")
937948 }
938949 }
939950
940951
941952
942953 @Callable(i)
943954 func putOneTknV2 (minOutAmount,autoStake) = {
944955 let isPoolOneTokenOperationsDisabled = {
945956 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
946957 if ($isInstanceOf(@, "Boolean"))
947958 then @
948959 else throw(($getType(@) + " couldn't be cast to Boolean"))
949960 }
950961 let isPutDisabled = if (if (if (igs())
951962 then true
952963 else (cfgPoolStatus == PoolPutDis))
953964 then true
954965 else (cfgPoolStatus == PoolShutdown))
955966 then true
956967 else isPoolOneTokenOperationsDisabled
957968 let checks = [if (if (!(isPutDisabled))
958969 then true
959970 else isManager(i))
960971 then true
961972 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
962973 then true
963974 else throwErr("exactly 1 payment are expected")]
964975 if ((checks == checks))
965976 then {
966977 let poolConfig = gpc()
967978 let amId = poolConfig[idxAmAsId]
968979 let prId = poolConfig[idxPrAsId]
969980 let lpId = fromBase58String(poolConfig[idxLPAsId])
970981 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
971982 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
972983 let userAddress = if ((i.caller == this))
973984 then i.originCaller
974985 else i.caller
975986 let pmt = value(i.payments[0])
976987 let pmtAssetId = toBase58String(value(pmt.assetId))
977988 let pmtAmt = pmt.amount
978- let $t03519835356 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
979- if (($t03519835356 == $t03519835356))
989+ let $t03569835856 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
990+ if (($t03569835856 == $t03569835856))
980991 then {
981- let feeAmount = $t03519835356._3
982- let state = $t03519835356._2
983- let estimLP = $t03519835356._1
992+ let feeAmount = $t03569835856._3
993+ let state = $t03569835856._2
994+ let estimLP = $t03569835856._1
984995 let emitLpAmt = if (if ((minOutAmount > 0))
985996 then (minOutAmount > estimLP)
986997 else false)
987998 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
988999 else estimLP
9891000 let e = invoke(fca, "emit", [emitLpAmt], nil)
9901001 if ((e == e))
9911002 then {
9921003 let el = match e {
9931004 case legacy: Address =>
9941005 invoke(legacy, "emit", [emitLpAmt], nil)
9951006 case _ =>
9961007 unit
9971008 }
9981009 if ((el == el))
9991010 then {
10001011 let lpTrnsfr = if (autoStake)
10011012 then {
10021013 let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
10031014 if ((ss == ss))
10041015 then nil
10051016 else throw("Strict value is not equal to itself.")
10061017 }
10071018 else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
10081019 let sendFeeToMatcher = if ((feeAmount > 0))
10091020 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
10101021 else nil
1011- let $t03617136520 = if ((this == feeCollectorAddress))
1022+ let $t03667137020 = if ((this == feeCollectorAddress))
10121023 then $Tuple2(0, 0)
10131024 else {
10141025 let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
10151026 then true
10161027 else false
10171028 if (paymentInAmountAsset)
10181029 then $Tuple2(-(feeAmount), 0)
10191030 else $Tuple2(0, -(feeAmount))
10201031 }
1021- let amountAssetBalanceDelta = $t03617136520._1
1022- let priceAssetBalanceDelta = $t03617136520._2
1023- let $t03652336631 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1024- let refreshDLpActions = $t03652336631._1
1025- let updatedDLp = $t03652336631._2
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
10261037 $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
10271038 }
10281039 else throw("Strict value is not equal to itself.")
10291040 }
10301041 else throw("Strict value is not equal to itself.")
10311042 }
10321043 else throw("Strict value is not equal to itself.")
10331044 }
10341045 else throw("Strict value is not equal to itself.")
10351046 }
10361047
10371048
10381049
10391050 @Callable(i)
10401051 func putForFree (maxSlpg) = if ((0 > maxSlpg))
10411052 then throw("Wrong slpg")
10421053 else if ((size(i.payments) != 2))
10431054 then throw("2 pmnts expd")
10441055 else {
10451056 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, "")
10461057 let state = estPut._9
1047- let $t03738937454 = refreshDLpInternal(0, 0, 0)
1048- let refreshDLpActions = $t03738937454._1
1049- let updatedDLp = $t03738937454._2
1050- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1051- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1052- then (state ++ refreshDLpActions)
1058+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1059+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1060+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
1061+ if ((currentDLp == currentDLp))
1062+ then {
1063+ let $t03809038155 = refreshDLpInternal(0, 0, 0)
1064+ let refreshDLpActions = $t03809038155._1
1065+ let updatedDLp = $t03809038155._2
1066+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1067+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1068+ then (state ++ refreshDLpActions)
1069+ else throw("Strict value is not equal to itself.")
1070+ }
10531071 else throw("Strict value is not equal to itself.")
10541072 }
10551073
10561074
10571075
10581076 @Callable(i)
10591077 func get () = {
10601078 let r = cg(i)
10611079 let outAmtAmt = r._1
10621080 let outPrAmt = r._2
10631081 let pmtAmt = r._3
10641082 let pmtAssetId = r._4
10651083 let state = r._5
10661084 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10671085 if ((b == b))
10681086 then {
1069- let $t03814938231 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1070- let refreshDLpActions = $t03814938231._1
1071- let updatedDLp = $t03814938231._2
1072- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1087+ 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
1091+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
10731092 if ((isUpdatedDLpValid == isUpdatedDLpValid))
10741093 then (state ++ refreshDLpActions)
10751094 else throw("Strict value is not equal to itself.")
10761095 }
10771096 else throw("Strict value is not equal to itself.")
10781097 }
10791098
10801099
10811100
10821101 @Callable(i)
10831102 func getOneTknV2 (outAssetId,minOutAmount) = {
10841103 let isPoolOneTokenOperationsDisabled = {
10851104 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
10861105 if ($isInstanceOf(@, "Boolean"))
10871106 then @
10881107 else throw(($getType(@) + " couldn't be cast to Boolean"))
10891108 }
10901109 let isGetDisabled = if (if (igs())
10911110 then true
10921111 else (cfgPoolStatus == PoolShutdown))
10931112 then true
10941113 else isPoolOneTokenOperationsDisabled
10951114 let checks = [if (if (!(isGetDisabled))
10961115 then true
10971116 else isManager(i))
10981117 then true
10991118 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
11001119 then true
11011120 else throwErr("exactly 1 payment are expected")]
11021121 if ((checks == checks))
11031122 then {
1104- let $t03883738992 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1105- let state = $t03883738992._1
1106- let totalAmount = $t03883738992._2
1123+ let $t03964439799 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1124+ let state = $t03964439799._1
1125+ let totalAmount = $t03964439799._2
11071126 $Tuple2(state, totalAmount)
11081127 }
11091128 else throw("Strict value is not equal to itself.")
11101129 }
11111130
11121131
11131132
11141133 @Callable(i)
11151134 func refreshDLp () = {
11161135 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
11171136 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
11181137 then unit
11191138 else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
11201139 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
11211140 then {
11221141 let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1123- let $t03951639580 = refreshDLpInternal(0, 0, 0)
1124- let dLpUpdateActions = $t03951639580._1
1125- let updatedDLp = $t03951639580._2
1142+ let $t04032340387 = refreshDLpInternal(0, 0, 0)
1143+ let dLpUpdateActions = $t04032340387._1
1144+ let updatedDLp = $t04032340387._2
11261145 let actions = if ((dLp != updatedDLp))
11271146 then dLpUpdateActions
11281147 else throwErr("nothing to refresh")
11291148 $Tuple2(actions, toString(updatedDLp))
11301149 }
11311150 else throw("Strict value is not equal to itself.")
11321151 }
11331152
11341153
11351154
11361155 @Callable(i)
11371156 func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
11381157 let poolConfig = gpc()
11391158 let amId = poolConfig[idxAmAsId]
11401159 let prId = poolConfig[idxPrAsId]
11411160 let lpId = poolConfig[idxLPAsId]
11421161 let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))]
11431162 let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
11441163 let D0 = getD(xp)
11451164 let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission))
11461165 let index = if ((outAssetId == amId))
11471166 then 0
11481167 else if ((outAssetId == prId))
11491168 then 1
11501169 else throw("invalid out asset id")
11511170 let newY = getYD(xp, index, D1)
11521171 let dy = (xp[index] - newY)
11531172 let totalGetRaw = max([0, toInt((dy - big1))])
1154- let $t04048040529 = takeFee(totalGetRaw)
1155- let totalGet = $t04048040529._1
1156- let feeAmount = $t04048040529._2
1173+ let $t04128741336 = takeFee(totalGetRaw)
1174+ let totalGet = $t04128741336._1
1175+ let feeAmount = $t04128741336._2
11571176 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
11581177 }
11591178
11601179
11611180
11621181 @Callable(i)
11631182 func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = {
11641183 let poolConfig = gpc()
11651184 let amId = poolConfig[idxAmAsId]
11661185 let prId = poolConfig[idxPrAsId]
11671186 let lpId = poolConfig[idxLPAsId]
11681187 let amBalance = getAccBalance(amId)
11691188 let prBalance = getAccBalance(prId)
1170- let $t04087440989 = {
1189+ let $t04168141796 = {
11711190 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
11721191 if ($isInstanceOf(@, "(Int, Int)"))
11731192 then @
11741193 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
11751194 }
1176- let totalGet = $t04087440989._1
1177- let feeAmount = $t04087440989._2
1195+ let totalGet = $t04168141796._1
1196+ let feeAmount = $t04168141796._2
11781197 let r = ego("", lpId, lpAssetAmount, this)
11791198 let outAmAmt = r._1
11801199 let outPrAmt = r._2
11811200 let sumOfGetAssets = (outAmAmt + outPrAmt)
11821201 let bonus = if ((sumOfGetAssets == 0))
11831202 then if ((totalGet == 0))
11841203 then 0
11851204 else throw("bonus calculation error")
11861205 else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets)
11871206 $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus))
11881207 }
11891208
11901209
11911210
11921211 @Callable(i)
11931212 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
11941213 let r = cg(i)
11951214 let outAmAmt = r._1
11961215 let outPrAmt = r._2
11971216 let pmtAmt = r._3
11981217 let pmtAssetId = r._4
11991218 let state = r._5
12001219 if ((noLessThenAmtAsset > outAmAmt))
12011220 then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
12021221 else if ((noLessThenPriceAsset > outPrAmt))
12031222 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
12041223 else {
1224+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
12051225 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12061226 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12071227 then {
1208- let $t04207542156 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1209- let refreshDLpActions = $t04207542156._1
1210- let updatedDLp = $t04207542156._2
1211- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1228+ let $t04296443045 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1229+ let refreshDLpActions = $t04296443045._1
1230+ let updatedDLp = $t04296443045._2
1231+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
12121232 if ((isUpdatedDLpValid == isUpdatedDLpValid))
12131233 then (state ++ refreshDLpActions)
12141234 else throw("Strict value is not equal to itself.")
12151235 }
12161236 else throw("Strict value is not equal to itself.")
12171237 }
12181238 }
12191239
12201240
12211241
12221242 @Callable(i)
12231243 func unstakeAndGet (amount) = {
12241244 let checkPayments = if ((size(i.payments) != 0))
12251245 then throw("No pmnts expd")
12261246 else true
12271247 if ((checkPayments == checkPayments))
12281248 then {
12291249 let cfg = gpc()
12301250 let factoryCfg = gfc()
12311251 let lpAssetId = fromBase58String(cfg[idxLPAsId])
12321252 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1253+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
12331254 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
12341255 if ((unstakeInv == unstakeInv))
12351256 then {
12361257 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
12371258 let outAmAmt = r._1
12381259 let outPrAmt = r._2
12391260 let sts = parseIntValue(r._9)
12401261 let state = r._10
12411262 let v = if (if (igs())
12421263 then true
12431264 else (sts == PoolShutdown))
12441265 then throw(("Blocked: " + toString(sts)))
12451266 else true
12461267 if ((v == v))
12471268 then {
12481269 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
12491270 if ((burnA == burnA))
12501271 then {
1251- let $t04313043211 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1252- let refreshDLpActions = $t04313043211._1
1253- let updatedDLp = $t04313043211._2
1254- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1272+ let $t04410844189 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1273+ let refreshDLpActions = $t04410844189._1
1274+ let updatedDLp = $t04410844189._2
1275+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
12551276 if ((isUpdatedDLpValid == isUpdatedDLpValid))
12561277 then (state ++ refreshDLpActions)
12571278 else throw("Strict value is not equal to itself.")
12581279 }
12591280 else throw("Strict value is not equal to itself.")
12601281 }
12611282 else throw("Strict value is not equal to itself.")
12621283 }
12631284 else throw("Strict value is not equal to itself.")
12641285 }
12651286 else throw("Strict value is not equal to itself.")
12661287 }
12671288
12681289
12691290
12701291 @Callable(i)
12711292 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
12721293 let isGetDisabled = if (igs())
12731294 then true
12741295 else (cfgPoolStatus == PoolShutdown)
12751296 let checks = [if (!(isGetDisabled))
12761297 then true
12771298 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
12781299 then true
12791300 else throw("no payments are expected")]
12801301 if ((checks == checks))
12811302 then {
1303+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
12821304 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
12831305 if ((unstakeInv == unstakeInv))
12841306 then {
12851307 let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
12861308 let outAmAmt = res._1
12871309 let outPrAmt = res._2
12881310 let state = res._10
12891311 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
12901312 then true
12911313 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
12921314 then true
12931315 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
12941316 if ((checkAmounts == checkAmounts))
12951317 then {
12961318 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
12971319 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12981320 then {
1299- let $t04437044451 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1300- let refreshDLpActions = $t04437044451._1
1301- let updatedDLp = $t04437044451._2
1302- let isUpdatedDLpValid = validateUpdatedDLp(updatedDLp)
1321+ let $t04543745518 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1322+ let refreshDLpActions = $t04543745518._1
1323+ let updatedDLp = $t04543745518._2
1324+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
13031325 if ((isUpdatedDLpValid == isUpdatedDLpValid))
13041326 then (state ++ refreshDLpActions)
13051327 else throw("Strict value is not equal to itself.")
13061328 }
13071329 else throw("Strict value is not equal to itself.")
13081330 }
13091331 else throw("Strict value is not equal to itself.")
13101332 }
13111333 else throw("Strict value is not equal to itself.")
13121334 }
13131335 else throw("Strict value is not equal to itself.")
13141336 }
13151337
13161338
13171339
13181340 @Callable(i)
13191341 func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = {
13201342 let isPoolOneTokenOperationsDisabled = {
13211343 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13221344 if ($isInstanceOf(@, "Boolean"))
13231345 then @
13241346 else throw(($getType(@) + " couldn't be cast to Boolean"))
13251347 }
13261348 let isGetDisabled = if (if (igs())
13271349 then true
13281350 else (cfgPoolStatus == PoolShutdown))
13291351 then true
13301352 else isPoolOneTokenOperationsDisabled
13311353 let checks = [if (if (!(isGetDisabled))
13321354 then true
13331355 else isManager(i))
13341356 then true
13351357 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13361358 then true
13371359 else throwErr("no payments are expected")]
13381360 if ((checks == checks))
13391361 then {
13401362 let cfg = gpc()
13411363 let factoryCfg = gfc()
13421364 let lpAssetId = fromBase58String(cfg[idxLPAsId])
13431365 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
13441366 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
13451367 if ((unstakeInv == unstakeInv))
13461368 then {
1347- let $t04537345561 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1348- let state = $t04537345561._1
1349- let totalAmount = $t04537345561._2
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
13501372 $Tuple2(state, totalAmount)
13511373 }
13521374 else throw("Strict value is not equal to itself.")
13531375 }
13541376 else throw("Strict value is not equal to itself.")
13551377 }
13561378
13571379
13581380
13591381 @Callable(i)
13601382 func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = {
13611383 let poolConfig = gpc()
13621384 let amId = poolConfig[idxAmAsId]
13631385 let prId = poolConfig[idxPrAsId]
13641386 let lpId = poolConfig[idxLPAsId]
1365- let $t04582045923 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1366- let lpAmount = $t04582045923._1
1367- let state = $t04582045923._2
1368- let feeAmount = $t04582045923._3
1369- let bonus = $t04582045923._4
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
13701392 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13711393 }
13721394
13731395
13741396
13751397 @Callable(i)
13761398 func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = {
13771399 let poolConfig = gpc()
13781400 let amId = poolConfig[idxAmAsId]
13791401 let prId = poolConfig[idxPrAsId]
13801402 let lpId = poolConfig[idxLPAsId]
1381- let $t04620246306 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1382- let lpAmount = $t04620246306._1
1383- let state = $t04620246306._2
1384- let feeAmount = $t04620246306._3
1385- let bonus = $t04620246306._4
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
13861408 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13871409 }
13881410
13891411
13901412
13911413 @Callable(i)
13921414 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
13931415 then throw("denied")
13941416 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
13951417
13961418
13971419
13981420 @Callable(i)
13991421 func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
14001422 then pd
14011423 else [StringEntry(k, v)]
14021424
14031425
14041426
14051427 @Callable(i)
14061428 func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
14071429 then pd
14081430 else [IntegerEntry(k, v)]
14091431
14101432
14111433
14121434 @Callable(i)
14131435 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
14141436
14151437
14161438
14171439 @Callable(i)
14181440 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
14191441
14201442
14211443
14221444 @Callable(i)
14231445 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
14241446 let pr = calcPrices(amAmt, prAmt, lpAmt)
14251447 $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
14261448 }
14271449
14281450
14291451
14301452 @Callable(i)
14311453 func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
14321454
14331455
14341456
14351457 @Callable(i)
14361458 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
14371459
14381460
14391461
14401462 @Callable(i)
14411463 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
14421464
14431465
14441466
14451467 @Callable(i)
14461468 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, ""))
14471469
14481470
14491471
14501472 @Callable(i)
14511473 func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
14521474 let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
14531475 $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
14541476 }
14551477
14561478
14571479
14581480 @Callable(i)
14591481 func getFeeREADONLY () = $Tuple2(nil, fee)
14601482
14611483
14621484 @Verifier(tx)
14631485 func verify () = {
14641486 let targetPublicKey = match m() {
14651487 case pk: ByteVector =>
14661488 pk
14671489 case _: Unit =>
14681490 tx.senderPublicKey
14691491 case _ =>
14701492 throw("Match error")
14711493 }
14721494 match tx {
14731495 case order: Order =>
14741496 let matcherPub = mp()
14751497 let orderValid = moa(order)
14761498 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14771499 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
14781500 if (if (if (orderValid)
14791501 then senderValid
14801502 else false)
14811503 then matcherValid
14821504 else false)
14831505 then true
14841506 else toe(orderValid, senderValid, matcherValid)
14851507 case s: SetScriptTransaction =>
14861508 let newHash = blake2b256(value(s.script))
14871509 let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash())))
14881510 let currentHash = scriptHash(this)
14891511 if (if ((allowedHash == newHash))
14901512 then (currentHash != newHash)
14911513 else false)
14921514 then true
14931515 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14941516 case _ =>
14951517 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14961518 }
14971519 }
14981520

github/deemru/w8io/169f3d6 
181.41 ms