tx · CCYYE7dWbfKWoSUA5SNkVhcc4B9se3ExZEL1V2NpdEjJ

3N23sqNJqpVXnHxv4nKXriWA8N6QLsPKd5K:  -0.03500000 Waves

2022.12.07 17:08 [2350015] smart account 3N23sqNJqpVXnHxv4nKXriWA8N6QLsPKd5K > SELF 0.00000000 Waves

{ "type": 13, "id": "CCYYE7dWbfKWoSUA5SNkVhcc4B9se3ExZEL1V2NpdEjJ", "fee": 3500000, "feeAssetId": null, "timestamp": 1670422164655, "version": 1, "sender": "3N23sqNJqpVXnHxv4nKXriWA8N6QLsPKd5K", "senderPublicKey": "2fTQW76r4FCNaSvj5ycqdyqgJWWapZ2m25zmQLckTQwJ", "proofs": [ "2HAuSJUjjYBAhaYbs1ZVFZHQ4eLCWz26oTwkGA3R88cxLvwnmxMwTAo79qSbdStVVjhfqhnEnV3wANwWtWA3uppY" ], "script": "base64:BgL1LAgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlke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CZHIPc2VuZGVyUHVibGljS2V5BAJhQgkA9AMDCAUCZHIJYm9keUJ5dGVzCQCRAwIIBQJkcgZwcm9vZnMAAQUCZ0MDAwMFAmF6BQJhQQcFAmFCBwYJAQJheQMFAmF6BQJhQQUCYUIDCQABAgUCZE0CFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJlUAUCZE0EAmdECQD2AwEJAQV2YWx1ZQEIBQJlUAZzY3JpcHQEAmdFCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUoJAQJhdwAEAmdGCQDxBwEFBHRoaXMDAwkAAAIFAmdFBQJnRAkBAiE9AgUCZ0YFAmdEBwYJAPQDAwgFAmd6CWJvZHlCeXRlcwkAkQMCCAUCZ3oGcHJvb2ZzAAAFAmdCCQD0AwMIBQJneglib2R5Qnl0ZXMJAJEDAggFAmd6BnByb29mcwAABQJnQsDAXEo=", "chainId": 84, "height": 2350015, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G5NeKZuFAbvcUSFaN1o4CDChKsAea4zruoyCxV14YJSj Next: T1oTjfTU5dkxP62vhm9kGDrUjWTHpULd2UsHfr5VFFH Diff:
OldNewDifferences
233233 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
234234
235235
236+func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
237+
238+
236239 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
237240 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
238241 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
342345 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
343346 else {
344347 let lpEmissionX18 = toX18(lpEmission, scale8)
345- let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18, CEILING)
346- let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18, CEILING)
348+ let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
349+ let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
347350 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
348351 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
349352 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
350353 let expAmtAssetAmtX18 = expectedAmts._1
351354 let expPriceAssetAmtX18 = expectedAmts._2
352- let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
355+ let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
353356 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
354357 }
355358 }
408411 func validateMatcherOrderAllowed (order) = {
409412 let amountAssetAmount = order.amount
410413 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
411- let $t02035920571 = if ((order.orderType == Buy))
414+ let $t02061520827 = if ((order.orderType == Buy))
412415 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
413416 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
414- let amountAssetBalanceDelta = $t02035920571._1
415- let priceAssetBalanceDelta = $t02035920571._2
417+ let amountAssetBalanceDelta = $t02061520827._1
418+ let priceAssetBalanceDelta = $t02061520827._2
416419 if (if (if (isGlobalShutdown())
417420 then true
418421 else (cfgPoolStatus == PoolMatcherDisabled))
425428 then throw("Wrong order assets.")
426429 else {
427430 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
428- let $t02104221142 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
429- let unusedActions = $t02104221142._1
430- let kLpNew = $t02104221142._2
431+ let $t02129821398 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
432+ let unusedActions = $t02129821398._1
433+ let kLpNew = $t02129821398._2
431434 let isOrderValid = (kLpNew >= kLp)
432435 isOrderValid
433436 }
503506 else if ((paymentAssetId == cfgPriceAssetId))
504507 then false
505508 else throwErr("invalid asset")
506- let $t02382724120 = if (isEval)
509+ let $t02408324376 = if (isEval)
507510 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
508511 else if (paymentInAmountAsset)
509512 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
510513 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
511- let amountBalanceOld = $t02382724120._1
512- let priceBalanceOld = $t02382724120._2
513- let $t02412424273 = if (paymentInAmountAsset)
514+ let amountBalanceOld = $t02408324376._1
515+ let priceBalanceOld = $t02408324376._2
516+ let $t02438024529 = if (paymentInAmountAsset)
514517 then $Tuple2(paymentAmountRaw, 0)
515518 else $Tuple2(0, paymentAmountRaw)
516- let amountAssetAmountRaw = $t02412424273._1
517- let priceAssetAmountRaw = $t02412424273._2
519+ let amountAssetAmountRaw = $t02438024529._1
520+ let priceAssetAmountRaw = $t02438024529._2
518521 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
519522 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
520- let $t02439524454 = takeFee(paymentAmountRaw)
521- let paymentAmount = $t02439524454._1
522- let feeAmount = $t02439524454._2
523+ let $t02465124710 = takeFee(paymentAmountRaw)
524+ let paymentAmount = $t02465124710._1
525+ let feeAmount = $t02465124710._2
523526 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
524527 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
525528 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
542545 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
543546 let priceOld = fromX18(priceOldX18, scale8)
544547 let loss = {
545- let $t02593126098 = if (paymentInAmountAsset)
548+ let $t02618726354 = if (paymentInAmountAsset)
546549 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
547550 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
548- let amount = $t02593126098._1
549- let balance = $t02593126098._2
551+ let amount = $t02618726354._1
552+ let balance = $t02618726354._2
550553 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
551554 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
552555 }
580583 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
581584 let redeemedBigInt = toBigInt(paymentAmount)
582585 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
583- let $t02770027750 = takeFee(amountRaw)
584- let totalAmount = $t02770027750._1
585- let feeAmount = $t02770027750._2
586- let $t02775427980 = if (outInAmountAsset)
586+ let $t02795628006 = takeFee(amountRaw)
587+ let totalAmount = $t02795628006._1
588+ let feeAmount = $t02795628006._2
589+ let $t02801028236 = if (outInAmountAsset)
587590 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
588591 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
589- let outAmAmount = $t02775427980._1
590- let outPrAmount = $t02775427980._2
591- let amBalanceNew = $t02775427980._3
592- let prBalanceNew = $t02775427980._4
592+ let outAmAmount = $t02801028236._1
593+ let outPrAmount = $t02801028236._2
594+ let amBalanceNew = $t02801028236._3
595+ let prBalanceNew = $t02801028236._4
593596 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
594597 let priceNew = fromX18(priceNewX18, scale8)
595598 let commonState = if (isEval)
735738 else throw("Strict value is not equal to itself.")
736739 }
737740 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
738- let $t03250832970 = refreshKLpInternal(0, 0, 0)
739- if (($t03250832970 == $t03250832970))
741+ let $t03276433226 = refreshKLpInternal(0, 0, 0)
742+ if (($t03276433226 == $t03276433226))
740743 then {
741- let updatedKLp = $t03250832970._2
742- let refreshKLpActions = $t03250832970._1
744+ let updatedKLp = $t03276433226._2
745+ let refreshKLpActions = $t03276433226._1
743746 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
744747 if ((isUpdatedKLpValid == isUpdatedKLpValid))
745748 then ((state ++ lpTransfer) ++ refreshKLpActions)
771774 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
772775 if ((currentKLp == currentKLp))
773776 then {
774- let $t03353233597 = refreshKLpInternal(0, 0, 0)
775- let refreshKLpActions = $t03353233597._1
776- let updatedKLp = $t03353233597._2
777+ let $t03378833853 = refreshKLpInternal(0, 0, 0)
778+ let refreshKLpActions = $t03378833853._1
779+ let updatedKLp = $t03378833853._2
777780 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
778781 if ((isUpdatedKLpValid == isUpdatedKLpValid))
779782 then (state ++ refreshKLpActions)
818821 else throwErr("payment asset is not supported")
819822 let userAddress = i.caller
820823 let txId = i.transactionId
821- let $t03478234934 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
822- if (($t03478234934 == $t03478234934))
824+ let $t03503835190 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
825+ if (($t03503835190 == $t03503835190))
823826 then {
824- let paymentInAmountAsset = $t03478234934._5
825- let bonus = $t03478234934._4
826- let feeAmount = $t03478234934._3
827- let commonState = $t03478234934._2
828- let emitAmountEstimated = $t03478234934._1
827+ let paymentInAmountAsset = $t03503835190._5
828+ let bonus = $t03503835190._4
829+ let feeAmount = $t03503835190._3
830+ let commonState = $t03503835190._2
831+ let emitAmountEstimated = $t03503835190._1
829832 let emitAmount = if (if ((minOutAmount > 0))
830833 then (minOutAmount > emitAmountEstimated)
831834 else false)
845848 let sendFee = if ((feeAmount > 0))
846849 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
847850 else nil
848- let $t03552035717 = if ((this == feeCollectorAddress))
851+ let $t03577635973 = if ((this == feeCollectorAddress))
849852 then $Tuple2(0, 0)
850853 else if (paymentInAmountAsset)
851854 then $Tuple2(-(feeAmount), 0)
852855 else $Tuple2(0, -(feeAmount))
853- let amountAssetBalanceDelta = $t03552035717._1
854- let priceAssetBalanceDelta = $t03552035717._2
855- let $t03572035828 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
856- let refreshKLpActions = $t03572035828._1
857- let updatedKLp = $t03572035828._2
856+ let amountAssetBalanceDelta = $t03577635973._1
857+ let priceAssetBalanceDelta = $t03577635973._2
858+ let $t03597636084 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
859+ let refreshKLpActions = $t03597636084._1
860+ let updatedKLp = $t03597636084._2
858861 let kLp = value(getString(keyKLp))
859862 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
860863 if ((isUpdatedKLpValid == isUpdatedKLpValid))
872875
873876 @Callable(i)
874877 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
875- let $t03613436291 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
876- let emitAmountEstimated = $t03613436291._1
877- let commonState = $t03613436291._2
878- let feeAmount = $t03613436291._3
879- let bonus = $t03613436291._4
880- let paymentInAmountAsset = $t03613436291._5
878+ let $t03639036547 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
879+ let emitAmountEstimated = $t03639036547._1
880+ let commonState = $t03639036547._2
881+ let feeAmount = $t03639036547._3
882+ let bonus = $t03639036547._4
883+ let paymentInAmountAsset = $t03639036547._5
881884 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
882885 }
883886
912915 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
913916 let userAddress = i.caller
914917 let txId = i.transactionId
915- let $t03718537338 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
916- if (($t03718537338 == $t03718537338))
918+ let $t03744137594 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
919+ if (($t03744137594 == $t03744137594))
917920 then {
918- let outInAmountAsset = $t03718537338._5
919- let bonus = $t03718537338._4
920- let feeAmount = $t03718537338._3
921- let commonState = $t03718537338._2
922- let amountEstimated = $t03718537338._1
921+ let outInAmountAsset = $t03744137594._5
922+ let bonus = $t03744137594._4
923+ let feeAmount = $t03744137594._3
924+ let commonState = $t03744137594._2
925+ let amountEstimated = $t03744137594._1
923926 let amount = if (if ((minOutAmount > 0))
924927 then (minOutAmount > amountEstimated)
925928 else false)
932935 let sendFee = if ((feeAmount > 0))
933936 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
934937 else nil
935- let $t03783838085 = {
938+ let $t03809438341 = {
936939 let feeAmountForCalc = if ((this == feeCollectorAddress))
937940 then 0
938941 else feeAmount
940943 then $Tuple2(-((amount + feeAmountForCalc)), 0)
941944 else $Tuple2(0, -((amount + feeAmountForCalc)))
942945 }
943- let amountAssetBalanceDelta = $t03783838085._1
944- let priceAssetBalanceDelta = $t03783838085._2
945- let $t03808838196 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
946- let refreshKLpActions = $t03808838196._1
947- let updatedKLp = $t03808838196._2
946+ let amountAssetBalanceDelta = $t03809438341._1
947+ let priceAssetBalanceDelta = $t03809438341._2
948+ let $t03834438452 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
949+ let refreshKLpActions = $t03834438452._1
950+ let updatedKLp = $t03834438452._2
948951 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
949952 if ((isUpdatedKLpValid == isUpdatedKLpValid))
950953 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
961964
962965 @Callable(i)
963966 func getOneTknREADONLY (outAssetId,paymentAmount) = {
964- let $t03845338609 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
965- let amountEstimated = $t03845338609._1
966- let commonState = $t03845338609._2
967- let feeAmount = $t03845338609._3
968- let bonus = $t03845338609._4
969- let outInAmountAsset = $t03845338609._5
967+ let $t03870938865 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
968+ let amountEstimated = $t03870938865._1
969+ let commonState = $t03870938865._2
970+ let feeAmount = $t03870938865._3
971+ let bonus = $t03870938865._4
972+ let outInAmountAsset = $t03870938865._5
970973 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
971974 }
972975
10011004 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10021005 if ((unstakeInv == unstakeInv))
10031006 then {
1004- let $t03951139662 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1005- if (($t03951139662 == $t03951139662))
1007+ let $t03976739918 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1008+ if (($t03976739918 == $t03976739918))
10061009 then {
1007- let outInAmountAsset = $t03951139662._5
1008- let bonus = $t03951139662._4
1009- let feeAmount = $t03951139662._3
1010- let commonState = $t03951139662._2
1011- let amountEstimated = $t03951139662._1
1010+ let outInAmountAsset = $t03976739918._5
1011+ let bonus = $t03976739918._4
1012+ let feeAmount = $t03976739918._3
1013+ let commonState = $t03976739918._2
1014+ let amountEstimated = $t03976739918._1
10121015 let amount = if (if ((minOutAmount > 0))
10131016 then (minOutAmount > amountEstimated)
10141017 else false)
10211024 let sendFee = if ((feeAmount > 0))
10221025 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10231026 else nil
1024- let $t04015740404 = {
1027+ let $t04041340660 = {
10251028 let feeAmountForCalc = if ((this == feeCollectorAddress))
10261029 then 0
10271030 else feeAmount
10291032 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10301033 else $Tuple2(0, -((amount + feeAmountForCalc)))
10311034 }
1032- let amountAssetBalanceDelta = $t04015740404._1
1033- let priceAssetBalanceDelta = $t04015740404._2
1034- let $t04040740515 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1035- let refreshKLpActions = $t04040740515._1
1036- let updatedKLp = $t04040740515._2
1035+ let amountAssetBalanceDelta = $t04041340660._1
1036+ let priceAssetBalanceDelta = $t04041340660._2
1037+ let $t04066340771 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1038+ let refreshKLpActions = $t04066340771._1
1039+ let updatedKLp = $t04066340771._2
10371040 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10381041 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10391042 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10621065 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10631066 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10641067 then {
1065- let $t04146341545 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1066- let refreshKLpActions = $t04146341545._1
1067- let updatedKLp = $t04146341545._2
1068+ let $t04171941801 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1069+ let refreshKLpActions = $t04171941801._1
1070+ let updatedKLp = $t04171941801._2
10681071 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10691072 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10701073 then (state ++ refreshKLpActions)
10921095 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10931096 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10941097 then {
1095- let $t04249642577 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1096- let refreshKLpActions = $t04249642577._1
1097- let updatedKLp = $t04249642577._2
1098+ let $t04275242833 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1099+ let refreshKLpActions = $t04275242833._1
1100+ let updatedKLp = $t04275242833._2
10981101 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10991102 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11001103 then (state ++ refreshKLpActions)
11341137 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11351138 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11361139 then {
1137- let $t04370043781 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1138- let refreshKLpActions = $t04370043781._1
1139- let updatedKLp = $t04370043781._2
1140+ let $t04395644037 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1141+ let refreshKLpActions = $t04395644037._1
1142+ let updatedKLp = $t04395644037._2
11401143 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11411144 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11421145 then (state ++ refreshKLpActions)
11831186 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11841187 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11851188 then {
1186- let $t04507345154 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1187- let refreshKLpActions = $t04507345154._1
1188- let updatedKLp = $t04507345154._2
1189+ let $t04532945410 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1190+ let refreshKLpActions = $t04532945410._1
1191+ let updatedKLp = $t04532945410._2
11891192 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11901193 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11911194 then (state ++ refreshKLpActions)
12181221 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12191222 then {
12201223 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1221- let $t04634146405 = refreshKLpInternal(0, 0, 0)
1222- let kLpUpdateActions = $t04634146405._1
1223- let updatedKLp = $t04634146405._2
1224+ let $t04659746661 = refreshKLpInternal(0, 0, 0)
1225+ let kLpUpdateActions = $t04659746661._1
1226+ let updatedKLp = $t04659746661._2
12241227 let actions = if ((kLp != updatedKLp))
12251228 then kLpUpdateActions
12261229 else throwErr("nothing to refresh")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lPdecimals = 8
55
66 let scale8 = 100000000
77
88 let scale8BigInt = toBigInt(100000000)
99
1010 let scale18 = toBigInt(1000000000000000000)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let big0 = toBigInt(0)
1515
1616 let big1 = toBigInt(1)
1717
1818 let big2 = toBigInt(2)
1919
2020 let wavesString = "WAVES"
2121
2222 let SEP = "__"
2323
2424 let PoolActive = 1
2525
2626 let PoolPutDisabled = 2
2727
2828 let PoolMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
3232 let idxPoolAddress = 1
3333
3434 let idxPoolStatus = 2
3535
3636 let idxPoolLPAssetId = 3
3737
3838 let idxAmtAssetId = 4
3939
4040 let idxPriceAssetId = 5
4141
4242 let idxAmtAssetDcm = 6
4343
4444 let idxPriceAssetDcm = 7
4545
4646 let idxIAmtAssetId = 8
4747
4848 let idxIPriceAssetId = 9
4949
5050 let idxLPAssetDcm = 10
5151
5252 let idxPoolAmtAssetAmt = 1
5353
5454 let idxPoolPriceAssetAmt = 2
5555
5656 let idxPoolLPAssetAmt = 3
5757
5858 let idxFactoryStakingContract = 1
5959
6060 let idxFactorySlippageContract = 7
6161
6262 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6666
6767
6868 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
6969
7070
7171 func abs (val) = if ((0 > 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,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
9494
9595
9696 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
9797
9898
9999 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
100100
101101
102102 func aa () = "%s__amountAsset"
103103
104104
105105 func pa () = "%s__priceAsset"
106106
107107
108108 let keyFee = "%s__fee"
109109
110110 let feeDefault = fraction(10, scale8, 10000)
111111
112112 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
113113
114114 let keyKLp = makeString(["%s", "kLp"], SEP)
115115
116116 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
117117
118118 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
119119
120120 let kLpRefreshDelayDefault = 30
121121
122122 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
123123
124124 func keyFactoryConfig () = "%s__factoryConfig"
125125
126126
127127 func keyMatcherPub () = "%s%s__matcher__publicKey"
128128
129129
130130 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
131131
132132
133133 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
134134
135135
136136 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
137137
138138
139139 func keyAllPoolsShutdown () = "%s__shutdown"
140140
141141
142142 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
143143
144144
145145 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
146146
147147
148148 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
149149
150150 func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
151151
152152
153153 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
154154
155155
156156 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
157157
158158
159159 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
160160
161161
162162 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
163163
164164
165165 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
166166
167167 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
168168
169169 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
170170
171171
172172 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
173173
174174
175175 func getPoolConfig () = {
176176 let amtAsset = getStringOrFail(this, aa())
177177 let priceAsset = getStringOrFail(this, pa())
178178 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
179179 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
180180 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
181181 }
182182
183183
184184 func parseAssetId (input) = if ((input == wavesString))
185185 then unit
186186 else fromBase58String(input)
187187
188188
189189 func assetIdToString (input) = if ((input == unit))
190190 then wavesString
191191 else toBase58String(value(input))
192192
193193
194194 func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolStatus]), fromBase58String(poolConfig[idxPoolLPAssetId]), parseAssetId(poolConfig[idxAmtAssetId]), parseAssetId(poolConfig[idxPriceAssetId]), parseIntValue(poolConfig[idxAmtAssetDcm]), parseIntValue(poolConfig[idxPriceAssetDcm]))
195195
196196
197197 let poolConfigParsed = parsePoolConfig(getPoolConfig())
198198
199199 let $t079158081 = poolConfigParsed
200200
201201 let cfgPoolAddress = $t079158081._1
202202
203203 let cfgPoolStatus = $t079158081._2
204204
205205 let cfgLpAssetId = $t079158081._3
206206
207207 let cfgAmountAssetId = $t079158081._4
208208
209209 let cfgPriceAssetId = $t079158081._5
210210
211211 let cfgAmountAssetDecimals = $t079158081._6
212212
213213 let cfgPriceAssetDecimals = $t079158081._7
214214
215215 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
216216
217217
218218 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
219219
220220 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
221221
222222 func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp,slipageAmtAssetAmt,slipagePriceAssetAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp), toString(slipageAmtAssetAmt), toString(slipagePriceAssetAmt)], SEP)
223223
224224
225225 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)
226226
227227
228228 func getAccBalance (assetId) = if ((assetId == "WAVES"))
229229 then wavesBalance(this).available
230230 else assetBalance(this, fromBase58String(assetId))
231231
232232
233233 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
234234
235235
236+func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
237+
238+
236239 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
237240 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
238241 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
239242 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
240243 }
241244
242245
243246 func calcPrices (amAmt,prAmt,lpAmt) = {
244247 let cfg = getPoolConfig()
245248 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
246249 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
247250 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
248251 let amAmtX18 = toX18(amAmt, amtAssetDcm)
249252 let prAmtX18 = toX18(prAmt, priceAssetDcm)
250253 let lpAmtX18 = toX18(lpAmt, scale8)
251254 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
252255 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
253256 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
254257 }
255258
256259
257260 func calculatePrices (amAmt,prAmt,lpAmt) = {
258261 let prices = calcPrices(amAmt, prAmt, lpAmt)
259262 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
260263 }
261264
262265
263266 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
264267 let cfg = getPoolConfig()
265268 let lpAssetId = cfg[idxPoolLPAssetId]
266269 let amAssetId = cfg[idxAmtAssetId]
267270 let prAssetId = cfg[idxPriceAssetId]
268271 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
269272 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
270273 let poolStatus = cfg[idxPoolStatus]
271274 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
272275 if ((lpAssetId != pmtAssetId))
273276 then throw("Invalid asset passed.")
274277 else {
275278 let amBalance = getAccBalance(amAssetId)
276279 let amBalanceX18 = toX18(amBalance, amAssetDcm)
277280 let prBalance = getAccBalance(prAssetId)
278281 let prBalanceX18 = toX18(prBalance, prAssetDcm)
279282 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
280283 let curPrice = fromX18(curPriceX18, scale8)
281284 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
282285 let lpEmissionX18 = toX18(lpEmission, scale8)
283286 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
284287 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
285288 let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
286289 let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
287290 let state = if ((txId58 == ""))
288291 then nil
289292 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
290293 then unit
291294 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
292295 then unit
293296 else fromBase58String(prAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)]
294297 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
295298 }
296299 }
297300
298301
299302 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
300303 let cfg = getPoolConfig()
301304 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
302305 let amAssetIdStr = cfg[idxAmtAssetId]
303306 let prAssetIdStr = cfg[idxPriceAssetId]
304307 let iAmtAssetId = cfg[idxIAmtAssetId]
305308 let iPriceAssetId = cfg[idxIPriceAssetId]
306309 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
307310 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
308311 let poolStatus = cfg[idxPoolStatus]
309312 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
310313 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
311314 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
312315 if (if ((amAssetIdStr != inAmAssetIdStr))
313316 then true
314317 else (prAssetIdStr != inPrAssetIdStr))
315318 then throw("Invalid amt or price asset passed.")
316319 else {
317320 let amBalance = if (isEvaluate)
318321 then getAccBalance(amAssetIdStr)
319322 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
320323 let prBalance = if (isEvaluate)
321324 then getAccBalance(prAssetIdStr)
322325 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
323326 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
324327 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
325328 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
326329 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
327330 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
328331 let res = if ((lpEmission == 0))
329332 then {
330333 let curPriceX18 = zeroBigInt
331334 let slippageX18 = zeroBigInt
332335 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
333336 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
334337 }
335338 else {
336339 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
337340 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
338341 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
339342 if (if ((curPriceX18 != zeroBigInt))
340343 then (slippageX18 > slippageToleranceX18)
341344 else false)
342345 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
343346 else {
344347 let lpEmissionX18 = toX18(lpEmission, scale8)
345- let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18, CEILING)
346- let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18, CEILING)
348+ let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
349+ let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
347350 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
348351 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
349352 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
350353 let expAmtAssetAmtX18 = expectedAmts._1
351354 let expPriceAssetAmtX18 = expectedAmts._2
352- let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
355+ let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
353356 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
354357 }
355358 }
356359 let calcLpAmt = res._1
357360 let calcAmAssetPmt = res._2
358361 let calcPrAssetPmt = res._3
359362 let curPrice = fromX18(res._4, scale8)
360363 let slippageCalc = fromX18(res._5, scale8)
361364 if ((0 >= calcLpAmt))
362365 then throw("Invalid calculations. LP calculated is less than zero.")
363366 else {
364367 let emitLpAmt = if (!(emitLp))
365368 then 0
366369 else calcLpAmt
367370 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
368371 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
369372 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(calcAmAssetPmt, calcPrAssetPmt, emitLpAmt, curPrice, slippageTolerance, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
370373 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
371374 }
372375 }
373376 }
374377
375378
376379 func calcKLp (amountBalance,priceBalance,lpEmission) = {
377380 let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
378381 if ((lpEmission == big0))
379382 then big0
380383 else updatedKLp
381384 }
382385
383386
384387 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
385388 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
386389 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
387390 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
388391 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
389392 currentKLp
390393 }
391394
392395
393396 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
394397 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
395398 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
396399 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
397400 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
398401 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
399402 $Tuple2(actions, updatedKLp)
400403 }
401404
402405
403406 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
404407 then true
405408 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
406409
407410
408411 func validateMatcherOrderAllowed (order) = {
409412 let amountAssetAmount = order.amount
410413 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
411- let $t02035920571 = if ((order.orderType == Buy))
414+ let $t02061520827 = if ((order.orderType == Buy))
412415 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
413416 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
414- let amountAssetBalanceDelta = $t02035920571._1
415- let priceAssetBalanceDelta = $t02035920571._2
417+ let amountAssetBalanceDelta = $t02061520827._1
418+ let priceAssetBalanceDelta = $t02061520827._2
416419 if (if (if (isGlobalShutdown())
417420 then true
418421 else (cfgPoolStatus == PoolMatcherDisabled))
419422 then true
420423 else (cfgPoolStatus == PoolShutdown))
421424 then throw("Exchange operations disabled")
422425 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
423426 then true
424427 else (order.assetPair.priceAsset != cfgPriceAssetId))
425428 then throw("Wrong order assets.")
426429 else {
427430 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
428- let $t02104221142 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
429- let unusedActions = $t02104221142._1
430- let kLpNew = $t02104221142._2
431+ let $t02129821398 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
432+ let unusedActions = $t02129821398._1
433+ let kLpNew = $t02129821398._2
431434 let isOrderValid = (kLpNew >= kLp)
432435 isOrderValid
433436 }
434437 }
435438
436439
437440 func commonGet (i) = if ((size(i.payments) != 1))
438441 then throw("exactly 1 payment is expected")
439442 else {
440443 let pmt = value(i.payments[0])
441444 let pmtAssetId = value(pmt.assetId)
442445 let pmtAmt = pmt.amount
443446 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
444447 let outAmAmt = res._1
445448 let outPrAmt = res._2
446449 let poolStatus = parseIntValue(res._9)
447450 let state = res._10
448451 if (if (isGlobalShutdown())
449452 then true
450453 else (poolStatus == PoolShutdown))
451454 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
452455 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
453456 }
454457
455458
456459 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
457460 then throw("exactly 2 payments are expected")
458461 else {
459462 let amAssetPmt = value(i.payments[0])
460463 let prAssetPmt = value(i.payments[1])
461464 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
462465 let poolStatus = parseIntValue(estPut._8)
463466 if (if (if (isGlobalShutdown())
464467 then true
465468 else (poolStatus == PoolPutDisabled))
466469 then true
467470 else (poolStatus == PoolShutdown))
468471 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
469472 else estPut
470473 }
471474
472475
473476 func emit (amount) = {
474477 let emitInv = invoke(factoryContract, "emit", [amount], nil)
475478 if ((emitInv == emitInv))
476479 then {
477480 let emitInvLegacy = match emitInv {
478481 case legacyFactoryContract: Address =>
479482 invoke(legacyFactoryContract, "emit", [amount], nil)
480483 case _ =>
481484 unit
482485 }
483486 if ((emitInvLegacy == emitInvLegacy))
484487 then amount
485488 else throw("Strict value is not equal to itself.")
486489 }
487490 else throw("Strict value is not equal to itself.")
488491 }
489492
490493
491494 func takeFee (amount) = {
492495 let feeAmount = fraction(amount, fee, scale8)
493496 $Tuple2((amount - feeAmount), feeAmount)
494497 }
495498
496499
497500 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
498501 let isEval = (txId == unit)
499502 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
500503 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
501504 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
502505 then true
503506 else if ((paymentAssetId == cfgPriceAssetId))
504507 then false
505508 else throwErr("invalid asset")
506- let $t02382724120 = if (isEval)
509+ let $t02408324376 = if (isEval)
507510 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
508511 else if (paymentInAmountAsset)
509512 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
510513 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
511- let amountBalanceOld = $t02382724120._1
512- let priceBalanceOld = $t02382724120._2
513- let $t02412424273 = if (paymentInAmountAsset)
514+ let amountBalanceOld = $t02408324376._1
515+ let priceBalanceOld = $t02408324376._2
516+ let $t02438024529 = if (paymentInAmountAsset)
514517 then $Tuple2(paymentAmountRaw, 0)
515518 else $Tuple2(0, paymentAmountRaw)
516- let amountAssetAmountRaw = $t02412424273._1
517- let priceAssetAmountRaw = $t02412424273._2
519+ let amountAssetAmountRaw = $t02438024529._1
520+ let priceAssetAmountRaw = $t02438024529._2
518521 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
519522 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
520- let $t02439524454 = takeFee(paymentAmountRaw)
521- let paymentAmount = $t02439524454._1
522- let feeAmount = $t02439524454._2
523+ let $t02465124710 = takeFee(paymentAmountRaw)
524+ let paymentAmount = $t02465124710._1
525+ let feeAmount = $t02465124710._2
523526 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
524527 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
525528 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
526529 let priceNew = fromX18(priceNewX18, scale8)
527530 let paymentBalance = if (paymentInAmountAsset)
528531 then amountBalanceOld
529532 else priceBalanceOld
530533 let paymentBalanceBigInt = toBigInt(paymentBalance)
531534 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
532535 let chechSupply = if ((supplyBigInt > big0))
533536 then true
534537 else throwErr("initial deposit requires all coins")
535538 if ((chechSupply == chechSupply))
536539 then {
537540 let depositBigInt = toBigInt(paymentAmount)
538541 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
539542 let commonState = if (isEval)
540543 then nil
541544 else [IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew), StringEntry(pau(toString(value(userAddress)), toBase58String(value(txId))), dataPutActionInfo(amountAssetAmountRaw, priceAssetAmountRaw, issueAmount, priceNew, 0, 0, height, lastBlock.timestamp, 0, 0))]
542545 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
543546 let priceOld = fromX18(priceOldX18, scale8)
544547 let loss = {
545- let $t02593126098 = if (paymentInAmountAsset)
548+ let $t02618726354 = if (paymentInAmountAsset)
546549 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
547550 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
548- let amount = $t02593126098._1
549- let balance = $t02593126098._2
551+ let amount = $t02618726354._1
552+ let balance = $t02618726354._2
550553 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
551554 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
552555 }
553556 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
554557 }
555558 else throw("Strict value is not equal to itself.")
556559 }
557560
558561
559562 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
560563 let isEval = (txId == unit)
561564 let checks = [if ((paymentAssetId == cfgLpAssetId))
562565 then true
563566 else throwErr("invalid lp asset")]
564567 if ((checks == checks))
565568 then {
566569 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
567570 then true
568571 else if ((outAssetId == cfgPriceAssetId))
569572 then false
570573 else throwErr("invalid asset")
571574 let balanceBigInt = if (outInAmountAsset)
572575 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
573576 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
574577 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
575578 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
576579 let outBalance = if (outInAmountAsset)
577580 then amBalanceOld
578581 else prBalanceOld
579582 let outBalanceBigInt = toBigInt(outBalance)
580583 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
581584 let redeemedBigInt = toBigInt(paymentAmount)
582585 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
583- let $t02770027750 = takeFee(amountRaw)
584- let totalAmount = $t02770027750._1
585- let feeAmount = $t02770027750._2
586- let $t02775427980 = if (outInAmountAsset)
586+ let $t02795628006 = takeFee(amountRaw)
587+ let totalAmount = $t02795628006._1
588+ let feeAmount = $t02795628006._2
589+ let $t02801028236 = if (outInAmountAsset)
587590 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
588591 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
589- let outAmAmount = $t02775427980._1
590- let outPrAmount = $t02775427980._2
591- let amBalanceNew = $t02775427980._3
592- let prBalanceNew = $t02775427980._4
592+ let outAmAmount = $t02801028236._1
593+ let outPrAmount = $t02801028236._2
594+ let amBalanceNew = $t02801028236._3
595+ let prBalanceNew = $t02801028236._4
593596 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
594597 let priceNew = fromX18(priceNewX18, scale8)
595598 let commonState = if (isEval)
596599 then nil
597600 else [StringEntry(gau(toString(value(userAddress)), toBase58String(value(txId))), dataGetActionInfo(outAmAmount, outPrAmount, paymentAmount, priceNew, height, lastBlock.timestamp)), IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew)]
598601 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
599602 let priceOld = fromX18(priceOldX18, scale8)
600603 let loss = {
601604 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
602605 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
603606 }
604607 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
605608 }
606609 else throw("Strict value is not equal to itself.")
607610 }
608611
609612
610613 func managerPublicKeyOrUnit () = match getString(mpk()) {
611614 case s: String =>
612615 fromBase58String(s)
613616 case _: Unit =>
614617 unit
615618 case _ =>
616619 throw("Match error")
617620 }
618621
619622
620623 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
621624 case s: String =>
622625 fromBase58String(s)
623626 case _: Unit =>
624627 unit
625628 case _ =>
626629 throw("Match error")
627630 }
628631
629632
630633 func isManager (i) = match managerPublicKeyOrUnit() {
631634 case pk: ByteVector =>
632635 (i.callerPublicKey == pk)
633636 case _: Unit =>
634637 (i.caller == this)
635638 case _ =>
636639 throw("Match error")
637640 }
638641
639642
640643 func mustManager (i) = {
641644 let pd = throw("Permission denied")
642645 match managerPublicKeyOrUnit() {
643646 case pk: ByteVector =>
644647 if ((i.callerPublicKey == pk))
645648 then true
646649 else pd
647650 case _: Unit =>
648651 if ((i.caller == this))
649652 then true
650653 else pd
651654 case _ =>
652655 throw("Match error")
653656 }
654657 }
655658
656659
657660 @Callable(i)
658661 func setManager (pendingManagerPublicKey) = {
659662 let checkCaller = mustManager(i)
660663 if ((checkCaller == checkCaller))
661664 then {
662665 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
663666 if ((checkManagerPublicKey == checkManagerPublicKey))
664667 then [StringEntry(pmpk(), pendingManagerPublicKey)]
665668 else throw("Strict value is not equal to itself.")
666669 }
667670 else throw("Strict value is not equal to itself.")
668671 }
669672
670673
671674
672675 @Callable(i)
673676 func confirmManager () = {
674677 let pm = pendingManagerPublicKeyOrUnit()
675678 let hasPM = if (isDefined(pm))
676679 then true
677680 else throw("No pending manager")
678681 if ((hasPM == hasPM))
679682 then {
680683 let checkPM = if ((i.callerPublicKey == value(pm)))
681684 then true
682685 else throw("You are not pending manager")
683686 if ((checkPM == checkPM))
684687 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
685688 else throw("Strict value is not equal to itself.")
686689 }
687690 else throw("Strict value is not equal to itself.")
688691 }
689692
690693
691694
692695 @Callable(i)
693696 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
694697 then throw("Invalid slippageTolerance passed")
695698 else {
696699 let estPut = commonPut(i, slippageTolerance, true)
697700 let emitLpAmt = estPut._2
698701 let lpAssetId = estPut._7
699702 let state = estPut._9
700703 let amDiff = estPut._10
701704 let prDiff = estPut._11
702705 let amId = estPut._12
703706 let prId = estPut._13
704707 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
705708 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
706709 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
707710 if ((currentKLp == currentKLp))
708711 then {
709712 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
710713 if ((emitInv == emitInv))
711714 then {
712715 let emitInvLegacy = match emitInv {
713716 case legacyFactoryContract: Address =>
714717 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
715718 case _ =>
716719 unit
717720 }
718721 if ((emitInvLegacy == emitInvLegacy))
719722 then {
720723 let slippageAInv = if ((amDiff > 0))
721724 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
722725 else nil
723726 if ((slippageAInv == slippageAInv))
724727 then {
725728 let slippagePInv = if ((prDiff > 0))
726729 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
727730 else nil
728731 if ((slippagePInv == slippagePInv))
729732 then {
730733 let lpTransfer = if (shouldAutoStake)
731734 then {
732735 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
733736 if ((slpStakeInv == slpStakeInv))
734737 then nil
735738 else throw("Strict value is not equal to itself.")
736739 }
737740 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
738- let $t03250832970 = refreshKLpInternal(0, 0, 0)
739- if (($t03250832970 == $t03250832970))
741+ let $t03276433226 = refreshKLpInternal(0, 0, 0)
742+ if (($t03276433226 == $t03276433226))
740743 then {
741- let updatedKLp = $t03250832970._2
742- let refreshKLpActions = $t03250832970._1
744+ let updatedKLp = $t03276433226._2
745+ let refreshKLpActions = $t03276433226._1
743746 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
744747 if ((isUpdatedKLpValid == isUpdatedKLpValid))
745748 then ((state ++ lpTransfer) ++ refreshKLpActions)
746749 else throw("Strict value is not equal to itself.")
747750 }
748751 else throw("Strict value is not equal to itself.")
749752 }
750753 else throw("Strict value is not equal to itself.")
751754 }
752755 else throw("Strict value is not equal to itself.")
753756 }
754757 else throw("Strict value is not equal to itself.")
755758 }
756759 else throw("Strict value is not equal to itself.")
757760 }
758761 else throw("Strict value is not equal to itself.")
759762 }
760763
761764
762765
763766 @Callable(i)
764767 func putForFree (maxSlippage) = if ((0 > maxSlippage))
765768 then throw("Invalid value passed")
766769 else {
767770 let estPut = commonPut(i, maxSlippage, false)
768771 let state = estPut._9
769772 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
770773 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
771774 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
772775 if ((currentKLp == currentKLp))
773776 then {
774- let $t03353233597 = refreshKLpInternal(0, 0, 0)
775- let refreshKLpActions = $t03353233597._1
776- let updatedKLp = $t03353233597._2
777+ let $t03378833853 = refreshKLpInternal(0, 0, 0)
778+ let refreshKLpActions = $t03378833853._1
779+ let updatedKLp = $t03378833853._2
777780 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
778781 if ((isUpdatedKLpValid == isUpdatedKLpValid))
779782 then (state ++ refreshKLpActions)
780783 else throw("Strict value is not equal to itself.")
781784 }
782785 else throw("Strict value is not equal to itself.")
783786 }
784787
785788
786789
787790 @Callable(i)
788791 func putOneTkn (minOutAmount,autoStake) = {
789792 let isPoolOneTokenOperationsDisabled = {
790793 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
791794 if ($isInstanceOf(@, "Boolean"))
792795 then @
793796 else throw(($getType(@) + " couldn't be cast to Boolean"))
794797 }
795798 let isPutDisabled = if (if (if (isGlobalShutdown())
796799 then true
797800 else (cfgPoolStatus == PoolPutDisabled))
798801 then true
799802 else (cfgPoolStatus == PoolShutdown))
800803 then true
801804 else isPoolOneTokenOperationsDisabled
802805 let checks = [if (if (!(isPutDisabled))
803806 then true
804807 else isManager(i))
805808 then true
806809 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
807810 then true
808811 else throwErr("exactly 1 payment are expected")]
809812 if ((checks == checks))
810813 then {
811814 let payment = i.payments[0]
812815 let paymentAssetId = payment.assetId
813816 let paymentAmountRaw = payment.amount
814817 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
815818 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
816819 else if ((paymentAssetId == cfgPriceAssetId))
817820 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
818821 else throwErr("payment asset is not supported")
819822 let userAddress = i.caller
820823 let txId = i.transactionId
821- let $t03478234934 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
822- if (($t03478234934 == $t03478234934))
824+ let $t03503835190 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
825+ if (($t03503835190 == $t03503835190))
823826 then {
824- let paymentInAmountAsset = $t03478234934._5
825- let bonus = $t03478234934._4
826- let feeAmount = $t03478234934._3
827- let commonState = $t03478234934._2
828- let emitAmountEstimated = $t03478234934._1
827+ let paymentInAmountAsset = $t03503835190._5
828+ let bonus = $t03503835190._4
829+ let feeAmount = $t03503835190._3
830+ let commonState = $t03503835190._2
831+ let emitAmountEstimated = $t03503835190._1
829832 let emitAmount = if (if ((minOutAmount > 0))
830833 then (minOutAmount > emitAmountEstimated)
831834 else false)
832835 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
833836 else emitAmountEstimated
834837 let emitInv = emit(emitAmount)
835838 if ((emitInv == emitInv))
836839 then {
837840 let lpTransfer = if (autoStake)
838841 then {
839842 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
840843 if ((stakeInv == stakeInv))
841844 then nil
842845 else throw("Strict value is not equal to itself.")
843846 }
844847 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
845848 let sendFee = if ((feeAmount > 0))
846849 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
847850 else nil
848- let $t03552035717 = if ((this == feeCollectorAddress))
851+ let $t03577635973 = if ((this == feeCollectorAddress))
849852 then $Tuple2(0, 0)
850853 else if (paymentInAmountAsset)
851854 then $Tuple2(-(feeAmount), 0)
852855 else $Tuple2(0, -(feeAmount))
853- let amountAssetBalanceDelta = $t03552035717._1
854- let priceAssetBalanceDelta = $t03552035717._2
855- let $t03572035828 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
856- let refreshKLpActions = $t03572035828._1
857- let updatedKLp = $t03572035828._2
856+ let amountAssetBalanceDelta = $t03577635973._1
857+ let priceAssetBalanceDelta = $t03577635973._2
858+ let $t03597636084 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
859+ let refreshKLpActions = $t03597636084._1
860+ let updatedKLp = $t03597636084._2
858861 let kLp = value(getString(keyKLp))
859862 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
860863 if ((isUpdatedKLpValid == isUpdatedKLpValid))
861864 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
862865 else throw("Strict value is not equal to itself.")
863866 }
864867 else throw("Strict value is not equal to itself.")
865868 }
866869 else throw("Strict value is not equal to itself.")
867870 }
868871 else throw("Strict value is not equal to itself.")
869872 }
870873
871874
872875
873876 @Callable(i)
874877 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
875- let $t03613436291 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
876- let emitAmountEstimated = $t03613436291._1
877- let commonState = $t03613436291._2
878- let feeAmount = $t03613436291._3
879- let bonus = $t03613436291._4
880- let paymentInAmountAsset = $t03613436291._5
878+ let $t03639036547 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
879+ let emitAmountEstimated = $t03639036547._1
880+ let commonState = $t03639036547._2
881+ let feeAmount = $t03639036547._3
882+ let bonus = $t03639036547._4
883+ let paymentInAmountAsset = $t03639036547._5
881884 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
882885 }
883886
884887
885888
886889 @Callable(i)
887890 func getOneTkn (outAssetIdStr,minOutAmount) = {
888891 let isPoolOneTokenOperationsDisabled = {
889892 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
890893 if ($isInstanceOf(@, "Boolean"))
891894 then @
892895 else throw(($getType(@) + " couldn't be cast to Boolean"))
893896 }
894897 let isGetDisabled = if (if (isGlobalShutdown())
895898 then true
896899 else (cfgPoolStatus == PoolShutdown))
897900 then true
898901 else isPoolOneTokenOperationsDisabled
899902 let checks = [if (if (!(isGetDisabled))
900903 then true
901904 else isManager(i))
902905 then true
903906 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
904907 then true
905908 else throwErr("exactly 1 payment are expected")]
906909 if ((checks == checks))
907910 then {
908911 let outAssetId = parseAssetId(outAssetIdStr)
909912 let payment = i.payments[0]
910913 let paymentAssetId = payment.assetId
911914 let paymentAmount = payment.amount
912915 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
913916 let userAddress = i.caller
914917 let txId = i.transactionId
915- let $t03718537338 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
916- if (($t03718537338 == $t03718537338))
918+ let $t03744137594 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
919+ if (($t03744137594 == $t03744137594))
917920 then {
918- let outInAmountAsset = $t03718537338._5
919- let bonus = $t03718537338._4
920- let feeAmount = $t03718537338._3
921- let commonState = $t03718537338._2
922- let amountEstimated = $t03718537338._1
921+ let outInAmountAsset = $t03744137594._5
922+ let bonus = $t03744137594._4
923+ let feeAmount = $t03744137594._3
924+ let commonState = $t03744137594._2
925+ let amountEstimated = $t03744137594._1
923926 let amount = if (if ((minOutAmount > 0))
924927 then (minOutAmount > amountEstimated)
925928 else false)
926929 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
927930 else amountEstimated
928931 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
929932 if ((burnInv == burnInv))
930933 then {
931934 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
932935 let sendFee = if ((feeAmount > 0))
933936 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
934937 else nil
935- let $t03783838085 = {
938+ let $t03809438341 = {
936939 let feeAmountForCalc = if ((this == feeCollectorAddress))
937940 then 0
938941 else feeAmount
939942 if (outInAmountAsset)
940943 then $Tuple2(-((amount + feeAmountForCalc)), 0)
941944 else $Tuple2(0, -((amount + feeAmountForCalc)))
942945 }
943- let amountAssetBalanceDelta = $t03783838085._1
944- let priceAssetBalanceDelta = $t03783838085._2
945- let $t03808838196 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
946- let refreshKLpActions = $t03808838196._1
947- let updatedKLp = $t03808838196._2
946+ let amountAssetBalanceDelta = $t03809438341._1
947+ let priceAssetBalanceDelta = $t03809438341._2
948+ let $t03834438452 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
949+ let refreshKLpActions = $t03834438452._1
950+ let updatedKLp = $t03834438452._2
948951 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
949952 if ((isUpdatedKLpValid == isUpdatedKLpValid))
950953 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
951954 else throw("Strict value is not equal to itself.")
952955 }
953956 else throw("Strict value is not equal to itself.")
954957 }
955958 else throw("Strict value is not equal to itself.")
956959 }
957960 else throw("Strict value is not equal to itself.")
958961 }
959962
960963
961964
962965 @Callable(i)
963966 func getOneTknREADONLY (outAssetId,paymentAmount) = {
964- let $t03845338609 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
965- let amountEstimated = $t03845338609._1
966- let commonState = $t03845338609._2
967- let feeAmount = $t03845338609._3
968- let bonus = $t03845338609._4
969- let outInAmountAsset = $t03845338609._5
967+ let $t03870938865 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
968+ let amountEstimated = $t03870938865._1
969+ let commonState = $t03870938865._2
970+ let feeAmount = $t03870938865._3
971+ let bonus = $t03870938865._4
972+ let outInAmountAsset = $t03870938865._5
970973 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
971974 }
972975
973976
974977
975978 @Callable(i)
976979 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
977980 let isPoolOneTokenOperationsDisabled = {
978981 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
979982 if ($isInstanceOf(@, "Boolean"))
980983 then @
981984 else throw(($getType(@) + " couldn't be cast to Boolean"))
982985 }
983986 let isGetDisabled = if (if (isGlobalShutdown())
984987 then true
985988 else (cfgPoolStatus == PoolShutdown))
986989 then true
987990 else isPoolOneTokenOperationsDisabled
988991 let checks = [if (if (!(isGetDisabled))
989992 then true
990993 else isManager(i))
991994 then true
992995 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
993996 then true
994997 else throwErr("no payments are expected")]
995998 if ((checks == checks))
996999 then {
9971000 let outAssetId = parseAssetId(outAssetIdStr)
9981001 let userAddress = i.caller
9991002 let txId = i.transactionId
10001003 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
10011004 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10021005 if ((unstakeInv == unstakeInv))
10031006 then {
1004- let $t03951139662 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1005- if (($t03951139662 == $t03951139662))
1007+ let $t03976739918 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1008+ if (($t03976739918 == $t03976739918))
10061009 then {
1007- let outInAmountAsset = $t03951139662._5
1008- let bonus = $t03951139662._4
1009- let feeAmount = $t03951139662._3
1010- let commonState = $t03951139662._2
1011- let amountEstimated = $t03951139662._1
1010+ let outInAmountAsset = $t03976739918._5
1011+ let bonus = $t03976739918._4
1012+ let feeAmount = $t03976739918._3
1013+ let commonState = $t03976739918._2
1014+ let amountEstimated = $t03976739918._1
10121015 let amount = if (if ((minOutAmount > 0))
10131016 then (minOutAmount > amountEstimated)
10141017 else false)
10151018 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
10161019 else amountEstimated
10171020 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10181021 if ((burnInv == burnInv))
10191022 then {
10201023 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
10211024 let sendFee = if ((feeAmount > 0))
10221025 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10231026 else nil
1024- let $t04015740404 = {
1027+ let $t04041340660 = {
10251028 let feeAmountForCalc = if ((this == feeCollectorAddress))
10261029 then 0
10271030 else feeAmount
10281031 if (outInAmountAsset)
10291032 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10301033 else $Tuple2(0, -((amount + feeAmountForCalc)))
10311034 }
1032- let amountAssetBalanceDelta = $t04015740404._1
1033- let priceAssetBalanceDelta = $t04015740404._2
1034- let $t04040740515 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1035- let refreshKLpActions = $t04040740515._1
1036- let updatedKLp = $t04040740515._2
1035+ let amountAssetBalanceDelta = $t04041340660._1
1036+ let priceAssetBalanceDelta = $t04041340660._2
1037+ let $t04066340771 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1038+ let refreshKLpActions = $t04066340771._1
1039+ let updatedKLp = $t04066340771._2
10371040 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10381041 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10391042 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10401043 else throw("Strict value is not equal to itself.")
10411044 }
10421045 else throw("Strict value is not equal to itself.")
10431046 }
10441047 else throw("Strict value is not equal to itself.")
10451048 }
10461049 else throw("Strict value is not equal to itself.")
10471050 }
10481051 else throw("Strict value is not equal to itself.")
10491052 }
10501053
10511054
10521055
10531056 @Callable(i)
10541057 func get () = {
10551058 let res = commonGet(i)
10561059 let outAmtAmt = res._1
10571060 let outPrAmt = res._2
10581061 let pmtAmt = res._3
10591062 let pmtAssetId = res._4
10601063 let state = res._5
10611064 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10621065 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10631066 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10641067 then {
1065- let $t04146341545 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1066- let refreshKLpActions = $t04146341545._1
1067- let updatedKLp = $t04146341545._2
1068+ let $t04171941801 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1069+ let refreshKLpActions = $t04171941801._1
1070+ let updatedKLp = $t04171941801._2
10681071 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10691072 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10701073 then (state ++ refreshKLpActions)
10711074 else throw("Strict value is not equal to itself.")
10721075 }
10731076 else throw("Strict value is not equal to itself.")
10741077 }
10751078
10761079
10771080
10781081 @Callable(i)
10791082 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
10801083 let res = commonGet(i)
10811084 let outAmAmt = res._1
10821085 let outPrAmt = res._2
10831086 let pmtAmt = res._3
10841087 let pmtAssetId = res._4
10851088 let state = res._5
10861089 if ((noLessThenAmtAsset > outAmAmt))
10871090 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
10881091 else if ((noLessThenPriceAsset > outPrAmt))
10891092 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
10901093 else {
10911094 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10921095 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10931096 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10941097 then {
1095- let $t04249642577 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1096- let refreshKLpActions = $t04249642577._1
1097- let updatedKLp = $t04249642577._2
1098+ let $t04275242833 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1099+ let refreshKLpActions = $t04275242833._1
1100+ let updatedKLp = $t04275242833._2
10981101 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10991102 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11001103 then (state ++ refreshKLpActions)
11011104 else throw("Strict value is not equal to itself.")
11021105 }
11031106 else throw("Strict value is not equal to itself.")
11041107 }
11051108 }
11061109
11071110
11081111
11091112 @Callable(i)
11101113 func unstakeAndGet (amount) = {
11111114 let checkPayments = if ((size(i.payments) != 0))
11121115 then throw("No payments are expected")
11131116 else true
11141117 if ((checkPayments == checkPayments))
11151118 then {
11161119 let cfg = getPoolConfig()
11171120 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11181121 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11191122 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
11201123 if ((unstakeInv == unstakeInv))
11211124 then {
11221125 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
11231126 let outAmAmt = res._1
11241127 let outPrAmt = res._2
11251128 let poolStatus = parseIntValue(res._9)
11261129 let state = res._10
11271130 let checkPoolStatus = if (if (isGlobalShutdown())
11281131 then true
11291132 else (poolStatus == PoolShutdown))
11301133 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
11311134 else true
11321135 if ((checkPoolStatus == checkPoolStatus))
11331136 then {
11341137 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11351138 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11361139 then {
1137- let $t04370043781 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1138- let refreshKLpActions = $t04370043781._1
1139- let updatedKLp = $t04370043781._2
1140+ let $t04395644037 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1141+ let refreshKLpActions = $t04395644037._1
1142+ let updatedKLp = $t04395644037._2
11401143 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11411144 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11421145 then (state ++ refreshKLpActions)
11431146 else throw("Strict value is not equal to itself.")
11441147 }
11451148 else throw("Strict value is not equal to itself.")
11461149 }
11471150 else throw("Strict value is not equal to itself.")
11481151 }
11491152 else throw("Strict value is not equal to itself.")
11501153 }
11511154 else throw("Strict value is not equal to itself.")
11521155 }
11531156
11541157
11551158
11561159 @Callable(i)
11571160 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
11581161 let isGetDisabled = if (isGlobalShutdown())
11591162 then true
11601163 else (cfgPoolStatus == PoolShutdown)
11611164 let checks = [if (!(isGetDisabled))
11621165 then true
11631166 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11641167 then true
11651168 else throw("no payments are expected")]
11661169 if ((checks == checks))
11671170 then {
11681171 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11691172 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11701173 if ((unstakeInv == unstakeInv))
11711174 then {
11721175 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11731176 let outAmAmt = res._1
11741177 let outPrAmt = res._2
11751178 let state = res._10
11761179 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11771180 then true
11781181 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11791182 then true
11801183 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11811184 if ((checkAmounts == checkAmounts))
11821185 then {
11831186 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11841187 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11851188 then {
1186- let $t04507345154 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1187- let refreshKLpActions = $t04507345154._1
1188- let updatedKLp = $t04507345154._2
1189+ let $t04532945410 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1190+ let refreshKLpActions = $t04532945410._1
1191+ let updatedKLp = $t04532945410._2
11891192 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11901193 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11911194 then (state ++ refreshKLpActions)
11921195 else throw("Strict value is not equal to itself.")
11931196 }
11941197 else throw("Strict value is not equal to itself.")
11951198 }
11961199 else throw("Strict value is not equal to itself.")
11971200 }
11981201 else throw("Strict value is not equal to itself.")
11991202 }
12001203 else throw("Strict value is not equal to itself.")
12011204 }
12021205
12031206
12041207
12051208 @Callable(i)
12061209 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
12071210 then throw("permissions denied")
12081211 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
12091212
12101213
12111214
12121215 @Callable(i)
12131216 func refreshKLp () = {
12141217 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
12151218 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
12161219 then unit
12171220 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
12181221 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12191222 then {
12201223 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1221- let $t04634146405 = refreshKLpInternal(0, 0, 0)
1222- let kLpUpdateActions = $t04634146405._1
1223- let updatedKLp = $t04634146405._2
1224+ let $t04659746661 = refreshKLpInternal(0, 0, 0)
1225+ let kLpUpdateActions = $t04659746661._1
1226+ let updatedKLp = $t04659746661._2
12241227 let actions = if ((kLp != updatedKLp))
12251228 then kLpUpdateActions
12261229 else throwErr("nothing to refresh")
12271230 $Tuple2(actions, toString(updatedKLp))
12281231 }
12291232 else throw("Strict value is not equal to itself.")
12301233 }
12311234
12321235
12331236
12341237 @Callable(i)
12351238 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
12361239
12371240
12381241
12391242 @Callable(i)
12401243 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
12411244
12421245
12431246
12441247 @Callable(i)
12451248 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
12461249 let prices = calcPrices(amAmt, prAmt, lpAmt)
12471250 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
12481251 }
12491252
12501253
12511254
12521255 @Callable(i)
12531256 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
12541257
12551258
12561259
12571260 @Callable(i)
12581261 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
12591262
12601263
12611264
12621265 @Callable(i)
12631266 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
12641267
12651268
12661269
12671270 @Callable(i)
12681271 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
12691272
12701273
12711274
12721275 @Callable(i)
12731276 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
12741277 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
12751278 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
12761279 }
12771280
12781281
12791282
12801283 @Callable(i)
12811284 func statsREADONLY () = {
12821285 let cfg = getPoolConfig()
12831286 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12841287 let amtAssetId = cfg[idxAmtAssetId]
12851288 let priceAssetId = cfg[idxPriceAssetId]
12861289 let iAmtAssetId = cfg[idxIAmtAssetId]
12871290 let iPriceAssetId = cfg[idxIPriceAssetId]
12881291 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12891292 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12901293 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12911294 let accAmtAssetBalance = getAccBalance(amtAssetId)
12921295 let accPriceAssetBalance = getAccBalance(priceAssetId)
12931296 let pricesList = if ((poolLPBalance == 0))
12941297 then [zeroBigInt, zeroBigInt, zeroBigInt]
12951298 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
12961299 let curPrice = 0
12971300 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
12981301 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
12991302 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
13001303 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP))
13011304 }
13021305
13031306
13041307
13051308 @Callable(i)
13061309 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
13071310 let cfg = getPoolConfig()
13081311 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13091312 let amAssetIdStr = cfg[idxAmtAssetId]
13101313 let amAssetId = fromBase58String(amAssetIdStr)
13111314 let prAssetIdStr = cfg[idxPriceAssetId]
13121315 let prAssetId = fromBase58String(prAssetIdStr)
13131316 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13141317 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13151318 let poolStatus = cfg[idxPoolStatus]
13161319 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13171320 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
13181321 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
13191322 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
13201323 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
13211324 let curPriceX18 = if ((poolLPBalance == 0))
13221325 then zeroBigInt
13231326 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
13241327 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
13251328 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
13261329 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
13271330 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13281331 let calcLpAmt = estPut._1
13291332 let curPriceCalc = estPut._3
13301333 let amBalance = estPut._4
13311334 let prBalance = estPut._5
13321335 let lpEmission = estPut._6
13331336 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP))
13341337 }
13351338
13361339
13371340
13381341 @Callable(i)
13391342 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
13401343 let cfg = getPoolConfig()
13411344 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13421345 let amAssetIdStr = cfg[idxAmtAssetId]
13431346 let amAssetId = fromBase58String(amAssetIdStr)
13441347 let prAssetIdStr = cfg[idxPriceAssetId]
13451348 let prAssetId = fromBase58String(prAssetIdStr)
13461349 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13471350 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13481351 let poolStatus = cfg[idxPoolStatus]
13491352 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13501353 let amBalanceRaw = getAccBalance(amAssetIdStr)
13511354 let prBalanceRaw = getAccBalance(prAssetIdStr)
13521355 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
13531356 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
13541357 let curPriceX18 = if ((poolLPBalance == 0))
13551358 then zeroBigInt
13561359 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
13571360 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
13581361 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
13591362 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
13601363 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13611364 let calcLpAmt = estPut._1
13621365 let curPriceCalc = estPut._3
13631366 let amBalance = estPut._4
13641367 let prBalance = estPut._5
13651368 let lpEmission = estPut._6
13661369 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP))
13671370 }
13681371
13691372
13701373
13711374 @Callable(i)
13721375 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
13731376 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
13741377 let outAmAmt = res._1
13751378 let outPrAmt = res._2
13761379 let amBalance = res._5
13771380 let prBalance = res._6
13781381 let lpEmission = res._7
13791382 let curPrice = res._8
13801383 let poolStatus = parseIntValue(res._9)
13811384 $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), toString(curPrice), toString(poolStatus)], SEP))
13821385 }
13831386
13841387
13851388 @Verifier(tx)
13861389 func verify () = {
13871390 let targetPublicKey = match managerPublicKeyOrUnit() {
13881391 case pk: ByteVector =>
13891392 pk
13901393 case _: Unit =>
13911394 tx.senderPublicKey
13921395 case _ =>
13931396 throw("Match error")
13941397 }
13951398 match tx {
13961399 case order: Order =>
13971400 let matcherPub = getMatcherPubOrFail()
13981401 let orderValid = validateMatcherOrderAllowed(order)
13991402 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14001403 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
14011404 if (if (if (orderValid)
14021405 then senderValid
14031406 else false)
14041407 then matcherValid
14051408 else false)
14061409 then true
14071410 else throwOrderError(orderValid, senderValid, matcherValid)
14081411 case s: SetScriptTransaction =>
14091412 let newHash = blake2b256(value(s.script))
14101413 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
14111414 let currentHash = scriptHash(this)
14121415 if (if ((allowedHash == newHash))
14131416 then (currentHash != newHash)
14141417 else false)
14151418 then true
14161419 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14171420 case _ =>
14181421 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14191422 }
14201423 }
14211424

github/deemru/w8io/026f985 
199.52 ms