tx · GQcsXos4MtyJj8skGy8Eafa4UZDtJh7a6ExvmWSeCRmu

3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT:  -0.03500000 Waves

2022.12.08 09:54 [2351040] smart account 3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT > SELF 0.00000000 Waves

{ "type": 13, "id": "GQcsXos4MtyJj8skGy8Eafa4UZDtJh7a6ExvmWSeCRmu", "fee": 3500000, "feeAssetId": null, "timestamp": 1670482503305, "version": 1, "sender": "3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT", "senderPublicKey": "AYbpHveq7zviKTDV7SGTB1pZGFbkumgfq3jSwVv6BznT", "proofs": [ "YbsZi6DHP5wcqxL7CAmXU9XdmTRjMsBBRHV3rWLn395RyrXdDuk3xdhxBzBnvKRtHMnEfG36GzU2ocW63Qdw4sy" ], "script": "base64:BgKgLQgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlkeExQQXNzZXRE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ZHMGcHJvb2ZzAAEFAmdGAwMDBQJhQgUCYUMHBQJhRAcGCQECYUEDBQJhQgUCYUMFAmFEAwkAAQIFAmROAhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCZVEFAmROBAJnRwkA9gMBCQEFdmFsdWUBCAUCZVEGc2NyaXB0BAJnSAkA2wQBCQEFdmFsdWUBCQCdCAIFAmFMCQECYXkABAJnSQkA8QcBBQR0aGlzAwMJAAACBQJnSAUCZ0cJAQIhPQIFAmdJBQJnRwcGCQD0AwMIBQJnQwlib2R5Qnl0ZXMJAJEDAggFAmdDBnByb29mcwAABQJnRQkA9AMDCAUCZ0MJYm9keUJ5dGVzCQCRAwIIBQJnQwZwcm9vZnMAAAUCZ0V0XrXd", "chainId": 84, "height": 2351040, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GBrtcQZzkdYfBT3gcQwRMA7PgsnFihTVsq7kfeyq6Xtp Next: 8AfhYQ5T6oJWbNFJp6qAEnTFW6o43SuFwjDHGUNZ1GvX Diff:
OldNewDifferences
6363
6464
6565 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
66+
67+
68+func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
6669
6770
6871 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
196199
197200 let poolConfigParsed = parsePoolConfig(getPoolConfig())
198201
199-let $t079158081 = poolConfigParsed
202+let $t080638229 = poolConfigParsed
200203
201-let cfgPoolAddress = $t079158081._1
204+let cfgPoolAddress = $t080638229._1
202205
203-let cfgPoolStatus = $t079158081._2
206+let cfgPoolStatus = $t080638229._2
204207
205-let cfgLpAssetId = $t079158081._3
208+let cfgLpAssetId = $t080638229._3
206209
207-let cfgAmountAssetId = $t079158081._4
210+let cfgAmountAssetId = $t080638229._4
208211
209-let cfgPriceAssetId = $t079158081._5
212+let cfgPriceAssetId = $t080638229._5
210213
211-let cfgAmountAssetDecimals = $t079158081._6
214+let cfgAmountAssetDecimals = $t080638229._6
212215
213-let cfgPriceAssetDecimals = $t079158081._7
216+let cfgPriceAssetDecimals = $t080638229._7
214217
215218 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
216219
353356 let expAmtAssetAmtX18 = expectedAmts._1
354357 let expPriceAssetAmtX18 = expectedAmts._2
355358 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
356- $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
359+ $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
357360 }
358361 }
359362 let calcLpAmt = res._1
411414 func validateMatcherOrderAllowed (order) = {
412415 let amountAssetAmount = order.amount
413416 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
414- let $t02061520827 = if ((order.orderType == Buy))
417+ let $t02080321015 = if ((order.orderType == Buy))
415418 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
416419 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
417- let amountAssetBalanceDelta = $t02061520827._1
418- let priceAssetBalanceDelta = $t02061520827._2
420+ let amountAssetBalanceDelta = $t02080321015._1
421+ let priceAssetBalanceDelta = $t02080321015._2
419422 if (if (if (isGlobalShutdown())
420423 then true
421424 else (cfgPoolStatus == PoolMatcherDisabled))
428431 then throw("Wrong order assets.")
429432 else {
430433 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
431- let $t02129821398 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
432- let unusedActions = $t02129821398._1
433- let kLpNew = $t02129821398._2
434+ let $t02148621586 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435+ let unusedActions = $t02148621586._1
436+ let kLpNew = $t02148621586._2
434437 let isOrderValid = (kLpNew >= kLp)
435438 isOrderValid
436439 }
506509 else if ((paymentAssetId == cfgPriceAssetId))
507510 then false
508511 else throwErr("invalid asset")
509- let $t02408324376 = if (isEval)
512+ let $t02427124564 = if (isEval)
510513 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
511514 else if (paymentInAmountAsset)
512515 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
513516 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
514- let amountBalanceOld = $t02408324376._1
515- let priceBalanceOld = $t02408324376._2
516- let $t02438024529 = if (paymentInAmountAsset)
517+ let amountBalanceOld = $t02427124564._1
518+ let priceBalanceOld = $t02427124564._2
519+ let $t02456824717 = if (paymentInAmountAsset)
517520 then $Tuple2(paymentAmountRaw, 0)
518521 else $Tuple2(0, paymentAmountRaw)
519- let amountAssetAmountRaw = $t02438024529._1
520- let priceAssetAmountRaw = $t02438024529._2
522+ let amountAssetAmountRaw = $t02456824717._1
523+ let priceAssetAmountRaw = $t02456824717._2
521524 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
522525 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
523- let $t02465124710 = takeFee(paymentAmountRaw)
524- let paymentAmount = $t02465124710._1
525- let feeAmount = $t02465124710._2
526+ let $t02483924898 = takeFee(paymentAmountRaw)
527+ let paymentAmount = $t02483924898._1
528+ let feeAmount = $t02483924898._2
526529 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
527530 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
528531 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
545548 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
546549 let priceOld = fromX18(priceOldX18, scale8)
547550 let loss = {
548- let $t02618726354 = if (paymentInAmountAsset)
551+ let $t02637526542 = if (paymentInAmountAsset)
549552 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
550553 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
551- let amount = $t02618726354._1
552- let balance = $t02618726354._2
554+ let amount = $t02637526542._1
555+ let balance = $t02637526542._2
553556 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
554557 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
555558 }
583586 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
584587 let redeemedBigInt = toBigInt(paymentAmount)
585588 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
586- let $t02795628006 = takeFee(amountRaw)
587- let totalAmount = $t02795628006._1
588- let feeAmount = $t02795628006._2
589- let $t02801028236 = if (outInAmountAsset)
589+ let $t02814428194 = takeFee(amountRaw)
590+ let totalAmount = $t02814428194._1
591+ let feeAmount = $t02814428194._2
592+ let $t02819828424 = if (outInAmountAsset)
590593 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
591594 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
592- let outAmAmount = $t02801028236._1
593- let outPrAmount = $t02801028236._2
594- let amBalanceNew = $t02801028236._3
595- let prBalanceNew = $t02801028236._4
595+ let outAmAmount = $t02819828424._1
596+ let outPrAmount = $t02819828424._2
597+ let amBalanceNew = $t02819828424._3
598+ let prBalanceNew = $t02819828424._4
596599 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
597600 let priceNew = fromX18(priceNewX18, scale8)
598601 let commonState = if (isEval)
750753 let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity
751754 if ((lpAssetEmissionAfter == lpAssetEmissionAfter))
752755 then {
753- let $t03275632824 = refreshKLpInternal(0, 0, 0)
754- if (($t03275632824 == $t03275632824))
756+ let $t03294433012 = refreshKLpInternal(0, 0, 0)
757+ if (($t03294433012 == $t03294433012))
755758 then {
756- let updatedKLp = $t03275632824._2
757- let refreshKLpActions = $t03275632824._1
759+ let updatedKLp = $t03294433012._2
760+ let refreshKLpActions = $t03294433012._1
758761 let error = throwErr(makeString([toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentKLp), toString(updatedKLp), toString(emitLpAmt), toString(amDiff), toString(prDiff), toString(lpAssetEmission), toString(lpAssetEmissionAfter)], " "))
759762 if ((error == error))
760763 then {
799802 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
800803 if ((currentKLp == currentKLp))
801804 then {
802- let $t03375633821 = refreshKLpInternal(0, 0, 0)
803- let refreshKLpActions = $t03375633821._1
804- let updatedKLp = $t03375633821._2
805+ let $t03394434009 = refreshKLpInternal(0, 0, 0)
806+ let refreshKLpActions = $t03394434009._1
807+ let updatedKLp = $t03394434009._2
805808 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
806809 if ((isUpdatedKLpValid == isUpdatedKLpValid))
807810 then (state ++ refreshKLpActions)
846849 else throwErr("payment asset is not supported")
847850 let userAddress = i.caller
848851 let txId = i.transactionId
849- let $t03500635158 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
850- if (($t03500635158 == $t03500635158))
852+ let $t03519435346 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
853+ if (($t03519435346 == $t03519435346))
851854 then {
852- let paymentInAmountAsset = $t03500635158._5
853- let bonus = $t03500635158._4
854- let feeAmount = $t03500635158._3
855- let commonState = $t03500635158._2
856- let emitAmountEstimated = $t03500635158._1
855+ let paymentInAmountAsset = $t03519435346._5
856+ let bonus = $t03519435346._4
857+ let feeAmount = $t03519435346._3
858+ let commonState = $t03519435346._2
859+ let emitAmountEstimated = $t03519435346._1
857860 let emitAmount = if (if ((minOutAmount > 0))
858861 then (minOutAmount > emitAmountEstimated)
859862 else false)
873876 let sendFee = if ((feeAmount > 0))
874877 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
875878 else nil
876- let $t03574435941 = if ((this == feeCollectorAddress))
879+ let $t03593236129 = if ((this == feeCollectorAddress))
877880 then $Tuple2(0, 0)
878881 else if (paymentInAmountAsset)
879882 then $Tuple2(-(feeAmount), 0)
880883 else $Tuple2(0, -(feeAmount))
881- let amountAssetBalanceDelta = $t03574435941._1
882- let priceAssetBalanceDelta = $t03574435941._2
883- let $t03594436052 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
884- let refreshKLpActions = $t03594436052._1
885- let updatedKLp = $t03594436052._2
884+ let amountAssetBalanceDelta = $t03593236129._1
885+ let priceAssetBalanceDelta = $t03593236129._2
886+ let $t03613236240 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
887+ let refreshKLpActions = $t03613236240._1
888+ let updatedKLp = $t03613236240._2
886889 let kLp = value(getString(keyKLp))
887890 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
888891 if ((isUpdatedKLpValid == isUpdatedKLpValid))
900903
901904 @Callable(i)
902905 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
903- let $t03635836515 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
904- let emitAmountEstimated = $t03635836515._1
905- let commonState = $t03635836515._2
906- let feeAmount = $t03635836515._3
907- let bonus = $t03635836515._4
908- let paymentInAmountAsset = $t03635836515._5
906+ let $t03654636703 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
907+ let emitAmountEstimated = $t03654636703._1
908+ let commonState = $t03654636703._2
909+ let feeAmount = $t03654636703._3
910+ let bonus = $t03654636703._4
911+ let paymentInAmountAsset = $t03654636703._5
909912 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
910913 }
911914
940943 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
941944 let userAddress = i.caller
942945 let txId = i.transactionId
943- let $t03740937562 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
944- if (($t03740937562 == $t03740937562))
946+ let $t03759737750 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
947+ if (($t03759737750 == $t03759737750))
945948 then {
946- let outInAmountAsset = $t03740937562._5
947- let bonus = $t03740937562._4
948- let feeAmount = $t03740937562._3
949- let commonState = $t03740937562._2
950- let amountEstimated = $t03740937562._1
949+ let outInAmountAsset = $t03759737750._5
950+ let bonus = $t03759737750._4
951+ let feeAmount = $t03759737750._3
952+ let commonState = $t03759737750._2
953+ let amountEstimated = $t03759737750._1
951954 let amount = if (if ((minOutAmount > 0))
952955 then (minOutAmount > amountEstimated)
953956 else false)
960963 let sendFee = if ((feeAmount > 0))
961964 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
962965 else nil
963- let $t03806238309 = {
966+ let $t03825038497 = {
964967 let feeAmountForCalc = if ((this == feeCollectorAddress))
965968 then 0
966969 else feeAmount
968971 then $Tuple2(-((amount + feeAmountForCalc)), 0)
969972 else $Tuple2(0, -((amount + feeAmountForCalc)))
970973 }
971- let amountAssetBalanceDelta = $t03806238309._1
972- let priceAssetBalanceDelta = $t03806238309._2
973- let $t03831238420 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
974- let refreshKLpActions = $t03831238420._1
975- let updatedKLp = $t03831238420._2
974+ let amountAssetBalanceDelta = $t03825038497._1
975+ let priceAssetBalanceDelta = $t03825038497._2
976+ let $t03850038608 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
977+ let refreshKLpActions = $t03850038608._1
978+ let updatedKLp = $t03850038608._2
976979 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
977980 if ((isUpdatedKLpValid == isUpdatedKLpValid))
978981 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
989992
990993 @Callable(i)
991994 func getOneTknREADONLY (outAssetId,paymentAmount) = {
992- let $t03867738833 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
993- let amountEstimated = $t03867738833._1
994- let commonState = $t03867738833._2
995- let feeAmount = $t03867738833._3
996- let bonus = $t03867738833._4
997- let outInAmountAsset = $t03867738833._5
995+ let $t03886539021 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
996+ let amountEstimated = $t03886539021._1
997+ let commonState = $t03886539021._2
998+ let feeAmount = $t03886539021._3
999+ let bonus = $t03886539021._4
1000+ let outInAmountAsset = $t03886539021._5
9981001 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
9991002 }
10001003
10291032 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10301033 if ((unstakeInv == unstakeInv))
10311034 then {
1032- let $t03973539886 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1033- if (($t03973539886 == $t03973539886))
1035+ let $t03992340074 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1036+ if (($t03992340074 == $t03992340074))
10341037 then {
1035- let outInAmountAsset = $t03973539886._5
1036- let bonus = $t03973539886._4
1037- let feeAmount = $t03973539886._3
1038- let commonState = $t03973539886._2
1039- let amountEstimated = $t03973539886._1
1038+ let outInAmountAsset = $t03992340074._5
1039+ let bonus = $t03992340074._4
1040+ let feeAmount = $t03992340074._3
1041+ let commonState = $t03992340074._2
1042+ let amountEstimated = $t03992340074._1
10401043 let amount = if (if ((minOutAmount > 0))
10411044 then (minOutAmount > amountEstimated)
10421045 else false)
10491052 let sendFee = if ((feeAmount > 0))
10501053 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10511054 else nil
1052- let $t04038140628 = {
1055+ let $t04056940816 = {
10531056 let feeAmountForCalc = if ((this == feeCollectorAddress))
10541057 then 0
10551058 else feeAmount
10571060 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10581061 else $Tuple2(0, -((amount + feeAmountForCalc)))
10591062 }
1060- let amountAssetBalanceDelta = $t04038140628._1
1061- let priceAssetBalanceDelta = $t04038140628._2
1062- let $t04063140739 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1063- let refreshKLpActions = $t04063140739._1
1064- let updatedKLp = $t04063140739._2
1063+ let amountAssetBalanceDelta = $t04056940816._1
1064+ let priceAssetBalanceDelta = $t04056940816._2
1065+ let $t04081940927 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1066+ let refreshKLpActions = $t04081940927._1
1067+ let updatedKLp = $t04081940927._2
10651068 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10661069 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10671070 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10901093 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10911094 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10921095 then {
1093- let $t04168741769 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1094- let refreshKLpActions = $t04168741769._1
1095- let updatedKLp = $t04168741769._2
1096+ let $t04187541957 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1097+ let refreshKLpActions = $t04187541957._1
1098+ let updatedKLp = $t04187541957._2
10961099 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10971100 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10981101 then (state ++ refreshKLpActions)
11201123 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11211124 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11221125 then {
1123- let $t04272042801 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1124- let refreshKLpActions = $t04272042801._1
1125- let updatedKLp = $t04272042801._2
1126+ let $t04290842989 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1127+ let refreshKLpActions = $t04290842989._1
1128+ let updatedKLp = $t04290842989._2
11261129 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11271130 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11281131 then (state ++ refreshKLpActions)
11621165 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11631166 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11641167 then {
1165- let $t04392444005 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1166- let refreshKLpActions = $t04392444005._1
1167- let updatedKLp = $t04392444005._2
1168+ let $t04411244193 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1169+ let refreshKLpActions = $t04411244193._1
1170+ let updatedKLp = $t04411244193._2
11681171 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11691172 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11701173 then (state ++ refreshKLpActions)
12111214 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
12121215 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12131216 then {
1214- let $t04529745378 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1215- let refreshKLpActions = $t04529745378._1
1216- let updatedKLp = $t04529745378._2
1217+ let $t04548545566 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1218+ let refreshKLpActions = $t04548545566._1
1219+ let updatedKLp = $t04548545566._2
12171220 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12181221 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12191222 then (state ++ refreshKLpActions)
12461249 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12471250 then {
12481251 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1249- let $t04656546629 = refreshKLpInternal(0, 0, 0)
1250- let kLpUpdateActions = $t04656546629._1
1251- let updatedKLp = $t04656546629._2
1252+ let $t04675346817 = refreshKLpInternal(0, 0, 0)
1253+ let kLpUpdateActions = $t04675346817._1
1254+ let updatedKLp = $t04675346817._2
12521255 let actions = if ((kLp != updatedKLp))
12531256 then kLpUpdateActions
12541257 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))
66+
67+
68+func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
6669
6770
6871 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
6972
7073
7174 func abs (val) = if ((0 > val))
7275 then -(val)
7376 else val
7477
7578
7679 func absBigInt (val) = if ((zeroBigInt > val))
7780 then -(val)
7881 else val
7982
8083
8184 func fc () = "%s__factoryContract"
8285
8386
8487 func mpk () = "%s__managerPublicKey"
8588
8689
8790 func pmpk () = "%s__pendingManagerPublicKey"
8891
8992
9093 func pl () = "%s%s__price__last"
9194
9295
9396 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
9497
9598
9699 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
97100
98101
99102 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
100103
101104
102105 func aa () = "%s__amountAsset"
103106
104107
105108 func pa () = "%s__priceAsset"
106109
107110
108111 let keyFee = "%s__fee"
109112
110113 let feeDefault = fraction(10, scale8, 10000)
111114
112115 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
113116
114117 let keyKLp = makeString(["%s", "kLp"], SEP)
115118
116119 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
117120
118121 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
119122
120123 let kLpRefreshDelayDefault = 30
121124
122125 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
123126
124127 func keyFactoryConfig () = "%s__factoryConfig"
125128
126129
127130 func keyMatcherPub () = "%s%s__matcher__publicKey"
128131
129132
130133 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
131134
132135
133136 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
134137
135138
136139 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
137140
138141
139142 func keyAllPoolsShutdown () = "%s__shutdown"
140143
141144
142145 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
143146
144147
145148 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
146149
147150
148151 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
149152
150153 func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
151154
152155
153156 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
154157
155158
156159 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
157160
158161
159162 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
160163
161164
162165 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
163166
164167
165168 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
166169
167170 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
168171
169172 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
170173
171174
172175 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
173176
174177
175178 func getPoolConfig () = {
176179 let amtAsset = getStringOrFail(this, aa())
177180 let priceAsset = getStringOrFail(this, pa())
178181 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
179182 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
180183 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
181184 }
182185
183186
184187 func parseAssetId (input) = if ((input == wavesString))
185188 then unit
186189 else fromBase58String(input)
187190
188191
189192 func assetIdToString (input) = if ((input == unit))
190193 then wavesString
191194 else toBase58String(value(input))
192195
193196
194197 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]))
195198
196199
197200 let poolConfigParsed = parsePoolConfig(getPoolConfig())
198201
199-let $t079158081 = poolConfigParsed
202+let $t080638229 = poolConfigParsed
200203
201-let cfgPoolAddress = $t079158081._1
204+let cfgPoolAddress = $t080638229._1
202205
203-let cfgPoolStatus = $t079158081._2
206+let cfgPoolStatus = $t080638229._2
204207
205-let cfgLpAssetId = $t079158081._3
208+let cfgLpAssetId = $t080638229._3
206209
207-let cfgAmountAssetId = $t079158081._4
210+let cfgAmountAssetId = $t080638229._4
208211
209-let cfgPriceAssetId = $t079158081._5
212+let cfgPriceAssetId = $t080638229._5
210213
211-let cfgAmountAssetDecimals = $t079158081._6
214+let cfgAmountAssetDecimals = $t080638229._6
212215
213-let cfgPriceAssetDecimals = $t079158081._7
216+let cfgPriceAssetDecimals = $t080638229._7
214217
215218 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
216219
217220
218221 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
219222
220223 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
221224
222225 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)
223226
224227
225228 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)
226229
227230
228231 func getAccBalance (assetId) = if ((assetId == "WAVES"))
229232 then wavesBalance(this).available
230233 else assetBalance(this, fromBase58String(assetId))
231234
232235
233236 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
234237
235238
236239 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
237240
238241
239242 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
240243 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
241244 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
242245 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
243246 }
244247
245248
246249 func calcPrices (amAmt,prAmt,lpAmt) = {
247250 let cfg = getPoolConfig()
248251 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
249252 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
250253 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
251254 let amAmtX18 = toX18(amAmt, amtAssetDcm)
252255 let prAmtX18 = toX18(prAmt, priceAssetDcm)
253256 let lpAmtX18 = toX18(lpAmt, scale8)
254257 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
255258 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
256259 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
257260 }
258261
259262
260263 func calculatePrices (amAmt,prAmt,lpAmt) = {
261264 let prices = calcPrices(amAmt, prAmt, lpAmt)
262265 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
263266 }
264267
265268
266269 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
267270 let cfg = getPoolConfig()
268271 let lpAssetId = cfg[idxPoolLPAssetId]
269272 let amAssetId = cfg[idxAmtAssetId]
270273 let prAssetId = cfg[idxPriceAssetId]
271274 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
272275 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
273276 let poolStatus = cfg[idxPoolStatus]
274277 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
275278 if ((lpAssetId != pmtAssetId))
276279 then throw("Invalid asset passed.")
277280 else {
278281 let amBalance = getAccBalance(amAssetId)
279282 let amBalanceX18 = toX18(amBalance, amAssetDcm)
280283 let prBalance = getAccBalance(prAssetId)
281284 let prBalanceX18 = toX18(prBalance, prAssetDcm)
282285 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
283286 let curPrice = fromX18(curPriceX18, scale8)
284287 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
285288 let lpEmissionX18 = toX18(lpEmission, scale8)
286289 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
287290 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
288291 let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
289292 let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
290293 let state = if ((txId58 == ""))
291294 then nil
292295 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
293296 then unit
294297 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
295298 then unit
296299 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)]
297300 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
298301 }
299302 }
300303
301304
302305 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
303306 let cfg = getPoolConfig()
304307 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
305308 let amAssetIdStr = cfg[idxAmtAssetId]
306309 let prAssetIdStr = cfg[idxPriceAssetId]
307310 let iAmtAssetId = cfg[idxIAmtAssetId]
308311 let iPriceAssetId = cfg[idxIPriceAssetId]
309312 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
310313 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
311314 let poolStatus = cfg[idxPoolStatus]
312315 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
313316 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
314317 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
315318 if (if ((amAssetIdStr != inAmAssetIdStr))
316319 then true
317320 else (prAssetIdStr != inPrAssetIdStr))
318321 then throw("Invalid amt or price asset passed.")
319322 else {
320323 let amBalance = if (isEvaluate)
321324 then getAccBalance(amAssetIdStr)
322325 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
323326 let prBalance = if (isEvaluate)
324327 then getAccBalance(prAssetIdStr)
325328 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
326329 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
327330 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
328331 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
329332 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
330333 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
331334 let res = if ((lpEmission == 0))
332335 then {
333336 let curPriceX18 = zeroBigInt
334337 let slippageX18 = zeroBigInt
335338 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
336339 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
337340 }
338341 else {
339342 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
340343 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
341344 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
342345 if (if ((curPriceX18 != zeroBigInt))
343346 then (slippageX18 > slippageToleranceX18)
344347 else false)
345348 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
346349 else {
347350 let lpEmissionX18 = toX18(lpEmission, scale8)
348351 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
349352 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
350353 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
351354 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
352355 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
353356 let expAmtAssetAmtX18 = expectedAmts._1
354357 let expPriceAssetAmtX18 = expectedAmts._2
355358 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
356- $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
359+ $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
357360 }
358361 }
359362 let calcLpAmt = res._1
360363 let calcAmAssetPmt = res._2
361364 let calcPrAssetPmt = res._3
362365 let curPrice = fromX18(res._4, scale8)
363366 let slippageCalc = fromX18(res._5, scale8)
364367 if ((0 >= calcLpAmt))
365368 then throw("Invalid calculations. LP calculated is less than zero.")
366369 else {
367370 let emitLpAmt = if (!(emitLp))
368371 then 0
369372 else calcLpAmt
370373 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
371374 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
372375 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))]
373376 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
374377 }
375378 }
376379 }
377380
378381
379382 func calcKLp (amountBalance,priceBalance,lpEmission) = {
380383 let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
381384 if ((lpEmission == big0))
382385 then big0
383386 else updatedKLp
384387 }
385388
386389
387390 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
388391 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
389392 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
390393 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
391394 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
392395 currentKLp
393396 }
394397
395398
396399 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
397400 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
398401 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
399402 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
400403 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
401404 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
402405 $Tuple2(actions, updatedKLp)
403406 }
404407
405408
406409 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
407410 then true
408411 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
409412
410413
411414 func validateMatcherOrderAllowed (order) = {
412415 let amountAssetAmount = order.amount
413416 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
414- let $t02061520827 = if ((order.orderType == Buy))
417+ let $t02080321015 = if ((order.orderType == Buy))
415418 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
416419 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
417- let amountAssetBalanceDelta = $t02061520827._1
418- let priceAssetBalanceDelta = $t02061520827._2
420+ let amountAssetBalanceDelta = $t02080321015._1
421+ let priceAssetBalanceDelta = $t02080321015._2
419422 if (if (if (isGlobalShutdown())
420423 then true
421424 else (cfgPoolStatus == PoolMatcherDisabled))
422425 then true
423426 else (cfgPoolStatus == PoolShutdown))
424427 then throw("Exchange operations disabled")
425428 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
426429 then true
427430 else (order.assetPair.priceAsset != cfgPriceAssetId))
428431 then throw("Wrong order assets.")
429432 else {
430433 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
431- let $t02129821398 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
432- let unusedActions = $t02129821398._1
433- let kLpNew = $t02129821398._2
434+ let $t02148621586 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435+ let unusedActions = $t02148621586._1
436+ let kLpNew = $t02148621586._2
434437 let isOrderValid = (kLpNew >= kLp)
435438 isOrderValid
436439 }
437440 }
438441
439442
440443 func commonGet (i) = if ((size(i.payments) != 1))
441444 then throw("exactly 1 payment is expected")
442445 else {
443446 let pmt = value(i.payments[0])
444447 let pmtAssetId = value(pmt.assetId)
445448 let pmtAmt = pmt.amount
446449 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
447450 let outAmAmt = res._1
448451 let outPrAmt = res._2
449452 let poolStatus = parseIntValue(res._9)
450453 let state = res._10
451454 if (if (isGlobalShutdown())
452455 then true
453456 else (poolStatus == PoolShutdown))
454457 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
455458 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
456459 }
457460
458461
459462 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
460463 then throw("exactly 2 payments are expected")
461464 else {
462465 let amAssetPmt = value(i.payments[0])
463466 let prAssetPmt = value(i.payments[1])
464467 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
465468 let poolStatus = parseIntValue(estPut._8)
466469 if (if (if (isGlobalShutdown())
467470 then true
468471 else (poolStatus == PoolPutDisabled))
469472 then true
470473 else (poolStatus == PoolShutdown))
471474 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
472475 else estPut
473476 }
474477
475478
476479 func emit (amount) = {
477480 let emitInv = invoke(factoryContract, "emit", [amount], nil)
478481 if ((emitInv == emitInv))
479482 then {
480483 let emitInvLegacy = match emitInv {
481484 case legacyFactoryContract: Address =>
482485 invoke(legacyFactoryContract, "emit", [amount], nil)
483486 case _ =>
484487 unit
485488 }
486489 if ((emitInvLegacy == emitInvLegacy))
487490 then amount
488491 else throw("Strict value is not equal to itself.")
489492 }
490493 else throw("Strict value is not equal to itself.")
491494 }
492495
493496
494497 func takeFee (amount) = {
495498 let feeAmount = fraction(amount, fee, scale8)
496499 $Tuple2((amount - feeAmount), feeAmount)
497500 }
498501
499502
500503 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
501504 let isEval = (txId == unit)
502505 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
503506 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
504507 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
505508 then true
506509 else if ((paymentAssetId == cfgPriceAssetId))
507510 then false
508511 else throwErr("invalid asset")
509- let $t02408324376 = if (isEval)
512+ let $t02427124564 = if (isEval)
510513 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
511514 else if (paymentInAmountAsset)
512515 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
513516 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
514- let amountBalanceOld = $t02408324376._1
515- let priceBalanceOld = $t02408324376._2
516- let $t02438024529 = if (paymentInAmountAsset)
517+ let amountBalanceOld = $t02427124564._1
518+ let priceBalanceOld = $t02427124564._2
519+ let $t02456824717 = if (paymentInAmountAsset)
517520 then $Tuple2(paymentAmountRaw, 0)
518521 else $Tuple2(0, paymentAmountRaw)
519- let amountAssetAmountRaw = $t02438024529._1
520- let priceAssetAmountRaw = $t02438024529._2
522+ let amountAssetAmountRaw = $t02456824717._1
523+ let priceAssetAmountRaw = $t02456824717._2
521524 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
522525 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
523- let $t02465124710 = takeFee(paymentAmountRaw)
524- let paymentAmount = $t02465124710._1
525- let feeAmount = $t02465124710._2
526+ let $t02483924898 = takeFee(paymentAmountRaw)
527+ let paymentAmount = $t02483924898._1
528+ let feeAmount = $t02483924898._2
526529 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
527530 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
528531 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
529532 let priceNew = fromX18(priceNewX18, scale8)
530533 let paymentBalance = if (paymentInAmountAsset)
531534 then amountBalanceOld
532535 else priceBalanceOld
533536 let paymentBalanceBigInt = toBigInt(paymentBalance)
534537 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
535538 let chechSupply = if ((supplyBigInt > big0))
536539 then true
537540 else throwErr("initial deposit requires all coins")
538541 if ((chechSupply == chechSupply))
539542 then {
540543 let depositBigInt = toBigInt(paymentAmount)
541544 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
542545 let commonState = if (isEval)
543546 then nil
544547 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))]
545548 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
546549 let priceOld = fromX18(priceOldX18, scale8)
547550 let loss = {
548- let $t02618726354 = if (paymentInAmountAsset)
551+ let $t02637526542 = if (paymentInAmountAsset)
549552 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
550553 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
551- let amount = $t02618726354._1
552- let balance = $t02618726354._2
554+ let amount = $t02637526542._1
555+ let balance = $t02637526542._2
553556 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
554557 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
555558 }
556559 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
557560 }
558561 else throw("Strict value is not equal to itself.")
559562 }
560563
561564
562565 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
563566 let isEval = (txId == unit)
564567 let checks = [if ((paymentAssetId == cfgLpAssetId))
565568 then true
566569 else throwErr("invalid lp asset")]
567570 if ((checks == checks))
568571 then {
569572 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
570573 then true
571574 else if ((outAssetId == cfgPriceAssetId))
572575 then false
573576 else throwErr("invalid asset")
574577 let balanceBigInt = if (outInAmountAsset)
575578 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
576579 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
577580 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
578581 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
579582 let outBalance = if (outInAmountAsset)
580583 then amBalanceOld
581584 else prBalanceOld
582585 let outBalanceBigInt = toBigInt(outBalance)
583586 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
584587 let redeemedBigInt = toBigInt(paymentAmount)
585588 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
586- let $t02795628006 = takeFee(amountRaw)
587- let totalAmount = $t02795628006._1
588- let feeAmount = $t02795628006._2
589- let $t02801028236 = if (outInAmountAsset)
589+ let $t02814428194 = takeFee(amountRaw)
590+ let totalAmount = $t02814428194._1
591+ let feeAmount = $t02814428194._2
592+ let $t02819828424 = if (outInAmountAsset)
590593 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
591594 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
592- let outAmAmount = $t02801028236._1
593- let outPrAmount = $t02801028236._2
594- let amBalanceNew = $t02801028236._3
595- let prBalanceNew = $t02801028236._4
595+ let outAmAmount = $t02819828424._1
596+ let outPrAmount = $t02819828424._2
597+ let amBalanceNew = $t02819828424._3
598+ let prBalanceNew = $t02819828424._4
596599 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
597600 let priceNew = fromX18(priceNewX18, scale8)
598601 let commonState = if (isEval)
599602 then nil
600603 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)]
601604 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
602605 let priceOld = fromX18(priceOldX18, scale8)
603606 let loss = {
604607 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
605608 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
606609 }
607610 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
608611 }
609612 else throw("Strict value is not equal to itself.")
610613 }
611614
612615
613616 func managerPublicKeyOrUnit () = match getString(mpk()) {
614617 case s: String =>
615618 fromBase58String(s)
616619 case _: Unit =>
617620 unit
618621 case _ =>
619622 throw("Match error")
620623 }
621624
622625
623626 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
624627 case s: String =>
625628 fromBase58String(s)
626629 case _: Unit =>
627630 unit
628631 case _ =>
629632 throw("Match error")
630633 }
631634
632635
633636 func isManager (i) = match managerPublicKeyOrUnit() {
634637 case pk: ByteVector =>
635638 (i.callerPublicKey == pk)
636639 case _: Unit =>
637640 (i.caller == this)
638641 case _ =>
639642 throw("Match error")
640643 }
641644
642645
643646 func mustManager (i) = {
644647 let pd = throw("Permission denied")
645648 match managerPublicKeyOrUnit() {
646649 case pk: ByteVector =>
647650 if ((i.callerPublicKey == pk))
648651 then true
649652 else pd
650653 case _: Unit =>
651654 if ((i.caller == this))
652655 then true
653656 else pd
654657 case _ =>
655658 throw("Match error")
656659 }
657660 }
658661
659662
660663 @Callable(i)
661664 func setManager (pendingManagerPublicKey) = {
662665 let checkCaller = mustManager(i)
663666 if ((checkCaller == checkCaller))
664667 then {
665668 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
666669 if ((checkManagerPublicKey == checkManagerPublicKey))
667670 then [StringEntry(pmpk(), pendingManagerPublicKey)]
668671 else throw("Strict value is not equal to itself.")
669672 }
670673 else throw("Strict value is not equal to itself.")
671674 }
672675
673676
674677
675678 @Callable(i)
676679 func confirmManager () = {
677680 let pm = pendingManagerPublicKeyOrUnit()
678681 let hasPM = if (isDefined(pm))
679682 then true
680683 else throw("No pending manager")
681684 if ((hasPM == hasPM))
682685 then {
683686 let checkPM = if ((i.callerPublicKey == value(pm)))
684687 then true
685688 else throw("You are not pending manager")
686689 if ((checkPM == checkPM))
687690 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
688691 else throw("Strict value is not equal to itself.")
689692 }
690693 else throw("Strict value is not equal to itself.")
691694 }
692695
693696
694697
695698 @Callable(i)
696699 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
697700 then throw("Invalid slippageTolerance passed")
698701 else {
699702 let estPut = commonPut(i, slippageTolerance, true)
700703 let emitLpAmt = estPut._2
701704 let lpAssetId = estPut._7
702705 let state = estPut._9
703706 let amDiff = estPut._10
704707 let prDiff = estPut._11
705708 let amId = estPut._12
706709 let prId = estPut._13
707710 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
708711 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
709712 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt)
710713 if ((amountAssetBalance == amountAssetBalance))
711714 then {
712715 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt)
713716 if ((priceAssetBalance == priceAssetBalance))
714717 then {
715718 let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity)
716719 if ((lpAssetEmission == lpAssetEmission))
717720 then {
718721 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
719722 if ((currentKLp == currentKLp))
720723 then {
721724 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
722725 if ((emitInv == emitInv))
723726 then {
724727 let emitInvLegacy = match emitInv {
725728 case legacyFactoryContract: Address =>
726729 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
727730 case _ =>
728731 unit
729732 }
730733 if ((emitInvLegacy == emitInvLegacy))
731734 then {
732735 let slippageAInv = if ((amDiff > 0))
733736 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
734737 else nil
735738 if ((slippageAInv == slippageAInv))
736739 then {
737740 let slippagePInv = if ((prDiff > 0))
738741 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
739742 else nil
740743 if ((slippagePInv == slippagePInv))
741744 then {
742745 let lpTransfer = if (shouldAutoStake)
743746 then {
744747 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
745748 if ((slpStakeInv == slpStakeInv))
746749 then nil
747750 else throw("Strict value is not equal to itself.")
748751 }
749752 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
750753 let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity
751754 if ((lpAssetEmissionAfter == lpAssetEmissionAfter))
752755 then {
753- let $t03275632824 = refreshKLpInternal(0, 0, 0)
754- if (($t03275632824 == $t03275632824))
756+ let $t03294433012 = refreshKLpInternal(0, 0, 0)
757+ if (($t03294433012 == $t03294433012))
755758 then {
756- let updatedKLp = $t03275632824._2
757- let refreshKLpActions = $t03275632824._1
759+ let updatedKLp = $t03294433012._2
760+ let refreshKLpActions = $t03294433012._1
758761 let error = throwErr(makeString([toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentKLp), toString(updatedKLp), toString(emitLpAmt), toString(amDiff), toString(prDiff), toString(lpAssetEmission), toString(lpAssetEmissionAfter)], " "))
759762 if ((error == error))
760763 then {
761764 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
762765 if ((isUpdatedKLpValid == isUpdatedKLpValid))
763766 then ((state ++ lpTransfer) ++ refreshKLpActions)
764767 else throw("Strict value is not equal to itself.")
765768 }
766769 else throw("Strict value is not equal to itself.")
767770 }
768771 else throw("Strict value is not equal to itself.")
769772 }
770773 else throw("Strict value is not equal to itself.")
771774 }
772775 else throw("Strict value is not equal to itself.")
773776 }
774777 else throw("Strict value is not equal to itself.")
775778 }
776779 else throw("Strict value is not equal to itself.")
777780 }
778781 else throw("Strict value is not equal to itself.")
779782 }
780783 else throw("Strict value is not equal to itself.")
781784 }
782785 else throw("Strict value is not equal to itself.")
783786 }
784787 else throw("Strict value is not equal to itself.")
785788 }
786789 else throw("Strict value is not equal to itself.")
787790 }
788791
789792
790793
791794 @Callable(i)
792795 func putForFree (maxSlippage) = if ((0 > maxSlippage))
793796 then throw("Invalid value passed")
794797 else {
795798 let estPut = commonPut(i, maxSlippage, false)
796799 let state = estPut._9
797800 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
798801 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
799802 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
800803 if ((currentKLp == currentKLp))
801804 then {
802- let $t03375633821 = refreshKLpInternal(0, 0, 0)
803- let refreshKLpActions = $t03375633821._1
804- let updatedKLp = $t03375633821._2
805+ let $t03394434009 = refreshKLpInternal(0, 0, 0)
806+ let refreshKLpActions = $t03394434009._1
807+ let updatedKLp = $t03394434009._2
805808 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
806809 if ((isUpdatedKLpValid == isUpdatedKLpValid))
807810 then (state ++ refreshKLpActions)
808811 else throw("Strict value is not equal to itself.")
809812 }
810813 else throw("Strict value is not equal to itself.")
811814 }
812815
813816
814817
815818 @Callable(i)
816819 func putOneTkn (minOutAmount,autoStake) = {
817820 let isPoolOneTokenOperationsDisabled = {
818821 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
819822 if ($isInstanceOf(@, "Boolean"))
820823 then @
821824 else throw(($getType(@) + " couldn't be cast to Boolean"))
822825 }
823826 let isPutDisabled = if (if (if (isGlobalShutdown())
824827 then true
825828 else (cfgPoolStatus == PoolPutDisabled))
826829 then true
827830 else (cfgPoolStatus == PoolShutdown))
828831 then true
829832 else isPoolOneTokenOperationsDisabled
830833 let checks = [if (if (!(isPutDisabled))
831834 then true
832835 else isManager(i))
833836 then true
834837 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
835838 then true
836839 else throwErr("exactly 1 payment are expected")]
837840 if ((checks == checks))
838841 then {
839842 let payment = i.payments[0]
840843 let paymentAssetId = payment.assetId
841844 let paymentAmountRaw = payment.amount
842845 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
843846 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
844847 else if ((paymentAssetId == cfgPriceAssetId))
845848 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
846849 else throwErr("payment asset is not supported")
847850 let userAddress = i.caller
848851 let txId = i.transactionId
849- let $t03500635158 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
850- if (($t03500635158 == $t03500635158))
852+ let $t03519435346 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
853+ if (($t03519435346 == $t03519435346))
851854 then {
852- let paymentInAmountAsset = $t03500635158._5
853- let bonus = $t03500635158._4
854- let feeAmount = $t03500635158._3
855- let commonState = $t03500635158._2
856- let emitAmountEstimated = $t03500635158._1
855+ let paymentInAmountAsset = $t03519435346._5
856+ let bonus = $t03519435346._4
857+ let feeAmount = $t03519435346._3
858+ let commonState = $t03519435346._2
859+ let emitAmountEstimated = $t03519435346._1
857860 let emitAmount = if (if ((minOutAmount > 0))
858861 then (minOutAmount > emitAmountEstimated)
859862 else false)
860863 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
861864 else emitAmountEstimated
862865 let emitInv = emit(emitAmount)
863866 if ((emitInv == emitInv))
864867 then {
865868 let lpTransfer = if (autoStake)
866869 then {
867870 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
868871 if ((stakeInv == stakeInv))
869872 then nil
870873 else throw("Strict value is not equal to itself.")
871874 }
872875 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
873876 let sendFee = if ((feeAmount > 0))
874877 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
875878 else nil
876- let $t03574435941 = if ((this == feeCollectorAddress))
879+ let $t03593236129 = if ((this == feeCollectorAddress))
877880 then $Tuple2(0, 0)
878881 else if (paymentInAmountAsset)
879882 then $Tuple2(-(feeAmount), 0)
880883 else $Tuple2(0, -(feeAmount))
881- let amountAssetBalanceDelta = $t03574435941._1
882- let priceAssetBalanceDelta = $t03574435941._2
883- let $t03594436052 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
884- let refreshKLpActions = $t03594436052._1
885- let updatedKLp = $t03594436052._2
884+ let amountAssetBalanceDelta = $t03593236129._1
885+ let priceAssetBalanceDelta = $t03593236129._2
886+ let $t03613236240 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
887+ let refreshKLpActions = $t03613236240._1
888+ let updatedKLp = $t03613236240._2
886889 let kLp = value(getString(keyKLp))
887890 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
888891 if ((isUpdatedKLpValid == isUpdatedKLpValid))
889892 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
890893 else throw("Strict value is not equal to itself.")
891894 }
892895 else throw("Strict value is not equal to itself.")
893896 }
894897 else throw("Strict value is not equal to itself.")
895898 }
896899 else throw("Strict value is not equal to itself.")
897900 }
898901
899902
900903
901904 @Callable(i)
902905 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
903- let $t03635836515 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
904- let emitAmountEstimated = $t03635836515._1
905- let commonState = $t03635836515._2
906- let feeAmount = $t03635836515._3
907- let bonus = $t03635836515._4
908- let paymentInAmountAsset = $t03635836515._5
906+ let $t03654636703 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
907+ let emitAmountEstimated = $t03654636703._1
908+ let commonState = $t03654636703._2
909+ let feeAmount = $t03654636703._3
910+ let bonus = $t03654636703._4
911+ let paymentInAmountAsset = $t03654636703._5
909912 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
910913 }
911914
912915
913916
914917 @Callable(i)
915918 func getOneTkn (outAssetIdStr,minOutAmount) = {
916919 let isPoolOneTokenOperationsDisabled = {
917920 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
918921 if ($isInstanceOf(@, "Boolean"))
919922 then @
920923 else throw(($getType(@) + " couldn't be cast to Boolean"))
921924 }
922925 let isGetDisabled = if (if (isGlobalShutdown())
923926 then true
924927 else (cfgPoolStatus == PoolShutdown))
925928 then true
926929 else isPoolOneTokenOperationsDisabled
927930 let checks = [if (if (!(isGetDisabled))
928931 then true
929932 else isManager(i))
930933 then true
931934 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
932935 then true
933936 else throwErr("exactly 1 payment are expected")]
934937 if ((checks == checks))
935938 then {
936939 let outAssetId = parseAssetId(outAssetIdStr)
937940 let payment = i.payments[0]
938941 let paymentAssetId = payment.assetId
939942 let paymentAmount = payment.amount
940943 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
941944 let userAddress = i.caller
942945 let txId = i.transactionId
943- let $t03740937562 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
944- if (($t03740937562 == $t03740937562))
946+ let $t03759737750 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
947+ if (($t03759737750 == $t03759737750))
945948 then {
946- let outInAmountAsset = $t03740937562._5
947- let bonus = $t03740937562._4
948- let feeAmount = $t03740937562._3
949- let commonState = $t03740937562._2
950- let amountEstimated = $t03740937562._1
949+ let outInAmountAsset = $t03759737750._5
950+ let bonus = $t03759737750._4
951+ let feeAmount = $t03759737750._3
952+ let commonState = $t03759737750._2
953+ let amountEstimated = $t03759737750._1
951954 let amount = if (if ((minOutAmount > 0))
952955 then (minOutAmount > amountEstimated)
953956 else false)
954957 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
955958 else amountEstimated
956959 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
957960 if ((burnInv == burnInv))
958961 then {
959962 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
960963 let sendFee = if ((feeAmount > 0))
961964 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
962965 else nil
963- let $t03806238309 = {
966+ let $t03825038497 = {
964967 let feeAmountForCalc = if ((this == feeCollectorAddress))
965968 then 0
966969 else feeAmount
967970 if (outInAmountAsset)
968971 then $Tuple2(-((amount + feeAmountForCalc)), 0)
969972 else $Tuple2(0, -((amount + feeAmountForCalc)))
970973 }
971- let amountAssetBalanceDelta = $t03806238309._1
972- let priceAssetBalanceDelta = $t03806238309._2
973- let $t03831238420 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
974- let refreshKLpActions = $t03831238420._1
975- let updatedKLp = $t03831238420._2
974+ let amountAssetBalanceDelta = $t03825038497._1
975+ let priceAssetBalanceDelta = $t03825038497._2
976+ let $t03850038608 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
977+ let refreshKLpActions = $t03850038608._1
978+ let updatedKLp = $t03850038608._2
976979 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
977980 if ((isUpdatedKLpValid == isUpdatedKLpValid))
978981 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
979982 else throw("Strict value is not equal to itself.")
980983 }
981984 else throw("Strict value is not equal to itself.")
982985 }
983986 else throw("Strict value is not equal to itself.")
984987 }
985988 else throw("Strict value is not equal to itself.")
986989 }
987990
988991
989992
990993 @Callable(i)
991994 func getOneTknREADONLY (outAssetId,paymentAmount) = {
992- let $t03867738833 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
993- let amountEstimated = $t03867738833._1
994- let commonState = $t03867738833._2
995- let feeAmount = $t03867738833._3
996- let bonus = $t03867738833._4
997- let outInAmountAsset = $t03867738833._5
995+ let $t03886539021 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
996+ let amountEstimated = $t03886539021._1
997+ let commonState = $t03886539021._2
998+ let feeAmount = $t03886539021._3
999+ let bonus = $t03886539021._4
1000+ let outInAmountAsset = $t03886539021._5
9981001 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
9991002 }
10001003
10011004
10021005
10031006 @Callable(i)
10041007 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
10051008 let isPoolOneTokenOperationsDisabled = {
10061009 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
10071010 if ($isInstanceOf(@, "Boolean"))
10081011 then @
10091012 else throw(($getType(@) + " couldn't be cast to Boolean"))
10101013 }
10111014 let isGetDisabled = if (if (isGlobalShutdown())
10121015 then true
10131016 else (cfgPoolStatus == PoolShutdown))
10141017 then true
10151018 else isPoolOneTokenOperationsDisabled
10161019 let checks = [if (if (!(isGetDisabled))
10171020 then true
10181021 else isManager(i))
10191022 then true
10201023 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
10211024 then true
10221025 else throwErr("no payments are expected")]
10231026 if ((checks == checks))
10241027 then {
10251028 let outAssetId = parseAssetId(outAssetIdStr)
10261029 let userAddress = i.caller
10271030 let txId = i.transactionId
10281031 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
10291032 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10301033 if ((unstakeInv == unstakeInv))
10311034 then {
1032- let $t03973539886 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1033- if (($t03973539886 == $t03973539886))
1035+ let $t03992340074 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1036+ if (($t03992340074 == $t03992340074))
10341037 then {
1035- let outInAmountAsset = $t03973539886._5
1036- let bonus = $t03973539886._4
1037- let feeAmount = $t03973539886._3
1038- let commonState = $t03973539886._2
1039- let amountEstimated = $t03973539886._1
1038+ let outInAmountAsset = $t03992340074._5
1039+ let bonus = $t03992340074._4
1040+ let feeAmount = $t03992340074._3
1041+ let commonState = $t03992340074._2
1042+ let amountEstimated = $t03992340074._1
10401043 let amount = if (if ((minOutAmount > 0))
10411044 then (minOutAmount > amountEstimated)
10421045 else false)
10431046 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
10441047 else amountEstimated
10451048 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10461049 if ((burnInv == burnInv))
10471050 then {
10481051 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
10491052 let sendFee = if ((feeAmount > 0))
10501053 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10511054 else nil
1052- let $t04038140628 = {
1055+ let $t04056940816 = {
10531056 let feeAmountForCalc = if ((this == feeCollectorAddress))
10541057 then 0
10551058 else feeAmount
10561059 if (outInAmountAsset)
10571060 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10581061 else $Tuple2(0, -((amount + feeAmountForCalc)))
10591062 }
1060- let amountAssetBalanceDelta = $t04038140628._1
1061- let priceAssetBalanceDelta = $t04038140628._2
1062- let $t04063140739 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1063- let refreshKLpActions = $t04063140739._1
1064- let updatedKLp = $t04063140739._2
1063+ let amountAssetBalanceDelta = $t04056940816._1
1064+ let priceAssetBalanceDelta = $t04056940816._2
1065+ let $t04081940927 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1066+ let refreshKLpActions = $t04081940927._1
1067+ let updatedKLp = $t04081940927._2
10651068 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10661069 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10671070 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10681071 else throw("Strict value is not equal to itself.")
10691072 }
10701073 else throw("Strict value is not equal to itself.")
10711074 }
10721075 else throw("Strict value is not equal to itself.")
10731076 }
10741077 else throw("Strict value is not equal to itself.")
10751078 }
10761079 else throw("Strict value is not equal to itself.")
10771080 }
10781081
10791082
10801083
10811084 @Callable(i)
10821085 func get () = {
10831086 let res = commonGet(i)
10841087 let outAmtAmt = res._1
10851088 let outPrAmt = res._2
10861089 let pmtAmt = res._3
10871090 let pmtAssetId = res._4
10881091 let state = res._5
10891092 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10901093 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10911094 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10921095 then {
1093- let $t04168741769 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1094- let refreshKLpActions = $t04168741769._1
1095- let updatedKLp = $t04168741769._2
1096+ let $t04187541957 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1097+ let refreshKLpActions = $t04187541957._1
1098+ let updatedKLp = $t04187541957._2
10961099 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10971100 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10981101 then (state ++ refreshKLpActions)
10991102 else throw("Strict value is not equal to itself.")
11001103 }
11011104 else throw("Strict value is not equal to itself.")
11021105 }
11031106
11041107
11051108
11061109 @Callable(i)
11071110 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
11081111 let res = commonGet(i)
11091112 let outAmAmt = res._1
11101113 let outPrAmt = res._2
11111114 let pmtAmt = res._3
11121115 let pmtAssetId = res._4
11131116 let state = res._5
11141117 if ((noLessThenAmtAsset > outAmAmt))
11151118 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
11161119 else if ((noLessThenPriceAsset > outPrAmt))
11171120 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
11181121 else {
11191122 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
11201123 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11211124 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11221125 then {
1123- let $t04272042801 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1124- let refreshKLpActions = $t04272042801._1
1125- let updatedKLp = $t04272042801._2
1126+ let $t04290842989 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1127+ let refreshKLpActions = $t04290842989._1
1128+ let updatedKLp = $t04290842989._2
11261129 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11271130 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11281131 then (state ++ refreshKLpActions)
11291132 else throw("Strict value is not equal to itself.")
11301133 }
11311134 else throw("Strict value is not equal to itself.")
11321135 }
11331136 }
11341137
11351138
11361139
11371140 @Callable(i)
11381141 func unstakeAndGet (amount) = {
11391142 let checkPayments = if ((size(i.payments) != 0))
11401143 then throw("No payments are expected")
11411144 else true
11421145 if ((checkPayments == checkPayments))
11431146 then {
11441147 let cfg = getPoolConfig()
11451148 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11461149 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11471150 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
11481151 if ((unstakeInv == unstakeInv))
11491152 then {
11501153 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
11511154 let outAmAmt = res._1
11521155 let outPrAmt = res._2
11531156 let poolStatus = parseIntValue(res._9)
11541157 let state = res._10
11551158 let checkPoolStatus = if (if (isGlobalShutdown())
11561159 then true
11571160 else (poolStatus == PoolShutdown))
11581161 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
11591162 else true
11601163 if ((checkPoolStatus == checkPoolStatus))
11611164 then {
11621165 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11631166 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11641167 then {
1165- let $t04392444005 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1166- let refreshKLpActions = $t04392444005._1
1167- let updatedKLp = $t04392444005._2
1168+ let $t04411244193 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1169+ let refreshKLpActions = $t04411244193._1
1170+ let updatedKLp = $t04411244193._2
11681171 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11691172 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11701173 then (state ++ refreshKLpActions)
11711174 else throw("Strict value is not equal to itself.")
11721175 }
11731176 else throw("Strict value is not equal to itself.")
11741177 }
11751178 else throw("Strict value is not equal to itself.")
11761179 }
11771180 else throw("Strict value is not equal to itself.")
11781181 }
11791182 else throw("Strict value is not equal to itself.")
11801183 }
11811184
11821185
11831186
11841187 @Callable(i)
11851188 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
11861189 let isGetDisabled = if (isGlobalShutdown())
11871190 then true
11881191 else (cfgPoolStatus == PoolShutdown)
11891192 let checks = [if (!(isGetDisabled))
11901193 then true
11911194 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11921195 then true
11931196 else throw("no payments are expected")]
11941197 if ((checks == checks))
11951198 then {
11961199 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11971200 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11981201 if ((unstakeInv == unstakeInv))
11991202 then {
12001203 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
12011204 let outAmAmt = res._1
12021205 let outPrAmt = res._2
12031206 let state = res._10
12041207 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
12051208 then true
12061209 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
12071210 then true
12081211 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
12091212 if ((checkAmounts == checkAmounts))
12101213 then {
12111214 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
12121215 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12131216 then {
1214- let $t04529745378 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1215- let refreshKLpActions = $t04529745378._1
1216- let updatedKLp = $t04529745378._2
1217+ let $t04548545566 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1218+ let refreshKLpActions = $t04548545566._1
1219+ let updatedKLp = $t04548545566._2
12171220 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12181221 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12191222 then (state ++ refreshKLpActions)
12201223 else throw("Strict value is not equal to itself.")
12211224 }
12221225 else throw("Strict value is not equal to itself.")
12231226 }
12241227 else throw("Strict value is not equal to itself.")
12251228 }
12261229 else throw("Strict value is not equal to itself.")
12271230 }
12281231 else throw("Strict value is not equal to itself.")
12291232 }
12301233
12311234
12321235
12331236 @Callable(i)
12341237 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
12351238 then throw("permissions denied")
12361239 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
12371240
12381241
12391242
12401243 @Callable(i)
12411244 func refreshKLp () = {
12421245 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
12431246 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
12441247 then unit
12451248 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
12461249 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12471250 then {
12481251 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1249- let $t04656546629 = refreshKLpInternal(0, 0, 0)
1250- let kLpUpdateActions = $t04656546629._1
1251- let updatedKLp = $t04656546629._2
1252+ let $t04675346817 = refreshKLpInternal(0, 0, 0)
1253+ let kLpUpdateActions = $t04675346817._1
1254+ let updatedKLp = $t04675346817._2
12521255 let actions = if ((kLp != updatedKLp))
12531256 then kLpUpdateActions
12541257 else throwErr("nothing to refresh")
12551258 $Tuple2(actions, toString(updatedKLp))
12561259 }
12571260 else throw("Strict value is not equal to itself.")
12581261 }
12591262
12601263
12611264
12621265 @Callable(i)
12631266 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
12641267
12651268
12661269
12671270 @Callable(i)
12681271 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
12691272
12701273
12711274
12721275 @Callable(i)
12731276 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
12741277 let prices = calcPrices(amAmt, prAmt, lpAmt)
12751278 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
12761279 }
12771280
12781281
12791282
12801283 @Callable(i)
12811284 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
12821285
12831286
12841287
12851288 @Callable(i)
12861289 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
12871290
12881291
12891292
12901293 @Callable(i)
12911294 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
12921295
12931296
12941297
12951298 @Callable(i)
12961299 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
12971300
12981301
12991302
13001303 @Callable(i)
13011304 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
13021305 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
13031306 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
13041307 }
13051308
13061309
13071310
13081311 @Callable(i)
13091312 func statsREADONLY () = {
13101313 let cfg = getPoolConfig()
13111314 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13121315 let amtAssetId = cfg[idxAmtAssetId]
13131316 let priceAssetId = cfg[idxPriceAssetId]
13141317 let iAmtAssetId = cfg[idxIAmtAssetId]
13151318 let iPriceAssetId = cfg[idxIPriceAssetId]
13161319 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13171320 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13181321 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13191322 let accAmtAssetBalance = getAccBalance(amtAssetId)
13201323 let accPriceAssetBalance = getAccBalance(priceAssetId)
13211324 let pricesList = if ((poolLPBalance == 0))
13221325 then [zeroBigInt, zeroBigInt, zeroBigInt]
13231326 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
13241327 let curPrice = 0
13251328 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
13261329 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
13271330 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
13281331 $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))
13291332 }
13301333
13311334
13321335
13331336 @Callable(i)
13341337 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
13351338 let cfg = getPoolConfig()
13361339 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13371340 let amAssetIdStr = cfg[idxAmtAssetId]
13381341 let amAssetId = fromBase58String(amAssetIdStr)
13391342 let prAssetIdStr = cfg[idxPriceAssetId]
13401343 let prAssetId = fromBase58String(prAssetIdStr)
13411344 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13421345 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13431346 let poolStatus = cfg[idxPoolStatus]
13441347 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13451348 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
13461349 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
13471350 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
13481351 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
13491352 let curPriceX18 = if ((poolLPBalance == 0))
13501353 then zeroBigInt
13511354 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
13521355 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
13531356 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
13541357 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
13551358 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13561359 let calcLpAmt = estPut._1
13571360 let curPriceCalc = estPut._3
13581361 let amBalance = estPut._4
13591362 let prBalance = estPut._5
13601363 let lpEmission = estPut._6
13611364 $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))
13621365 }
13631366
13641367
13651368
13661369 @Callable(i)
13671370 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
13681371 let cfg = getPoolConfig()
13691372 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13701373 let amAssetIdStr = cfg[idxAmtAssetId]
13711374 let amAssetId = fromBase58String(amAssetIdStr)
13721375 let prAssetIdStr = cfg[idxPriceAssetId]
13731376 let prAssetId = fromBase58String(prAssetIdStr)
13741377 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13751378 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13761379 let poolStatus = cfg[idxPoolStatus]
13771380 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13781381 let amBalanceRaw = getAccBalance(amAssetIdStr)
13791382 let prBalanceRaw = getAccBalance(prAssetIdStr)
13801383 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
13811384 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
13821385 let curPriceX18 = if ((poolLPBalance == 0))
13831386 then zeroBigInt
13841387 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
13851388 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
13861389 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
13871390 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
13881391 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13891392 let calcLpAmt = estPut._1
13901393 let curPriceCalc = estPut._3
13911394 let amBalance = estPut._4
13921395 let prBalance = estPut._5
13931396 let lpEmission = estPut._6
13941397 $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))
13951398 }
13961399
13971400
13981401
13991402 @Callable(i)
14001403 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
14011404 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
14021405 let outAmAmt = res._1
14031406 let outPrAmt = res._2
14041407 let amBalance = res._5
14051408 let prBalance = res._6
14061409 let lpEmission = res._7
14071410 let curPrice = res._8
14081411 let poolStatus = parseIntValue(res._9)
14091412 $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))
14101413 }
14111414
14121415
14131416 @Verifier(tx)
14141417 func verify () = {
14151418 let targetPublicKey = match managerPublicKeyOrUnit() {
14161419 case pk: ByteVector =>
14171420 pk
14181421 case _: Unit =>
14191422 tx.senderPublicKey
14201423 case _ =>
14211424 throw("Match error")
14221425 }
14231426 match tx {
14241427 case order: Order =>
14251428 let matcherPub = getMatcherPubOrFail()
14261429 let orderValid = validateMatcherOrderAllowed(order)
14271430 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14281431 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
14291432 if (if (if (orderValid)
14301433 then senderValid
14311434 else false)
14321435 then matcherValid
14331436 else false)
14341437 then true
14351438 else throwOrderError(orderValid, senderValid, matcherValid)
14361439 case s: SetScriptTransaction =>
14371440 let newHash = blake2b256(value(s.script))
14381441 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
14391442 let currentHash = scriptHash(this)
14401443 if (if ((allowedHash == newHash))
14411444 then (currentHash != newHash)
14421445 else false)
14431446 then true
14441447 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14451448 case _ =>
14461449 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14471450 }
14481451 }
14491452

github/deemru/w8io/169f3d6 
215.77 ms