tx · 8abw8MN1mzBZBDspc1uPq3nSKvVUTo3mbk1CX28bhkL3

3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh:  -0.04200000 Waves

2023.04.06 11:01 [2522423] smart account 3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh > SELF 0.00000000 Waves

{ "type": 13, "id": "8abw8MN1mzBZBDspc1uPq3nSKvVUTo3mbk1CX28bhkL3", "fee": 4200000, "feeAssetId": null, "timestamp": 1680768098991, "version": 2, "chainId": 84, "sender": "3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh", "senderPublicKey": "Cr8D7eozSzJh7XHsYTjBinPpo3SS83BrCGiBAJsjGxBo", "proofs": [ "2DXmBfWaNmPK5nS6NXSRja7wXKXvBEFWsdfnEtj8izPCdPdJWM1mLgoSFXDVC4Hv7iXpNKs6swE3xn9SZfRbdqJq" ], "script": "base64:BgKQNwgCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdE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AmlvBQJpbQcJAPQDAwgFAmloCWJvZHlCeXRlcwkAkQMCCAUCaWgGcHJvb2ZzAAAFAmlqM22mKQ==", "height": 2522423, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8zoQe5RB7mf8NrwrUV3G4N1vXt37cwqYCdTBW8dpJGrL Next: Dnav4vhgNucxxQvM1ZHuENuVwwjtFvdAkUwXu9NXmckh Diff:
OldNewDifferences
502502 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
503503 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
504504 let AmAmtWithdrawState = withdrawAndRebalanceAsset(amAssetId, outAmAmt)
505- if ((AmAmtWithdrawState == AmAmtWithdrawState))
506- then {
507- let PrAmtWithdrawState = withdrawAndRebalanceAsset(prAssetId, outPrAmt)
508- if ((PrAmtWithdrawState == PrAmtWithdrawState))
509- then {
510- let state = if ((txId58 == ""))
511- then nil
512- else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
513- then unit
514- else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
515- then unit
516- 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- $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
518- }
519- else throw("Strict value is not equal to itself.")
520- }
521- else throw("Strict value is not equal to itself.")
505+ let PrAmtWithdrawState = withdrawAndRebalanceAsset(prAssetId, outPrAmt)
506+ let state = if ((txId58 == ""))
507+ then nil
508+ else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
509+ then unit
510+ else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
511+ 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)])
513+ $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
522514 }
523515 }
524516
639631 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
640632 let amountAssetAmount = order.amount
641633 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
642- let $t02815328365 = if ((order.orderType == Buy))
634+ let $t02814728359 = if ((order.orderType == Buy))
643635 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
644636 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
645- let amountAssetBalanceDelta = $t02815328365._1
646- let priceAssetBalanceDelta = $t02815328365._2
637+ let amountAssetBalanceDelta = $t02814728359._1
638+ let priceAssetBalanceDelta = $t02814728359._2
647639 if (if (if (isGlobalShutdown())
648640 then true
649641 else (cfgPoolStatus == PoolMatcherDisabled))
656648 then throw("Wrong order assets.")
657649 else {
658650 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
659- let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
660- let unusedActions = $t02880528905._1
661- let kLpNew = $t02880528905._2
651+ let $t02879928899 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
652+ let unusedActions = $t02879928899._1
653+ let kLpNew = $t02879928899._2
662654 let isOrderValid = (kLpNew >= kLp)
663655 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
664656 $Tuple2(isOrderValid, info)
737729 else if ((paymentAssetId == cfgPriceAssetId))
738730 then false
739731 else throwErr("invalid asset")
740- let $t03201832311 = if (isEval)
732+ let $t03201232305 = if (isEval)
741733 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
742734 else if (paymentInAmountAsset)
743735 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
744736 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
745- let amountBalanceOld = $t03201832311._1
746- let priceBalanceOld = $t03201832311._2
747- let $t03231532464 = if (paymentInAmountAsset)
737+ let amountBalanceOld = $t03201232305._1
738+ let priceBalanceOld = $t03201232305._2
739+ let $t03230932458 = if (paymentInAmountAsset)
748740 then $Tuple2(paymentAmountRaw, 0)
749741 else $Tuple2(0, paymentAmountRaw)
750- let amountAssetAmountRaw = $t03231532464._1
751- let priceAssetAmountRaw = $t03231532464._2
742+ let amountAssetAmountRaw = $t03230932458._1
743+ let priceAssetAmountRaw = $t03230932458._2
752744 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
753745 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
754- let $t03259632660 = takeFee(paymentAmountRaw, inFee)
755- let paymentAmount = $t03259632660._1
756- let feeAmount = $t03259632660._2
746+ let $t03259032654 = takeFee(paymentAmountRaw, inFee)
747+ let paymentAmount = $t03259032654._1
748+ let feeAmount = $t03259032654._2
757749 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
758750 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
759751 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
776768 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
777769 let priceOld = fromX18(priceOldX18, scale8)
778770 let loss = {
779- let $t03434134508 = if (paymentInAmountAsset)
771+ let $t03433534502 = if (paymentInAmountAsset)
780772 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
781773 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
782- let amount = $t03434134508._1
783- let balance = $t03434134508._2
774+ let amount = $t03433534502._1
775+ let balance = $t03433534502._2
784776 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
785777 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
786778 }
820812 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
821813 let redeemedBigInt = toBigInt(paymentAmount)
822814 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
823- let $t03658636642 = takeFee(amountRaw, outFee)
824- let totalAmount = $t03658636642._1
825- let feeAmount = $t03658636642._2
826- let $t03664636872 = if (outInAmountAsset)
815+ let $t03658036636 = takeFee(amountRaw, outFee)
816+ let totalAmount = $t03658036636._1
817+ let feeAmount = $t03658036636._2
818+ let $t03664036866 = if (outInAmountAsset)
827819 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
828820 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
829- let outAmAmount = $t03664636872._1
830- let outPrAmount = $t03664636872._2
831- let amBalanceNew = $t03664636872._3
832- let prBalanceNew = $t03664636872._4
821+ let outAmAmount = $t03664036866._1
822+ let outPrAmount = $t03664036866._2
823+ let amBalanceNew = $t03664036866._3
824+ let prBalanceNew = $t03664036866._4
833825 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
834826 let priceNew = fromX18(priceNewX18, scale8)
835827 let commonState = if (isEval)
901893
902894 @Callable(i)
903895 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
904- let $t03875839063 = if ((isReverse == false))
896+ let $t03875239057 = if ((isReverse == false))
905897 then {
906898 let assetOut = getStringOrFail(this, pa())
907899 let assetIn = getStringOrFail(this, aa())
912904 let assetIn = getStringOrFail(this, pa())
913905 $Tuple2(assetOut, assetIn)
914906 }
915- let assetOut = $t03875839063._1
916- let assetIn = $t03875839063._2
907+ let assetOut = $t03875239057._1
908+ let assetIn = $t03875239057._2
917909 let poolAssetInBalance = getAccBalance(assetIn)
918910 let poolAssetOutBalance = getAccBalance(assetOut)
919911 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10641056 else throw("Strict value is not equal to itself.")
10651057 }
10661058 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1067- let $t04410944571 = refreshKLpInternal(0, 0, 0)
1068- if (($t04410944571 == $t04410944571))
1059+ let $t04410344565 = refreshKLpInternal(0, 0, 0)
1060+ if (($t04410344565 == $t04410344565))
10691061 then {
1070- let updatedKLp = $t04410944571._2
1071- let refreshKLpActions = $t04410944571._1
1062+ let updatedKLp = $t04410344565._2
1063+ let refreshKLpActions = $t04410344565._1
10721064 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10731065 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10741066 then {
11051097 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11061098 if ((currentKLp == currentKLp))
11071099 then {
1108- let $t04518345248 = refreshKLpInternal(0, 0, 0)
1109- let refreshKLpActions = $t04518345248._1
1110- let updatedKLp = $t04518345248._2
1100+ let $t04517745242 = refreshKLpInternal(0, 0, 0)
1101+ let refreshKLpActions = $t04517745242._1
1102+ let updatedKLp = $t04517745242._2
11111103 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11121104 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11131105 then (state ++ refreshKLpActions)
11541146 then {
11551147 let userAddress = i.caller
11561148 let txId = i.transactionId
1157- let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1158- if (($t04643646588 == $t04643646588))
1149+ let $t04643046582 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1150+ if (($t04643046582 == $t04643046582))
11591151 then {
1160- let paymentInAmountAsset = $t04643646588._5
1161- let bonus = $t04643646588._4
1162- let feeAmount = $t04643646588._3
1163- let commonState = $t04643646588._2
1164- let emitAmountEstimated = $t04643646588._1
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
11651157 let emitAmount = if (if ((minOutAmount > 0))
11661158 then (minOutAmount > emitAmountEstimated)
11671159 else false)
11811173 let sendFee = if ((feeAmount > 0))
11821174 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11831175 else nil
1184- let $t04717447371 = if ((this == feeCollectorAddress))
1176+ let $t04716847365 = if ((this == feeCollectorAddress))
11851177 then $Tuple2(0, 0)
11861178 else if (paymentInAmountAsset)
11871179 then $Tuple2(-(feeAmount), 0)
11881180 else $Tuple2(0, -(feeAmount))
1189- let amountAssetBalanceDelta = $t04717447371._1
1190- let priceAssetBalanceDelta = $t04717447371._2
1191- let $t04737447482 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1192- let refreshKLpActions = $t04737447482._1
1193- let updatedKLp = $t04737447482._2
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
11941186 let kLp = value(getString(keyKLp))
11951187 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11961188 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12151207
12161208 @Callable(i)
12171209 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1218- let $t04783747994 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1219- let emitAmountEstimated = $t04783747994._1
1220- let commonState = $t04783747994._2
1221- let feeAmount = $t04783747994._3
1222- let bonus = $t04783747994._4
1223- let paymentInAmountAsset = $t04783747994._5
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
12241216 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12251217 }
12261218
12571249 then {
12581250 let userAddress = i.caller
12591251 let txId = i.transactionId
1260- let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1261- if (($t04887949032 == $t04887949032))
1252+ let $t04887349026 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1253+ if (($t04887349026 == $t04887349026))
12621254 then {
1263- let outInAmountAsset = $t04887949032._5
1264- let bonus = $t04887949032._4
1265- let feeAmount = $t04887949032._3
1266- let commonState = $t04887949032._2
1267- let amountEstimated = $t04887949032._1
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
12681260 let amount = if (if ((minOutAmount > 0))
12691261 then (minOutAmount > amountEstimated)
12701262 else false)
12741266 if ((burnInv == burnInv))
12751267 then {
12761268 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
1277- if ((withdrawState == withdrawState))
1278- then {
1279- let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
1280- let sendFee = if ((feeAmount > 0))
1281- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1282- else nil
1283- let $t04960649853 = {
1284- let feeAmountForCalc = if ((this == feeCollectorAddress))
1285- then 0
1286- else feeAmount
1287- if (outInAmountAsset)
1288- then $Tuple2(-((amount + feeAmountForCalc)), 0)
1289- else $Tuple2(0, -((amount + feeAmountForCalc)))
1290- }
1291- let amountAssetBalanceDelta = $t04960649853._1
1292- let priceAssetBalanceDelta = $t04960649853._2
1293- let $t04985649964 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1294- let refreshKLpActions = $t04985649964._1
1295- let updatedKLp = $t04985649964._2
1296- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1297- if ((isUpdatedKLpValid == isUpdatedKLpValid))
1298- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1299- else throw("Strict value is not equal to itself.")
1300- }
1269+ let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
1270+ let sendFee = if ((feeAmount > 0))
1271+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1272+ else nil
1273+ let $t04959749844 = {
1274+ let feeAmountForCalc = if ((this == feeCollectorAddress))
1275+ then 0
1276+ else feeAmount
1277+ if (outInAmountAsset)
1278+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
1279+ else $Tuple2(0, -((amount + feeAmountForCalc)))
1280+ }
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 isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1287+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1288+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13011289 else throw("Strict value is not equal to itself.")
13021290 }
13031291 else throw("Strict value is not equal to itself.")
13131301
13141302 @Callable(i)
13151303 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1316- let $t05024250398 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1317- let amountEstimated = $t05024250398._1
1318- let commonState = $t05024250398._2
1319- let feeAmount = $t05024250398._3
1320- let bonus = $t05024250398._4
1321- let outInAmountAsset = $t05024250398._5
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
13221310 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13231311 }
13241312
13551343 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13561344 if ((unstakeInv == unstakeInv))
13571345 then {
1358- let $t05130351454 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1359- if (($t05130351454 == $t05130351454))
1346+ let $t05129451445 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1347+ if (($t05129451445 == $t05129451445))
13601348 then {
1361- let outInAmountAsset = $t05130351454._5
1362- let bonus = $t05130351454._4
1363- let feeAmount = $t05130351454._3
1364- let commonState = $t05130351454._2
1365- let amountEstimated = $t05130351454._1
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
13661354 let amount = if (if ((minOutAmount > 0))
13671355 then (minOutAmount > amountEstimated)
13681356 else false)
13721360 if ((burnInv == burnInv))
13731361 then {
13741362 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
1375- if ((withdrawState == withdrawState))
1376- then {
1377- let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
1378- let sendFee = if ((feeAmount > 0))
1379- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1380- else nil
1381- let $t05202352270 = {
1382- let feeAmountForCalc = if ((this == feeCollectorAddress))
1383- then 0
1384- else feeAmount
1385- if (outInAmountAsset)
1386- then $Tuple2(-((amount + feeAmountForCalc)), 0)
1387- else $Tuple2(0, -((amount + feeAmountForCalc)))
1388- }
1389- let amountAssetBalanceDelta = $t05202352270._1
1390- let priceAssetBalanceDelta = $t05202352270._2
1391- let $t05227352381 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1392- let refreshKLpActions = $t05227352381._1
1393- let updatedKLp = $t05227352381._2
1394- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1395- if ((isUpdatedKLpValid == isUpdatedKLpValid))
1396- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1397- else throw("Strict value is not equal to itself.")
1398- }
1363+ let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
1364+ let sendFee = if ((feeAmount > 0))
1365+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1366+ else nil
1367+ let $t05201152258 = {
1368+ let feeAmountForCalc = if ((this == feeCollectorAddress))
1369+ then 0
1370+ else feeAmount
1371+ if (outInAmountAsset)
1372+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
1373+ else $Tuple2(0, -((amount + feeAmountForCalc)))
1374+ }
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 isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1381+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1382+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13991383 else throw("Strict value is not equal to itself.")
14001384 }
14011385 else throw("Strict value is not equal to itself.")
14251409 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14261410 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14271411 then {
1428- let $t05334853430 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1429- let refreshKLpActions = $t05334853430._1
1430- let updatedKLp = $t05334853430._2
1412+ let $t05333653418 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1413+ let refreshKLpActions = $t05333653418._1
1414+ let updatedKLp = $t05333653418._2
14311415 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14321416 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14331417 then (state ++ refreshKLpActions)
14591443 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14601444 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14611445 then {
1462- let $t05437954460 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1463- let refreshKLpActions = $t05437954460._1
1464- let updatedKLp = $t05437954460._2
1446+ let $t05436754448 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1447+ let refreshKLpActions = $t05436754448._1
1448+ let updatedKLp = $t05436754448._2
14651449 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14661450 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14671451 then (state ++ refreshKLpActions)
15051489 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15061490 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15071491 then {
1508- let $t05558655667 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1509- let refreshKLpActions = $t05558655667._1
1510- let updatedKLp = $t05558655667._2
1492+ let $t05557455655 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1493+ let refreshKLpActions = $t05557455655._1
1494+ let updatedKLp = $t05557455655._2
15111495 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15121496 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15131497 then (state ++ refreshKLpActions)
15581542 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15591543 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15601544 then {
1561- let $t05696257043 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1562- let refreshKLpActions = $t05696257043._1
1563- let updatedKLp = $t05696257043._2
1545+ let $t05695057031 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1546+ let refreshKLpActions = $t05695057031._1
1547+ let updatedKLp = $t05695057031._2
15641548 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15651549 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15661550 then (state ++ refreshKLpActions)
15951579 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15961580 then {
15971581 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1598- let $t05823058294 = refreshKLpInternal(0, 0, 0)
1599- let kLpUpdateActions = $t05823058294._1
1600- let updatedKLp = $t05823058294._2
1582+ let $t05821858282 = refreshKLpInternal(0, 0, 0)
1583+ let kLpUpdateActions = $t05821858282._1
1584+ let updatedKLp = $t05821858282._2
16011585 let actions = if ((kLp != updatedKLp))
16021586 then kLpUpdateActions
16031587 else throwErr("nothing to refresh")
17721756 match tx {
17731757 case order: Order =>
17741758 let matcherPub = getMatcherPubOrFail()
1775- let $t06695667025 = validateMatcherOrderAllowed(order)
1776- let orderValid = $t06695667025._1
1777- let orderValidInfo = $t06695667025._2
1759+ let $t06694467013 = validateMatcherOrderAllowed(order)
1760+ let orderValid = $t06694467013._1
1761+ let orderValidInfo = $t06694467013._2
17781762 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17791763 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17801764 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
453453 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
454454 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
455455 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
456456 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
457457 }
458458
459459
460460 func calcPrices (amAmt,prAmt,lpAmt) = {
461461 let cfg = getPoolConfig()
462462 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
463463 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
464464 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
465465 let amAmtX18 = toX18(amAmt, amtAssetDcm)
466466 let prAmtX18 = toX18(prAmt, priceAssetDcm)
467467 let lpAmtX18 = toX18(lpAmt, scale8)
468468 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
469469 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
470470 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
471471 }
472472
473473
474474 func calculatePrices (amAmt,prAmt,lpAmt) = {
475475 let prices = calcPrices(amAmt, prAmt, lpAmt)
476476 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
477477 }
478478
479479
480480 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
481481 let cfg = getPoolConfig()
482482 let lpAssetId = cfg[idxPoolLPAssetId]
483483 let amAssetId = cfg[idxAmtAssetId]
484484 let prAssetId = cfg[idxPriceAssetId]
485485 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
486486 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
487487 let poolStatus = cfg[idxPoolStatus]
488488 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
489489 if ((lpAssetId != pmtAssetId))
490490 then throw("Invalid asset passed.")
491491 else {
492492 let amBalance = getAccBalance(amAssetId)
493493 let amBalanceX18 = toX18(amBalance, amAssetDcm)
494494 let prBalance = getAccBalance(prAssetId)
495495 let prBalanceX18 = toX18(prBalance, prAssetDcm)
496496 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
497497 let curPrice = fromX18(curPriceX18, scale8)
498498 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
499499 let lpEmissionX18 = toX18(lpEmission, scale8)
500500 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
501501 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
502502 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
503503 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
504504 let AmAmtWithdrawState = withdrawAndRebalanceAsset(amAssetId, outAmAmt)
505- if ((AmAmtWithdrawState == AmAmtWithdrawState))
506- then {
507- let PrAmtWithdrawState = withdrawAndRebalanceAsset(prAssetId, outPrAmt)
508- if ((PrAmtWithdrawState == PrAmtWithdrawState))
509- then {
510- let state = if ((txId58 == ""))
511- then nil
512- else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
513- then unit
514- else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
515- then unit
516- 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- $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
518- }
519- else throw("Strict value is not equal to itself.")
520- }
521- else throw("Strict value is not equal to itself.")
505+ let PrAmtWithdrawState = withdrawAndRebalanceAsset(prAssetId, outPrAmt)
506+ let state = if ((txId58 == ""))
507+ then nil
508+ else ((AmAmtWithdrawState ++ PrAmtWithdrawState) ++ [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
509+ then unit
510+ else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
511+ 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)])
513+ $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
522514 }
523515 }
524516
525517
526518 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
527519 let cfg = getPoolConfig()
528520 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
529521 let amAssetIdStr = cfg[idxAmtAssetId]
530522 let prAssetIdStr = cfg[idxPriceAssetId]
531523 let iAmtAssetId = cfg[idxIAmtAssetId]
532524 let iPriceAssetId = cfg[idxIPriceAssetId]
533525 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
534526 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
535527 let poolStatus = cfg[idxPoolStatus]
536528 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
537529 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
538530 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
539531 if (if ((amAssetIdStr != inAmAssetIdStr))
540532 then true
541533 else (prAssetIdStr != inPrAssetIdStr))
542534 then throw("Invalid amt or price asset passed.")
543535 else {
544536 let amBalance = if (isEvaluate)
545537 then getAccBalance(amAssetIdStr)
546538 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
547539 let prBalance = if (isEvaluate)
548540 then getAccBalance(prAssetIdStr)
549541 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
550542 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
551543 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
552544 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
553545 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
554546 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
555547 let res = if ((lpEmission == 0))
556548 then {
557549 let curPriceX18 = zeroBigInt
558550 let slippageX18 = zeroBigInt
559551 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
560552 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
561553 }
562554 else {
563555 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
564556 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
565557 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
566558 if (if ((curPriceX18 != zeroBigInt))
567559 then (slippageX18 > slippageToleranceX18)
568560 else false)
569561 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
570562 else {
571563 let lpEmissionX18 = toX18(lpEmission, scale8)
572564 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
573565 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
574566 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
575567 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
576568 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
577569 let expAmtAssetAmtX18 = expectedAmts._1
578570 let expPriceAssetAmtX18 = expectedAmts._2
579571 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
580572 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
581573 }
582574 }
583575 let calcLpAmt = res._1
584576 let calcAmAssetPmt = res._2
585577 let calcPrAssetPmt = res._3
586578 let curPrice = fromX18(res._4, scale8)
587579 let slippageCalc = fromX18(res._5, scale8)
588580 if ((0 >= calcLpAmt))
589581 then throw("Invalid calculations. LP calculated is less than zero.")
590582 else {
591583 let emitLpAmt = if (!(emitLp))
592584 then 0
593585 else calcLpAmt
594586 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
595587 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
596588 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))]
597589 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
598590 }
599591 }
600592 }
601593
602594
603595 func calcKLp (amountBalance,priceBalance,lpEmission) = {
604596 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
605597 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
606598 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
607599 if ((lpEmission == big0))
608600 then big0
609601 else updatedKLp
610602 }
611603
612604
613605 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
614606 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
615607 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
616608 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
617609 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
618610 currentKLp
619611 }
620612
621613
622614 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
623615 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
624616 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
625617 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
626618 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
627619 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
628620 $Tuple2(actions, updatedKLp)
629621 }
630622
631623
632624 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
633625 then true
634626 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
635627
636628
637629 func validateMatcherOrderAllowed (order) = {
638630 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
639631 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
640632 let amountAssetAmount = order.amount
641633 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
642- let $t02815328365 = if ((order.orderType == Buy))
634+ let $t02814728359 = if ((order.orderType == Buy))
643635 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
644636 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
645- let amountAssetBalanceDelta = $t02815328365._1
646- let priceAssetBalanceDelta = $t02815328365._2
637+ let amountAssetBalanceDelta = $t02814728359._1
638+ let priceAssetBalanceDelta = $t02814728359._2
647639 if (if (if (isGlobalShutdown())
648640 then true
649641 else (cfgPoolStatus == PoolMatcherDisabled))
650642 then true
651643 else (cfgPoolStatus == PoolShutdown))
652644 then throw("Exchange operations disabled")
653645 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
654646 then true
655647 else (order.assetPair.priceAsset != cfgPriceAssetId))
656648 then throw("Wrong order assets.")
657649 else {
658650 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
659- let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
660- let unusedActions = $t02880528905._1
661- let kLpNew = $t02880528905._2
651+ let $t02879928899 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
652+ let unusedActions = $t02879928899._1
653+ let kLpNew = $t02879928899._2
662654 let isOrderValid = (kLpNew >= kLp)
663655 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
664656 $Tuple2(isOrderValid, info)
665657 }
666658 }
667659
668660
669661 func commonGet (i) = if ((size(i.payments) != 1))
670662 then throw("exactly 1 payment is expected")
671663 else {
672664 let pmt = value(i.payments[0])
673665 let pmtAssetId = value(pmt.assetId)
674666 let pmtAmt = pmt.amount
675667 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
676668 let outAmAmt = res._1
677669 let outPrAmt = res._2
678670 let poolStatus = parseIntValue(res._9)
679671 let state = res._10
680672 if (if (isGlobalShutdown())
681673 then true
682674 else (poolStatus == PoolShutdown))
683675 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
684676 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
685677 }
686678
687679
688680 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
689681 then throw("exactly 2 payments are expected")
690682 else {
691683 let amAssetPmt = value(i.payments[0])
692684 let prAssetPmt = value(i.payments[1])
693685 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
694686 let poolStatus = parseIntValue(estPut._8)
695687 if (if (if (isGlobalShutdown())
696688 then true
697689 else (poolStatus == PoolPutDisabled))
698690 then true
699691 else (poolStatus == PoolShutdown))
700692 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
701693 else estPut
702694 }
703695
704696
705697 func emit (amount) = {
706698 let emitInv = invoke(factoryContract, "emit", [amount], nil)
707699 if ((emitInv == emitInv))
708700 then {
709701 let emitInvLegacy = match emitInv {
710702 case legacyFactoryContract: Address =>
711703 invoke(legacyFactoryContract, "emit", [amount], nil)
712704 case _ =>
713705 unit
714706 }
715707 if ((emitInvLegacy == emitInvLegacy))
716708 then amount
717709 else throw("Strict value is not equal to itself.")
718710 }
719711 else throw("Strict value is not equal to itself.")
720712 }
721713
722714
723715 func takeFee (amount,fee) = {
724716 let feeAmount = if ((fee == 0))
725717 then 0
726718 else fraction(amount, fee, scale8)
727719 $Tuple2((amount - feeAmount), feeAmount)
728720 }
729721
730722
731723 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
732724 let isEval = (txId == unit)
733725 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
734726 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
735727 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
736728 then true
737729 else if ((paymentAssetId == cfgPriceAssetId))
738730 then false
739731 else throwErr("invalid asset")
740- let $t03201832311 = if (isEval)
732+ let $t03201232305 = if (isEval)
741733 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
742734 else if (paymentInAmountAsset)
743735 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
744736 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
745- let amountBalanceOld = $t03201832311._1
746- let priceBalanceOld = $t03201832311._2
747- let $t03231532464 = if (paymentInAmountAsset)
737+ let amountBalanceOld = $t03201232305._1
738+ let priceBalanceOld = $t03201232305._2
739+ let $t03230932458 = if (paymentInAmountAsset)
748740 then $Tuple2(paymentAmountRaw, 0)
749741 else $Tuple2(0, paymentAmountRaw)
750- let amountAssetAmountRaw = $t03231532464._1
751- let priceAssetAmountRaw = $t03231532464._2
742+ let amountAssetAmountRaw = $t03230932458._1
743+ let priceAssetAmountRaw = $t03230932458._2
752744 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
753745 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
754- let $t03259632660 = takeFee(paymentAmountRaw, inFee)
755- let paymentAmount = $t03259632660._1
756- let feeAmount = $t03259632660._2
746+ let $t03259032654 = takeFee(paymentAmountRaw, inFee)
747+ let paymentAmount = $t03259032654._1
748+ let feeAmount = $t03259032654._2
757749 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
758750 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
759751 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
760752 let priceNew = fromX18(priceNewX18, scale8)
761753 let paymentBalance = if (paymentInAmountAsset)
762754 then amountBalanceOld
763755 else priceBalanceOld
764756 let paymentBalanceBigInt = toBigInt(paymentBalance)
765757 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
766758 let chechSupply = if ((supplyBigInt > big0))
767759 then true
768760 else throwErr("initial deposit requires all coins")
769761 if ((chechSupply == chechSupply))
770762 then {
771763 let depositBigInt = toBigInt(paymentAmount)
772764 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
773765 let commonState = if (isEval)
774766 then nil
775767 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))]
776768 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
777769 let priceOld = fromX18(priceOldX18, scale8)
778770 let loss = {
779- let $t03434134508 = if (paymentInAmountAsset)
771+ let $t03433534502 = if (paymentInAmountAsset)
780772 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
781773 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
782- let amount = $t03434134508._1
783- let balance = $t03434134508._2
774+ let amount = $t03433534502._1
775+ let balance = $t03433534502._2
784776 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
785777 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
786778 }
787779 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
788780 }
789781 else throw("Strict value is not equal to itself.")
790782 }
791783
792784
793785 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
794786 let isEval = (txId == unit)
795787 let cfg = getPoolConfig()
796788 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
797789 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
798790 let checks = [if ((paymentAssetId == cfgLpAssetId))
799791 then true
800792 else throwErr("invalid lp asset")]
801793 if ((checks == checks))
802794 then {
803795 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
804796 then true
805797 else if ((outAssetId == cfgPriceAssetId))
806798 then false
807799 else throwErr("invalid asset")
808800 let balanceBigInt = if (outInAmountAsset)
809801 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
810802 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
811803 let outInAmountAssetDecimals = if (outInAmountAsset)
812804 then amtAssetDcm
813805 else priceAssetDcm
814806 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
815807 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
816808 let outBalance = if (outInAmountAsset)
817809 then amBalanceOld
818810 else prBalanceOld
819811 let outBalanceBigInt = toBigInt(outBalance)
820812 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
821813 let redeemedBigInt = toBigInt(paymentAmount)
822814 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
823- let $t03658636642 = takeFee(amountRaw, outFee)
824- let totalAmount = $t03658636642._1
825- let feeAmount = $t03658636642._2
826- let $t03664636872 = if (outInAmountAsset)
815+ let $t03658036636 = takeFee(amountRaw, outFee)
816+ let totalAmount = $t03658036636._1
817+ let feeAmount = $t03658036636._2
818+ let $t03664036866 = if (outInAmountAsset)
827819 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
828820 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
829- let outAmAmount = $t03664636872._1
830- let outPrAmount = $t03664636872._2
831- let amBalanceNew = $t03664636872._3
832- let prBalanceNew = $t03664636872._4
821+ let outAmAmount = $t03664036866._1
822+ let outPrAmount = $t03664036866._2
823+ let amBalanceNew = $t03664036866._3
824+ let prBalanceNew = $t03664036866._4
833825 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
834826 let priceNew = fromX18(priceNewX18, scale8)
835827 let commonState = if (isEval)
836828 then nil
837829 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)]
838830 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
839831 let priceOld = fromX18(priceOldX18, scale8)
840832 let loss = {
841833 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
842834 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
843835 }
844836 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
845837 }
846838 else throw("Strict value is not equal to itself.")
847839 }
848840
849841
850842 func managerPublicKeyOrUnit () = match getString(mpk()) {
851843 case s: String =>
852844 fromBase58String(s)
853845 case _: Unit =>
854846 unit
855847 case _ =>
856848 throw("Match error")
857849 }
858850
859851
860852 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
861853 case s: String =>
862854 fromBase58String(s)
863855 case _: Unit =>
864856 unit
865857 case _ =>
866858 throw("Match error")
867859 }
868860
869861
870862 func isManager (i) = match managerPublicKeyOrUnit() {
871863 case pk: ByteVector =>
872864 (i.callerPublicKey == pk)
873865 case _: Unit =>
874866 (i.caller == this)
875867 case _ =>
876868 throw("Match error")
877869 }
878870
879871
880872 func mustManager (i) = {
881873 let pd = throw("Permission denied")
882874 match managerPublicKeyOrUnit() {
883875 case pk: ByteVector =>
884876 if ((i.callerPublicKey == pk))
885877 then true
886878 else pd
887879 case _: Unit =>
888880 if ((i.caller == this))
889881 then true
890882 else pd
891883 case _ =>
892884 throw("Match error")
893885 }
894886 }
895887
896888
897889 @Callable(i)
898890 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
899891
900892
901893
902894 @Callable(i)
903895 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
904- let $t03875839063 = if ((isReverse == false))
896+ let $t03875239057 = if ((isReverse == false))
905897 then {
906898 let assetOut = getStringOrFail(this, pa())
907899 let assetIn = getStringOrFail(this, aa())
908900 $Tuple2(assetOut, assetIn)
909901 }
910902 else {
911903 let assetOut = getStringOrFail(this, aa())
912904 let assetIn = getStringOrFail(this, pa())
913905 $Tuple2(assetOut, assetIn)
914906 }
915- let assetOut = $t03875839063._1
916- let assetIn = $t03875839063._2
907+ let assetOut = $t03875239057._1
908+ let assetIn = $t03875239057._2
917909 let poolAssetInBalance = getAccBalance(assetIn)
918910 let poolAssetOutBalance = getAccBalance(assetOut)
919911 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
920912 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
921913 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
922914 let checkK = if ((newK >= oldK))
923915 then true
924916 else throw("new K is fewer error")
925917 if ((checkK == checkK))
926918 then $Tuple2(nil, amountOut)
927919 else throw("Strict value is not equal to itself.")
928920 }
929921
930922
931923
932924 @Callable(i)
933925 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
934926 let swapContact = {
935927 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
936928 if ($isInstanceOf(@, "String"))
937929 then @
938930 else throw(($getType(@) + " couldn't be cast to String"))
939931 }
940932 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
941933 then true
942934 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
943935 then true
944936 else throwErr("Permission denied")]
945937 if ((checks == checks))
946938 then {
947939 let pmt = value(i.payments[0])
948940 let assetIn = assetIdToString(pmt.assetId)
949941 let assetOut = if ((isReverse == false))
950942 then getStringOrFail(this, pa())
951943 else getStringOrFail(this, aa())
952944 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
953945 let poolAssetOutBalance = getAccBalance(assetOut)
954946 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
955947 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
956948 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
957949 let checkK = if ((newK >= oldK))
958950 then true
959951 else throw("new K is fewer error")
960952 if ((checkK == checkK))
961953 then {
962954 let checkMin = if ((amountOut >= amountOutMin))
963955 then true
964956 else throw("Exchange result is fewer coins than expected")
965957 if ((checkMin == checkMin))
966958 then {
967959 let rebalanceState = rebalanceAsset(assetIn)
968960 if ((rebalanceState == rebalanceState))
969961 then {
970962 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
971963 if ((withdrawState == withdrawState))
972964 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
973965 else throw("Strict value is not equal to itself.")
974966 }
975967 else throw("Strict value is not equal to itself.")
976968 }
977969 else throw("Strict value is not equal to itself.")
978970 }
979971 else throw("Strict value is not equal to itself.")
980972 }
981973 else throw("Strict value is not equal to itself.")
982974 }
983975
984976
985977
986978 @Callable(i)
987979 func setManager (pendingManagerPublicKey) = {
988980 let checkCaller = mustManager(i)
989981 if ((checkCaller == checkCaller))
990982 then {
991983 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
992984 if ((checkManagerPublicKey == checkManagerPublicKey))
993985 then [StringEntry(pmpk(), pendingManagerPublicKey)]
994986 else throw("Strict value is not equal to itself.")
995987 }
996988 else throw("Strict value is not equal to itself.")
997989 }
998990
999991
1000992
1001993 @Callable(i)
1002994 func confirmManager () = {
1003995 let pm = pendingManagerPublicKeyOrUnit()
1004996 let hasPM = if (isDefined(pm))
1005997 then true
1006998 else throw("No pending manager")
1007999 if ((hasPM == hasPM))
10081000 then {
10091001 let checkPM = if ((i.callerPublicKey == value(pm)))
10101002 then true
10111003 else throw("You are not pending manager")
10121004 if ((checkPM == checkPM))
10131005 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
10141006 else throw("Strict value is not equal to itself.")
10151007 }
10161008 else throw("Strict value is not equal to itself.")
10171009 }
10181010
10191011
10201012
10211013 @Callable(i)
10221014 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10231015 then throw("Invalid slippageTolerance passed")
10241016 else {
10251017 let estPut = commonPut(i, slippageTolerance, true)
10261018 let emitLpAmt = estPut._2
10271019 let lpAssetId = estPut._7
10281020 let state = estPut._9
10291021 let amDiff = estPut._10
10301022 let prDiff = estPut._11
10311023 let amId = estPut._12
10321024 let prId = estPut._13
10331025 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10341026 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10351027 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10361028 if ((currentKLp == currentKLp))
10371029 then {
10381030 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10391031 if ((emitInv == emitInv))
10401032 then {
10411033 let emitInvLegacy = match emitInv {
10421034 case legacyFactoryContract: Address =>
10431035 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10441036 case _ =>
10451037 unit
10461038 }
10471039 if ((emitInvLegacy == emitInvLegacy))
10481040 then {
10491041 let slippageAInv = if ((amDiff > 0))
10501042 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10511043 else nil
10521044 if ((slippageAInv == slippageAInv))
10531045 then {
10541046 let slippagePInv = if ((prDiff > 0))
10551047 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10561048 else nil
10571049 if ((slippagePInv == slippagePInv))
10581050 then {
10591051 let lpTransfer = if (shouldAutoStake)
10601052 then {
10611053 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10621054 if ((slpStakeInv == slpStakeInv))
10631055 then nil
10641056 else throw("Strict value is not equal to itself.")
10651057 }
10661058 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1067- let $t04410944571 = refreshKLpInternal(0, 0, 0)
1068- if (($t04410944571 == $t04410944571))
1059+ let $t04410344565 = refreshKLpInternal(0, 0, 0)
1060+ if (($t04410344565 == $t04410344565))
10691061 then {
1070- let updatedKLp = $t04410944571._2
1071- let refreshKLpActions = $t04410944571._1
1062+ let updatedKLp = $t04410344565._2
1063+ let refreshKLpActions = $t04410344565._1
10721064 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10731065 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10741066 then {
10751067 let reb = invoke(this, "rebalance", nil, nil)
10761068 if ((reb == reb))
10771069 then ((state ++ lpTransfer) ++ refreshKLpActions)
10781070 else throw("Strict value is not equal to itself.")
10791071 }
10801072 else throw("Strict value is not equal to itself.")
10811073 }
10821074 else throw("Strict value is not equal to itself.")
10831075 }
10841076 else throw("Strict value is not equal to itself.")
10851077 }
10861078 else throw("Strict value is not equal to itself.")
10871079 }
10881080 else throw("Strict value is not equal to itself.")
10891081 }
10901082 else throw("Strict value is not equal to itself.")
10911083 }
10921084 else throw("Strict value is not equal to itself.")
10931085 }
10941086
10951087
10961088
10971089 @Callable(i)
10981090 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10991091 then throw("Invalid value passed")
11001092 else {
11011093 let estPut = commonPut(i, maxSlippage, false)
11021094 let state = estPut._9
11031095 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
11041096 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
11051097 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11061098 if ((currentKLp == currentKLp))
11071099 then {
1108- let $t04518345248 = refreshKLpInternal(0, 0, 0)
1109- let refreshKLpActions = $t04518345248._1
1110- let updatedKLp = $t04518345248._2
1100+ let $t04517745242 = refreshKLpInternal(0, 0, 0)
1101+ let refreshKLpActions = $t04517745242._1
1102+ let updatedKLp = $t04517745242._2
11111103 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11121104 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11131105 then (state ++ refreshKLpActions)
11141106 else throw("Strict value is not equal to itself.")
11151107 }
11161108 else throw("Strict value is not equal to itself.")
11171109 }
11181110
11191111
11201112
11211113 @Callable(i)
11221114 func putOneTkn (minOutAmount,autoStake) = {
11231115 let isPoolOneTokenOperationsDisabled = {
11241116 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11251117 if ($isInstanceOf(@, "Boolean"))
11261118 then @
11271119 else throw(($getType(@) + " couldn't be cast to Boolean"))
11281120 }
11291121 let isPutDisabled = if (if (if (isGlobalShutdown())
11301122 then true
11311123 else (cfgPoolStatus == PoolPutDisabled))
11321124 then true
11331125 else (cfgPoolStatus == PoolShutdown))
11341126 then true
11351127 else isPoolOneTokenOperationsDisabled
11361128 let checks = [if (if (!(isPutDisabled))
11371129 then true
11381130 else isManager(i))
11391131 then true
11401132 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11411133 then true
11421134 else throwErr("exactly 1 payment are expected")]
11431135 if ((checks == checks))
11441136 then {
11451137 let payment = i.payments[0]
11461138 let paymentAssetId = payment.assetId
11471139 let paymentAmountRaw = payment.amount
11481140 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11491141 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11501142 else if ((paymentAssetId == cfgPriceAssetId))
11511143 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11521144 else throwErr("payment asset is not supported")
11531145 if ((currentKLp == currentKLp))
11541146 then {
11551147 let userAddress = i.caller
11561148 let txId = i.transactionId
1157- let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1158- if (($t04643646588 == $t04643646588))
1149+ let $t04643046582 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1150+ if (($t04643046582 == $t04643046582))
11591151 then {
1160- let paymentInAmountAsset = $t04643646588._5
1161- let bonus = $t04643646588._4
1162- let feeAmount = $t04643646588._3
1163- let commonState = $t04643646588._2
1164- let emitAmountEstimated = $t04643646588._1
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
11651157 let emitAmount = if (if ((minOutAmount > 0))
11661158 then (minOutAmount > emitAmountEstimated)
11671159 else false)
11681160 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11691161 else emitAmountEstimated
11701162 let emitInv = emit(emitAmount)
11711163 if ((emitInv == emitInv))
11721164 then {
11731165 let lpTransfer = if (autoStake)
11741166 then {
11751167 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11761168 if ((stakeInv == stakeInv))
11771169 then nil
11781170 else throw("Strict value is not equal to itself.")
11791171 }
11801172 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11811173 let sendFee = if ((feeAmount > 0))
11821174 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11831175 else nil
1184- let $t04717447371 = if ((this == feeCollectorAddress))
1176+ let $t04716847365 = if ((this == feeCollectorAddress))
11851177 then $Tuple2(0, 0)
11861178 else if (paymentInAmountAsset)
11871179 then $Tuple2(-(feeAmount), 0)
11881180 else $Tuple2(0, -(feeAmount))
1189- let amountAssetBalanceDelta = $t04717447371._1
1190- let priceAssetBalanceDelta = $t04717447371._2
1191- let $t04737447482 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1192- let refreshKLpActions = $t04737447482._1
1193- let updatedKLp = $t04737447482._2
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
11941186 let kLp = value(getString(keyKLp))
11951187 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11961188 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11971189 then {
11981190 let reb = invoke(this, "rebalance", nil, nil)
11991191 if ((reb == reb))
12001192 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
12011193 else throw("Strict value is not equal to itself.")
12021194 }
12031195 else throw("Strict value is not equal to itself.")
12041196 }
12051197 else throw("Strict value is not equal to itself.")
12061198 }
12071199 else throw("Strict value is not equal to itself.")
12081200 }
12091201 else throw("Strict value is not equal to itself.")
12101202 }
12111203 else throw("Strict value is not equal to itself.")
12121204 }
12131205
12141206
12151207
12161208 @Callable(i)
12171209 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1218- let $t04783747994 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1219- let emitAmountEstimated = $t04783747994._1
1220- let commonState = $t04783747994._2
1221- let feeAmount = $t04783747994._3
1222- let bonus = $t04783747994._4
1223- let paymentInAmountAsset = $t04783747994._5
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
12241216 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12251217 }
12261218
12271219
12281220
12291221 @Callable(i)
12301222 func getOneTkn (outAssetIdStr,minOutAmount) = {
12311223 let isPoolOneTokenOperationsDisabled = {
12321224 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12331225 if ($isInstanceOf(@, "Boolean"))
12341226 then @
12351227 else throw(($getType(@) + " couldn't be cast to Boolean"))
12361228 }
12371229 let isGetDisabled = if (if (isGlobalShutdown())
12381230 then true
12391231 else (cfgPoolStatus == PoolShutdown))
12401232 then true
12411233 else isPoolOneTokenOperationsDisabled
12421234 let checks = [if (if (!(isGetDisabled))
12431235 then true
12441236 else isManager(i))
12451237 then true
12461238 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12471239 then true
12481240 else throwErr("exactly 1 payment are expected")]
12491241 if ((checks == checks))
12501242 then {
12511243 let outAssetId = parseAssetId(outAssetIdStr)
12521244 let payment = i.payments[0]
12531245 let paymentAssetId = payment.assetId
12541246 let paymentAmount = payment.amount
12551247 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12561248 if ((currentKLp == currentKLp))
12571249 then {
12581250 let userAddress = i.caller
12591251 let txId = i.transactionId
1260- let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1261- if (($t04887949032 == $t04887949032))
1252+ let $t04887349026 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1253+ if (($t04887349026 == $t04887349026))
12621254 then {
1263- let outInAmountAsset = $t04887949032._5
1264- let bonus = $t04887949032._4
1265- let feeAmount = $t04887949032._3
1266- let commonState = $t04887949032._2
1267- let amountEstimated = $t04887949032._1
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
12681260 let amount = if (if ((minOutAmount > 0))
12691261 then (minOutAmount > amountEstimated)
12701262 else false)
12711263 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12721264 else amountEstimated
12731265 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12741266 if ((burnInv == burnInv))
12751267 then {
12761268 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
1277- if ((withdrawState == withdrawState))
1278- then {
1279- let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
1280- let sendFee = if ((feeAmount > 0))
1281- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1282- else nil
1283- let $t04960649853 = {
1284- let feeAmountForCalc = if ((this == feeCollectorAddress))
1285- then 0
1286- else feeAmount
1287- if (outInAmountAsset)
1288- then $Tuple2(-((amount + feeAmountForCalc)), 0)
1289- else $Tuple2(0, -((amount + feeAmountForCalc)))
1290- }
1291- let amountAssetBalanceDelta = $t04960649853._1
1292- let priceAssetBalanceDelta = $t04960649853._2
1293- let $t04985649964 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1294- let refreshKLpActions = $t04985649964._1
1295- let updatedKLp = $t04985649964._2
1296- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1297- if ((isUpdatedKLpValid == isUpdatedKLpValid))
1298- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1299- else throw("Strict value is not equal to itself.")
1300- }
1269+ let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
1270+ let sendFee = if ((feeAmount > 0))
1271+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1272+ else nil
1273+ let $t04959749844 = {
1274+ let feeAmountForCalc = if ((this == feeCollectorAddress))
1275+ then 0
1276+ else feeAmount
1277+ if (outInAmountAsset)
1278+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
1279+ else $Tuple2(0, -((amount + feeAmountForCalc)))
1280+ }
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 isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1287+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1288+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13011289 else throw("Strict value is not equal to itself.")
13021290 }
13031291 else throw("Strict value is not equal to itself.")
13041292 }
13051293 else throw("Strict value is not equal to itself.")
13061294 }
13071295 else throw("Strict value is not equal to itself.")
13081296 }
13091297 else throw("Strict value is not equal to itself.")
13101298 }
13111299
13121300
13131301
13141302 @Callable(i)
13151303 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1316- let $t05024250398 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1317- let amountEstimated = $t05024250398._1
1318- let commonState = $t05024250398._2
1319- let feeAmount = $t05024250398._3
1320- let bonus = $t05024250398._4
1321- let outInAmountAsset = $t05024250398._5
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
13221310 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13231311 }
13241312
13251313
13261314
13271315 @Callable(i)
13281316 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13291317 let isPoolOneTokenOperationsDisabled = {
13301318 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13311319 if ($isInstanceOf(@, "Boolean"))
13321320 then @
13331321 else throw(($getType(@) + " couldn't be cast to Boolean"))
13341322 }
13351323 let isGetDisabled = if (if (isGlobalShutdown())
13361324 then true
13371325 else (cfgPoolStatus == PoolShutdown))
13381326 then true
13391327 else isPoolOneTokenOperationsDisabled
13401328 let checks = [if (if (!(isGetDisabled))
13411329 then true
13421330 else isManager(i))
13431331 then true
13441332 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13451333 then true
13461334 else throwErr("no payments are expected")]
13471335 if ((checks == checks))
13481336 then {
13491337 let outAssetId = parseAssetId(outAssetIdStr)
13501338 let userAddress = i.caller
13511339 let txId = i.transactionId
13521340 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13531341 if ((currentKLp == currentKLp))
13541342 then {
13551343 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13561344 if ((unstakeInv == unstakeInv))
13571345 then {
1358- let $t05130351454 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1359- if (($t05130351454 == $t05130351454))
1346+ let $t05129451445 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1347+ if (($t05129451445 == $t05129451445))
13601348 then {
1361- let outInAmountAsset = $t05130351454._5
1362- let bonus = $t05130351454._4
1363- let feeAmount = $t05130351454._3
1364- let commonState = $t05130351454._2
1365- let amountEstimated = $t05130351454._1
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
13661354 let amount = if (if ((minOutAmount > 0))
13671355 then (minOutAmount > amountEstimated)
13681356 else false)
13691357 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13701358 else amountEstimated
13711359 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13721360 if ((burnInv == burnInv))
13731361 then {
13741362 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
1375- if ((withdrawState == withdrawState))
1376- then {
1377- let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
1378- let sendFee = if ((feeAmount > 0))
1379- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1380- else nil
1381- let $t05202352270 = {
1382- let feeAmountForCalc = if ((this == feeCollectorAddress))
1383- then 0
1384- else feeAmount
1385- if (outInAmountAsset)
1386- then $Tuple2(-((amount + feeAmountForCalc)), 0)
1387- else $Tuple2(0, -((amount + feeAmountForCalc)))
1388- }
1389- let amountAssetBalanceDelta = $t05202352270._1
1390- let priceAssetBalanceDelta = $t05202352270._2
1391- let $t05227352381 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1392- let refreshKLpActions = $t05227352381._1
1393- let updatedKLp = $t05227352381._2
1394- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1395- if ((isUpdatedKLpValid == isUpdatedKLpValid))
1396- then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1397- else throw("Strict value is not equal to itself.")
1398- }
1363+ let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
1364+ let sendFee = if ((feeAmount > 0))
1365+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
1366+ else nil
1367+ let $t05201152258 = {
1368+ let feeAmountForCalc = if ((this == feeCollectorAddress))
1369+ then 0
1370+ else feeAmount
1371+ if (outInAmountAsset)
1372+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
1373+ else $Tuple2(0, -((amount + feeAmountForCalc)))
1374+ }
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 isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
1381+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1382+ then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13991383 else throw("Strict value is not equal to itself.")
14001384 }
14011385 else throw("Strict value is not equal to itself.")
14021386 }
14031387 else throw("Strict value is not equal to itself.")
14041388 }
14051389 else throw("Strict value is not equal to itself.")
14061390 }
14071391 else throw("Strict value is not equal to itself.")
14081392 }
14091393 else throw("Strict value is not equal to itself.")
14101394 }
14111395
14121396
14131397
14141398 @Callable(i)
14151399 func get () = {
14161400 let res = commonGet(i)
14171401 let outAmtAmt = res._1
14181402 let outPrAmt = res._2
14191403 let pmtAmt = res._3
14201404 let pmtAssetId = res._4
14211405 let state = res._5
14221406 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14231407 if ((currentKLp == currentKLp))
14241408 then {
14251409 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14261410 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14271411 then {
1428- let $t05334853430 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1429- let refreshKLpActions = $t05334853430._1
1430- let updatedKLp = $t05334853430._2
1412+ let $t05333653418 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1413+ let refreshKLpActions = $t05333653418._1
1414+ let updatedKLp = $t05333653418._2
14311415 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14321416 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14331417 then (state ++ refreshKLpActions)
14341418 else throw("Strict value is not equal to itself.")
14351419 }
14361420 else throw("Strict value is not equal to itself.")
14371421 }
14381422 else throw("Strict value is not equal to itself.")
14391423 }
14401424
14411425
14421426
14431427 @Callable(i)
14441428 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14451429 let res = commonGet(i)
14461430 let outAmAmt = res._1
14471431 let outPrAmt = res._2
14481432 let pmtAmt = res._3
14491433 let pmtAssetId = res._4
14501434 let state = res._5
14511435 if ((noLessThenAmtAsset > outAmAmt))
14521436 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14531437 else if ((noLessThenPriceAsset > outPrAmt))
14541438 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14551439 else {
14561440 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14571441 if ((currentKLp == currentKLp))
14581442 then {
14591443 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14601444 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14611445 then {
1462- let $t05437954460 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1463- let refreshKLpActions = $t05437954460._1
1464- let updatedKLp = $t05437954460._2
1446+ let $t05436754448 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1447+ let refreshKLpActions = $t05436754448._1
1448+ let updatedKLp = $t05436754448._2
14651449 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14661450 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14671451 then (state ++ refreshKLpActions)
14681452 else throw("Strict value is not equal to itself.")
14691453 }
14701454 else throw("Strict value is not equal to itself.")
14711455 }
14721456 else throw("Strict value is not equal to itself.")
14731457 }
14741458 }
14751459
14761460
14771461
14781462 @Callable(i)
14791463 func unstakeAndGet (amount) = {
14801464 let checkPayments = if ((size(i.payments) != 0))
14811465 then throw("No payments are expected")
14821466 else true
14831467 if ((checkPayments == checkPayments))
14841468 then {
14851469 let cfg = getPoolConfig()
14861470 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14871471 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14881472 if ((currentKLp == currentKLp))
14891473 then {
14901474 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14911475 if ((unstakeInv == unstakeInv))
14921476 then {
14931477 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14941478 let outAmAmt = res._1
14951479 let outPrAmt = res._2
14961480 let poolStatus = parseIntValue(res._9)
14971481 let state = res._10
14981482 let checkPoolStatus = if (if (isGlobalShutdown())
14991483 then true
15001484 else (poolStatus == PoolShutdown))
15011485 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
15021486 else true
15031487 if ((checkPoolStatus == checkPoolStatus))
15041488 then {
15051489 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15061490 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15071491 then {
1508- let $t05558655667 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1509- let refreshKLpActions = $t05558655667._1
1510- let updatedKLp = $t05558655667._2
1492+ let $t05557455655 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1493+ let refreshKLpActions = $t05557455655._1
1494+ let updatedKLp = $t05557455655._2
15111495 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15121496 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15131497 then (state ++ refreshKLpActions)
15141498 else throw("Strict value is not equal to itself.")
15151499 }
15161500 else throw("Strict value is not equal to itself.")
15171501 }
15181502 else throw("Strict value is not equal to itself.")
15191503 }
15201504 else throw("Strict value is not equal to itself.")
15211505 }
15221506 else throw("Strict value is not equal to itself.")
15231507 }
15241508 else throw("Strict value is not equal to itself.")
15251509 }
15261510
15271511
15281512
15291513 @Callable(i)
15301514 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15311515 let isGetDisabled = if (isGlobalShutdown())
15321516 then true
15331517 else (cfgPoolStatus == PoolShutdown)
15341518 let checks = [if (!(isGetDisabled))
15351519 then true
15361520 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15371521 then true
15381522 else throw("no payments are expected")]
15391523 if ((checks == checks))
15401524 then {
15411525 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15421526 if ((currentKLp == currentKLp))
15431527 then {
15441528 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15451529 if ((unstakeInv == unstakeInv))
15461530 then {
15471531 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15481532 let outAmAmt = res._1
15491533 let outPrAmt = res._2
15501534 let state = res._10
15511535 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15521536 then true
15531537 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15541538 then true
15551539 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15561540 if ((checkAmounts == checkAmounts))
15571541 then {
15581542 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15591543 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15601544 then {
1561- let $t05696257043 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1562- let refreshKLpActions = $t05696257043._1
1563- let updatedKLp = $t05696257043._2
1545+ let $t05695057031 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1546+ let refreshKLpActions = $t05695057031._1
1547+ let updatedKLp = $t05695057031._2
15641548 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15651549 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15661550 then (state ++ refreshKLpActions)
15671551 else throw("Strict value is not equal to itself.")
15681552 }
15691553 else throw("Strict value is not equal to itself.")
15701554 }
15711555 else throw("Strict value is not equal to itself.")
15721556 }
15731557 else throw("Strict value is not equal to itself.")
15741558 }
15751559 else throw("Strict value is not equal to itself.")
15761560 }
15771561 else throw("Strict value is not equal to itself.")
15781562 }
15791563
15801564
15811565
15821566 @Callable(i)
15831567 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15841568 then throw("permissions denied")
15851569 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15861570
15871571
15881572
15891573 @Callable(i)
15901574 func refreshKLp () = {
15911575 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15921576 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15931577 then unit
15941578 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15951579 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15961580 then {
15971581 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1598- let $t05823058294 = refreshKLpInternal(0, 0, 0)
1599- let kLpUpdateActions = $t05823058294._1
1600- let updatedKLp = $t05823058294._2
1582+ let $t05821858282 = refreshKLpInternal(0, 0, 0)
1583+ let kLpUpdateActions = $t05821858282._1
1584+ let updatedKLp = $t05821858282._2
16011585 let actions = if ((kLp != updatedKLp))
16021586 then kLpUpdateActions
16031587 else throwErr("nothing to refresh")
16041588 $Tuple2(actions, toString(updatedKLp))
16051589 }
16061590 else throw("Strict value is not equal to itself.")
16071591 }
16081592
16091593
16101594
16111595 @Callable(i)
16121596 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
16131597
16141598
16151599
16161600 @Callable(i)
16171601 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16181602
16191603
16201604
16211605 @Callable(i)
16221606 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16231607 let prices = calcPrices(amAmt, prAmt, lpAmt)
16241608 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16251609 }
16261610
16271611
16281612
16291613 @Callable(i)
16301614 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16311615
16321616
16331617
16341618 @Callable(i)
16351619 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16361620
16371621
16381622
16391623 @Callable(i)
16401624 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16411625
16421626
16431627
16441628 @Callable(i)
16451629 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16461630
16471631
16481632
16491633 @Callable(i)
16501634 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16511635 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16521636 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16531637 }
16541638
16551639
16561640
16571641 @Callable(i)
16581642 func statsREADONLY () = {
16591643 let cfg = getPoolConfig()
16601644 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16611645 let amtAssetId = cfg[idxAmtAssetId]
16621646 let priceAssetId = cfg[idxPriceAssetId]
16631647 let iAmtAssetId = cfg[idxIAmtAssetId]
16641648 let iPriceAssetId = cfg[idxIPriceAssetId]
16651649 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16661650 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16671651 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16681652 let accAmtAssetBalance = getAccBalance(amtAssetId)
16691653 let accPriceAssetBalance = getAccBalance(priceAssetId)
16701654 let pricesList = if ((poolLPBalance == 0))
16711655 then [zeroBigInt, zeroBigInt, zeroBigInt]
16721656 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16731657 let curPrice = 0
16741658 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16751659 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16761660 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16771661 $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))
16781662 }
16791663
16801664
16811665
16821666 @Callable(i)
16831667 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16841668 let cfg = getPoolConfig()
16851669 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16861670 let amAssetIdStr = cfg[idxAmtAssetId]
16871671 let amAssetId = fromBase58String(amAssetIdStr)
16881672 let prAssetIdStr = cfg[idxPriceAssetId]
16891673 let prAssetId = fromBase58String(prAssetIdStr)
16901674 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16911675 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16921676 let poolStatus = cfg[idxPoolStatus]
16931677 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16941678 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16951679 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16961680 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16971681 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16981682 let curPriceX18 = if ((poolLPBalance == 0))
16991683 then zeroBigInt
17001684 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
17011685 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
17021686 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
17031687 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
17041688 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17051689 let calcLpAmt = estPut._1
17061690 let curPriceCalc = estPut._3
17071691 let amBalance = estPut._4
17081692 let prBalance = estPut._5
17091693 let lpEmission = estPut._6
17101694 $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))
17111695 }
17121696
17131697
17141698
17151699 @Callable(i)
17161700 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17171701 let cfg = getPoolConfig()
17181702 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17191703 let amAssetIdStr = cfg[idxAmtAssetId]
17201704 let amAssetId = fromBase58String(amAssetIdStr)
17211705 let prAssetIdStr = cfg[idxPriceAssetId]
17221706 let prAssetId = fromBase58String(prAssetIdStr)
17231707 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17241708 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17251709 let poolStatus = cfg[idxPoolStatus]
17261710 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17271711 let amBalanceRaw = getAccBalance(amAssetIdStr)
17281712 let prBalanceRaw = getAccBalance(prAssetIdStr)
17291713 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17301714 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17311715 let curPriceX18 = if ((poolLPBalance == 0))
17321716 then zeroBigInt
17331717 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17341718 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17351719 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17361720 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17371721 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17381722 let calcLpAmt = estPut._1
17391723 let curPriceCalc = estPut._3
17401724 let amBalance = estPut._4
17411725 let prBalance = estPut._5
17421726 let lpEmission = estPut._6
17431727 $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))
17441728 }
17451729
17461730
17471731
17481732 @Callable(i)
17491733 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17501734 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17511735 let outAmAmt = res._1
17521736 let outPrAmt = res._2
17531737 let amBalance = res._5
17541738 let prBalance = res._6
17551739 let lpEmission = res._7
17561740 let curPrice = res._8
17571741 let poolStatus = parseIntValue(res._9)
17581742 $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))
17591743 }
17601744
17611745
17621746 @Verifier(tx)
17631747 func verify () = {
17641748 let targetPublicKey = match managerPublicKeyOrUnit() {
17651749 case pk: ByteVector =>
17661750 pk
17671751 case _: Unit =>
17681752 tx.senderPublicKey
17691753 case _ =>
17701754 throw("Match error")
17711755 }
17721756 match tx {
17731757 case order: Order =>
17741758 let matcherPub = getMatcherPubOrFail()
1775- let $t06695667025 = validateMatcherOrderAllowed(order)
1776- let orderValid = $t06695667025._1
1777- let orderValidInfo = $t06695667025._2
1759+ let $t06694467013 = validateMatcherOrderAllowed(order)
1760+ let orderValid = $t06694467013._1
1761+ let orderValidInfo = $t06694467013._2
17781762 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17791763 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17801764 if (if (if (orderValid)
17811765 then senderValid
17821766 else false)
17831767 then matcherValid
17841768 else false)
17851769 then true
17861770 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17871771 case s: SetScriptTransaction =>
17881772 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17891773 then true
17901774 else {
17911775 let newHash = blake2b256(value(s.script))
17921776 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17931777 let currentHash = scriptHash(this)
17941778 if ((allowedHash == newHash))
17951779 then (currentHash != newHash)
17961780 else false
17971781 }
17981782 case _ =>
17991783 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
18001784 }
18011785 }
18021786

github/deemru/w8io/026f985 
218.08 ms