tx · Gz64QcKwVrRVgTixQCLM99VYeRiAVDayozszDaiZtyQ5

3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA:  -0.03300000 Waves

2022.10.07 10:21 [2261609] smart account 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA > SELF 0.00000000 Waves

{ "type": 13, "id": "Gz64QcKwVrRVgTixQCLM99VYeRiAVDayozszDaiZtyQ5", "fee": 3300000, "feeAssetId": null, "timestamp": 1665127320656, "version": 1, "sender": "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA", "senderPublicKey": "35yd3qw1gxKDxKwGAykHN9fANbXNWwseaUwbWDj24o3x", "proofs": [ "3Rs61f2BLGdycg2VE4BGcfQbH4GUXRfUnkJtLoz1b6qnz3T59NU9ujXf93qU39gw2GQhs3scdz9woMAf4pRnbYdd" ], "script": "base64:BgK1IQgCEgMKAQgSAwoBCBIAEgQKAgEEEgcKBQEBAQEEEgQKAgEEEgMKAQESABIHCgUBAQEIARIECgIIARIECgIIARIECgIIARIECgIIARIECgIBARIDCgEBEgUKAwEIARIECgIBCBIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgpzbGlwcGFnZTREIgVBbXVsdCIFRGNvbnYiA1NFUCIFRU1QVFkiClBvb2xBY3RpdmUiClBvb2xQdXREaXMiDlBvb2xNYXRjaGVyRGlzIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIglpZHhQb29sU3QiCWlkeExQQXNJZCIJaWR4QW1Bc0lkIglpZHhQckFzSWQiC2lkeEFtdEFzRGNtIg1pZHhQcmljZUFzRGNtIgtpZHhJQW10QXNJZCINaWR4SVByaWNlQXNJZCIPaWR4RmFjdFN0YWtDbnRyIhBpZHh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wAACAUCZGUPc2VuZGVyUHVibGljS2V5BAJnTwkA9AMDCAUCZGUJYm9keUJ5dGVzCQCRAwIIBQJkZQZwcm9vZnMAAQUCZ0wDAwMFAmdNBQJnTgcFAmdPBwYJAQJhcQMFAmdNBQJnTgUCZ08DCQABAgUCYXYCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJkRQUCYXYEAmdQCQD2AwEJAQV2YWx1ZQEIBQJkRQZzY3JpcHQEAmdRCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUIJAQJhbwAEAmdSCQDxBwEFBHRoaXMDAwkAAAIFAmdRBQJnUAkBAiE9AgUCZ1IFAmdQBwYJAPQDAwgFAmdJCWJvZHlCeXRlcwkAkQMCCAUCZ0kGcHJvb2ZzAAAFAmdLCQD0AwMIBQJnSQlib2R5Qnl0ZXMJAJEDAggFAmdJBnByb29mcwAABQJnS0ATk4E=", "chainId": 84, "height": 2261609, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DLRS2yrdxrwTPucfLa2nqdVLujKuymogcB3G4gy6gckq Next: Ex7MCG9jFNn35Ly6TaGzRK9f6u5oSGT8h2Ud2UWJeXD8 Diff:
OldNewDifferences
459459 }
460460
461461
462-func estimatePutOneTknV2 (pmtAmtRaw,pmtAssetId,userAddress,txId) = {
462+func getD (xp) = {
463+ let n = big2
464+ let xp0 = xp[0]
465+ let xp1 = xp[1]
466+ let aPrecision = parseBigIntValue(Amult)
467+ let a = (parseBigIntValue(A) * aPrecision)
468+ let s = (xp0 + xp1)
469+ if ((s == big0))
470+ then big0
471+ else {
472+ let ann = (a * n)
473+ func calc (acc,cur) = {
474+ let $t02109621116 = acc
475+ let d = $t02109621116._1
476+ let found = $t02109621116._2
477+ if ((found != unit))
478+ then acc
479+ else {
480+ let dp = (((d * d) * d) / (((xp0 * xp1) * n) * n))
481+ let dNext = (((((ann * s) / aPrecision) + (dp * n)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((n + big1) * dp)))
482+ let dDiff = absBigInt((dNext - value(d)))
483+ if ((big1 >= dDiff))
484+ then $Tuple2(dNext, cur)
485+ else $Tuple2(dNext, unit)
486+ }
487+ }
488+
489+ let arr = [0, 1, 2, 3, 4, 5, 6]
490+ let $t02153221578 = {
491+ let $l = arr
492+ let $s = size($l)
493+ let $acc0 = $Tuple2(s, unit)
494+ func $f0_1 ($a,$i) = if (($i >= $s))
495+ then $a
496+ else calc($a, $l[$i])
497+
498+ func $f0_2 ($a,$i) = if (($i >= $s))
499+ then $a
500+ else throw("List size exceeds 7")
501+
502+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7)
503+ }
504+ let d = $t02153221578._1
505+ let found = $t02153221578._2
506+ if ((found != unit))
507+ then d
508+ else throw(("D calculation error, D = " + toString(d)))
509+ }
510+ }
511+
512+
513+func getYD (xp,i,D) = {
514+ let n = big2
515+ let x = xp[if ((i == 0))
516+ then 1
517+ else 0]
518+ let aPrecision = parseBigIntValue(Amult)
519+ let a = (parseBigIntValue(A) * aPrecision)
520+ let s = x
521+ let ann = (a * n)
522+ let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
523+ let b = ((s + ((D * aPrecision) / ann)) - D)
524+ func calc (acc,cur) = {
525+ let $t02207822098 = acc
526+ let y = $t02207822098._1
527+ let found = $t02207822098._2
528+ if ((found != unit))
529+ then acc
530+ else {
531+ let yNext = (((y * y) + c) / ((big2 * y) + b))
532+ let yDiff = absBigInt((yNext - value(y)))
533+ if ((big1 >= yDiff))
534+ then $Tuple2(yNext, cur)
535+ else $Tuple2(yNext, unit)
536+ }
537+ }
538+
539+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
540+ let $t02240522452 = {
541+ let $l = arr
542+ let $s = size($l)
543+ let $acc0 = $Tuple2(D, unit)
544+ func $f0_1 ($a,$i) = if (($i >= $s))
545+ then $a
546+ else calc($a, $l[$i])
547+
548+ func $f0_2 ($a,$i) = if (($i >= $s))
549+ then $a
550+ else throw("List size exceeds 15")
551+
552+ $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)
553+ }
554+ let y = $t02240522452._1
555+ let found = $t02240522452._2
556+ if ((found != unit))
557+ then y
558+ else throw(("Y calculation error, Y = " + toString(y)))
559+ }
560+
561+
562+func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId) = {
463563 let poolConfig = gpc()
464564 let amId = poolConfig[idxAmAsId]
465565 let prId = poolConfig[idxPrAsId]
566+ let lpId = poolConfig[idxLPAsId]
567+ let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm])
568+ let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm])
466569 let amBalance = getAccBalance(amId)
467570 let prBalance = getAccBalance(prId)
468- let $t02102721072 = takeFee(pmtAmtRaw)
469- let pmtAmt = $t02102721072._1
470- let feeAmount = $t02102721072._2
471- let $t02107621537 = if ((txId == ""))
571+ let $t02299423039 = takeFee(pmtAmtRaw)
572+ let pmtAmt = $t02299423039._1
573+ let feeAmount = $t02299423039._2
574+ let $t02304323504 = if ((txId == ""))
472575 then $Tuple2(amBalance, prBalance)
473576 else if ((pmtAssetId == amId))
474577 then if ((pmtAmtRaw > amBalance))
479582 then throw("invalid payment amount")
480583 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
481584 else throw("wrong pmtAssetId")
482- let amBalanceNow = $t02107621537._1
483- let prBalanceNow = $t02107621537._2
484- let $t02154121675 = if ((pmtAssetId == amId))
485- then $Tuple2(amBalanceNow, prBalanceNow)
486- else $Tuple2(prBalanceNow, amBalanceNow)
487- let amBalanceForCalc = $t02154121675._1
488- let prBalanceForCalc = $t02154121675._2
489- let xPrecision = 1
490- let result = {
491- let @ = invoke(gwxContract, "calcPutXOnly", [toString(pmtAmt), toString(amBalanceForCalc), toString(prBalanceForCalc), "", A, Amult, toString(xPrecision), Dconv], nil)
492- if ($isInstanceOf(@, "(Int, Int)"))
493- then @
494- else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
495- }
496- let $t02214422240 = if ((pmtAssetId == amId))
497- then result
498- else $Tuple2(result._2, result._1)
499- let amAssetPart = $t02214422240._1
500- let prAssetPart = $t02214422240._2
501- let estPut = cp(userAddress, txId, AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), 0, true, true, false, pmtAmtRaw, pmtAssetId)
502- let estimLP = estPut._2
503- let lpAssetId = estPut._7
504- let state = estPut._9
505- let amDiff = estPut._10
506- let prDiff = estPut._11
507- estPut
585+ let amBalanceOld = $t02304323504._1
586+ let prBalanceOld = $t02304323504._2
587+ let $t02351023674 = if ((pmtAssetId == amId))
588+ then $Tuple2(pmtAmt, 0)
589+ else if ((pmtAssetId == prId))
590+ then $Tuple2(0, pmtAmt)
591+ else throw("invalid payment")
592+ let amAmount = $t02351023674._1
593+ let prAmount = $t02351023674._2
594+ let amBalanceNew = (amBalanceOld + amAmount)
595+ let prBalanceNew = (prBalanceOld + prAmount)
596+ let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
597+ let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
598+ let checkD = if ((D1 > D0))
599+ then true
600+ else throw()
601+ if ((checkD == checkD))
602+ then {
603+ let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
604+ let lpAmount = if ((lpAssetEmission > big0))
605+ then fraction(lpAssetEmission, (D1 - D0), D0)
606+ else throw("initial deposit requires all coins")
607+ let curPrice = {
608+ let amBalanceX18 = t1(amBalance, amtDcm)
609+ let prBalanceX18 = t1(prBalance, priceDcm)
610+ f1(cpbi(prBalanceX18, amBalanceX18), scale8)
611+ }
612+ let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmount, prAmount, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))]
613+ let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
614+ let amountAssetPart = fraction(pmtAmt, scale8, (poolProportion + scale8))
615+ let priceAssetPart = (pmtAmt - amountAssetPart)
616+ let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
617+ let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth))
618+ $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus)
619+ }
620+ else throw("Strict value is not equal to itself.")
508621 }
509622
510623
533646 else {
534647 let amBalance = getAccBalance(amId)
535648 let prBalance = getAccBalance(prId)
536- let $t02359523703 = {
649+ let $t02606926177 = {
537650 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
538651 if ($isInstanceOf(@, "(Int, Int)"))
539652 then @
540653 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
541654 }
542- let totalGet = $t02359523703._1
543- let feeAmount = $t02359523703._2
655+ let totalGet = $t02606926177._1
656+ let feeAmount = $t02606926177._2
544657 let totalAmount = if (if ((minOutAmount > 0))
545658 then (minOutAmount > totalGet)
546659 else false)
547660 then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
548661 else totalGet
549- let $t02389023977 = if ((outAssetId == amId))
662+ let $t02636426451 = if ((outAssetId == amId))
550663 then $Tuple2(totalAmount, 0)
551664 else $Tuple2(0, totalAmount)
552- let outAm = $t02389023977._1
553- let outPr = $t02389023977._2
665+ let outAm = $t02636426451._1
666+ let outPr = $t02636426451._2
554667 let curPrX18 = cpbi(t1(prBalance, prDecimals), t1(amBalance, amDecimals))
555668 let curPr = f1(curPrX18, scale8)
556669 let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
571684 }
572685 }
573686 }
574-
575-
576-func getD (xp) = {
577- let n = big2
578- let xp0 = xp[0]
579- let xp1 = xp[1]
580- let aPrecision = parseBigIntValue(Amult)
581- let a = (parseBigIntValue(A) * aPrecision)
582- let s = (xp0 + xp1)
583- if ((s == big0))
584- then big0
585- else {
586- let ann = (a * n)
587- func calc (acc,cur) = {
588- let $t02513525155 = acc
589- let d = $t02513525155._1
590- let found = $t02513525155._2
591- if ((found != unit))
592- then acc
593- else {
594- let dp = (((d * d) * d) / (((xp0 * xp1) * n) * n))
595- let dNext = (((((ann * s) / aPrecision) + (dp * n)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((n + big1) * dp)))
596- let dDiff = absBigInt((dNext - value(d)))
597- if ((big1 >= dDiff))
598- then $Tuple2(dNext, cur)
599- else $Tuple2(dNext, unit)
600- }
601- }
602-
603- let arr = [0, 1, 2, 3, 4, 5, 6]
604- let $t02557125617 = {
605- let $l = arr
606- let $s = size($l)
607- let $acc0 = $Tuple2(s, unit)
608- func $f0_1 ($a,$i) = if (($i >= $s))
609- then $a
610- else calc($a, $l[$i])
611-
612- func $f0_2 ($a,$i) = if (($i >= $s))
613- then $a
614- else throw("List size exceeds 7")
615-
616- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7)
617- }
618- let d = $t02557125617._1
619- let found = $t02557125617._2
620- if ((found != unit))
621- then d
622- else throw(("D calculation error, D = " + toString(d)))
623- }
624- }
625-
626-
627-func getYD (xp,i,D) = {
628- let n = big2
629- let x = xp[if ((i == 0))
630- then 1
631- else 0]
632- let aPrecision = parseBigIntValue(Amult)
633- let a = (parseBigIntValue(A) * aPrecision)
634- let s = x
635- let ann = (a * n)
636- let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
637- let b = ((s + ((D * aPrecision) / ann)) - D)
638- func calc (acc,cur) = {
639- let $t02611726137 = acc
640- let y = $t02611726137._1
641- let found = $t02611726137._2
642- if ((found != unit))
643- then acc
644- else {
645- let yNext = (((y * y) + c) / ((big2 * y) + b))
646- let yDiff = absBigInt((yNext - value(y)))
647- if ((big1 >= yDiff))
648- then $Tuple2(yNext, cur)
649- else $Tuple2(yNext, unit)
650- }
651- }
652-
653- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
654- let $t02644426491 = {
655- let $l = arr
656- let $s = size($l)
657- let $acc0 = $Tuple2(D, unit)
658- func $f0_1 ($a,$i) = if (($i >= $s))
659- then $a
660- else calc($a, $l[$i])
661-
662- func $f0_2 ($a,$i) = if (($i >= $s))
663- then $a
664- else throw("List size exceeds 15")
665-
666- $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)
667- }
668- let y = $t02644426491._1
669- let found = $t02644426491._2
670- if ((found != unit))
671- then y
672- else throw(("Y calculation error, Y = " + toString(y)))
673- }
674687
675688
676689 func m () = match getString(mpk()) {
844857 let pmt = value(i.payments[0])
845858 let pmtAssetId = toBase58String(value(pmt.assetId))
846859 let paymentAmountRaw = pmt.amount
847- let $t03118731239 = takeFee(paymentAmountRaw)
848- let pmtAmt = $t03118731239._1
849- let feeAmount = $t03118731239._2
860+ let $t03183731889 = takeFee(paymentAmountRaw)
861+ let pmtAmt = $t03183731889._1
862+ let feeAmount = $t03183731889._2
850863 if ((10000000 > paymentAmountRaw))
851864 then throw("Wrong pmt amt")
852865 else {
853866 let amBalance = getAccBalance(amId)
854867 let prBalance = getAccBalance(prId)
855- let $t03139932015 = if ((pmtAssetId == amId))
868+ let $t03204932665 = if ((pmtAssetId == amId))
856869 then if (if ((paymentAmountRaw > amBalance))
857870 then true
858871 else (amAssetPart > pmtAmt))
865878 then throw("invalid payment amount")
866879 else $Tuple6(amBalance, (prBalance - paymentAmountRaw), 0, 0, (pmtAmt - prAssetPart), amAssetPart)
867880 else throw("wrong pmtAssetId")
868- let amBalanceNow = $t03139932015._1
869- let prBalanceNow = $t03139932015._2
870- let virtSwapInAm = $t03139932015._3
871- let virtSwapOutPr = $t03139932015._4
872- let virtSwapInPr = $t03139932015._5
873- let virtSwapOutAm = $t03139932015._6
881+ let amBalanceNow = $t03204932665._1
882+ let prBalanceNow = $t03204932665._2
883+ let virtSwapInAm = $t03204932665._3
884+ let virtSwapOutPr = $t03204932665._4
885+ let virtSwapInPr = $t03204932665._5
886+ let virtSwapOutAm = $t03204932665._6
874887 let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
875888 let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil)
876889 let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
940953 let poolConfig = gpc()
941954 let amId = poolConfig[idxAmAsId]
942955 let prId = poolConfig[idxPrAsId]
956+ let lpId = fromBase58String(poolConfig[idxLPAsId])
943957 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
944958 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
945959 let userAddress = if ((i.caller == this))
951965 if ((10000000 > pmtAmt))
952966 then throw("Wrong pmt amt")
953967 else {
954- let r = estimatePutOneTknV2(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId))
955- let estimLP = r._2
956- let lpAssetId = r._7
957- let state = r._9
958- let amDiff = r._10
959- let prDiff = r._11
968+ let $t03557135696 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId))
969+ let estimLP = $t03557135696._1
970+ let state = $t03557135696._2
971+ let feeAmount = $t03557135696._3
960972 let emitLpAmt = if (if ((minOutAmount > 0))
961973 then (minOutAmount > estimLP)
962974 else false)
973985 }
974986 if ((el == el))
975987 then {
976- let sa = if ((amDiff > 0))
977- then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
978- else nil
979- if ((sa == sa))
988+ let lpTrnsfr = if (autoStake)
980989 then {
981- let sp = if ((prDiff > 0))
982- then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
983- else nil
984- if ((sp == sp))
985- then {
986- let lpTrnsfr = if (autoStake)
987- then {
988- let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
989- if ((ss == ss))
990- then nil
991- else throw("Strict value is not equal to itself.")
992- }
993- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
994- let feeAmount = takeFee(pmtAmt)._2
995- let sendFeeToMatcher = if ((feeAmount > 0))
996- then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
997- else nil
998- $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
999- }
990+ let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
991+ if ((ss == ss))
992+ then nil
1000993 else throw("Strict value is not equal to itself.")
1001994 }
1002- else throw("Strict value is not equal to itself.")
995+ else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
996+ let sendFeeToMatcher = if ((feeAmount > 0))
997+ then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
998+ else nil
999+ $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
10031000 }
10041001 else throw("Strict value is not equal to itself.")
10051002 }
10061003 else throw("Strict value is not equal to itself.")
10071004 }
10081005 }
1009-
1010-
1011-
1012-@Callable(i)
1013-func putOneTknV2WithBonusOldREADONLY (paymentAmount,paymentAssetId) = {
1014- let poolConfig = gpc()
1015- let amId = poolConfig[idxAmAsId]
1016- let prId = poolConfig[idxPrAsId]
1017- let r = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "")
1018- let estimLP = r._2
1019- let curPrice = r._3
1020- let lpAssetEmission = r._6
1021- let lpAssetId = r._7
1022- let amBalance = getAccBalance(amId)
1023- let prBalance = getAccBalance(prId)
1024- let poolProportion = fraction(prBalance, scale8, amBalance)
1025- let amountAssetPart = fraction(paymentAmount, scale8, (poolProportion + scale8))
1026- let priceAssetPart = (paymentAmount - amountAssetPart)
1027- let lpAmtBoth = fraction(lpAssetEmission, priceAssetPart, prBalance)
1028- let bonus = fraction((estimLP - lpAmtBoth), scale8, lpAmtBoth)
1029- let feeAmount = takeFee(paymentAmount)._2
1030- $Tuple2(nil, $Tuple3(estimLP, feeAmount, bonus))
1031- }
10321006
10331007
10341008
10971071 let estimPrAmt = r._2
10981072 let amBalance = getAccBalance(amId)
10991073 let prBalance = getAccBalance(prId)
1100- let $t03997540435 = if ((outAssetId == amId))
1074+ let $t03932739787 = if ((outAssetId == amId))
11011075 then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult))
11021076 else if ((outAssetId == prId))
11031077 then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult))
11041078 else throw("wrong outAssetId")
1105- let amBalanceNow = $t03997540435._1
1106- let prBalanceNow = $t03997540435._2
1107- let virtSwapInAm = $t03997540435._3
1108- let virtSwapOutPr = $t03997540435._4
1109- let virtSwapInPr = $t03997540435._5
1110- let virtSwapOutAm = $t03997540435._6
1111- let totalGetRaw = $t03997540435._7
1079+ let amBalanceNow = $t03932739787._1
1080+ let prBalanceNow = $t03932739787._2
1081+ let virtSwapInAm = $t03932739787._3
1082+ let virtSwapOutPr = $t03932739787._4
1083+ let virtSwapInPr = $t03932739787._5
1084+ let virtSwapOutAm = $t03932739787._6
1085+ let totalGetRaw = $t03932739787._7
11121086 if (if ((0 > virtSwapInAm))
11131087 then true
11141088 else (0 > virtSwapInPr))
11231097 let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage))
11241098 if ((finalRes == finalRes))
11251099 then {
1126- let $t04118241286 = if ((outAssetId == amId))
1100+ let $t04053440638 = if ((outAssetId == amId))
11271101 then $Tuple2(toInt(finalRes._2), 0)
11281102 else $Tuple2(0, toInt(finalRes._2))
1129- let outAm = $t04118241286._1
1130- let outPr = $t04118241286._2
1103+ let outAm = $t04053440638._1
1104+ let outPr = $t04053440638._2
11311105 let totalAmount = (outAm + outPr)
11321106 let feeAmount = (totalGetRaw - totalGet)
11331107 let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
11591133
11601134 @Callable(i)
11611135 func getOneTknV2 (outAssetId,minOutAmount) = {
1162- let $t04231142466 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1163- let state = $t04231142466._1
1164- let totalAmount = $t04231142466._2
1136+ let $t04166341818 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1137+ let state = $t04166341818._1
1138+ let totalAmount = $t04166341818._2
11651139 $Tuple2(state, totalAmount)
11661140 }
11671141
11801154 let prBalance = getAccBalance(prId)
11811155 let amBalanceNow = (amBalance - estimAmAmt)
11821156 let prBalanceNow = (prBalance - estimPrAmt)
1183- let $t04297943287 = if ((outAssetId == amId))
1157+ let $t04233142639 = if ((outAssetId == amId))
11841158 then $Tuple4(prBalanceNow, amBalanceNow, estimPrAmt, estimAmAmt)
11851159 else if ((outAssetId == prId))
11861160 then $Tuple4(amBalanceNow, prBalanceNow, estimAmAmt, estimPrAmt)
11871161 else throw("wrong outAssetId")
1188- let amountBalanceForSwap = $t04297943287._1
1189- let priceBalanceForSwap = $t04297943287._2
1190- let amountToSwap = $t04297943287._3
1191- let amountToAdd = $t04297943287._4
1162+ let amountBalanceForSwap = $t04233142639._1
1163+ let priceBalanceForSwap = $t04233142639._2
1164+ let amountToSwap = $t04233142639._3
1165+ let amountToAdd = $t04233142639._4
11921166 let yPrecision = 1
11931167 let exchResult = {
11941168 let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)
11971171 else throw(($getType(@) + " couldn't be cast to Int"))
11981172 }
11991173 let totalGetRaw = (exchResult + amountToAdd)
1200- let $t04381543864 = takeFee(totalGetRaw)
1201- let totalGet = $t04381543864._1
1202- let feeAmount = $t04381543864._2
1174+ let $t04316743216 = takeFee(totalGetRaw)
1175+ let totalGet = $t04316743216._1
1176+ let feeAmount = $t04316743216._2
12031177 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
12041178 }
12051179
12211195 let newY = getYD(xp, index, D1)
12221196 let dy = (xp[index] - newY)
12231197 let totalGetRaw = toInt((dy - big1))
1224- let $t04455544604 = takeFee(totalGetRaw)
1225- let totalGet = $t04455544604._1
1226- let feeAmount = $t04455544604._2
1198+ let $t04390743956 = takeFee(totalGetRaw)
1199+ let totalGet = $t04390743956._1
1200+ let feeAmount = $t04390743956._2
12271201 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
12281202 }
12291203
12371211 let lpId = poolConfig[idxLPAsId]
12381212 let amBalance = getAccBalance(amId)
12391213 let prBalance = getAccBalance(prId)
1240- let $t04494945064 = {
1214+ let $t04430144416 = {
12411215 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
12421216 if ($isInstanceOf(@, "(Int, Int)"))
12431217 then @
12441218 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
12451219 }
1246- let totalGet = $t04494945064._1
1247- let feeAmount = $t04494945064._2
1220+ let totalGet = $t04430144416._1
1221+ let feeAmount = $t04430144416._2
12481222 let r = ego("", lpId, lpAssetAmount, this)
12491223 let outAmAmt = r._1
12501224 let outPrAmt = r._2
13291303 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
13301304 if ((unstakeInv == unstakeInv))
13311305 then {
1332- let $t04736947557 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1333- let state = $t04736947557._1
1334- let totalAmount = $t04736947557._2
1306+ let $t04672146909 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1307+ let state = $t04672146909._1
1308+ let totalAmount = $t04672146909._2
13351309 $Tuple2(state, totalAmount)
13361310 }
13371311 else throw("Strict value is not equal to itself.")
13421316
13431317
13441318 @Callable(i)
1345-func putOneTknV2WithBonusREADONLY (amount,asset) = {
1319+func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = {
13461320 let poolConfig = gpc()
13471321 let amId = poolConfig[idxAmAsId]
13481322 let prId = poolConfig[idxPrAsId]
13491323 let lpId = poolConfig[idxLPAsId]
1350- let paymentAsset = asset
1351- let paymentAmountRaw = amount
1352- let $t04799448084 = takeFee(paymentAmountRaw)
1353- let paymentAmount = $t04799448084._1
1354- let feeAmount = $t04799448084._2
1355- let $t04808848270 = if ((paymentAsset == amId))
1356- then $Tuple2(paymentAmount, 0)
1357- else if ((paymentAsset == prId))
1358- then $Tuple2(0, paymentAmount)
1359- else throw("invalid payment")
1360- let amAmount = $t04808848270._1
1361- let prAmount = $t04808848270._2
1362- let amBalanceOld = getAccBalance(amId)
1363- let prBalanceOld = getAccBalance(prId)
1364- let amBalanceNew = (amBalanceOld + amAmount)
1365- let prBalanceNew = (prBalanceOld + prAmount)
1366- let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
1367- let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
1368- let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
1369- let lpAmount = ((lpAssetEmission * (D1 - D0)) / D0)
1370- let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
1371- let amountAssetPart = fraction(paymentAmount, scale8, (poolProportion + scale8))
1372- let priceAssetPart = (paymentAmount - amountAssetPart)
1373- let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
1374- let bonus = fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)
1375- $Tuple2(nil, $Tuple3(toInt(lpAmount), feeAmount, toInt(bonus)))
1324+ let $t04716847265 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "")
1325+ let lpAmount = $t04716847265._1
1326+ let state = $t04716847265._2
1327+ let feeAmount = $t04716847265._3
1328+ let bonus = $t04716847265._4
1329+ $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13761330 }
13771331
13781332
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 Amult = "100"
2121
2222 let Dconv = "1"
2323
2424 let SEP = "__"
2525
2626 let EMPTY = ""
2727
2828 let PoolActive = 1
2929
3030 let PoolPutDis = 2
3131
3232 let PoolMatcherDis = 3
3333
3434 let PoolShutdown = 4
3535
3636 let idxPoolAddress = 1
3737
3838 let idxPoolSt = 2
3939
4040 let idxLPAsId = 3
4141
4242 let idxAmAsId = 4
4343
4444 let idxPrAsId = 5
4545
4646 let idxAmtAsDcm = 6
4747
4848 let idxPriceAsDcm = 7
4949
5050 let idxIAmtAsId = 8
5151
5252 let idxIPriceAsId = 9
5353
5454 let idxFactStakCntr = 1
5555
5656 let idxFactSlippCntr = 7
5757
5858 let idxFactGwxRewCntr = 10
5959
6060 let feeDefault = fraction(5, scale8, 10000)
6161
6262 func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6666
6767
6868 func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
6969
7070
7171 func abs (val) = if ((zeroBigInt > val))
7272 then -(val)
7373 else val
7474
7575
7676 func absBigInt (val) = if ((zeroBigInt > val))
7777 then -(val)
7878 else val
7979
8080
8181 func fc () = "%s__factoryContract"
8282
8383
8484 func mpk () = "%s__managerPublicKey"
8585
8686
8787 func pmpk () = "%s__pendingManagerPublicKey"
8888
8989
9090 func pl () = "%s%s__price__last"
9191
9292
9393 func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
9494
9595
9696 func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
9797
9898
9999 func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
100100
101101
102102 func aa () = "%s__amountAsset"
103103
104104
105105 func pa () = "%s__priceAsset"
106106
107107
108108 func amp () = "%s__amp"
109109
110110
111111 func ada () = "%s__addonAddr"
112112
113113
114114 let keyFee = "%s__fee"
115115
116116 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
117117
118118 func fcfg () = "%s__factoryConfig"
119119
120120
121121 func mtpk () = "%s%s__matcher__publicKey"
122122
123123
124124 func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
125125
126126
127127 func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
128128
129129
130130 func aps () = "%s__shutdown"
131131
132132
133133 func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash"
134134
135135
136136 func keyFeeCollectorAddress () = "%s__feeCollectorAddress"
137137
138138
139139 func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
140140
141141
142142 func str (val) = match val {
143143 case valStr: String =>
144144 valStr
145145 case _ =>
146146 throw("fail cast to String")
147147 }
148148
149149
150150 func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
151151
152152
153153 func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
154154
155155
156156 let fca = addressFromStringValue(strf(this, fc()))
157157
158158 let A = strf(this, amp())
159159
160160 func igs () = valueOrElse(getBoolean(fca, aps()), false)
161161
162162
163163 func mp () = fromBase58String(strf(fca, mtpk()))
164164
165165
166166 let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress()))
167167
168168 func gpc () = {
169169 let amtAs = strf(this, aa())
170170 let priceAs = strf(this, pa())
171171 let iPriceAs = intf(fca, mba(priceAs))
172172 let iAmtAs = intf(fca, mba(amtAs))
173173 split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
174174 }
175175
176176
177177 func gfc () = split(strf(fca, fcfg()), SEP)
178178
179179
180180 let factoryConfig = gfc()
181181
182182 let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address")
183183
184184 let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address")
185185
186186 let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address")
187187
188188 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)
189189
190190
191191 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)
192192
193193
194194 func getAccBalance (assetId) = if ((assetId == "WAVES"))
195195 then wavesBalance(this).available
196196 else assetBalance(this, fromBase58String(assetId))
197197
198198
199199 func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
200200
201201
202202 func vad (A1,A2,slippage) = {
203203 let diff = fraction((A1 - A2), scale8BigInt, A2)
204204 let pass = ((slippage - abs(diff)) > zeroBigInt)
205205 if (!(pass))
206206 then throw(("Big slpg: " + toString(diff)))
207207 else $Tuple2(pass, min([A1, A2]))
208208 }
209209
210210
211211 func vd (D1,D0,slpg) = {
212212 let diff = fraction(D0, scale8BigInt, D1)
213213 let fail = (slpg > diff)
214214 if (if (fail)
215215 then true
216216 else (D0 > D1))
217217 then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
218218 else fail
219219 }
220220
221221
222222 func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
223223 let amtAsAmtX18 = t1(amAmt, amAssetDcm)
224224 let prAsAmtX18 = t1(prAmt, prAssetDcm)
225225 cpbi(prAsAmtX18, amtAsAmtX18)
226226 }
227227
228228
229229 func calcPrices (amAmt,prAmt,lpAmt) = {
230230 let cfg = gpc()
231231 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
232232 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
233233 let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
234234 let amAmtX18 = t1(amAmt, amtAsDcm)
235235 let prAmtX18 = t1(prAmt, prAsDcm)
236236 let lpAmtX18 = t1(lpAmt, scale8)
237237 let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
238238 let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
239239 [priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
240240 }
241241
242242
243243 func calculatePrices (amAmt,prAmt,lpAmt) = {
244244 let p = calcPrices(amAmt, prAmt, lpAmt)
245245 [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
246246 }
247247
248248
249249 func takeFee (amount) = {
250250 let feeAmount = fraction(amount, fee, scale8)
251251 $Tuple2((amount - feeAmount), feeAmount)
252252 }
253253
254254
255255 func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
256256 let cfg = gpc()
257257 let lpId = cfg[idxLPAsId]
258258 let amId = cfg[idxAmAsId]
259259 let prId = cfg[idxPrAsId]
260260 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
261261 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
262262 let sts = cfg[idxPoolSt]
263263 let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
264264 if ((lpId != pmtAssetId))
265265 then throw("Wrong pmt asset")
266266 else {
267267 let amBalance = getAccBalance(amId)
268268 let amBalanceX18 = t1(amBalance, amDcm)
269269 let prBalance = getAccBalance(prId)
270270 let prBalanceX18 = t1(prBalance, prDcm)
271271 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
272272 let curPrice = f1(curPriceX18, scale8)
273273 let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
274274 let lpEmissX18 = t1(lpEmiss, scale8)
275275 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
276276 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
277277 let outAmAmt = f1(outAmAmtX18, amDcm)
278278 let outPrAmt = f1(outPrAmtX18, prDcm)
279279 let state = if ((txId58 == ""))
280280 then nil
281281 else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
282282 then unit
283283 else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
284284 then unit
285285 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)]
286286 $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
287287 }
288288 }
289289
290290
291291 func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
292292 let cfg = gpc()
293293 let lpId = fromBase58String(cfg[idxLPAsId])
294294 let amIdStr = cfg[idxAmAsId]
295295 let prIdStr = cfg[idxPrAsId]
296296 let inAmIdStr = cfg[idxIAmtAsId]
297297 let inPrIdStr = cfg[idxIPriceAsId]
298298 let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
299299 let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
300300 let sts = cfg[idxPoolSt]
301301 let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
302302 let amBalance = if (isEval)
303303 then getAccBalance(amIdStr)
304304 else if (if (isOneAsset)
305305 then (pmtId == amIdStr)
306306 else false)
307307 then (getAccBalance(amIdStr) - pmtAmt)
308308 else if (isOneAsset)
309309 then getAccBalance(amIdStr)
310310 else (getAccBalance(amIdStr) - inAmAmt)
311311 let prBalance = if (isEval)
312312 then getAccBalance(prIdStr)
313313 else if (if (isOneAsset)
314314 then (pmtId == prIdStr)
315315 else false)
316316 then (getAccBalance(prIdStr) - pmtAmt)
317317 else if (isOneAsset)
318318 then getAccBalance(prIdStr)
319319 else (getAccBalance(prIdStr) - inPrAmt)
320320 let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
321321 let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
322322 let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
323323 let amBalanceX18 = t1(amBalance, amtDcm)
324324 let prBalanceX18 = t1(prBalance, priceDcm)
325325 let r = if ((lpEm == 0))
326326 then {
327327 let curPriceX18 = zeroBigInt
328328 let slippageX18 = zeroBigInt
329329 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
330330 $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
331331 }
332332 else {
333333 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
334334 let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
335335 let slippageX18 = t1(slippage, scale8)
336336 if (if (if (validateSlippage)
337337 then (curPriceX18 != zeroBigInt)
338338 else false)
339339 then (slippageRealX18 > slippageX18)
340340 else false)
341341 then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
342342 else {
343343 let lpEmissionX18 = t1(lpEm, scale8)
344344 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
345345 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
346346 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
347347 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
348348 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
349349 let expAmtAssetAmtX18 = expectedAmts._1
350350 let expPriceAssetAmtX18 = expectedAmts._2
351351 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
352352 $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
353353 }
354354 }
355355 let calcLpAmt = r._1
356356 let calcAmAssetPmt = r._2
357357 let calcPrAssetPmt = r._3
358358 let curPrice = f1(r._4, scale8)
359359 let slippageCalc = f1(r._5, scale8)
360360 if ((0 >= calcLpAmt))
361361 then throw("LP <= 0")
362362 else {
363363 let emitLpAmt = if (!(emitLp))
364364 then 0
365365 else calcLpAmt
366366 let amDiff = (inAmAmt - calcAmAssetPmt)
367367 let prDiff = (inPrAmt - calcPrAssetPmt)
368368 let $t01635116696 = if (if (isOneAsset)
369369 then (pmtId == amIdStr)
370370 else false)
371371 then $Tuple2(pmtAmt, 0)
372372 else if (if (isOneAsset)
373373 then (pmtId == prIdStr)
374374 else false)
375375 then $Tuple2(0, pmtAmt)
376376 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
377377 let writeAmAmt = $t01635116696._1
378378 let writePrAmt = $t01635116696._2
379379 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))]
380380 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
381381 }
382382 }
383383
384384
385385 func moa (order) = {
386386 let cfg = gpc()
387387 let amtAsId = cfg[idxAmAsId]
388388 let prAsId = cfg[idxPrAsId]
389389 let sts = parseIntValue(cfg[idxPoolSt])
390390 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
391391 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
392392 let accAmtAsBalance = getAccBalance(amtAsId)
393393 let accPrAsBalance = getAccBalance(prAsId)
394394 let curPriceX18 = if ((order.orderType == Buy))
395395 then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance)
396396 else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance)
397397 let curPrice = f1(curPriceX18, scale8)
398398 if (if (if (igs())
399399 then true
400400 else (sts == PoolMatcherDis))
401401 then true
402402 else (sts == PoolShutdown))
403403 then throw("Admin blocked")
404404 else {
405405 let orAmtAsset = order.assetPair.amountAsset
406406 let orAmtAsStr = if ((orAmtAsset == unit))
407407 then "WAVES"
408408 else toBase58String(value(orAmtAsset))
409409 let orPrAsset = order.assetPair.priceAsset
410410 let orPrAsStr = if ((orPrAsset == unit))
411411 then "WAVES"
412412 else toBase58String(value(orPrAsset))
413413 if (if ((orAmtAsStr != amtAsId))
414414 then true
415415 else (orPrAsStr != prAsId))
416416 then throw("Wr assets")
417417 else {
418418 let orderPrice = order.price
419419 let priceDcm = fraction(scale8, prAsDcm, amtAsDcm)
420420 let castOrderPrice = ts(orderPrice, scale8, priceDcm)
421421 let isOrderPriceValid = if ((order.orderType == Buy))
422422 then (curPrice >= castOrderPrice)
423423 else (castOrderPrice >= curPrice)
424424 true
425425 }
426426 }
427427 }
428428
429429
430430 func cg (i) = if ((size(i.payments) != 1))
431431 then throw("1 pmnt exp")
432432 else {
433433 let pmt = value(i.payments[0])
434434 let pmtAssetId = value(pmt.assetId)
435435 let pmtAmt = pmt.amount
436436 let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
437437 let outAmAmt = r._1
438438 let outPrAmt = r._2
439439 let sts = parseIntValue(r._9)
440440 let state = r._10
441441 if (if (igs())
442442 then true
443443 else (sts == PoolShutdown))
444444 then throw(("Admin blocked: " + toString(sts)))
445445 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
446446 }
447447
448448
449449 func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
450450 let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId)
451451 let sts = parseIntValue(r._8)
452452 if (if (if (igs())
453453 then true
454454 else (sts == PoolPutDis))
455455 then true
456456 else (sts == PoolShutdown))
457457 then throw(("Blocked:" + toString(sts)))
458458 else r
459459 }
460460
461461
462-func estimatePutOneTknV2 (pmtAmtRaw,pmtAssetId,userAddress,txId) = {
462+func getD (xp) = {
463+ let n = big2
464+ let xp0 = xp[0]
465+ let xp1 = xp[1]
466+ let aPrecision = parseBigIntValue(Amult)
467+ let a = (parseBigIntValue(A) * aPrecision)
468+ let s = (xp0 + xp1)
469+ if ((s == big0))
470+ then big0
471+ else {
472+ let ann = (a * n)
473+ func calc (acc,cur) = {
474+ let $t02109621116 = acc
475+ let d = $t02109621116._1
476+ let found = $t02109621116._2
477+ if ((found != unit))
478+ then acc
479+ else {
480+ let dp = (((d * d) * d) / (((xp0 * xp1) * n) * n))
481+ let dNext = (((((ann * s) / aPrecision) + (dp * n)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((n + big1) * dp)))
482+ let dDiff = absBigInt((dNext - value(d)))
483+ if ((big1 >= dDiff))
484+ then $Tuple2(dNext, cur)
485+ else $Tuple2(dNext, unit)
486+ }
487+ }
488+
489+ let arr = [0, 1, 2, 3, 4, 5, 6]
490+ let $t02153221578 = {
491+ let $l = arr
492+ let $s = size($l)
493+ let $acc0 = $Tuple2(s, unit)
494+ func $f0_1 ($a,$i) = if (($i >= $s))
495+ then $a
496+ else calc($a, $l[$i])
497+
498+ func $f0_2 ($a,$i) = if (($i >= $s))
499+ then $a
500+ else throw("List size exceeds 7")
501+
502+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7)
503+ }
504+ let d = $t02153221578._1
505+ let found = $t02153221578._2
506+ if ((found != unit))
507+ then d
508+ else throw(("D calculation error, D = " + toString(d)))
509+ }
510+ }
511+
512+
513+func getYD (xp,i,D) = {
514+ let n = big2
515+ let x = xp[if ((i == 0))
516+ then 1
517+ else 0]
518+ let aPrecision = parseBigIntValue(Amult)
519+ let a = (parseBigIntValue(A) * aPrecision)
520+ let s = x
521+ let ann = (a * n)
522+ let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
523+ let b = ((s + ((D * aPrecision) / ann)) - D)
524+ func calc (acc,cur) = {
525+ let $t02207822098 = acc
526+ let y = $t02207822098._1
527+ let found = $t02207822098._2
528+ if ((found != unit))
529+ then acc
530+ else {
531+ let yNext = (((y * y) + c) / ((big2 * y) + b))
532+ let yDiff = absBigInt((yNext - value(y)))
533+ if ((big1 >= yDiff))
534+ then $Tuple2(yNext, cur)
535+ else $Tuple2(yNext, unit)
536+ }
537+ }
538+
539+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
540+ let $t02240522452 = {
541+ let $l = arr
542+ let $s = size($l)
543+ let $acc0 = $Tuple2(D, unit)
544+ func $f0_1 ($a,$i) = if (($i >= $s))
545+ then $a
546+ else calc($a, $l[$i])
547+
548+ func $f0_2 ($a,$i) = if (($i >= $s))
549+ then $a
550+ else throw("List size exceeds 15")
551+
552+ $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)
553+ }
554+ let y = $t02240522452._1
555+ let found = $t02240522452._2
556+ if ((found != unit))
557+ then y
558+ else throw(("Y calculation error, Y = " + toString(y)))
559+ }
560+
561+
562+func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId) = {
463563 let poolConfig = gpc()
464564 let amId = poolConfig[idxAmAsId]
465565 let prId = poolConfig[idxPrAsId]
566+ let lpId = poolConfig[idxLPAsId]
567+ let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm])
568+ let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm])
466569 let amBalance = getAccBalance(amId)
467570 let prBalance = getAccBalance(prId)
468- let $t02102721072 = takeFee(pmtAmtRaw)
469- let pmtAmt = $t02102721072._1
470- let feeAmount = $t02102721072._2
471- let $t02107621537 = if ((txId == ""))
571+ let $t02299423039 = takeFee(pmtAmtRaw)
572+ let pmtAmt = $t02299423039._1
573+ let feeAmount = $t02299423039._2
574+ let $t02304323504 = if ((txId == ""))
472575 then $Tuple2(amBalance, prBalance)
473576 else if ((pmtAssetId == amId))
474577 then if ((pmtAmtRaw > amBalance))
475578 then throw("invalid payment amount")
476579 else $Tuple2((amBalance - pmtAmtRaw), prBalance)
477580 else if ((pmtAssetId == prId))
478581 then if ((pmtAmtRaw > prBalance))
479582 then throw("invalid payment amount")
480583 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
481584 else throw("wrong pmtAssetId")
482- let amBalanceNow = $t02107621537._1
483- let prBalanceNow = $t02107621537._2
484- let $t02154121675 = if ((pmtAssetId == amId))
485- then $Tuple2(amBalanceNow, prBalanceNow)
486- else $Tuple2(prBalanceNow, amBalanceNow)
487- let amBalanceForCalc = $t02154121675._1
488- let prBalanceForCalc = $t02154121675._2
489- let xPrecision = 1
490- let result = {
491- let @ = invoke(gwxContract, "calcPutXOnly", [toString(pmtAmt), toString(amBalanceForCalc), toString(prBalanceForCalc), "", A, Amult, toString(xPrecision), Dconv], nil)
492- if ($isInstanceOf(@, "(Int, Int)"))
493- then @
494- else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
495- }
496- let $t02214422240 = if ((pmtAssetId == amId))
497- then result
498- else $Tuple2(result._2, result._1)
499- let amAssetPart = $t02214422240._1
500- let prAssetPart = $t02214422240._2
501- let estPut = cp(userAddress, txId, AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), 0, true, true, false, pmtAmtRaw, pmtAssetId)
502- let estimLP = estPut._2
503- let lpAssetId = estPut._7
504- let state = estPut._9
505- let amDiff = estPut._10
506- let prDiff = estPut._11
507- estPut
585+ let amBalanceOld = $t02304323504._1
586+ let prBalanceOld = $t02304323504._2
587+ let $t02351023674 = if ((pmtAssetId == amId))
588+ then $Tuple2(pmtAmt, 0)
589+ else if ((pmtAssetId == prId))
590+ then $Tuple2(0, pmtAmt)
591+ else throw("invalid payment")
592+ let amAmount = $t02351023674._1
593+ let prAmount = $t02351023674._2
594+ let amBalanceNew = (amBalanceOld + amAmount)
595+ let prBalanceNew = (prBalanceOld + prAmount)
596+ let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
597+ let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
598+ let checkD = if ((D1 > D0))
599+ then true
600+ else throw()
601+ if ((checkD == checkD))
602+ then {
603+ let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
604+ let lpAmount = if ((lpAssetEmission > big0))
605+ then fraction(lpAssetEmission, (D1 - D0), D0)
606+ else throw("initial deposit requires all coins")
607+ let curPrice = {
608+ let amBalanceX18 = t1(amBalance, amtDcm)
609+ let prBalanceX18 = t1(prBalance, priceDcm)
610+ f1(cpbi(prBalanceX18, amBalanceX18), scale8)
611+ }
612+ let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmount, prAmount, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))]
613+ let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
614+ let amountAssetPart = fraction(pmtAmt, scale8, (poolProportion + scale8))
615+ let priceAssetPart = (pmtAmt - amountAssetPart)
616+ let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
617+ let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth))
618+ $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus)
619+ }
620+ else throw("Strict value is not equal to itself.")
508621 }
509622
510623
511624 func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = if ((size(payments) != 1))
512625 then throw("1 pmnt expd")
513626 else {
514627 let poolConfig = gpc()
515628 let lpId = poolConfig[idxLPAsId]
516629 let amId = poolConfig[idxAmAsId]
517630 let prId = poolConfig[idxPrAsId]
518631 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
519632 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
520633 let poolStatus = poolConfig[idxPoolSt]
521634 let userAddress = if ((caller == this))
522635 then originCaller
523636 else caller
524637 let pmt = value(payments[0])
525638 let pmtAssetId = value(pmt.assetId)
526639 let pmtAmt = pmt.amount
527640 if ((1000000000 > pmtAmt))
528641 then throw("Min pmt 10 LP")
529642 else {
530643 let txId58 = toBase58String(transactionId)
531644 if ((lpId != toBase58String(pmtAssetId)))
532645 then throw("Wrong LP")
533646 else {
534647 let amBalance = getAccBalance(amId)
535648 let prBalance = getAccBalance(prId)
536- let $t02359523703 = {
649+ let $t02606926177 = {
537650 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
538651 if ($isInstanceOf(@, "(Int, Int)"))
539652 then @
540653 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
541654 }
542- let totalGet = $t02359523703._1
543- let feeAmount = $t02359523703._2
655+ let totalGet = $t02606926177._1
656+ let feeAmount = $t02606926177._2
544657 let totalAmount = if (if ((minOutAmount > 0))
545658 then (minOutAmount > totalGet)
546659 else false)
547660 then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
548661 else totalGet
549- let $t02389023977 = if ((outAssetId == amId))
662+ let $t02636426451 = if ((outAssetId == amId))
550663 then $Tuple2(totalAmount, 0)
551664 else $Tuple2(0, totalAmount)
552- let outAm = $t02389023977._1
553- let outPr = $t02389023977._2
665+ let outAm = $t02636426451._1
666+ let outPr = $t02636426451._2
554667 let curPrX18 = cpbi(t1(prBalance, prDecimals), t1(amBalance, amDecimals))
555668 let curPr = f1(curPrX18, scale8)
556669 let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
557670 then unit
558671 else fromBase58String(outAssetId)
559672 let sendFeeToMatcher = if ((feeAmount > 0))
560673 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
561674 else nil
562675 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)
563676 if ((state == state))
564677 then {
565678 let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
566679 if ((burn == burn))
567680 then $Tuple2(state, totalAmount)
568681 else throw("Strict value is not equal to itself.")
569682 }
570683 else throw("Strict value is not equal to itself.")
571684 }
572685 }
573686 }
574-
575-
576-func getD (xp) = {
577- let n = big2
578- let xp0 = xp[0]
579- let xp1 = xp[1]
580- let aPrecision = parseBigIntValue(Amult)
581- let a = (parseBigIntValue(A) * aPrecision)
582- let s = (xp0 + xp1)
583- if ((s == big0))
584- then big0
585- else {
586- let ann = (a * n)
587- func calc (acc,cur) = {
588- let $t02513525155 = acc
589- let d = $t02513525155._1
590- let found = $t02513525155._2
591- if ((found != unit))
592- then acc
593- else {
594- let dp = (((d * d) * d) / (((xp0 * xp1) * n) * n))
595- let dNext = (((((ann * s) / aPrecision) + (dp * n)) * d) / ((((ann - aPrecision) * d) / aPrecision) + ((n + big1) * dp)))
596- let dDiff = absBigInt((dNext - value(d)))
597- if ((big1 >= dDiff))
598- then $Tuple2(dNext, cur)
599- else $Tuple2(dNext, unit)
600- }
601- }
602-
603- let arr = [0, 1, 2, 3, 4, 5, 6]
604- let $t02557125617 = {
605- let $l = arr
606- let $s = size($l)
607- let $acc0 = $Tuple2(s, unit)
608- func $f0_1 ($a,$i) = if (($i >= $s))
609- then $a
610- else calc($a, $l[$i])
611-
612- func $f0_2 ($a,$i) = if (($i >= $s))
613- then $a
614- else throw("List size exceeds 7")
615-
616- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7)
617- }
618- let d = $t02557125617._1
619- let found = $t02557125617._2
620- if ((found != unit))
621- then d
622- else throw(("D calculation error, D = " + toString(d)))
623- }
624- }
625-
626-
627-func getYD (xp,i,D) = {
628- let n = big2
629- let x = xp[if ((i == 0))
630- then 1
631- else 0]
632- let aPrecision = parseBigIntValue(Amult)
633- let a = (parseBigIntValue(A) * aPrecision)
634- let s = x
635- let ann = (a * n)
636- let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
637- let b = ((s + ((D * aPrecision) / ann)) - D)
638- func calc (acc,cur) = {
639- let $t02611726137 = acc
640- let y = $t02611726137._1
641- let found = $t02611726137._2
642- if ((found != unit))
643- then acc
644- else {
645- let yNext = (((y * y) + c) / ((big2 * y) + b))
646- let yDiff = absBigInt((yNext - value(y)))
647- if ((big1 >= yDiff))
648- then $Tuple2(yNext, cur)
649- else $Tuple2(yNext, unit)
650- }
651- }
652-
653- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
654- let $t02644426491 = {
655- let $l = arr
656- let $s = size($l)
657- let $acc0 = $Tuple2(D, unit)
658- func $f0_1 ($a,$i) = if (($i >= $s))
659- then $a
660- else calc($a, $l[$i])
661-
662- func $f0_2 ($a,$i) = if (($i >= $s))
663- then $a
664- else throw("List size exceeds 15")
665-
666- $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)
667- }
668- let y = $t02644426491._1
669- let found = $t02644426491._2
670- if ((found != unit))
671- then y
672- else throw(("Y calculation error, Y = " + toString(y)))
673- }
674687
675688
676689 func m () = match getString(mpk()) {
677690 case s: String =>
678691 fromBase58String(s)
679692 case _: Unit =>
680693 unit
681694 case _ =>
682695 throw("Match error")
683696 }
684697
685698
686699 func pm () = match getString(pmpk()) {
687700 case s: String =>
688701 fromBase58String(s)
689702 case _: Unit =>
690703 unit
691704 case _ =>
692705 throw("Match error")
693706 }
694707
695708
696709 let pd = throw("Permission denied")
697710
698711 func mm (i) = match m() {
699712 case pk: ByteVector =>
700713 if ((i.callerPublicKey == pk))
701714 then true
702715 else pd
703716 case _: Unit =>
704717 if ((i.caller == this))
705718 then true
706719 else pd
707720 case _ =>
708721 throw("Match error")
709722 }
710723
711724
712725 @Callable(i)
713726 func constructor (fc) = {
714727 let c = mm(i)
715728 if ((c == c))
716729 then [StringEntry(fc(), fc)]
717730 else throw("Strict value is not equal to itself.")
718731 }
719732
720733
721734
722735 @Callable(i)
723736 func setManager (pendingManagerPublicKey) = {
724737 let c = mm(i)
725738 if ((c == c))
726739 then {
727740 let cm = fromBase58String(pendingManagerPublicKey)
728741 if ((cm == cm))
729742 then [StringEntry(pmpk(), pendingManagerPublicKey)]
730743 else throw("Strict value is not equal to itself.")
731744 }
732745 else throw("Strict value is not equal to itself.")
733746 }
734747
735748
736749
737750 @Callable(i)
738751 func confirmManager () = {
739752 let p = pm()
740753 let hpm = if (isDefined(p))
741754 then true
742755 else throw("No pending manager")
743756 if ((hpm == hpm))
744757 then {
745758 let cpm = if ((i.callerPublicKey == value(p)))
746759 then true
747760 else throw("You are not pending manager")
748761 if ((cpm == cpm))
749762 then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
750763 else throw("Strict value is not equal to itself.")
751764 }
752765 else throw("Strict value is not equal to itself.")
753766 }
754767
755768
756769
757770 @Callable(i)
758771 func put (slip,autoStake) = {
759772 let factCfg = gfc()
760773 let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
761774 let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
762775 if ((0 > slip))
763776 then throw("Wrong slippage")
764777 else if ((size(i.payments) != 2))
765778 then throw("2 pmnts expd")
766779 else {
767780 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, "")
768781 let emitLpAmt = e._2
769782 let lpAssetId = e._7
770783 let state = e._9
771784 let amDiff = e._10
772785 let prDiff = e._11
773786 let amId = e._12
774787 let prId = e._13
775788 let r = invoke(fca, "emit", [emitLpAmt], nil)
776789 if ((r == r))
777790 then {
778791 let el = match r {
779792 case legacy: Address =>
780793 invoke(legacy, "emit", [emitLpAmt], nil)
781794 case _ =>
782795 unit
783796 }
784797 if ((el == el))
785798 then {
786799 let sa = if ((amDiff > 0))
787800 then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
788801 else nil
789802 if ((sa == sa))
790803 then {
791804 let sp = if ((prDiff > 0))
792805 then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
793806 else nil
794807 if ((sp == sp))
795808 then {
796809 let lpTrnsfr = if (autoStake)
797810 then {
798811 let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
799812 if ((ss == ss))
800813 then nil
801814 else throw("Strict value is not equal to itself.")
802815 }
803816 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
804817 (state ++ lpTrnsfr)
805818 }
806819 else throw("Strict value is not equal to itself.")
807820 }
808821 else throw("Strict value is not equal to itself.")
809822 }
810823 else throw("Strict value is not equal to itself.")
811824 }
812825 else throw("Strict value is not equal to itself.")
813826 }
814827 }
815828
816829
817830
818831 @Callable(i)
819832 func putOneTkn (amAssetPart,prAssetPart,outLp,slippage,autoStake) = {
820833 let cfg = gfc()
821834 let stakingCntr = valueOrErrorMessage(addressFromString(cfg[idxFactStakCntr]), "Wr st addr")
822835 let slipCntr = valueOrErrorMessage(addressFromString(cfg[idxFactSlippCntr]), "Wr sl addr")
823836 let gwxCntr = valueOrErrorMessage(addressFromString(cfg[idxFactGwxRewCntr]), "Wr gwx addr")
824837 let poolCfg = gpc()
825838 let amId = poolCfg[idxAmAsId]
826839 let prId = poolCfg[idxPrAsId]
827840 let amDcm = parseIntValue(poolCfg[idxAmtAsDcm])
828841 let prDcm = parseIntValue(poolCfg[idxPriceAsDcm])
829842 let addon = valueOrElse(getString(this, ada()), "")
830843 let userAddress = if ((addon == toString(i.caller)))
831844 then i.originCaller
832845 else i.caller
833846 if (if (if (if ((0 >= slippage))
834847 then true
835848 else (0 >= amAssetPart))
836849 then true
837850 else (0 >= prAssetPart))
838851 then true
839852 else (0 >= outLp))
840853 then throw("Wrong params")
841854 else if ((size(i.payments) != 1))
842855 then throw("1 pmnt expd")
843856 else {
844857 let pmt = value(i.payments[0])
845858 let pmtAssetId = toBase58String(value(pmt.assetId))
846859 let paymentAmountRaw = pmt.amount
847- let $t03118731239 = takeFee(paymentAmountRaw)
848- let pmtAmt = $t03118731239._1
849- let feeAmount = $t03118731239._2
860+ let $t03183731889 = takeFee(paymentAmountRaw)
861+ let pmtAmt = $t03183731889._1
862+ let feeAmount = $t03183731889._2
850863 if ((10000000 > paymentAmountRaw))
851864 then throw("Wrong pmt amt")
852865 else {
853866 let amBalance = getAccBalance(amId)
854867 let prBalance = getAccBalance(prId)
855- let $t03139932015 = if ((pmtAssetId == amId))
868+ let $t03204932665 = if ((pmtAssetId == amId))
856869 then if (if ((paymentAmountRaw > amBalance))
857870 then true
858871 else (amAssetPart > pmtAmt))
859872 then throw("invalid payment amount")
860873 else $Tuple6((amBalance - paymentAmountRaw), prBalance, (pmtAmt - amAssetPart), prAssetPart, 0, 0)
861874 else if ((pmtAssetId == prId))
862875 then if (if ((paymentAmountRaw > prBalance))
863876 then true
864877 else (prAssetPart > pmtAmt))
865878 then throw("invalid payment amount")
866879 else $Tuple6(amBalance, (prBalance - paymentAmountRaw), 0, 0, (pmtAmt - prAssetPart), amAssetPart)
867880 else throw("wrong pmtAssetId")
868- let amBalanceNow = $t03139932015._1
869- let prBalanceNow = $t03139932015._2
870- let virtSwapInAm = $t03139932015._3
871- let virtSwapOutPr = $t03139932015._4
872- let virtSwapInPr = $t03139932015._5
873- let virtSwapOutAm = $t03139932015._6
881+ let amBalanceNow = $t03204932665._1
882+ let prBalanceNow = $t03204932665._2
883+ let virtSwapInAm = $t03204932665._3
884+ let virtSwapOutPr = $t03204932665._4
885+ let virtSwapInPr = $t03204932665._5
886+ let virtSwapOutAm = $t03204932665._6
874887 let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
875888 let D1 = invoke(gwxCntr, "calcD", [toString(toBigInt(((amBalanceNow + virtSwapInAm) - virtSwapOutAm))), toString(toBigInt(((prBalanceNow + virtSwapInPr) - virtSwapOutPr))), A, Amult, Dconv], nil)
876889 let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
877890 if ((D0vsD1 == D0vsD1))
878891 then {
879892 let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(fromBase58String(amId), amAssetPart), AttachedPayment(fromBase58String(prId), prAssetPart), slippage, true, true, true, pmtAmt, pmtAssetId)
880893 let estimLP = estPut._2
881894 let lpAssetId = estPut._7
882895 let state = estPut._9
883896 let amDiff = estPut._10
884897 let prDiff = estPut._11
885898 let lpCalcRes = vad(toBigInt(estimLP), toBigInt(outLp), toBigInt(slippage))
886899 let emitLpAmt = toInt(lpCalcRes._2)
887900 let e = invoke(fca, "emit", [emitLpAmt], nil)
888901 if ((e == e))
889902 then {
890903 let el = match e {
891904 case legacy: Address =>
892905 invoke(legacy, "emit", [emitLpAmt], nil)
893906 case _ =>
894907 unit
895908 }
896909 if ((el == el))
897910 then {
898911 let sa = if ((amDiff > 0))
899912 then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
900913 else nil
901914 if ((sa == sa))
902915 then {
903916 let sp = if ((prDiff > 0))
904917 then invoke(slipCntr, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
905918 else nil
906919 if ((sp == sp))
907920 then {
908921 let lpTrnsfr = if (autoStake)
909922 then {
910923 let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
911924 if ((ss == ss))
912925 then nil
913926 else throw("Strict value is not equal to itself.")
914927 }
915928 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
916929 let sendFeeToMatcher = if ((feeAmount > 0))
917930 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
918931 else nil
919932 ((state ++ lpTrnsfr) ++ sendFeeToMatcher)
920933 }
921934 else throw("Strict value is not equal to itself.")
922935 }
923936 else throw("Strict value is not equal to itself.")
924937 }
925938 else throw("Strict value is not equal to itself.")
926939 }
927940 else throw("Strict value is not equal to itself.")
928941 }
929942 else throw("Strict value is not equal to itself.")
930943 }
931944 }
932945 }
933946
934947
935948
936949 @Callable(i)
937950 func putOneTknV2 (minOutAmount,autoStake) = if ((size(i.payments) != 1))
938951 then throw("1 pmnt expd")
939952 else {
940953 let poolConfig = gpc()
941954 let amId = poolConfig[idxAmAsId]
942955 let prId = poolConfig[idxPrAsId]
956+ let lpId = fromBase58String(poolConfig[idxLPAsId])
943957 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
944958 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
945959 let userAddress = if ((i.caller == this))
946960 then i.originCaller
947961 else i.caller
948962 let pmt = value(i.payments[0])
949963 let pmtAssetId = toBase58String(value(pmt.assetId))
950964 let pmtAmt = pmt.amount
951965 if ((10000000 > pmtAmt))
952966 then throw("Wrong pmt amt")
953967 else {
954- let r = estimatePutOneTknV2(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId))
955- let estimLP = r._2
956- let lpAssetId = r._7
957- let state = r._9
958- let amDiff = r._10
959- let prDiff = r._11
968+ let $t03557135696 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId))
969+ let estimLP = $t03557135696._1
970+ let state = $t03557135696._2
971+ let feeAmount = $t03557135696._3
960972 let emitLpAmt = if (if ((minOutAmount > 0))
961973 then (minOutAmount > estimLP)
962974 else false)
963975 then throw(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
964976 else estimLP
965977 let e = invoke(fca, "emit", [emitLpAmt], nil)
966978 if ((e == e))
967979 then {
968980 let el = match e {
969981 case legacy: Address =>
970982 invoke(legacy, "emit", [emitLpAmt], nil)
971983 case _ =>
972984 unit
973985 }
974986 if ((el == el))
975987 then {
976- let sa = if ((amDiff > 0))
977- then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(amId), amDiff)])
978- else nil
979- if ((sa == sa))
988+ let lpTrnsfr = if (autoStake)
980989 then {
981- let sp = if ((prDiff > 0))
982- then invoke(slipageContract, "put", nil, [AttachedPayment(fromBase58String(prId), prDiff)])
983- else nil
984- if ((sp == sp))
985- then {
986- let lpTrnsfr = if (autoStake)
987- then {
988- let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
989- if ((ss == ss))
990- then nil
991- else throw("Strict value is not equal to itself.")
992- }
993- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
994- let feeAmount = takeFee(pmtAmt)._2
995- let sendFeeToMatcher = if ((feeAmount > 0))
996- then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
997- else nil
998- $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
999- }
990+ let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
991+ if ((ss == ss))
992+ then nil
1000993 else throw("Strict value is not equal to itself.")
1001994 }
1002- else throw("Strict value is not equal to itself.")
995+ else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
996+ let sendFeeToMatcher = if ((feeAmount > 0))
997+ then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
998+ else nil
999+ $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
10031000 }
10041001 else throw("Strict value is not equal to itself.")
10051002 }
10061003 else throw("Strict value is not equal to itself.")
10071004 }
10081005 }
1009-
1010-
1011-
1012-@Callable(i)
1013-func putOneTknV2WithBonusOldREADONLY (paymentAmount,paymentAssetId) = {
1014- let poolConfig = gpc()
1015- let amId = poolConfig[idxAmAsId]
1016- let prId = poolConfig[idxPrAsId]
1017- let r = estimatePutOneTknV2(paymentAmount, paymentAssetId, "", "")
1018- let estimLP = r._2
1019- let curPrice = r._3
1020- let lpAssetEmission = r._6
1021- let lpAssetId = r._7
1022- let amBalance = getAccBalance(amId)
1023- let prBalance = getAccBalance(prId)
1024- let poolProportion = fraction(prBalance, scale8, amBalance)
1025- let amountAssetPart = fraction(paymentAmount, scale8, (poolProportion + scale8))
1026- let priceAssetPart = (paymentAmount - amountAssetPart)
1027- let lpAmtBoth = fraction(lpAssetEmission, priceAssetPart, prBalance)
1028- let bonus = fraction((estimLP - lpAmtBoth), scale8, lpAmtBoth)
1029- let feeAmount = takeFee(paymentAmount)._2
1030- $Tuple2(nil, $Tuple3(estimLP, feeAmount, bonus))
1031- }
10321006
10331007
10341008
10351009 @Callable(i)
10361010 func putForFree (maxSlpg) = if ((0 > maxSlpg))
10371011 then throw("Wrong slpg")
10381012 else if ((size(i.payments) != 2))
10391013 then throw("2 pmnts expd")
10401014 else {
10411015 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, "")
10421016 estPut._9
10431017 }
10441018
10451019
10461020
10471021 @Callable(i)
10481022 func get () = {
10491023 let r = cg(i)
10501024 let outAmtAmt = r._1
10511025 let outPrAmt = r._2
10521026 let pmtAmt = r._3
10531027 let pmtAssetId = r._4
10541028 let state = r._5
10551029 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10561030 if ((b == b))
10571031 then state
10581032 else throw("Strict value is not equal to itself.")
10591033 }
10601034
10611035
10621036
10631037 @Callable(i)
10641038 func getOneTkn (exchResult,notUsed,outAmount,outAssetId,slippage) = if ((size(i.payments) != 1))
10651039 then throw("1 pmnt expd")
10661040 else {
10671041 let cfg = gpc()
10681042 let lpId = cfg[idxLPAsId]
10691043 let amId = cfg[idxAmAsId]
10701044 let prId = cfg[idxPrAsId]
10711045 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
10721046 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
10731047 let sts = cfg[idxPoolSt]
10741048 let factCfg = gfc()
10751049 let gwxCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactGwxRewCntr]), "Wr sl addr")
10761050 let pmt = value(i.payments[0])
10771051 let addon = valueOrElse(getString(this, ada()), "")
10781052 let userAddress = if ((addon == toString(i.caller)))
10791053 then i.originCaller
10801054 else i.caller
10811055 let txId58 = toBase58String(i.transactionId)
10821056 let pmtAssetId = value(pmt.assetId)
10831057 let pmtAmt = pmt.amount
10841058 if ((1000000000 > pmtAmt))
10851059 then throw("Min pmt 10 LP")
10861060 else if (if (if ((0 > slippage))
10871061 then true
10881062 else (0 > exchResult))
10891063 then true
10901064 else (0 > outAmount))
10911065 then throw("Wrong params")
10921066 else if ((lpId != toBase58String(pmtAssetId)))
10931067 then throw("Wrong LP")
10941068 else {
10951069 let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
10961070 let estimAmAmt = r._1
10971071 let estimPrAmt = r._2
10981072 let amBalance = getAccBalance(amId)
10991073 let prBalance = getAccBalance(prId)
1100- let $t03997540435 = if ((outAssetId == amId))
1074+ let $t03932739787 = if ((outAssetId == amId))
11011075 then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), exchResult, estimPrAmt, 0, 0, (estimAmAmt + exchResult))
11021076 else if ((outAssetId == prId))
11031077 then $Tuple7((amBalance - estimAmAmt), (prBalance - estimPrAmt), 0, 0, exchResult, estimAmAmt, (estimPrAmt + exchResult))
11041078 else throw("wrong outAssetId")
1105- let amBalanceNow = $t03997540435._1
1106- let prBalanceNow = $t03997540435._2
1107- let virtSwapInAm = $t03997540435._3
1108- let virtSwapOutPr = $t03997540435._4
1109- let virtSwapInPr = $t03997540435._5
1110- let virtSwapOutAm = $t03997540435._6
1111- let totalGetRaw = $t03997540435._7
1079+ let amBalanceNow = $t03932739787._1
1080+ let prBalanceNow = $t03932739787._2
1081+ let virtSwapInAm = $t03932739787._3
1082+ let virtSwapOutPr = $t03932739787._4
1083+ let virtSwapInPr = $t03932739787._5
1084+ let virtSwapOutAm = $t03932739787._6
1085+ let totalGetRaw = $t03932739787._7
11121086 if (if ((0 > virtSwapInAm))
11131087 then true
11141088 else (0 > virtSwapInPr))
11151089 then throw("Wrong calc")
11161090 else {
11171091 let D0 = invoke(gwxCntr, "calcD", [toString(amBalanceNow), toString(prBalanceNow), A, Amult, Dconv], nil)
11181092 let D1 = invoke(gwxCntr, "calcD", [toString(((amBalanceNow - virtSwapInAm) + virtSwapOutAm)), toString(((prBalanceNow + virtSwapOutPr) - virtSwapInPr)), A, Amult, Dconv], nil)
11191093 let D0vsD1 = vd(parseBigIntValue(str(D1)), parseBigIntValue(str(D0)), slippage4D)
11201094 if ((D0vsD1 == D0vsD1))
11211095 then {
11221096 let totalGet = takeFee(totalGetRaw)._1
11231097 let finalRes = vad(toBigInt(totalGet), toBigInt(outAmount), toBigInt(slippage))
11241098 if ((finalRes == finalRes))
11251099 then {
1126- let $t04118241286 = if ((outAssetId == amId))
1100+ let $t04053440638 = if ((outAssetId == amId))
11271101 then $Tuple2(toInt(finalRes._2), 0)
11281102 else $Tuple2(0, toInt(finalRes._2))
1129- let outAm = $t04118241286._1
1130- let outPr = $t04118241286._2
1103+ let outAm = $t04053440638._1
1104+ let outPr = $t04053440638._2
11311105 let totalAmount = (outAm + outPr)
11321106 let feeAmount = (totalGetRaw - totalGet)
11331107 let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
11341108 then unit
11351109 else fromBase58String(outAssetId)
11361110 let sendFeeToMatcher = if ((feeAmount > 0))
11371111 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
11381112 else nil
11391113 let curPrX18 = cpbi(t1(prBalance, prDcm), t1(amBalance, amDcm))
11401114 let curPr = f1(curPrX18, scale8)
11411115 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)]
11421116 if ((state == state))
11431117 then {
11441118 let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11451119 if ((burn == burn))
11461120 then (state ++ sendFeeToMatcher)
11471121 else throw("Strict value is not equal to itself.")
11481122 }
11491123 else throw("Strict value is not equal to itself.")
11501124 }
11511125 else throw("Strict value is not equal to itself.")
11521126 }
11531127 else throw("Strict value is not equal to itself.")
11541128 }
11551129 }
11561130 }
11571131
11581132
11591133
11601134 @Callable(i)
11611135 func getOneTknV2 (outAssetId,minOutAmount) = {
1162- let $t04231142466 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1163- let state = $t04231142466._1
1164- let totalAmount = $t04231142466._2
1136+ let $t04166341818 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1137+ let state = $t04166341818._1
1138+ let totalAmount = $t04166341818._2
11651139 $Tuple2(state, totalAmount)
11661140 }
11671141
11681142
11691143
11701144 @Callable(i)
11711145 func getOneTknV2OldREADONLY (outAssetId,lpAssetAmount) = {
11721146 let poolConfig = gpc()
11731147 let lpId = poolConfig[idxLPAsId]
11741148 let amId = poolConfig[idxAmAsId]
11751149 let prId = poolConfig[idxPrAsId]
11761150 let r = ego("", lpId, lpAssetAmount, this)
11771151 let estimAmAmt = r._1
11781152 let estimPrAmt = r._2
11791153 let amBalance = getAccBalance(amId)
11801154 let prBalance = getAccBalance(prId)
11811155 let amBalanceNow = (amBalance - estimAmAmt)
11821156 let prBalanceNow = (prBalance - estimPrAmt)
1183- let $t04297943287 = if ((outAssetId == amId))
1157+ let $t04233142639 = if ((outAssetId == amId))
11841158 then $Tuple4(prBalanceNow, amBalanceNow, estimPrAmt, estimAmAmt)
11851159 else if ((outAssetId == prId))
11861160 then $Tuple4(amBalanceNow, prBalanceNow, estimAmAmt, estimPrAmt)
11871161 else throw("wrong outAssetId")
1188- let amountBalanceForSwap = $t04297943287._1
1189- let priceBalanceForSwap = $t04297943287._2
1190- let amountToSwap = $t04297943287._3
1191- let amountToAdd = $t04297943287._4
1162+ let amountBalanceForSwap = $t04233142639._1
1163+ let priceBalanceForSwap = $t04233142639._2
1164+ let amountToSwap = $t04233142639._3
1165+ let amountToAdd = $t04233142639._4
11921166 let yPrecision = 1
11931167 let exchResult = {
11941168 let @ = invoke(gwxContract, "calcSwapXToY", [toString(amountToSwap), toString(amountBalanceForSwap), toString(priceBalanceForSwap), "", A, Amult, toString(yPrecision), Dconv], nil)
11951169 if ($isInstanceOf(@, "Int"))
11961170 then @
11971171 else throw(($getType(@) + " couldn't be cast to Int"))
11981172 }
11991173 let totalGetRaw = (exchResult + amountToAdd)
1200- let $t04381543864 = takeFee(totalGetRaw)
1201- let totalGet = $t04381543864._1
1202- let feeAmount = $t04381543864._2
1174+ let $t04316743216 = takeFee(totalGetRaw)
1175+ let totalGet = $t04316743216._1
1176+ let feeAmount = $t04316743216._2
12031177 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
12041178 }
12051179
12061180
12071181
12081182 @Callable(i)
12091183 func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
12101184 let poolConfig = gpc()
12111185 let amId = poolConfig[idxAmAsId]
12121186 let prId = poolConfig[idxPrAsId]
12131187 let lpId = poolConfig[idxLPAsId]
12141188 let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))]
12151189 let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
12161190 let D0 = getD(xp)
12171191 let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission))
12181192 let index = if ((outAssetId == amId))
12191193 then 0
12201194 else 1
12211195 let newY = getYD(xp, index, D1)
12221196 let dy = (xp[index] - newY)
12231197 let totalGetRaw = toInt((dy - big1))
1224- let $t04455544604 = takeFee(totalGetRaw)
1225- let totalGet = $t04455544604._1
1226- let feeAmount = $t04455544604._2
1198+ let $t04390743956 = takeFee(totalGetRaw)
1199+ let totalGet = $t04390743956._1
1200+ let feeAmount = $t04390743956._2
12271201 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
12281202 }
12291203
12301204
12311205
12321206 @Callable(i)
12331207 func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = {
12341208 let poolConfig = gpc()
12351209 let amId = poolConfig[idxAmAsId]
12361210 let prId = poolConfig[idxPrAsId]
12371211 let lpId = poolConfig[idxLPAsId]
12381212 let amBalance = getAccBalance(amId)
12391213 let prBalance = getAccBalance(prId)
1240- let $t04494945064 = {
1214+ let $t04430144416 = {
12411215 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
12421216 if ($isInstanceOf(@, "(Int, Int)"))
12431217 then @
12441218 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
12451219 }
1246- let totalGet = $t04494945064._1
1247- let feeAmount = $t04494945064._2
1220+ let totalGet = $t04430144416._1
1221+ let feeAmount = $t04430144416._2
12481222 let r = ego("", lpId, lpAssetAmount, this)
12491223 let outAmAmt = r._1
12501224 let outPrAmt = r._2
12511225 let sumOfGetAssets = (outAmAmt + outPrAmt)
12521226 let bonus = fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets)
12531227 $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus))
12541228 }
12551229
12561230
12571231
12581232 @Callable(i)
12591233 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
12601234 let r = cg(i)
12611235 let outAmAmt = r._1
12621236 let outPrAmt = r._2
12631237 let pmtAmt = r._3
12641238 let pmtAssetId = r._4
12651239 let state = r._5
12661240 if ((noLessThenAmtAsset > outAmAmt))
12671241 then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
12681242 else if ((noLessThenPriceAsset > outPrAmt))
12691243 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
12701244 else {
12711245 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12721246 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12731247 then state
12741248 else throw("Strict value is not equal to itself.")
12751249 }
12761250 }
12771251
12781252
12791253
12801254 @Callable(i)
12811255 func unstakeAndGet (amount) = {
12821256 let checkPayments = if ((size(i.payments) != 0))
12831257 then throw("No pmnts expd")
12841258 else true
12851259 if ((checkPayments == checkPayments))
12861260 then {
12871261 let cfg = gpc()
12881262 let factoryCfg = gfc()
12891263 let lpAssetId = fromBase58String(cfg[idxLPAsId])
12901264 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
12911265 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
12921266 if ((unstakeInv == unstakeInv))
12931267 then {
12941268 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
12951269 let sts = parseIntValue(r._9)
12961270 let state = r._10
12971271 let v = if (if (igs())
12981272 then true
12991273 else (sts == PoolShutdown))
13001274 then throw(("Blocked: " + toString(sts)))
13011275 else true
13021276 if ((v == v))
13031277 then {
13041278 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
13051279 if ((burnA == burnA))
13061280 then state
13071281 else throw("Strict value is not equal to itself.")
13081282 }
13091283 else throw("Strict value is not equal to itself.")
13101284 }
13111285 else throw("Strict value is not equal to itself.")
13121286 }
13131287 else throw("Strict value is not equal to itself.")
13141288 }
13151289
13161290
13171291
13181292 @Callable(i)
13191293 func unstakeAndGetOneTkn (unstakeAmount,outAssetId,minOutAmount) = {
13201294 let checkPayments = if ((size(i.payments) != 0))
13211295 then throw("No pmnts expd")
13221296 else true
13231297 if ((checkPayments == checkPayments))
13241298 then {
13251299 let cfg = gpc()
13261300 let factoryCfg = gfc()
13271301 let lpAssetId = fromBase58String(cfg[idxLPAsId])
13281302 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
13291303 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
13301304 if ((unstakeInv == unstakeInv))
13311305 then {
1332- let $t04736947557 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1333- let state = $t04736947557._1
1334- let totalAmount = $t04736947557._2
1306+ let $t04672146909 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1307+ let state = $t04672146909._1
1308+ let totalAmount = $t04672146909._2
13351309 $Tuple2(state, totalAmount)
13361310 }
13371311 else throw("Strict value is not equal to itself.")
13381312 }
13391313 else throw("Strict value is not equal to itself.")
13401314 }
13411315
13421316
13431317
13441318 @Callable(i)
1345-func putOneTknV2WithBonusREADONLY (amount,asset) = {
1319+func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = {
13461320 let poolConfig = gpc()
13471321 let amId = poolConfig[idxAmAsId]
13481322 let prId = poolConfig[idxPrAsId]
13491323 let lpId = poolConfig[idxLPAsId]
1350- let paymentAsset = asset
1351- let paymentAmountRaw = amount
1352- let $t04799448084 = takeFee(paymentAmountRaw)
1353- let paymentAmount = $t04799448084._1
1354- let feeAmount = $t04799448084._2
1355- let $t04808848270 = if ((paymentAsset == amId))
1356- then $Tuple2(paymentAmount, 0)
1357- else if ((paymentAsset == prId))
1358- then $Tuple2(0, paymentAmount)
1359- else throw("invalid payment")
1360- let amAmount = $t04808848270._1
1361- let prAmount = $t04808848270._2
1362- let amBalanceOld = getAccBalance(amId)
1363- let prBalanceOld = getAccBalance(prId)
1364- let amBalanceNew = (amBalanceOld + amAmount)
1365- let prBalanceNew = (prBalanceOld + prAmount)
1366- let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
1367- let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
1368- let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
1369- let lpAmount = ((lpAssetEmission * (D1 - D0)) / D0)
1370- let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
1371- let amountAssetPart = fraction(paymentAmount, scale8, (poolProportion + scale8))
1372- let priceAssetPart = (paymentAmount - amountAssetPart)
1373- let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
1374- let bonus = fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)
1375- $Tuple2(nil, $Tuple3(toInt(lpAmount), feeAmount, toInt(bonus)))
1324+ let $t04716847265 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "")
1325+ let lpAmount = $t04716847265._1
1326+ let state = $t04716847265._2
1327+ let feeAmount = $t04716847265._3
1328+ let bonus = $t04716847265._4
1329+ $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13761330 }
13771331
13781332
13791333
13801334 @Callable(i)
13811335 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
13821336 then throw("denied")
13831337 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
13841338
13851339
13861340
13871341 @Callable(i)
13881342 func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
13891343 then pd
13901344 else [StringEntry(k, v)]
13911345
13921346
13931347
13941348 @Callable(i)
13951349 func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
13961350 then pd
13971351 else [IntegerEntry(k, v)]
13981352
13991353
14001354
14011355 @Callable(i)
14021356 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
14031357
14041358
14051359
14061360 @Callable(i)
14071361 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
14081362
14091363
14101364
14111365 @Callable(i)
14121366 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
14131367 let pr = calcPrices(amAmt, prAmt, lpAmt)
14141368 $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
14151369 }
14161370
14171371
14181372
14191373 @Callable(i)
14201374 func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
14211375
14221376
14231377
14241378 @Callable(i)
14251379 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
14261380
14271381
14281382
14291383 @Callable(i)
14301384 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
14311385
14321386
14331387
14341388 @Callable(i)
14351389 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, ""))
14361390
14371391
14381392
14391393 @Callable(i)
14401394 func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
14411395 let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
14421396 $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
14431397 }
14441398
14451399
14461400
14471401 @Callable(i)
14481402 func getFeeREADONLY () = $Tuple2(nil, fee)
14491403
14501404
14511405 @Verifier(tx)
14521406 func verify () = {
14531407 let targetPublicKey = match m() {
14541408 case pk: ByteVector =>
14551409 pk
14561410 case _: Unit =>
14571411 tx.senderPublicKey
14581412 case _ =>
14591413 throw("Match error")
14601414 }
14611415 match tx {
14621416 case order: Order =>
14631417 let matcherPub = mp()
14641418 let orderValid = moa(order)
14651419 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14661420 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
14671421 if (if (if (orderValid)
14681422 then senderValid
14691423 else false)
14701424 then matcherValid
14711425 else false)
14721426 then true
14731427 else toe(orderValid, senderValid, matcherValid)
14741428 case s: SetScriptTransaction =>
14751429 let newHash = blake2b256(value(s.script))
14761430 let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash())))
14771431 let currentHash = scriptHash(this)
14781432 if (if ((allowedHash == newHash))
14791433 then (currentHash != newHash)
14801434 else false)
14811435 then true
14821436 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14831437 case _ =>
14841438 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14851439 }
14861440 }
14871441

github/deemru/w8io/026f985 
180.57 ms