tx · Dnav4vhgNucxxQvM1ZHuENuVwwjtFvdAkUwXu9NXmckh

3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh:  -0.04200000 Waves

2023.04.06 11:53 [2522486] smart account 3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh > SELF 0.00000000 Waves

{ "type": 13, "id": "Dnav4vhgNucxxQvM1ZHuENuVwwjtFvdAkUwXu9NXmckh", "fee": 4200000, "feeAssetId": null, "timestamp": 1680771202943, "version": 2, "chainId": 84, "sender": "3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh", "senderPublicKey": "Cr8D7eozSzJh7XHsYTjBinPpo3SS83BrCGiBAJsjGxBo", "proofs": [ "5mJ2M1fm6e2kT8Z195SYbTnudqF3bE3KNwFbcKZrqEaoWGf3f2zQQqXBEibfR75tBWBW1M9qaeNAH8rCjgwHgCq9" ], "script": "base64:BgLJNwgCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdE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CYUkFAmFKBQJhSwUCYUwDCQABAgUCYlQCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJnaQUCYlQDCQD0AwMIBQJpaglib2R5Qnl0ZXMJAJEDAggFAmlqBnByb29mcwAABQJpbAYEAmlvCQD2AwEJAQV2YWx1ZQEIBQJnaQZzY3JpcHQEAmlwCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYVQJAQJhRgAEAmlxCQDxBwEFBHRoaXMDCQAAAgUCaXAFAmlvCQECIT0CBQJpcQUCaW8HCQD0AwMIBQJpaglib2R5Qnl0ZXMJAJEDAggFAmlqBnByb29mcwAABQJpbLimS3g=", "height": 2522486, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8abw8MN1mzBZBDspc1uPq3nSKvVUTo3mbk1CX28bhkL3 Next: BoF1Gq5MSahwVzPKfC88kHQdGLR1FNLkbAvSBNXiZp3Q Diff:
OldNewDifferences
450450 }
451451
452452
453+func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
454+ let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
455+ let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
456+ (AmAmtWithdrawState ++ PrAmtWithdrawState)
457+ }
458+
459+
453460 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
454461 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
455462 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
501508 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
502509 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
503510 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
504- let AmAmtWithdrawState = withdrawAndRebalanceAsset(amAssetId, outAmAmt)
505- let PrAmtWithdrawState = withdrawAndRebalanceAsset(prAssetId, outPrAmt)
506511 let state = if ((txId58 == ""))
507512 then nil
508- else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
513+ else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
509514 then unit
510515 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
511516 then unit
512- 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)])
517+ 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)]
513518 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
514519 }
515520 }
631636 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
632637 let amountAssetAmount = order.amount
633638 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
634- let $t02814728359 = if ((order.orderType == Buy))
639+ let $t02830828520 = if ((order.orderType == Buy))
635640 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
636641 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
637- let amountAssetBalanceDelta = $t02814728359._1
638- let priceAssetBalanceDelta = $t02814728359._2
642+ let amountAssetBalanceDelta = $t02830828520._1
643+ let priceAssetBalanceDelta = $t02830828520._2
639644 if (if (if (isGlobalShutdown())
640645 then true
641646 else (cfgPoolStatus == PoolMatcherDisabled))
648653 then throw("Wrong order assets.")
649654 else {
650655 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
651- let $t02879928899 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
652- let unusedActions = $t02879928899._1
653- let kLpNew = $t02879928899._2
656+ let $t02896029060 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
657+ let unusedActions = $t02896029060._1
658+ let kLpNew = $t02896029060._2
654659 let isOrderValid = (kLpNew >= kLp)
655660 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
656661 $Tuple2(isOrderValid, info)
729734 else if ((paymentAssetId == cfgPriceAssetId))
730735 then false
731736 else throwErr("invalid asset")
732- let $t03201232305 = if (isEval)
737+ let $t03217332466 = if (isEval)
733738 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
734739 else if (paymentInAmountAsset)
735740 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
736741 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
737- let amountBalanceOld = $t03201232305._1
738- let priceBalanceOld = $t03201232305._2
739- let $t03230932458 = if (paymentInAmountAsset)
742+ let amountBalanceOld = $t03217332466._1
743+ let priceBalanceOld = $t03217332466._2
744+ let $t03247032619 = if (paymentInAmountAsset)
740745 then $Tuple2(paymentAmountRaw, 0)
741746 else $Tuple2(0, paymentAmountRaw)
742- let amountAssetAmountRaw = $t03230932458._1
743- let priceAssetAmountRaw = $t03230932458._2
747+ let amountAssetAmountRaw = $t03247032619._1
748+ let priceAssetAmountRaw = $t03247032619._2
744749 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
745750 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
746- let $t03259032654 = takeFee(paymentAmountRaw, inFee)
747- let paymentAmount = $t03259032654._1
748- let feeAmount = $t03259032654._2
751+ let $t03275132815 = takeFee(paymentAmountRaw, inFee)
752+ let paymentAmount = $t03275132815._1
753+ let feeAmount = $t03275132815._2
749754 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
750755 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
751756 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
768773 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
769774 let priceOld = fromX18(priceOldX18, scale8)
770775 let loss = {
771- let $t03433534502 = if (paymentInAmountAsset)
776+ let $t03449634663 = if (paymentInAmountAsset)
772777 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
773778 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
774- let amount = $t03433534502._1
775- let balance = $t03433534502._2
779+ let amount = $t03449634663._1
780+ let balance = $t03449634663._2
776781 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
777782 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
778783 }
812817 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
813818 let redeemedBigInt = toBigInt(paymentAmount)
814819 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
815- let $t03658036636 = takeFee(amountRaw, outFee)
816- let totalAmount = $t03658036636._1
817- let feeAmount = $t03658036636._2
818- let $t03664036866 = if (outInAmountAsset)
820+ let $t03674136797 = takeFee(amountRaw, outFee)
821+ let totalAmount = $t03674136797._1
822+ let feeAmount = $t03674136797._2
823+ let $t03680137027 = if (outInAmountAsset)
819824 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
820825 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
821- let outAmAmount = $t03664036866._1
822- let outPrAmount = $t03664036866._2
823- let amBalanceNew = $t03664036866._3
824- let prBalanceNew = $t03664036866._4
826+ let outAmAmount = $t03680137027._1
827+ let outPrAmount = $t03680137027._2
828+ let amBalanceNew = $t03680137027._3
829+ let prBalanceNew = $t03680137027._4
825830 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
826831 let priceNew = fromX18(priceNewX18, scale8)
827832 let commonState = if (isEval)
893898
894899 @Callable(i)
895900 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
896- let $t03875239057 = if ((isReverse == false))
901+ let $t03891339218 = if ((isReverse == false))
897902 then {
898903 let assetOut = getStringOrFail(this, pa())
899904 let assetIn = getStringOrFail(this, aa())
904909 let assetIn = getStringOrFail(this, pa())
905910 $Tuple2(assetOut, assetIn)
906911 }
907- let assetOut = $t03875239057._1
908- let assetIn = $t03875239057._2
912+ let assetOut = $t03891339218._1
913+ let assetIn = $t03891339218._2
909914 let poolAssetInBalance = getAccBalance(assetIn)
910915 let poolAssetOutBalance = getAccBalance(assetOut)
911916 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10561061 else throw("Strict value is not equal to itself.")
10571062 }
10581063 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1059- let $t04410344565 = refreshKLpInternal(0, 0, 0)
1060- if (($t04410344565 == $t04410344565))
1064+ let $t04426444726 = refreshKLpInternal(0, 0, 0)
1065+ if (($t04426444726 == $t04426444726))
10611066 then {
1062- let updatedKLp = $t04410344565._2
1063- let refreshKLpActions = $t04410344565._1
1067+ let updatedKLp = $t04426444726._2
1068+ let refreshKLpActions = $t04426444726._1
10641069 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10651070 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10661071 then {
10971102 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10981103 if ((currentKLp == currentKLp))
10991104 then {
1100- let $t04517745242 = refreshKLpInternal(0, 0, 0)
1101- let refreshKLpActions = $t04517745242._1
1102- let updatedKLp = $t04517745242._2
1105+ let $t04533845403 = refreshKLpInternal(0, 0, 0)
1106+ let refreshKLpActions = $t04533845403._1
1107+ let updatedKLp = $t04533845403._2
11031108 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11041109 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11051110 then (state ++ refreshKLpActions)
11461151 then {
11471152 let userAddress = i.caller
11481153 let txId = i.transactionId
1149- let $t04643046582 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1150- if (($t04643046582 == $t04643046582))
1154+ let $t04659146743 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1155+ if (($t04659146743 == $t04659146743))
11511156 then {
1152- let paymentInAmountAsset = $t04643046582._5
1153- let bonus = $t04643046582._4
1154- let feeAmount = $t04643046582._3
1155- let commonState = $t04643046582._2
1156- let emitAmountEstimated = $t04643046582._1
1157+ let paymentInAmountAsset = $t04659146743._5
1158+ let bonus = $t04659146743._4
1159+ let feeAmount = $t04659146743._3
1160+ let commonState = $t04659146743._2
1161+ let emitAmountEstimated = $t04659146743._1
11571162 let emitAmount = if (if ((minOutAmount > 0))
11581163 then (minOutAmount > emitAmountEstimated)
11591164 else false)
11731178 let sendFee = if ((feeAmount > 0))
11741179 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11751180 else nil
1176- let $t04716847365 = if ((this == feeCollectorAddress))
1181+ let $t04732947526 = if ((this == feeCollectorAddress))
11771182 then $Tuple2(0, 0)
11781183 else if (paymentInAmountAsset)
11791184 then $Tuple2(-(feeAmount), 0)
11801185 else $Tuple2(0, -(feeAmount))
1181- let amountAssetBalanceDelta = $t04716847365._1
1182- let priceAssetBalanceDelta = $t04716847365._2
1183- let $t04736847476 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1184- let refreshKLpActions = $t04736847476._1
1185- let updatedKLp = $t04736847476._2
1186+ let amountAssetBalanceDelta = $t04732947526._1
1187+ let priceAssetBalanceDelta = $t04732947526._2
1188+ let $t04752947637 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1189+ let refreshKLpActions = $t04752947637._1
1190+ let updatedKLp = $t04752947637._2
11861191 let kLp = value(getString(keyKLp))
11871192 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11881193 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12071212
12081213 @Callable(i)
12091214 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1210- let $t04783147988 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1211- let emitAmountEstimated = $t04783147988._1
1212- let commonState = $t04783147988._2
1213- let feeAmount = $t04783147988._3
1214- let bonus = $t04783147988._4
1215- let paymentInAmountAsset = $t04783147988._5
1215+ let $t04799248149 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1216+ let emitAmountEstimated = $t04799248149._1
1217+ let commonState = $t04799248149._2
1218+ let feeAmount = $t04799248149._3
1219+ let bonus = $t04799248149._4
1220+ let paymentInAmountAsset = $t04799248149._5
12161221 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12171222 }
12181223
12491254 then {
12501255 let userAddress = i.caller
12511256 let txId = i.transactionId
1252- let $t04887349026 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1253- if (($t04887349026 == $t04887349026))
1257+ let $t04903449187 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1258+ if (($t04903449187 == $t04903449187))
12541259 then {
1255- let outInAmountAsset = $t04887349026._5
1256- let bonus = $t04887349026._4
1257- let feeAmount = $t04887349026._3
1258- let commonState = $t04887349026._2
1259- let amountEstimated = $t04887349026._1
1260+ let outInAmountAsset = $t04903449187._5
1261+ let bonus = $t04903449187._4
1262+ let feeAmount = $t04903449187._3
1263+ let commonState = $t04903449187._2
1264+ let amountEstimated = $t04903449187._1
12601265 let amount = if (if ((minOutAmount > 0))
12611266 then (minOutAmount > amountEstimated)
12621267 else false)
12701275 let sendFee = if ((feeAmount > 0))
12711276 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12721277 else nil
1273- let $t04959749844 = {
1278+ let $t04975850005 = {
12741279 let feeAmountForCalc = if ((this == feeCollectorAddress))
12751280 then 0
12761281 else feeAmount
12781283 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12791284 else $Tuple2(0, -((amount + feeAmountForCalc)))
12801285 }
1281- let amountAssetBalanceDelta = $t04959749844._1
1282- let priceAssetBalanceDelta = $t04959749844._2
1283- let $t04984749955 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1284- let refreshKLpActions = $t04984749955._1
1285- let updatedKLp = $t04984749955._2
1286+ let amountAssetBalanceDelta = $t04975850005._1
1287+ let priceAssetBalanceDelta = $t04975850005._2
1288+ let $t05000850116 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1289+ let refreshKLpActions = $t05000850116._1
1290+ let updatedKLp = $t05000850116._2
12861291 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12871292 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12881293 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13011306
13021307 @Callable(i)
13031308 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1304- let $t05023350389 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1305- let amountEstimated = $t05023350389._1
1306- let commonState = $t05023350389._2
1307- let feeAmount = $t05023350389._3
1308- let bonus = $t05023350389._4
1309- let outInAmountAsset = $t05023350389._5
1309+ let $t05039450550 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1310+ let amountEstimated = $t05039450550._1
1311+ let commonState = $t05039450550._2
1312+ let feeAmount = $t05039450550._3
1313+ let bonus = $t05039450550._4
1314+ let outInAmountAsset = $t05039450550._5
13101315 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13111316 }
13121317
13431348 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13441349 if ((unstakeInv == unstakeInv))
13451350 then {
1346- let $t05129451445 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1347- if (($t05129451445 == $t05129451445))
1351+ let $t05145551606 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1352+ if (($t05145551606 == $t05145551606))
13481353 then {
1349- let outInAmountAsset = $t05129451445._5
1350- let bonus = $t05129451445._4
1351- let feeAmount = $t05129451445._3
1352- let commonState = $t05129451445._2
1353- let amountEstimated = $t05129451445._1
1354+ let outInAmountAsset = $t05145551606._5
1355+ let bonus = $t05145551606._4
1356+ let feeAmount = $t05145551606._3
1357+ let commonState = $t05145551606._2
1358+ let amountEstimated = $t05145551606._1
13541359 let amount = if (if ((minOutAmount > 0))
13551360 then (minOutAmount > amountEstimated)
13561361 else false)
13641369 let sendFee = if ((feeAmount > 0))
13651370 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13661371 else nil
1367- let $t05201152258 = {
1372+ let $t05217252419 = {
13681373 let feeAmountForCalc = if ((this == feeCollectorAddress))
13691374 then 0
13701375 else feeAmount
13721377 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13731378 else $Tuple2(0, -((amount + feeAmountForCalc)))
13741379 }
1375- let amountAssetBalanceDelta = $t05201152258._1
1376- let priceAssetBalanceDelta = $t05201152258._2
1377- let $t05226152369 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1378- let refreshKLpActions = $t05226152369._1
1379- let updatedKLp = $t05226152369._2
1380+ let amountAssetBalanceDelta = $t05217252419._1
1381+ let priceAssetBalanceDelta = $t05217252419._2
1382+ let $t05242252530 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1383+ let refreshKLpActions = $t05242252530._1
1384+ let updatedKLp = $t05242252530._2
13801385 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13811386 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13821387 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13981403 @Callable(i)
13991404 func get () = {
14001405 let res = commonGet(i)
1401- let outAmtAmt = res._1
1406+ let outAmAmt = res._1
14021407 let outPrAmt = res._2
14031408 let pmtAmt = res._3
14041409 let pmtAssetId = res._4
14051410 let state = res._5
1411+ let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14061412 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14071413 if ((currentKLp == currentKLp))
14081414 then {
14091415 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14101416 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14111417 then {
1412- let $t05333653418 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1413- let refreshKLpActions = $t05333653418._1
1414- let updatedKLp = $t05333653418._2
1418+ let $t05362553706 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1419+ let refreshKLpActions = $t05362553706._1
1420+ let updatedKLp = $t05362553706._2
14151421 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14161422 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1417- then (state ++ refreshKLpActions)
1423+ then ((withdrawState ++ state) ++ refreshKLpActions)
14181424 else throw("Strict value is not equal to itself.")
14191425 }
14201426 else throw("Strict value is not equal to itself.")
14371443 else if ((noLessThenPriceAsset > outPrAmt))
14381444 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14391445 else {
1446+ let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14401447 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14411448 if ((currentKLp == currentKLp))
14421449 then {
14431450 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14441451 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14451452 then {
1446- let $t05436754448 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1447- let refreshKLpActions = $t05436754448._1
1448- let updatedKLp = $t05436754448._2
1453+ let $t05480154882 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1454+ let refreshKLpActions = $t05480154882._1
1455+ let updatedKLp = $t05480154882._2
14491456 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14501457 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1451- then (state ++ refreshKLpActions)
1458+ then ((withdrawState ++ state) ++ refreshKLpActions)
14521459 else throw("Strict value is not equal to itself.")
14531460 }
14541461 else throw("Strict value is not equal to itself.")
14791486 let outPrAmt = res._2
14801487 let poolStatus = parseIntValue(res._9)
14811488 let state = res._10
1489+ let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14821490 let checkPoolStatus = if (if (isGlobalShutdown())
14831491 then true
14841492 else (poolStatus == PoolShutdown))
14891497 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14901498 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14911499 then {
1492- let $t05557455655 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1493- let refreshKLpActions = $t05557455655._1
1494- let updatedKLp = $t05557455655._2
1500+ let $t05615456235 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1501+ let refreshKLpActions = $t05615456235._1
1502+ let updatedKLp = $t05615456235._2
14951503 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14961504 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1497- then (state ++ refreshKLpActions)
1505+ then ((withdrawState ++ state) ++ refreshKLpActions)
14981506 else throw("Strict value is not equal to itself.")
14991507 }
15001508 else throw("Strict value is not equal to itself.")
15321540 let outAmAmt = res._1
15331541 let outPrAmt = res._2
15341542 let state = res._10
1543+ let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15351544 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15361545 then true
15371546 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15421551 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15431552 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15441553 then {
1545- let $t05695057031 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1546- let refreshKLpActions = $t05695057031._1
1547- let updatedKLp = $t05695057031._2
1554+ let $t05767657757 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1555+ let refreshKLpActions = $t05767657757._1
1556+ let updatedKLp = $t05767657757._2
15481557 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15491558 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1550- then (state ++ refreshKLpActions)
1559+ then ((withdrawState ++ state) ++ refreshKLpActions)
15511560 else throw("Strict value is not equal to itself.")
15521561 }
15531562 else throw("Strict value is not equal to itself.")
15791588 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15801589 then {
15811590 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1582- let $t05821858282 = refreshKLpInternal(0, 0, 0)
1583- let kLpUpdateActions = $t05821858282._1
1584- let updatedKLp = $t05821858282._2
1591+ let $t05896159025 = refreshKLpInternal(0, 0, 0)
1592+ let kLpUpdateActions = $t05896159025._1
1593+ let updatedKLp = $t05896159025._2
15851594 let actions = if ((kLp != updatedKLp))
15861595 then kLpUpdateActions
15871596 else throwErr("nothing to refresh")
17561765 match tx {
17571766 case order: Order =>
17581767 let matcherPub = getMatcherPubOrFail()
1759- let $t06694467013 = validateMatcherOrderAllowed(order)
1760- let orderValid = $t06694467013._1
1761- let orderValidInfo = $t06694467013._2
1768+ let $t06768767756 = validateMatcherOrderAllowed(order)
1769+ let orderValid = $t06768767756._1
1770+ let orderValidInfo = $t06768767756._2
17621771 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17631772 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17641773 if (if (if (orderValid)
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 toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult)
6666
6767
6868 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6969
7070
7171 func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
7272
7373
7474 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7575
7676
7777 func abs (val) = if ((0 > val))
7878 then -(val)
7979 else val
8080
8181
8282 func absBigInt (val) = if ((zeroBigInt > val))
8383 then -(val)
8484 else val
8585
8686
8787 func swapContract () = "%s__swapContract"
8888
8989
9090 func fc () = "%s__factoryContract"
9191
9292
9393 func mpk () = "%s__managerPublicKey"
9494
9595
9696 func pmpk () = "%s__pendingManagerPublicKey"
9797
9898
9999 func pl () = "%s%s__price__last"
100100
101101
102102 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
103103
104104
105105 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
106106
107107
108108 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
109109
110110
111111 func aa () = "%s__amountAsset"
112112
113113
114114 func pa () = "%s__priceAsset"
115115
116116
117117 let keyFee = "%s__fee"
118118
119119 let feeDefault = fraction(10, scale8, 10000)
120120
121121 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
122122
123123 let keyKLp = makeString(["%s", "kLp"], SEP)
124124
125125 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
126126
127127 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
128128
129129 let kLpRefreshDelayDefault = 30
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133133 func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP)
134134
135135
136136 func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP)
137137
138138
139139 func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
140140
141141
142142 func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
143143
144144
145145 func keyFactoryConfig () = "%s__factoryConfig"
146146
147147
148148 func keyMatcherPub () = "%s%s__matcher__publicKey"
149149
150150
151151 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
152152
153153
154154 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
155155
156156
157157 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
158158
159159
160160 func keyAllPoolsShutdown () = "%s__shutdown"
161161
162162
163163 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
164164
165165
166166 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
167167
168168
169169 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
170170
171171 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
172172
173173
174174 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
175175
176176
177177 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
178178
179179
180180 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
181181
182182
183183 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
184184
185185
186186 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
187187
188188 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
189189
190190 let inFee = {
191191 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
192192 if ($isInstanceOf(@, "Int"))
193193 then @
194194 else throw(($getType(@) + " couldn't be cast to Int"))
195195 }
196196
197197 let outFee = {
198198 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
199199 if ($isInstanceOf(@, "Int"))
200200 then @
201201 else throw(($getType(@) + " couldn't be cast to Int"))
202202 }
203203
204204 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
205205
206206
207207 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
208208
209209
210210 func getPoolConfig () = {
211211 let amtAsset = getStringOrFail(this, aa())
212212 let priceAsset = getStringOrFail(this, pa())
213213 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
214214 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
215215 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
216216 }
217217
218218
219219 func parseAssetId (input) = if ((input == wavesString))
220220 then unit
221221 else fromBase58String(input)
222222
223223
224224 func assetIdToString (input) = if ((input == unit))
225225 then wavesString
226226 else toBase58String(value(input))
227227
228228
229229 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]))
230230
231231
232232 let poolConfigParsed = parsePoolConfig(getPoolConfig())
233233
234234 let $t089629128 = poolConfigParsed
235235
236236 let cfgPoolAddress = $t089629128._1
237237
238238 let cfgPoolStatus = $t089629128._2
239239
240240 let cfgLpAssetId = $t089629128._3
241241
242242 let cfgAmountAssetId = $t089629128._4
243243
244244 let cfgPriceAssetId = $t089629128._5
245245
246246 let cfgAmountAssetDecimals = $t089629128._6
247247
248248 let cfgPriceAssetDecimals = $t089629128._7
249249
250250 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
251251
252252
253253 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
254254
255255 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
256256
257257 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)
258258
259259
260260 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)
261261
262262
263263 func getAccBalance (assetId) = {
264264 let balanceOnPool = if ((assetId == "WAVES"))
265265 then wavesBalance(this).available
266266 else assetBalance(this, fromBase58String(assetId))
267267 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
268268 max([0, totalBalance])
269269 }
270270
271271
272272 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
273273
274274
275275 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
276276
277277
278278 func getRate (proxy) = {
279279 let inv = invoke(proxy, "getRate", nil, nil)
280280 if ((inv == inv))
281281 then match inv {
282282 case r: Int =>
283283 r
284284 case _ =>
285285 throwErr("proxy.getRate() unexpected value")
286286 }
287287 else throw("Strict value is not equal to itself.")
288288 }
289289
290290
291291 func deposit (assetId,amount,stakingAssetId,proxy) = {
292292 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
293293 if ((currentAdditionalBalance == currentAdditionalBalance))
294294 then {
295295 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
296296 if ((currentStakingAssetBalance == currentStakingAssetBalance))
297297 then {
298298 let asset = parseAssetId(assetId)
299299 if ((amount > 0))
300300 then {
301301 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
302302 if ((depositInvoke == depositInvoke))
303303 then match depositInvoke {
304304 case receivedStakingAsset: Int =>
305305 let newAdditionalBalance = (currentAdditionalBalance + amount)
306306 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
307307 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
308308 case _ =>
309309 nil
310310 }
311311 else throw("Strict value is not equal to itself.")
312312 }
313313 else nil
314314 }
315315 else throw("Strict value is not equal to itself.")
316316 }
317317 else throw("Strict value is not equal to itself.")
318318 }
319319
320320
321321 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
322322 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
323323 if ((currentAdditionalBalance == currentAdditionalBalance))
324324 then {
325325 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
326326 if ((currentStakingAssetBalance == currentStakingAssetBalance))
327327 then {
328328 let currentProxyRate = getRate(proxy)
329329 if ((currentProxyRate == currentProxyRate))
330330 then {
331331 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
332332 let stakingAsset = parseAssetId(stakingAssetId)
333333 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
334334 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
335335 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
336336 if ((sendStakingAssetAmount > 0))
337337 then {
338338 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
339339 if ((withdrawInvoke == withdrawInvoke))
340340 then match withdrawInvoke {
341341 case receivedAssets: Int =>
342342 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
343343 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
344344 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
345345 case _ =>
346346 nil
347347 }
348348 else throw("Strict value is not equal to itself.")
349349 }
350350 else nil
351351 }
352352 else throw("Strict value is not equal to itself.")
353353 }
354354 else throw("Strict value is not equal to itself.")
355355 }
356356 else throw("Strict value is not equal to itself.")
357357 }
358358
359359
360360 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
361361 case a: (Boolean, Int, Int, String, String, Int, String) =>
362362 a
363363 case _ =>
364364 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
365365 }
366366
367367
368368 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
369369 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
370370 if ((currentAdditionalBalance == currentAdditionalBalance))
371371 then {
372372 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
373373 if ((currentStakingAssetBalance == currentStakingAssetBalance))
374374 then {
375375 let availableBalance = match parseAssetId(assetId) {
376376 case b: ByteVector =>
377377 assetBalance(this, b)
378378 case u: Unit =>
379379 wavesBalance(this).available
380380 case _ =>
381381 throw("Match error")
382382 }
383383 if ((availableBalance == availableBalance))
384384 then {
385385 let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
386386 let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
387387 let diff = (currentAdditionalBalance - targetAdditionalBalance)
388388 if ((diff == 0))
389389 then nil
390390 else if ((0 > diff))
391391 then {
392392 let sendAssetAmount = -(diff)
393393 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
394394 }
395395 else {
396396 let getAssetAmount = diff
397397 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
398398 }
399399 }
400400 else throw("Strict value is not equal to itself.")
401401 }
402402 else throw("Strict value is not equal to itself.")
403403 }
404404 else throw("Strict value is not equal to itself.")
405405 }
406406
407407
408408 func rebalanceAsset (assetId) = {
409409 let $t01552715663 = getLeaseProxyConfig(assetId)
410410 let isLeasable = $t01552715663._1
411411 let leasedRatio = $t01552715663._2
412412 let minBalance = $t01552715663._3
413413 let proxyAddress = $t01552715663._4
414414 let proxyAssetId = $t01552715663._5
415415 let proxyRateMul = $t01552715663._6
416416 let stakingProfitAddress = $t01552715663._7
417417 if (isLeasable)
418418 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
419419 else nil
420420 }
421421
422422
423423 func withdrawAndRebalanceAsset (assetId,getAmount) = {
424424 let $t01605216188 = getLeaseProxyConfig(assetId)
425425 let isLeasable = $t01605216188._1
426426 let leasedRatio = $t01605216188._2
427427 let minBalance = $t01605216188._3
428428 let proxyAddress = $t01605216188._4
429429 let proxyAssetId = $t01605216188._5
430430 let proxyRateMul = $t01605216188._6
431431 let stakingProfitAddress = $t01605216188._7
432432 if (isLeasable)
433433 then {
434434 let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
435435 if ((newTotalCalcBalance == newTotalCalcBalance))
436436 then {
437437 let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
438438 if ((newAdditionalBalance == newAdditionalBalance))
439439 then {
440440 let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
441441 if ((withdrawAmount == withdrawAmount))
442442 then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
443443 else throw("Strict value is not equal to itself.")
444444 }
445445 else throw("Strict value is not equal to itself.")
446446 }
447447 else throw("Strict value is not equal to itself.")
448448 }
449449 else nil
450450 }
451451
452452
453+func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
454+ let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
455+ let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
456+ (AmAmtWithdrawState ++ PrAmtWithdrawState)
457+ }
458+
459+
453460 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
454461 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
455462 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
456463 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
457464 }
458465
459466
460467 func calcPrices (amAmt,prAmt,lpAmt) = {
461468 let cfg = getPoolConfig()
462469 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
463470 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
464471 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
465472 let amAmtX18 = toX18(amAmt, amtAssetDcm)
466473 let prAmtX18 = toX18(prAmt, priceAssetDcm)
467474 let lpAmtX18 = toX18(lpAmt, scale8)
468475 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
469476 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
470477 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
471478 }
472479
473480
474481 func calculatePrices (amAmt,prAmt,lpAmt) = {
475482 let prices = calcPrices(amAmt, prAmt, lpAmt)
476483 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
477484 }
478485
479486
480487 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
481488 let cfg = getPoolConfig()
482489 let lpAssetId = cfg[idxPoolLPAssetId]
483490 let amAssetId = cfg[idxAmtAssetId]
484491 let prAssetId = cfg[idxPriceAssetId]
485492 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
486493 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
487494 let poolStatus = cfg[idxPoolStatus]
488495 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
489496 if ((lpAssetId != pmtAssetId))
490497 then throw("Invalid asset passed.")
491498 else {
492499 let amBalance = getAccBalance(amAssetId)
493500 let amBalanceX18 = toX18(amBalance, amAssetDcm)
494501 let prBalance = getAccBalance(prAssetId)
495502 let prBalanceX18 = toX18(prBalance, prAssetDcm)
496503 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
497504 let curPrice = fromX18(curPriceX18, scale8)
498505 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
499506 let lpEmissionX18 = toX18(lpEmission, scale8)
500507 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
501508 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
502509 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
503510 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
504- let AmAmtWithdrawState = withdrawAndRebalanceAsset(amAssetId, outAmAmt)
505- let PrAmtWithdrawState = withdrawAndRebalanceAsset(prAssetId, outPrAmt)
506511 let state = if ((txId58 == ""))
507512 then nil
508- else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
513+ else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
509514 then unit
510515 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
511516 then unit
512- 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)])
517+ 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)]
513518 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
514519 }
515520 }
516521
517522
518523 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
519524 let cfg = getPoolConfig()
520525 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
521526 let amAssetIdStr = cfg[idxAmtAssetId]
522527 let prAssetIdStr = cfg[idxPriceAssetId]
523528 let iAmtAssetId = cfg[idxIAmtAssetId]
524529 let iPriceAssetId = cfg[idxIPriceAssetId]
525530 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
526531 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
527532 let poolStatus = cfg[idxPoolStatus]
528533 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
529534 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
530535 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
531536 if (if ((amAssetIdStr != inAmAssetIdStr))
532537 then true
533538 else (prAssetIdStr != inPrAssetIdStr))
534539 then throw("Invalid amt or price asset passed.")
535540 else {
536541 let amBalance = if (isEvaluate)
537542 then getAccBalance(amAssetIdStr)
538543 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
539544 let prBalance = if (isEvaluate)
540545 then getAccBalance(prAssetIdStr)
541546 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
542547 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
543548 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
544549 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
545550 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
546551 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
547552 let res = if ((lpEmission == 0))
548553 then {
549554 let curPriceX18 = zeroBigInt
550555 let slippageX18 = zeroBigInt
551556 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
552557 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
553558 }
554559 else {
555560 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
556561 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
557562 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
558563 if (if ((curPriceX18 != zeroBigInt))
559564 then (slippageX18 > slippageToleranceX18)
560565 else false)
561566 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
562567 else {
563568 let lpEmissionX18 = toX18(lpEmission, scale8)
564569 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
565570 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
566571 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
567572 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
568573 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
569574 let expAmtAssetAmtX18 = expectedAmts._1
570575 let expPriceAssetAmtX18 = expectedAmts._2
571576 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
572577 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
573578 }
574579 }
575580 let calcLpAmt = res._1
576581 let calcAmAssetPmt = res._2
577582 let calcPrAssetPmt = res._3
578583 let curPrice = fromX18(res._4, scale8)
579584 let slippageCalc = fromX18(res._5, scale8)
580585 if ((0 >= calcLpAmt))
581586 then throw("Invalid calculations. LP calculated is less than zero.")
582587 else {
583588 let emitLpAmt = if (!(emitLp))
584589 then 0
585590 else calcLpAmt
586591 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
587592 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
588593 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))]
589594 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
590595 }
591596 }
592597 }
593598
594599
595600 func calcKLp (amountBalance,priceBalance,lpEmission) = {
596601 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
597602 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
598603 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
599604 if ((lpEmission == big0))
600605 then big0
601606 else updatedKLp
602607 }
603608
604609
605610 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
606611 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
607612 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
608613 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
609614 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
610615 currentKLp
611616 }
612617
613618
614619 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
615620 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
616621 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
617622 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
618623 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
619624 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
620625 $Tuple2(actions, updatedKLp)
621626 }
622627
623628
624629 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
625630 then true
626631 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
627632
628633
629634 func validateMatcherOrderAllowed (order) = {
630635 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
631636 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
632637 let amountAssetAmount = order.amount
633638 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
634- let $t02814728359 = if ((order.orderType == Buy))
639+ let $t02830828520 = if ((order.orderType == Buy))
635640 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
636641 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
637- let amountAssetBalanceDelta = $t02814728359._1
638- let priceAssetBalanceDelta = $t02814728359._2
642+ let amountAssetBalanceDelta = $t02830828520._1
643+ let priceAssetBalanceDelta = $t02830828520._2
639644 if (if (if (isGlobalShutdown())
640645 then true
641646 else (cfgPoolStatus == PoolMatcherDisabled))
642647 then true
643648 else (cfgPoolStatus == PoolShutdown))
644649 then throw("Exchange operations disabled")
645650 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
646651 then true
647652 else (order.assetPair.priceAsset != cfgPriceAssetId))
648653 then throw("Wrong order assets.")
649654 else {
650655 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
651- let $t02879928899 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
652- let unusedActions = $t02879928899._1
653- let kLpNew = $t02879928899._2
656+ let $t02896029060 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
657+ let unusedActions = $t02896029060._1
658+ let kLpNew = $t02896029060._2
654659 let isOrderValid = (kLpNew >= kLp)
655660 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
656661 $Tuple2(isOrderValid, info)
657662 }
658663 }
659664
660665
661666 func commonGet (i) = if ((size(i.payments) != 1))
662667 then throw("exactly 1 payment is expected")
663668 else {
664669 let pmt = value(i.payments[0])
665670 let pmtAssetId = value(pmt.assetId)
666671 let pmtAmt = pmt.amount
667672 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
668673 let outAmAmt = res._1
669674 let outPrAmt = res._2
670675 let poolStatus = parseIntValue(res._9)
671676 let state = res._10
672677 if (if (isGlobalShutdown())
673678 then true
674679 else (poolStatus == PoolShutdown))
675680 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
676681 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
677682 }
678683
679684
680685 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
681686 then throw("exactly 2 payments are expected")
682687 else {
683688 let amAssetPmt = value(i.payments[0])
684689 let prAssetPmt = value(i.payments[1])
685690 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
686691 let poolStatus = parseIntValue(estPut._8)
687692 if (if (if (isGlobalShutdown())
688693 then true
689694 else (poolStatus == PoolPutDisabled))
690695 then true
691696 else (poolStatus == PoolShutdown))
692697 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
693698 else estPut
694699 }
695700
696701
697702 func emit (amount) = {
698703 let emitInv = invoke(factoryContract, "emit", [amount], nil)
699704 if ((emitInv == emitInv))
700705 then {
701706 let emitInvLegacy = match emitInv {
702707 case legacyFactoryContract: Address =>
703708 invoke(legacyFactoryContract, "emit", [amount], nil)
704709 case _ =>
705710 unit
706711 }
707712 if ((emitInvLegacy == emitInvLegacy))
708713 then amount
709714 else throw("Strict value is not equal to itself.")
710715 }
711716 else throw("Strict value is not equal to itself.")
712717 }
713718
714719
715720 func takeFee (amount,fee) = {
716721 let feeAmount = if ((fee == 0))
717722 then 0
718723 else fraction(amount, fee, scale8)
719724 $Tuple2((amount - feeAmount), feeAmount)
720725 }
721726
722727
723728 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
724729 let isEval = (txId == unit)
725730 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
726731 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
727732 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
728733 then true
729734 else if ((paymentAssetId == cfgPriceAssetId))
730735 then false
731736 else throwErr("invalid asset")
732- let $t03201232305 = if (isEval)
737+ let $t03217332466 = if (isEval)
733738 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
734739 else if (paymentInAmountAsset)
735740 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
736741 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
737- let amountBalanceOld = $t03201232305._1
738- let priceBalanceOld = $t03201232305._2
739- let $t03230932458 = if (paymentInAmountAsset)
742+ let amountBalanceOld = $t03217332466._1
743+ let priceBalanceOld = $t03217332466._2
744+ let $t03247032619 = if (paymentInAmountAsset)
740745 then $Tuple2(paymentAmountRaw, 0)
741746 else $Tuple2(0, paymentAmountRaw)
742- let amountAssetAmountRaw = $t03230932458._1
743- let priceAssetAmountRaw = $t03230932458._2
747+ let amountAssetAmountRaw = $t03247032619._1
748+ let priceAssetAmountRaw = $t03247032619._2
744749 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
745750 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
746- let $t03259032654 = takeFee(paymentAmountRaw, inFee)
747- let paymentAmount = $t03259032654._1
748- let feeAmount = $t03259032654._2
751+ let $t03275132815 = takeFee(paymentAmountRaw, inFee)
752+ let paymentAmount = $t03275132815._1
753+ let feeAmount = $t03275132815._2
749754 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
750755 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
751756 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
752757 let priceNew = fromX18(priceNewX18, scale8)
753758 let paymentBalance = if (paymentInAmountAsset)
754759 then amountBalanceOld
755760 else priceBalanceOld
756761 let paymentBalanceBigInt = toBigInt(paymentBalance)
757762 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
758763 let chechSupply = if ((supplyBigInt > big0))
759764 then true
760765 else throwErr("initial deposit requires all coins")
761766 if ((chechSupply == chechSupply))
762767 then {
763768 let depositBigInt = toBigInt(paymentAmount)
764769 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
765770 let commonState = if (isEval)
766771 then nil
767772 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))]
768773 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
769774 let priceOld = fromX18(priceOldX18, scale8)
770775 let loss = {
771- let $t03433534502 = if (paymentInAmountAsset)
776+ let $t03449634663 = if (paymentInAmountAsset)
772777 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
773778 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
774- let amount = $t03433534502._1
775- let balance = $t03433534502._2
779+ let amount = $t03449634663._1
780+ let balance = $t03449634663._2
776781 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
777782 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
778783 }
779784 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
780785 }
781786 else throw("Strict value is not equal to itself.")
782787 }
783788
784789
785790 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
786791 let isEval = (txId == unit)
787792 let cfg = getPoolConfig()
788793 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
789794 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
790795 let checks = [if ((paymentAssetId == cfgLpAssetId))
791796 then true
792797 else throwErr("invalid lp asset")]
793798 if ((checks == checks))
794799 then {
795800 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
796801 then true
797802 else if ((outAssetId == cfgPriceAssetId))
798803 then false
799804 else throwErr("invalid asset")
800805 let balanceBigInt = if (outInAmountAsset)
801806 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
802807 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
803808 let outInAmountAssetDecimals = if (outInAmountAsset)
804809 then amtAssetDcm
805810 else priceAssetDcm
806811 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
807812 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
808813 let outBalance = if (outInAmountAsset)
809814 then amBalanceOld
810815 else prBalanceOld
811816 let outBalanceBigInt = toBigInt(outBalance)
812817 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
813818 let redeemedBigInt = toBigInt(paymentAmount)
814819 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
815- let $t03658036636 = takeFee(amountRaw, outFee)
816- let totalAmount = $t03658036636._1
817- let feeAmount = $t03658036636._2
818- let $t03664036866 = if (outInAmountAsset)
820+ let $t03674136797 = takeFee(amountRaw, outFee)
821+ let totalAmount = $t03674136797._1
822+ let feeAmount = $t03674136797._2
823+ let $t03680137027 = if (outInAmountAsset)
819824 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
820825 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
821- let outAmAmount = $t03664036866._1
822- let outPrAmount = $t03664036866._2
823- let amBalanceNew = $t03664036866._3
824- let prBalanceNew = $t03664036866._4
826+ let outAmAmount = $t03680137027._1
827+ let outPrAmount = $t03680137027._2
828+ let amBalanceNew = $t03680137027._3
829+ let prBalanceNew = $t03680137027._4
825830 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
826831 let priceNew = fromX18(priceNewX18, scale8)
827832 let commonState = if (isEval)
828833 then nil
829834 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)]
830835 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
831836 let priceOld = fromX18(priceOldX18, scale8)
832837 let loss = {
833838 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
834839 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
835840 }
836841 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
837842 }
838843 else throw("Strict value is not equal to itself.")
839844 }
840845
841846
842847 func managerPublicKeyOrUnit () = match getString(mpk()) {
843848 case s: String =>
844849 fromBase58String(s)
845850 case _: Unit =>
846851 unit
847852 case _ =>
848853 throw("Match error")
849854 }
850855
851856
852857 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
853858 case s: String =>
854859 fromBase58String(s)
855860 case _: Unit =>
856861 unit
857862 case _ =>
858863 throw("Match error")
859864 }
860865
861866
862867 func isManager (i) = match managerPublicKeyOrUnit() {
863868 case pk: ByteVector =>
864869 (i.callerPublicKey == pk)
865870 case _: Unit =>
866871 (i.caller == this)
867872 case _ =>
868873 throw("Match error")
869874 }
870875
871876
872877 func mustManager (i) = {
873878 let pd = throw("Permission denied")
874879 match managerPublicKeyOrUnit() {
875880 case pk: ByteVector =>
876881 if ((i.callerPublicKey == pk))
877882 then true
878883 else pd
879884 case _: Unit =>
880885 if ((i.caller == this))
881886 then true
882887 else pd
883888 case _ =>
884889 throw("Match error")
885890 }
886891 }
887892
888893
889894 @Callable(i)
890895 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
891896
892897
893898
894899 @Callable(i)
895900 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
896- let $t03875239057 = if ((isReverse == false))
901+ let $t03891339218 = if ((isReverse == false))
897902 then {
898903 let assetOut = getStringOrFail(this, pa())
899904 let assetIn = getStringOrFail(this, aa())
900905 $Tuple2(assetOut, assetIn)
901906 }
902907 else {
903908 let assetOut = getStringOrFail(this, aa())
904909 let assetIn = getStringOrFail(this, pa())
905910 $Tuple2(assetOut, assetIn)
906911 }
907- let assetOut = $t03875239057._1
908- let assetIn = $t03875239057._2
912+ let assetOut = $t03891339218._1
913+ let assetIn = $t03891339218._2
909914 let poolAssetInBalance = getAccBalance(assetIn)
910915 let poolAssetOutBalance = getAccBalance(assetOut)
911916 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
912917 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
913918 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
914919 let checkK = if ((newK >= oldK))
915920 then true
916921 else throw("new K is fewer error")
917922 if ((checkK == checkK))
918923 then $Tuple2(nil, amountOut)
919924 else throw("Strict value is not equal to itself.")
920925 }
921926
922927
923928
924929 @Callable(i)
925930 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
926931 let swapContact = {
927932 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
928933 if ($isInstanceOf(@, "String"))
929934 then @
930935 else throw(($getType(@) + " couldn't be cast to String"))
931936 }
932937 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
933938 then true
934939 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
935940 then true
936941 else throwErr("Permission denied")]
937942 if ((checks == checks))
938943 then {
939944 let pmt = value(i.payments[0])
940945 let assetIn = assetIdToString(pmt.assetId)
941946 let assetOut = if ((isReverse == false))
942947 then getStringOrFail(this, pa())
943948 else getStringOrFail(this, aa())
944949 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
945950 let poolAssetOutBalance = getAccBalance(assetOut)
946951 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
947952 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
948953 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
949954 let checkK = if ((newK >= oldK))
950955 then true
951956 else throw("new K is fewer error")
952957 if ((checkK == checkK))
953958 then {
954959 let checkMin = if ((amountOut >= amountOutMin))
955960 then true
956961 else throw("Exchange result is fewer coins than expected")
957962 if ((checkMin == checkMin))
958963 then {
959964 let rebalanceState = rebalanceAsset(assetIn)
960965 if ((rebalanceState == rebalanceState))
961966 then {
962967 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
963968 if ((withdrawState == withdrawState))
964969 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
965970 else throw("Strict value is not equal to itself.")
966971 }
967972 else throw("Strict value is not equal to itself.")
968973 }
969974 else throw("Strict value is not equal to itself.")
970975 }
971976 else throw("Strict value is not equal to itself.")
972977 }
973978 else throw("Strict value is not equal to itself.")
974979 }
975980
976981
977982
978983 @Callable(i)
979984 func setManager (pendingManagerPublicKey) = {
980985 let checkCaller = mustManager(i)
981986 if ((checkCaller == checkCaller))
982987 then {
983988 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
984989 if ((checkManagerPublicKey == checkManagerPublicKey))
985990 then [StringEntry(pmpk(), pendingManagerPublicKey)]
986991 else throw("Strict value is not equal to itself.")
987992 }
988993 else throw("Strict value is not equal to itself.")
989994 }
990995
991996
992997
993998 @Callable(i)
994999 func confirmManager () = {
9951000 let pm = pendingManagerPublicKeyOrUnit()
9961001 let hasPM = if (isDefined(pm))
9971002 then true
9981003 else throw("No pending manager")
9991004 if ((hasPM == hasPM))
10001005 then {
10011006 let checkPM = if ((i.callerPublicKey == value(pm)))
10021007 then true
10031008 else throw("You are not pending manager")
10041009 if ((checkPM == checkPM))
10051010 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
10061011 else throw("Strict value is not equal to itself.")
10071012 }
10081013 else throw("Strict value is not equal to itself.")
10091014 }
10101015
10111016
10121017
10131018 @Callable(i)
10141019 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10151020 then throw("Invalid slippageTolerance passed")
10161021 else {
10171022 let estPut = commonPut(i, slippageTolerance, true)
10181023 let emitLpAmt = estPut._2
10191024 let lpAssetId = estPut._7
10201025 let state = estPut._9
10211026 let amDiff = estPut._10
10221027 let prDiff = estPut._11
10231028 let amId = estPut._12
10241029 let prId = estPut._13
10251030 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10261031 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10271032 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10281033 if ((currentKLp == currentKLp))
10291034 then {
10301035 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10311036 if ((emitInv == emitInv))
10321037 then {
10331038 let emitInvLegacy = match emitInv {
10341039 case legacyFactoryContract: Address =>
10351040 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10361041 case _ =>
10371042 unit
10381043 }
10391044 if ((emitInvLegacy == emitInvLegacy))
10401045 then {
10411046 let slippageAInv = if ((amDiff > 0))
10421047 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10431048 else nil
10441049 if ((slippageAInv == slippageAInv))
10451050 then {
10461051 let slippagePInv = if ((prDiff > 0))
10471052 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10481053 else nil
10491054 if ((slippagePInv == slippagePInv))
10501055 then {
10511056 let lpTransfer = if (shouldAutoStake)
10521057 then {
10531058 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10541059 if ((slpStakeInv == slpStakeInv))
10551060 then nil
10561061 else throw("Strict value is not equal to itself.")
10571062 }
10581063 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1059- let $t04410344565 = refreshKLpInternal(0, 0, 0)
1060- if (($t04410344565 == $t04410344565))
1064+ let $t04426444726 = refreshKLpInternal(0, 0, 0)
1065+ if (($t04426444726 == $t04426444726))
10611066 then {
1062- let updatedKLp = $t04410344565._2
1063- let refreshKLpActions = $t04410344565._1
1067+ let updatedKLp = $t04426444726._2
1068+ let refreshKLpActions = $t04426444726._1
10641069 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10651070 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10661071 then {
10671072 let reb = invoke(this, "rebalance", nil, nil)
10681073 if ((reb == reb))
10691074 then ((state ++ lpTransfer) ++ refreshKLpActions)
10701075 else throw("Strict value is not equal to itself.")
10711076 }
10721077 else throw("Strict value is not equal to itself.")
10731078 }
10741079 else throw("Strict value is not equal to itself.")
10751080 }
10761081 else throw("Strict value is not equal to itself.")
10771082 }
10781083 else throw("Strict value is not equal to itself.")
10791084 }
10801085 else throw("Strict value is not equal to itself.")
10811086 }
10821087 else throw("Strict value is not equal to itself.")
10831088 }
10841089 else throw("Strict value is not equal to itself.")
10851090 }
10861091
10871092
10881093
10891094 @Callable(i)
10901095 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10911096 then throw("Invalid value passed")
10921097 else {
10931098 let estPut = commonPut(i, maxSlippage, false)
10941099 let state = estPut._9
10951100 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10961101 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10971102 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10981103 if ((currentKLp == currentKLp))
10991104 then {
1100- let $t04517745242 = refreshKLpInternal(0, 0, 0)
1101- let refreshKLpActions = $t04517745242._1
1102- let updatedKLp = $t04517745242._2
1105+ let $t04533845403 = refreshKLpInternal(0, 0, 0)
1106+ let refreshKLpActions = $t04533845403._1
1107+ let updatedKLp = $t04533845403._2
11031108 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11041109 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11051110 then (state ++ refreshKLpActions)
11061111 else throw("Strict value is not equal to itself.")
11071112 }
11081113 else throw("Strict value is not equal to itself.")
11091114 }
11101115
11111116
11121117
11131118 @Callable(i)
11141119 func putOneTkn (minOutAmount,autoStake) = {
11151120 let isPoolOneTokenOperationsDisabled = {
11161121 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11171122 if ($isInstanceOf(@, "Boolean"))
11181123 then @
11191124 else throw(($getType(@) + " couldn't be cast to Boolean"))
11201125 }
11211126 let isPutDisabled = if (if (if (isGlobalShutdown())
11221127 then true
11231128 else (cfgPoolStatus == PoolPutDisabled))
11241129 then true
11251130 else (cfgPoolStatus == PoolShutdown))
11261131 then true
11271132 else isPoolOneTokenOperationsDisabled
11281133 let checks = [if (if (!(isPutDisabled))
11291134 then true
11301135 else isManager(i))
11311136 then true
11321137 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11331138 then true
11341139 else throwErr("exactly 1 payment are expected")]
11351140 if ((checks == checks))
11361141 then {
11371142 let payment = i.payments[0]
11381143 let paymentAssetId = payment.assetId
11391144 let paymentAmountRaw = payment.amount
11401145 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11411146 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11421147 else if ((paymentAssetId == cfgPriceAssetId))
11431148 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11441149 else throwErr("payment asset is not supported")
11451150 if ((currentKLp == currentKLp))
11461151 then {
11471152 let userAddress = i.caller
11481153 let txId = i.transactionId
1149- let $t04643046582 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1150- if (($t04643046582 == $t04643046582))
1154+ let $t04659146743 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1155+ if (($t04659146743 == $t04659146743))
11511156 then {
1152- let paymentInAmountAsset = $t04643046582._5
1153- let bonus = $t04643046582._4
1154- let feeAmount = $t04643046582._3
1155- let commonState = $t04643046582._2
1156- let emitAmountEstimated = $t04643046582._1
1157+ let paymentInAmountAsset = $t04659146743._5
1158+ let bonus = $t04659146743._4
1159+ let feeAmount = $t04659146743._3
1160+ let commonState = $t04659146743._2
1161+ let emitAmountEstimated = $t04659146743._1
11571162 let emitAmount = if (if ((minOutAmount > 0))
11581163 then (minOutAmount > emitAmountEstimated)
11591164 else false)
11601165 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11611166 else emitAmountEstimated
11621167 let emitInv = emit(emitAmount)
11631168 if ((emitInv == emitInv))
11641169 then {
11651170 let lpTransfer = if (autoStake)
11661171 then {
11671172 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11681173 if ((stakeInv == stakeInv))
11691174 then nil
11701175 else throw("Strict value is not equal to itself.")
11711176 }
11721177 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11731178 let sendFee = if ((feeAmount > 0))
11741179 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11751180 else nil
1176- let $t04716847365 = if ((this == feeCollectorAddress))
1181+ let $t04732947526 = if ((this == feeCollectorAddress))
11771182 then $Tuple2(0, 0)
11781183 else if (paymentInAmountAsset)
11791184 then $Tuple2(-(feeAmount), 0)
11801185 else $Tuple2(0, -(feeAmount))
1181- let amountAssetBalanceDelta = $t04716847365._1
1182- let priceAssetBalanceDelta = $t04716847365._2
1183- let $t04736847476 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1184- let refreshKLpActions = $t04736847476._1
1185- let updatedKLp = $t04736847476._2
1186+ let amountAssetBalanceDelta = $t04732947526._1
1187+ let priceAssetBalanceDelta = $t04732947526._2
1188+ let $t04752947637 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1189+ let refreshKLpActions = $t04752947637._1
1190+ let updatedKLp = $t04752947637._2
11861191 let kLp = value(getString(keyKLp))
11871192 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11881193 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11891194 then {
11901195 let reb = invoke(this, "rebalance", nil, nil)
11911196 if ((reb == reb))
11921197 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11931198 else throw("Strict value is not equal to itself.")
11941199 }
11951200 else throw("Strict value is not equal to itself.")
11961201 }
11971202 else throw("Strict value is not equal to itself.")
11981203 }
11991204 else throw("Strict value is not equal to itself.")
12001205 }
12011206 else throw("Strict value is not equal to itself.")
12021207 }
12031208 else throw("Strict value is not equal to itself.")
12041209 }
12051210
12061211
12071212
12081213 @Callable(i)
12091214 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1210- let $t04783147988 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1211- let emitAmountEstimated = $t04783147988._1
1212- let commonState = $t04783147988._2
1213- let feeAmount = $t04783147988._3
1214- let bonus = $t04783147988._4
1215- let paymentInAmountAsset = $t04783147988._5
1215+ let $t04799248149 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1216+ let emitAmountEstimated = $t04799248149._1
1217+ let commonState = $t04799248149._2
1218+ let feeAmount = $t04799248149._3
1219+ let bonus = $t04799248149._4
1220+ let paymentInAmountAsset = $t04799248149._5
12161221 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12171222 }
12181223
12191224
12201225
12211226 @Callable(i)
12221227 func getOneTkn (outAssetIdStr,minOutAmount) = {
12231228 let isPoolOneTokenOperationsDisabled = {
12241229 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12251230 if ($isInstanceOf(@, "Boolean"))
12261231 then @
12271232 else throw(($getType(@) + " couldn't be cast to Boolean"))
12281233 }
12291234 let isGetDisabled = if (if (isGlobalShutdown())
12301235 then true
12311236 else (cfgPoolStatus == PoolShutdown))
12321237 then true
12331238 else isPoolOneTokenOperationsDisabled
12341239 let checks = [if (if (!(isGetDisabled))
12351240 then true
12361241 else isManager(i))
12371242 then true
12381243 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12391244 then true
12401245 else throwErr("exactly 1 payment are expected")]
12411246 if ((checks == checks))
12421247 then {
12431248 let outAssetId = parseAssetId(outAssetIdStr)
12441249 let payment = i.payments[0]
12451250 let paymentAssetId = payment.assetId
12461251 let paymentAmount = payment.amount
12471252 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12481253 if ((currentKLp == currentKLp))
12491254 then {
12501255 let userAddress = i.caller
12511256 let txId = i.transactionId
1252- let $t04887349026 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1253- if (($t04887349026 == $t04887349026))
1257+ let $t04903449187 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1258+ if (($t04903449187 == $t04903449187))
12541259 then {
1255- let outInAmountAsset = $t04887349026._5
1256- let bonus = $t04887349026._4
1257- let feeAmount = $t04887349026._3
1258- let commonState = $t04887349026._2
1259- let amountEstimated = $t04887349026._1
1260+ let outInAmountAsset = $t04903449187._5
1261+ let bonus = $t04903449187._4
1262+ let feeAmount = $t04903449187._3
1263+ let commonState = $t04903449187._2
1264+ let amountEstimated = $t04903449187._1
12601265 let amount = if (if ((minOutAmount > 0))
12611266 then (minOutAmount > amountEstimated)
12621267 else false)
12631268 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12641269 else amountEstimated
12651270 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12661271 if ((burnInv == burnInv))
12671272 then {
12681273 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
12691274 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12701275 let sendFee = if ((feeAmount > 0))
12711276 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12721277 else nil
1273- let $t04959749844 = {
1278+ let $t04975850005 = {
12741279 let feeAmountForCalc = if ((this == feeCollectorAddress))
12751280 then 0
12761281 else feeAmount
12771282 if (outInAmountAsset)
12781283 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12791284 else $Tuple2(0, -((amount + feeAmountForCalc)))
12801285 }
1281- let amountAssetBalanceDelta = $t04959749844._1
1282- let priceAssetBalanceDelta = $t04959749844._2
1283- let $t04984749955 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1284- let refreshKLpActions = $t04984749955._1
1285- let updatedKLp = $t04984749955._2
1286+ let amountAssetBalanceDelta = $t04975850005._1
1287+ let priceAssetBalanceDelta = $t04975850005._2
1288+ let $t05000850116 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1289+ let refreshKLpActions = $t05000850116._1
1290+ let updatedKLp = $t05000850116._2
12861291 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12871292 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12881293 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12891294 else throw("Strict value is not equal to itself.")
12901295 }
12911296 else throw("Strict value is not equal to itself.")
12921297 }
12931298 else throw("Strict value is not equal to itself.")
12941299 }
12951300 else throw("Strict value is not equal to itself.")
12961301 }
12971302 else throw("Strict value is not equal to itself.")
12981303 }
12991304
13001305
13011306
13021307 @Callable(i)
13031308 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1304- let $t05023350389 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1305- let amountEstimated = $t05023350389._1
1306- let commonState = $t05023350389._2
1307- let feeAmount = $t05023350389._3
1308- let bonus = $t05023350389._4
1309- let outInAmountAsset = $t05023350389._5
1309+ let $t05039450550 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1310+ let amountEstimated = $t05039450550._1
1311+ let commonState = $t05039450550._2
1312+ let feeAmount = $t05039450550._3
1313+ let bonus = $t05039450550._4
1314+ let outInAmountAsset = $t05039450550._5
13101315 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13111316 }
13121317
13131318
13141319
13151320 @Callable(i)
13161321 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13171322 let isPoolOneTokenOperationsDisabled = {
13181323 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13191324 if ($isInstanceOf(@, "Boolean"))
13201325 then @
13211326 else throw(($getType(@) + " couldn't be cast to Boolean"))
13221327 }
13231328 let isGetDisabled = if (if (isGlobalShutdown())
13241329 then true
13251330 else (cfgPoolStatus == PoolShutdown))
13261331 then true
13271332 else isPoolOneTokenOperationsDisabled
13281333 let checks = [if (if (!(isGetDisabled))
13291334 then true
13301335 else isManager(i))
13311336 then true
13321337 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13331338 then true
13341339 else throwErr("no payments are expected")]
13351340 if ((checks == checks))
13361341 then {
13371342 let outAssetId = parseAssetId(outAssetIdStr)
13381343 let userAddress = i.caller
13391344 let txId = i.transactionId
13401345 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13411346 if ((currentKLp == currentKLp))
13421347 then {
13431348 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13441349 if ((unstakeInv == unstakeInv))
13451350 then {
1346- let $t05129451445 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1347- if (($t05129451445 == $t05129451445))
1351+ let $t05145551606 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1352+ if (($t05145551606 == $t05145551606))
13481353 then {
1349- let outInAmountAsset = $t05129451445._5
1350- let bonus = $t05129451445._4
1351- let feeAmount = $t05129451445._3
1352- let commonState = $t05129451445._2
1353- let amountEstimated = $t05129451445._1
1354+ let outInAmountAsset = $t05145551606._5
1355+ let bonus = $t05145551606._4
1356+ let feeAmount = $t05145551606._3
1357+ let commonState = $t05145551606._2
1358+ let amountEstimated = $t05145551606._1
13541359 let amount = if (if ((minOutAmount > 0))
13551360 then (minOutAmount > amountEstimated)
13561361 else false)
13571362 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13581363 else amountEstimated
13591364 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13601365 if ((burnInv == burnInv))
13611366 then {
13621367 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
13631368 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13641369 let sendFee = if ((feeAmount > 0))
13651370 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13661371 else nil
1367- let $t05201152258 = {
1372+ let $t05217252419 = {
13681373 let feeAmountForCalc = if ((this == feeCollectorAddress))
13691374 then 0
13701375 else feeAmount
13711376 if (outInAmountAsset)
13721377 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13731378 else $Tuple2(0, -((amount + feeAmountForCalc)))
13741379 }
1375- let amountAssetBalanceDelta = $t05201152258._1
1376- let priceAssetBalanceDelta = $t05201152258._2
1377- let $t05226152369 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1378- let refreshKLpActions = $t05226152369._1
1379- let updatedKLp = $t05226152369._2
1380+ let amountAssetBalanceDelta = $t05217252419._1
1381+ let priceAssetBalanceDelta = $t05217252419._2
1382+ let $t05242252530 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1383+ let refreshKLpActions = $t05242252530._1
1384+ let updatedKLp = $t05242252530._2
13801385 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13811386 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13821387 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13831388 else throw("Strict value is not equal to itself.")
13841389 }
13851390 else throw("Strict value is not equal to itself.")
13861391 }
13871392 else throw("Strict value is not equal to itself.")
13881393 }
13891394 else throw("Strict value is not equal to itself.")
13901395 }
13911396 else throw("Strict value is not equal to itself.")
13921397 }
13931398 else throw("Strict value is not equal to itself.")
13941399 }
13951400
13961401
13971402
13981403 @Callable(i)
13991404 func get () = {
14001405 let res = commonGet(i)
1401- let outAmtAmt = res._1
1406+ let outAmAmt = res._1
14021407 let outPrAmt = res._2
14031408 let pmtAmt = res._3
14041409 let pmtAssetId = res._4
14051410 let state = res._5
1411+ let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14061412 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14071413 if ((currentKLp == currentKLp))
14081414 then {
14091415 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14101416 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14111417 then {
1412- let $t05333653418 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1413- let refreshKLpActions = $t05333653418._1
1414- let updatedKLp = $t05333653418._2
1418+ let $t05362553706 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1419+ let refreshKLpActions = $t05362553706._1
1420+ let updatedKLp = $t05362553706._2
14151421 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14161422 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1417- then (state ++ refreshKLpActions)
1423+ then ((withdrawState ++ state) ++ refreshKLpActions)
14181424 else throw("Strict value is not equal to itself.")
14191425 }
14201426 else throw("Strict value is not equal to itself.")
14211427 }
14221428 else throw("Strict value is not equal to itself.")
14231429 }
14241430
14251431
14261432
14271433 @Callable(i)
14281434 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14291435 let res = commonGet(i)
14301436 let outAmAmt = res._1
14311437 let outPrAmt = res._2
14321438 let pmtAmt = res._3
14331439 let pmtAssetId = res._4
14341440 let state = res._5
14351441 if ((noLessThenAmtAsset > outAmAmt))
14361442 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14371443 else if ((noLessThenPriceAsset > outPrAmt))
14381444 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14391445 else {
1446+ let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14401447 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14411448 if ((currentKLp == currentKLp))
14421449 then {
14431450 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14441451 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14451452 then {
1446- let $t05436754448 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1447- let refreshKLpActions = $t05436754448._1
1448- let updatedKLp = $t05436754448._2
1453+ let $t05480154882 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1454+ let refreshKLpActions = $t05480154882._1
1455+ let updatedKLp = $t05480154882._2
14491456 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14501457 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1451- then (state ++ refreshKLpActions)
1458+ then ((withdrawState ++ state) ++ refreshKLpActions)
14521459 else throw("Strict value is not equal to itself.")
14531460 }
14541461 else throw("Strict value is not equal to itself.")
14551462 }
14561463 else throw("Strict value is not equal to itself.")
14571464 }
14581465 }
14591466
14601467
14611468
14621469 @Callable(i)
14631470 func unstakeAndGet (amount) = {
14641471 let checkPayments = if ((size(i.payments) != 0))
14651472 then throw("No payments are expected")
14661473 else true
14671474 if ((checkPayments == checkPayments))
14681475 then {
14691476 let cfg = getPoolConfig()
14701477 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14711478 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14721479 if ((currentKLp == currentKLp))
14731480 then {
14741481 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14751482 if ((unstakeInv == unstakeInv))
14761483 then {
14771484 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14781485 let outAmAmt = res._1
14791486 let outPrAmt = res._2
14801487 let poolStatus = parseIntValue(res._9)
14811488 let state = res._10
1489+ let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14821490 let checkPoolStatus = if (if (isGlobalShutdown())
14831491 then true
14841492 else (poolStatus == PoolShutdown))
14851493 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14861494 else true
14871495 if ((checkPoolStatus == checkPoolStatus))
14881496 then {
14891497 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14901498 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14911499 then {
1492- let $t05557455655 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1493- let refreshKLpActions = $t05557455655._1
1494- let updatedKLp = $t05557455655._2
1500+ let $t05615456235 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1501+ let refreshKLpActions = $t05615456235._1
1502+ let updatedKLp = $t05615456235._2
14951503 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14961504 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1497- then (state ++ refreshKLpActions)
1505+ then ((withdrawState ++ state) ++ refreshKLpActions)
14981506 else throw("Strict value is not equal to itself.")
14991507 }
15001508 else throw("Strict value is not equal to itself.")
15011509 }
15021510 else throw("Strict value is not equal to itself.")
15031511 }
15041512 else throw("Strict value is not equal to itself.")
15051513 }
15061514 else throw("Strict value is not equal to itself.")
15071515 }
15081516 else throw("Strict value is not equal to itself.")
15091517 }
15101518
15111519
15121520
15131521 @Callable(i)
15141522 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15151523 let isGetDisabled = if (isGlobalShutdown())
15161524 then true
15171525 else (cfgPoolStatus == PoolShutdown)
15181526 let checks = [if (!(isGetDisabled))
15191527 then true
15201528 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15211529 then true
15221530 else throw("no payments are expected")]
15231531 if ((checks == checks))
15241532 then {
15251533 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15261534 if ((currentKLp == currentKLp))
15271535 then {
15281536 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15291537 if ((unstakeInv == unstakeInv))
15301538 then {
15311539 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15321540 let outAmAmt = res._1
15331541 let outPrAmt = res._2
15341542 let state = res._10
1543+ let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15351544 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15361545 then true
15371546 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15381547 then true
15391548 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15401549 if ((checkAmounts == checkAmounts))
15411550 then {
15421551 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15431552 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15441553 then {
1545- let $t05695057031 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1546- let refreshKLpActions = $t05695057031._1
1547- let updatedKLp = $t05695057031._2
1554+ let $t05767657757 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1555+ let refreshKLpActions = $t05767657757._1
1556+ let updatedKLp = $t05767657757._2
15481557 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15491558 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1550- then (state ++ refreshKLpActions)
1559+ then ((withdrawState ++ state) ++ refreshKLpActions)
15511560 else throw("Strict value is not equal to itself.")
15521561 }
15531562 else throw("Strict value is not equal to itself.")
15541563 }
15551564 else throw("Strict value is not equal to itself.")
15561565 }
15571566 else throw("Strict value is not equal to itself.")
15581567 }
15591568 else throw("Strict value is not equal to itself.")
15601569 }
15611570 else throw("Strict value is not equal to itself.")
15621571 }
15631572
15641573
15651574
15661575 @Callable(i)
15671576 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15681577 then throw("permissions denied")
15691578 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15701579
15711580
15721581
15731582 @Callable(i)
15741583 func refreshKLp () = {
15751584 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15761585 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15771586 then unit
15781587 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15791588 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15801589 then {
15811590 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1582- let $t05821858282 = refreshKLpInternal(0, 0, 0)
1583- let kLpUpdateActions = $t05821858282._1
1584- let updatedKLp = $t05821858282._2
1591+ let $t05896159025 = refreshKLpInternal(0, 0, 0)
1592+ let kLpUpdateActions = $t05896159025._1
1593+ let updatedKLp = $t05896159025._2
15851594 let actions = if ((kLp != updatedKLp))
15861595 then kLpUpdateActions
15871596 else throwErr("nothing to refresh")
15881597 $Tuple2(actions, toString(updatedKLp))
15891598 }
15901599 else throw("Strict value is not equal to itself.")
15911600 }
15921601
15931602
15941603
15951604 @Callable(i)
15961605 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
15971606
15981607
15991608
16001609 @Callable(i)
16011610 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16021611
16031612
16041613
16051614 @Callable(i)
16061615 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16071616 let prices = calcPrices(amAmt, prAmt, lpAmt)
16081617 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16091618 }
16101619
16111620
16121621
16131622 @Callable(i)
16141623 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16151624
16161625
16171626
16181627 @Callable(i)
16191628 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16201629
16211630
16221631
16231632 @Callable(i)
16241633 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16251634
16261635
16271636
16281637 @Callable(i)
16291638 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16301639
16311640
16321641
16331642 @Callable(i)
16341643 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16351644 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16361645 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16371646 }
16381647
16391648
16401649
16411650 @Callable(i)
16421651 func statsREADONLY () = {
16431652 let cfg = getPoolConfig()
16441653 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16451654 let amtAssetId = cfg[idxAmtAssetId]
16461655 let priceAssetId = cfg[idxPriceAssetId]
16471656 let iAmtAssetId = cfg[idxIAmtAssetId]
16481657 let iPriceAssetId = cfg[idxIPriceAssetId]
16491658 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16501659 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16511660 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16521661 let accAmtAssetBalance = getAccBalance(amtAssetId)
16531662 let accPriceAssetBalance = getAccBalance(priceAssetId)
16541663 let pricesList = if ((poolLPBalance == 0))
16551664 then [zeroBigInt, zeroBigInt, zeroBigInt]
16561665 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16571666 let curPrice = 0
16581667 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16591668 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16601669 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16611670 $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))
16621671 }
16631672
16641673
16651674
16661675 @Callable(i)
16671676 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16681677 let cfg = getPoolConfig()
16691678 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16701679 let amAssetIdStr = cfg[idxAmtAssetId]
16711680 let amAssetId = fromBase58String(amAssetIdStr)
16721681 let prAssetIdStr = cfg[idxPriceAssetId]
16731682 let prAssetId = fromBase58String(prAssetIdStr)
16741683 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16751684 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16761685 let poolStatus = cfg[idxPoolStatus]
16771686 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16781687 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16791688 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16801689 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16811690 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16821691 let curPriceX18 = if ((poolLPBalance == 0))
16831692 then zeroBigInt
16841693 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16851694 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16861695 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16871696 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16881697 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16891698 let calcLpAmt = estPut._1
16901699 let curPriceCalc = estPut._3
16911700 let amBalance = estPut._4
16921701 let prBalance = estPut._5
16931702 let lpEmission = estPut._6
16941703 $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))
16951704 }
16961705
16971706
16981707
16991708 @Callable(i)
17001709 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17011710 let cfg = getPoolConfig()
17021711 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17031712 let amAssetIdStr = cfg[idxAmtAssetId]
17041713 let amAssetId = fromBase58String(amAssetIdStr)
17051714 let prAssetIdStr = cfg[idxPriceAssetId]
17061715 let prAssetId = fromBase58String(prAssetIdStr)
17071716 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17081717 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17091718 let poolStatus = cfg[idxPoolStatus]
17101719 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17111720 let amBalanceRaw = getAccBalance(amAssetIdStr)
17121721 let prBalanceRaw = getAccBalance(prAssetIdStr)
17131722 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17141723 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17151724 let curPriceX18 = if ((poolLPBalance == 0))
17161725 then zeroBigInt
17171726 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17181727 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17191728 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17201729 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17211730 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17221731 let calcLpAmt = estPut._1
17231732 let curPriceCalc = estPut._3
17241733 let amBalance = estPut._4
17251734 let prBalance = estPut._5
17261735 let lpEmission = estPut._6
17271736 $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))
17281737 }
17291738
17301739
17311740
17321741 @Callable(i)
17331742 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17341743 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17351744 let outAmAmt = res._1
17361745 let outPrAmt = res._2
17371746 let amBalance = res._5
17381747 let prBalance = res._6
17391748 let lpEmission = res._7
17401749 let curPrice = res._8
17411750 let poolStatus = parseIntValue(res._9)
17421751 $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))
17431752 }
17441753
17451754
17461755 @Verifier(tx)
17471756 func verify () = {
17481757 let targetPublicKey = match managerPublicKeyOrUnit() {
17491758 case pk: ByteVector =>
17501759 pk
17511760 case _: Unit =>
17521761 tx.senderPublicKey
17531762 case _ =>
17541763 throw("Match error")
17551764 }
17561765 match tx {
17571766 case order: Order =>
17581767 let matcherPub = getMatcherPubOrFail()
1759- let $t06694467013 = validateMatcherOrderAllowed(order)
1760- let orderValid = $t06694467013._1
1761- let orderValidInfo = $t06694467013._2
1768+ let $t06768767756 = validateMatcherOrderAllowed(order)
1769+ let orderValid = $t06768767756._1
1770+ let orderValidInfo = $t06768767756._2
17621771 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17631772 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17641773 if (if (if (orderValid)
17651774 then senderValid
17661775 else false)
17671776 then matcherValid
17681777 else false)
17691778 then true
17701779 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17711780 case s: SetScriptTransaction =>
17721781 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17731782 then true
17741783 else {
17751784 let newHash = blake2b256(value(s.script))
17761785 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17771786 let currentHash = scriptHash(this)
17781787 if ((allowedHash == newHash))
17791788 then (currentHash != newHash)
17801789 else false
17811790 }
17821791 case _ =>
17831792 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17841793 }
17851794 }
17861795

github/deemru/w8io/026f985 
233.46 ms