tx · 3PKQvwCo8tzqXTq6h6xBv3hmiUc53HBkrFToQ96Ztm7w

3MsdLkCCcsf1niGwjyQCMi8aC4CkNbm2Wy9:  -0.04200000 Waves

2023.04.07 09:37 [2523806] smart account 3MsdLkCCcsf1niGwjyQCMi8aC4CkNbm2Wy9 > SELF 0.00000000 Waves

{ "type": 13, "id": "3PKQvwCo8tzqXTq6h6xBv3hmiUc53HBkrFToQ96Ztm7w", "fee": 4200000, "feeAssetId": null, "timestamp": 1680849503744, "version": 2, "chainId": 84, "sender": "3MsdLkCCcsf1niGwjyQCMi8aC4CkNbm2Wy9", "senderPublicKey": "B4L9D9LnFwCPW8fFVc65SHyFNYjb1KJv6MUQXPGMPSTy", "proofs": [ "5WfKUKRTFyRLuVYSqg94yeoctkcy3xqeEeHGJJEkd8UqBj8422Ew9MPCV3Rr4JrBR3w3Di9v6YRi5BEWNAYYzfWX" ], "script": "base64:BgK9NwgCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUF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wdAQCaW0JANsEAQkBBXZhbHVlAQkAnQgCBQJhVAkBAmFGAAQCaW4JAPEHAQUEdGhpcwMJAAACBQJpbQUCaWwJAQIhPQIFAmluBQJpbAcJAPQDAwgFAmlnCWJvZHlCeXRlcwkAkQMCCAUCaWcGcHJvb2ZzAAAFAmlpjGbQ+w==", "height": 2523806, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7XxcywpeHnjoMXasmvgX5PaLLbqxCVzeJq7dTDMCXVeP Next: FehTwtCQUz9QvQQ6RQqVkd8zBwBNV1f11bSGKvXDmo5U Diff:
OldNewDifferences
409409
410410
411411 func withdrawAndRebalanceAsset (assetId,getAmount) = {
412- let $t01588916025 = getLeaseProxyConfig(assetId)
413- let isLeasable = $t01588916025._1
414- let leasedRatio = $t01588916025._2
415- let minBalance = $t01588916025._3
416- let proxyAddress = $t01588916025._4
417- let proxyAssetId = $t01588916025._5
418- let proxyRateMul = $t01588916025._6
419- let stakingProfitAddress = $t01588916025._7
412+ let $t01589116027 = getLeaseProxyConfig(assetId)
413+ let isLeasable = $t01589116027._1
414+ let leasedRatio = $t01589116027._2
415+ let minBalance = $t01589116027._3
416+ let proxyAddress = $t01589116027._4
417+ let proxyAssetId = $t01589116027._5
418+ let proxyRateMul = $t01589116027._6
419+ let stakingProfitAddress = $t01589116027._7
420420 if (isLeasable)
421421 then {
422422 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
624624 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
625625 let amountAssetAmount = order.amount
626626 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
627- let $t02815328365 = if ((order.orderType == Buy))
627+ let $t02815528367 = if ((order.orderType == Buy))
628628 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
629629 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
630- let amountAssetBalanceDelta = $t02815328365._1
631- let priceAssetBalanceDelta = $t02815328365._2
630+ let amountAssetBalanceDelta = $t02815528367._1
631+ let priceAssetBalanceDelta = $t02815528367._2
632632 if (if (if (isGlobalShutdown())
633633 then true
634634 else (cfgPoolStatus == PoolMatcherDisabled))
641641 then throw("Wrong order assets.")
642642 else {
643643 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
644- let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
645- let unusedActions = $t02880528905._1
646- let kLpNew = $t02880528905._2
644+ let $t02880728907 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
645+ let unusedActions = $t02880728907._1
646+ let kLpNew = $t02880728907._2
647647 let isOrderValid = (kLpNew >= kLp)
648648 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
649649 $Tuple2(isOrderValid, info)
722722 else if ((paymentAssetId == cfgPriceAssetId))
723723 then false
724724 else throwErr("invalid asset")
725- let $t03201832311 = if (isEval)
725+ let $t03202032313 = if (isEval)
726726 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
727727 else if (paymentInAmountAsset)
728728 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
729729 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
730- let amountBalanceOld = $t03201832311._1
731- let priceBalanceOld = $t03201832311._2
732- let $t03231532464 = if (paymentInAmountAsset)
730+ let amountBalanceOld = $t03202032313._1
731+ let priceBalanceOld = $t03202032313._2
732+ let $t03231732466 = if (paymentInAmountAsset)
733733 then $Tuple2(paymentAmountRaw, 0)
734734 else $Tuple2(0, paymentAmountRaw)
735- let amountAssetAmountRaw = $t03231532464._1
736- let priceAssetAmountRaw = $t03231532464._2
735+ let amountAssetAmountRaw = $t03231732466._1
736+ let priceAssetAmountRaw = $t03231732466._2
737737 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
738738 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
739- let $t03259632660 = takeFee(paymentAmountRaw, inFee)
740- let paymentAmount = $t03259632660._1
741- let feeAmount = $t03259632660._2
739+ let $t03259832662 = takeFee(paymentAmountRaw, inFee)
740+ let paymentAmount = $t03259832662._1
741+ let feeAmount = $t03259832662._2
742742 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
743743 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
744744 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
761761 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
762762 let priceOld = fromX18(priceOldX18, scale8)
763763 let loss = {
764- let $t03434134508 = if (paymentInAmountAsset)
764+ let $t03434334510 = if (paymentInAmountAsset)
765765 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
766766 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
767- let amount = $t03434134508._1
768- let balance = $t03434134508._2
767+ let amount = $t03434334510._1
768+ let balance = $t03434334510._2
769769 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
770770 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
771771 }
805805 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
806806 let redeemedBigInt = toBigInt(paymentAmount)
807807 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
808- let $t03658636642 = takeFee(amountRaw, outFee)
809- let totalAmount = $t03658636642._1
810- let feeAmount = $t03658636642._2
811- let $t03664636872 = if (outInAmountAsset)
808+ let $t03658836644 = takeFee(amountRaw, outFee)
809+ let totalAmount = $t03658836644._1
810+ let feeAmount = $t03658836644._2
811+ let $t03664836874 = if (outInAmountAsset)
812812 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
813813 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
814- let outAmAmount = $t03664636872._1
815- let outPrAmount = $t03664636872._2
816- let amBalanceNew = $t03664636872._3
817- let prBalanceNew = $t03664636872._4
814+ let outAmAmount = $t03664836874._1
815+ let outPrAmount = $t03664836874._2
816+ let amBalanceNew = $t03664836874._3
817+ let prBalanceNew = $t03664836874._4
818818 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
819819 let priceNew = fromX18(priceNewX18, scale8)
820820 let commonState = if (isEval)
886886
887887 @Callable(i)
888888 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
889- let $t03875839063 = if ((isReverse == false))
889+ let $t03876039065 = if ((isReverse == false))
890890 then {
891891 let assetOut = getStringOrFail(this, pa())
892892 let assetIn = getStringOrFail(this, aa())
897897 let assetIn = getStringOrFail(this, pa())
898898 $Tuple2(assetOut, assetIn)
899899 }
900- let assetOut = $t03875839063._1
901- let assetIn = $t03875839063._2
900+ let assetOut = $t03876039065._1
901+ let assetIn = $t03876039065._2
902902 let poolAssetInBalance = getAccBalance(assetIn)
903903 let poolAssetOutBalance = getAccBalance(assetOut)
904904 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10491049 else throw("Strict value is not equal to itself.")
10501050 }
10511051 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1052- let $t04410944571 = refreshKLpInternal(0, 0, 0)
1053- if (($t04410944571 == $t04410944571))
1052+ let $t04411144573 = refreshKLpInternal(0, 0, 0)
1053+ if (($t04411144573 == $t04411144573))
10541054 then {
1055- let updatedKLp = $t04410944571._2
1056- let refreshKLpActions = $t04410944571._1
1055+ let updatedKLp = $t04411144573._2
1056+ let refreshKLpActions = $t04411144573._1
10571057 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10581058 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10591059 then {
10901090 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10911091 if ((currentKLp == currentKLp))
10921092 then {
1093- let $t04518345248 = refreshKLpInternal(0, 0, 0)
1094- let refreshKLpActions = $t04518345248._1
1095- let updatedKLp = $t04518345248._2
1093+ let $t04518545250 = refreshKLpInternal(0, 0, 0)
1094+ let refreshKLpActions = $t04518545250._1
1095+ let updatedKLp = $t04518545250._2
10961096 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10971097 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10981098 then (state ++ refreshKLpActions)
11391139 then {
11401140 let userAddress = i.caller
11411141 let txId = i.transactionId
1142- let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1143- if (($t04643646588 == $t04643646588))
1142+ let $t04643846590 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1143+ if (($t04643846590 == $t04643846590))
11441144 then {
1145- let paymentInAmountAsset = $t04643646588._5
1146- let bonus = $t04643646588._4
1147- let feeAmount = $t04643646588._3
1148- let commonState = $t04643646588._2
1149- let emitAmountEstimated = $t04643646588._1
1145+ let paymentInAmountAsset = $t04643846590._5
1146+ let bonus = $t04643846590._4
1147+ let feeAmount = $t04643846590._3
1148+ let commonState = $t04643846590._2
1149+ let emitAmountEstimated = $t04643846590._1
11501150 let emitAmount = if (if ((minOutAmount > 0))
11511151 then (minOutAmount > emitAmountEstimated)
11521152 else false)
11661166 let sendFee = if ((feeAmount > 0))
11671167 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11681168 else nil
1169- let $t04717447371 = if ((this == feeCollectorAddress))
1169+ let $t04717647373 = if ((this == feeCollectorAddress))
11701170 then $Tuple2(0, 0)
11711171 else if (paymentInAmountAsset)
11721172 then $Tuple2(-(feeAmount), 0)
11731173 else $Tuple2(0, -(feeAmount))
1174- let amountAssetBalanceDelta = $t04717447371._1
1175- let priceAssetBalanceDelta = $t04717447371._2
1176- let $t04737447482 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1177- let refreshKLpActions = $t04737447482._1
1178- let updatedKLp = $t04737447482._2
1174+ let amountAssetBalanceDelta = $t04717647373._1
1175+ let priceAssetBalanceDelta = $t04717647373._2
1176+ let $t04737647484 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1177+ let refreshKLpActions = $t04737647484._1
1178+ let updatedKLp = $t04737647484._2
11791179 let kLp = value(getString(keyKLp))
11801180 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11811181 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12001200
12011201 @Callable(i)
12021202 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1203- let $t04783747994 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1204- let emitAmountEstimated = $t04783747994._1
1205- let commonState = $t04783747994._2
1206- let feeAmount = $t04783747994._3
1207- let bonus = $t04783747994._4
1208- let paymentInAmountAsset = $t04783747994._5
1203+ let $t04783947996 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1204+ let emitAmountEstimated = $t04783947996._1
1205+ let commonState = $t04783947996._2
1206+ let feeAmount = $t04783947996._3
1207+ let bonus = $t04783947996._4
1208+ let paymentInAmountAsset = $t04783947996._5
12091209 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12101210 }
12111211
12421242 then {
12431243 let userAddress = i.caller
12441244 let txId = i.transactionId
1245- let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1246- if (($t04887949032 == $t04887949032))
1245+ let $t04888149034 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1246+ if (($t04888149034 == $t04888149034))
12471247 then {
1248- let outInAmountAsset = $t04887949032._5
1249- let bonus = $t04887949032._4
1250- let feeAmount = $t04887949032._3
1251- let commonState = $t04887949032._2
1252- let amountEstimated = $t04887949032._1
1248+ let outInAmountAsset = $t04888149034._5
1249+ let bonus = $t04888149034._4
1250+ let feeAmount = $t04888149034._3
1251+ let commonState = $t04888149034._2
1252+ let amountEstimated = $t04888149034._1
12531253 let amount = if (if ((minOutAmount > 0))
12541254 then (minOutAmount > amountEstimated)
12551255 else false)
12581258 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12591259 if ((burnInv == burnInv))
12601260 then {
1261- let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
1261+ let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12621262 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12631263 let sendFee = if ((feeAmount > 0))
12641264 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12651265 else nil
1266- let $t04960349850 = {
1266+ let $t04969849945 = {
12671267 let feeAmountForCalc = if ((this == feeCollectorAddress))
12681268 then 0
12691269 else feeAmount
12711271 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12721272 else $Tuple2(0, -((amount + feeAmountForCalc)))
12731273 }
1274- let amountAssetBalanceDelta = $t04960349850._1
1275- let priceAssetBalanceDelta = $t04960349850._2
1276- let $t04985349961 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1277- let refreshKLpActions = $t04985349961._1
1278- let updatedKLp = $t04985349961._2
1274+ let amountAssetBalanceDelta = $t04969849945._1
1275+ let priceAssetBalanceDelta = $t04969849945._2
1276+ let $t04994850056 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1277+ let refreshKLpActions = $t04994850056._1
1278+ let updatedKLp = $t04994850056._2
12791279 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12801280 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12811281 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12941294
12951295 @Callable(i)
12961296 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1297- let $t05023950395 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1298- let amountEstimated = $t05023950395._1
1299- let commonState = $t05023950395._2
1300- let feeAmount = $t05023950395._3
1301- let bonus = $t05023950395._4
1302- let outInAmountAsset = $t05023950395._5
1297+ let $t05033450490 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1298+ let amountEstimated = $t05033450490._1
1299+ let commonState = $t05033450490._2
1300+ let feeAmount = $t05033450490._3
1301+ let bonus = $t05033450490._4
1302+ let outInAmountAsset = $t05033450490._5
13031303 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13041304 }
13051305
13361336 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13371337 if ((unstakeInv == unstakeInv))
13381338 then {
1339- let $t05130051451 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1340- if (($t05130051451 == $t05130051451))
1339+ let $t05139551546 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1340+ if (($t05139551546 == $t05139551546))
13411341 then {
1342- let outInAmountAsset = $t05130051451._5
1343- let bonus = $t05130051451._4
1344- let feeAmount = $t05130051451._3
1345- let commonState = $t05130051451._2
1346- let amountEstimated = $t05130051451._1
1342+ let outInAmountAsset = $t05139551546._5
1343+ let bonus = $t05139551546._4
1344+ let feeAmount = $t05139551546._3
1345+ let commonState = $t05139551546._2
1346+ let amountEstimated = $t05139551546._1
13471347 let amount = if (if ((minOutAmount > 0))
13481348 then (minOutAmount > amountEstimated)
13491349 else false)
13521352 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13531353 if ((burnInv == burnInv))
13541354 then {
1355- let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
1355+ let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13561356 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13571357 let sendFee = if ((feeAmount > 0))
13581358 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13591359 else nil
1360- let $t05201752264 = {
1360+ let $t05220552452 = {
13611361 let feeAmountForCalc = if ((this == feeCollectorAddress))
13621362 then 0
13631363 else feeAmount
13651365 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13661366 else $Tuple2(0, -((amount + feeAmountForCalc)))
13671367 }
1368- let amountAssetBalanceDelta = $t05201752264._1
1369- let priceAssetBalanceDelta = $t05201752264._2
1370- let $t05226752375 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1371- let refreshKLpActions = $t05226752375._1
1372- let updatedKLp = $t05226752375._2
1368+ let amountAssetBalanceDelta = $t05220552452._1
1369+ let priceAssetBalanceDelta = $t05220552452._2
1370+ let $t05245552563 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1371+ let refreshKLpActions = $t05245552563._1
1372+ let updatedKLp = $t05245552563._2
13731373 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13741374 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13751375 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14031403 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14041404 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14051405 then {
1406- let $t05347053551 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1407- let refreshKLpActions = $t05347053551._1
1408- let updatedKLp = $t05347053551._2
1406+ let $t05365853739 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1407+ let refreshKLpActions = $t05365853739._1
1408+ let updatedKLp = $t05365853739._2
14091409 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14101410 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14111411 then ((withdrawState ++ state) ++ refreshKLpActions)
14381438 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14391439 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14401440 then {
1441- let $t05464654727 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1442- let refreshKLpActions = $t05464654727._1
1443- let updatedKLp = $t05464654727._2
1441+ let $t05483454915 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1442+ let refreshKLpActions = $t05483454915._1
1443+ let updatedKLp = $t05483454915._2
14441444 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14451445 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14461446 then ((withdrawState ++ state) ++ refreshKLpActions)
14851485 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14861486 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14871487 then {
1488- let $t05599956080 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1489- let refreshKLpActions = $t05599956080._1
1490- let updatedKLp = $t05599956080._2
1488+ let $t05618756268 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1489+ let refreshKLpActions = $t05618756268._1
1490+ let updatedKLp = $t05618756268._2
14911491 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14921492 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14931493 then ((withdrawState ++ state) ++ refreshKLpActions)
15391539 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15401540 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15411541 then {
1542- let $t05752157602 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1543- let refreshKLpActions = $t05752157602._1
1544- let updatedKLp = $t05752157602._2
1542+ let $t05770957790 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1543+ let refreshKLpActions = $t05770957790._1
1544+ let updatedKLp = $t05770957790._2
15451545 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15461546 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15471547 then ((withdrawState ++ state) ++ refreshKLpActions)
15761576 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15771577 then {
15781578 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1579- let $t05880658870 = refreshKLpInternal(0, 0, 0)
1580- let kLpUpdateActions = $t05880658870._1
1581- let updatedKLp = $t05880658870._2
1579+ let $t05899459058 = refreshKLpInternal(0, 0, 0)
1580+ let kLpUpdateActions = $t05899459058._1
1581+ let updatedKLp = $t05899459058._2
15821582 let actions = if ((kLp != updatedKLp))
15831583 then kLpUpdateActions
15841584 else throwErr("nothing to refresh")
17531753 match tx {
17541754 case order: Order =>
17551755 let matcherPub = getMatcherPubOrFail()
1756- let $t06753267601 = validateMatcherOrderAllowed(order)
1757- let orderValid = $t06753267601._1
1758- let orderValidInfo = $t06753267601._2
1756+ let $t06772067789 = validateMatcherOrderAllowed(order)
1757+ let orderValid = $t06772067789._1
1758+ let orderValidInfo = $t06772067789._2
17591759 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17601760 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17611761 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 leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
376376 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
377377 let diff = (currentAdditionalBalance - targetAdditionalBalance)
378378 if ((diff == 0))
379379 then nil
380380 else if ((0 > diff))
381381 then {
382382 let sendAssetAmount = -(diff)
383383 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
384384 }
385385 else {
386386 let getAssetAmount = diff
387387 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
388388 }
389389 }
390390 else throw("Strict value is not equal to itself.")
391391 }
392392 else throw("Strict value is not equal to itself.")
393393 }
394394
395395
396396 func rebalanceAsset (assetId) = {
397397 let $t01536415500 = getLeaseProxyConfig(assetId)
398398 let isLeasable = $t01536415500._1
399399 let leasedRatio = $t01536415500._2
400400 let minBalance = $t01536415500._3
401401 let proxyAddress = $t01536415500._4
402402 let proxyAssetId = $t01536415500._5
403403 let proxyRateMul = $t01536415500._6
404404 let stakingProfitAddress = $t01536415500._7
405405 if (isLeasable)
406406 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
407407 else nil
408408 }
409409
410410
411411 func withdrawAndRebalanceAsset (assetId,getAmount) = {
412- let $t01588916025 = getLeaseProxyConfig(assetId)
413- let isLeasable = $t01588916025._1
414- let leasedRatio = $t01588916025._2
415- let minBalance = $t01588916025._3
416- let proxyAddress = $t01588916025._4
417- let proxyAssetId = $t01588916025._5
418- let proxyRateMul = $t01588916025._6
419- let stakingProfitAddress = $t01588916025._7
412+ let $t01589116027 = getLeaseProxyConfig(assetId)
413+ let isLeasable = $t01589116027._1
414+ let leasedRatio = $t01589116027._2
415+ let minBalance = $t01589116027._3
416+ let proxyAddress = $t01589116027._4
417+ let proxyAssetId = $t01589116027._5
418+ let proxyRateMul = $t01589116027._6
419+ let stakingProfitAddress = $t01589116027._7
420420 if (isLeasable)
421421 then {
422422 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
423423 if ((newTotalLeasableBalance == newTotalLeasableBalance))
424424 then {
425425 let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
426426 if ((newAdditionalBalance == newAdditionalBalance))
427427 then {
428428 let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
429429 if ((withdrawAmount == withdrawAmount))
430430 then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
431431 else throw("Strict value is not equal to itself.")
432432 }
433433 else throw("Strict value is not equal to itself.")
434434 }
435435 else throw("Strict value is not equal to itself.")
436436 }
437437 else nil
438438 }
439439
440440
441441 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
442442 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
443443 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
444444 (AmAmtWithdrawState ++ PrAmtWithdrawState)
445445 }
446446
447447
448448 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
449449 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
450450 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
451451 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
452452 }
453453
454454
455455 func calcPrices (amAmt,prAmt,lpAmt) = {
456456 let cfg = getPoolConfig()
457457 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
458458 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
459459 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
460460 let amAmtX18 = toX18(amAmt, amtAssetDcm)
461461 let prAmtX18 = toX18(prAmt, priceAssetDcm)
462462 let lpAmtX18 = toX18(lpAmt, scale8)
463463 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
464464 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
465465 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
466466 }
467467
468468
469469 func calculatePrices (amAmt,prAmt,lpAmt) = {
470470 let prices = calcPrices(amAmt, prAmt, lpAmt)
471471 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
472472 }
473473
474474
475475 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
476476 let cfg = getPoolConfig()
477477 let lpAssetId = cfg[idxPoolLPAssetId]
478478 let amAssetId = cfg[idxAmtAssetId]
479479 let prAssetId = cfg[idxPriceAssetId]
480480 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
481481 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
482482 let poolStatus = cfg[idxPoolStatus]
483483 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
484484 if ((lpAssetId != pmtAssetId))
485485 then throw("Invalid asset passed.")
486486 else {
487487 let amBalance = getAccBalance(amAssetId)
488488 let amBalanceX18 = toX18(amBalance, amAssetDcm)
489489 let prBalance = getAccBalance(prAssetId)
490490 let prBalanceX18 = toX18(prBalance, prAssetDcm)
491491 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
492492 let curPrice = fromX18(curPriceX18, scale8)
493493 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
494494 let lpEmissionX18 = toX18(lpEmission, scale8)
495495 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
496496 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
497497 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
498498 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
499499 let state = if ((txId58 == ""))
500500 then nil
501501 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
502502 then unit
503503 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
504504 then unit
505505 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)]
506506 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
507507 }
508508 }
509509
510510
511511 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
512512 let cfg = getPoolConfig()
513513 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
514514 let amAssetIdStr = cfg[idxAmtAssetId]
515515 let prAssetIdStr = cfg[idxPriceAssetId]
516516 let iAmtAssetId = cfg[idxIAmtAssetId]
517517 let iPriceAssetId = cfg[idxIPriceAssetId]
518518 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
519519 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
520520 let poolStatus = cfg[idxPoolStatus]
521521 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
522522 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
523523 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
524524 if (if ((amAssetIdStr != inAmAssetIdStr))
525525 then true
526526 else (prAssetIdStr != inPrAssetIdStr))
527527 then throw("Invalid amt or price asset passed.")
528528 else {
529529 let amBalance = if (isEvaluate)
530530 then getAccBalance(amAssetIdStr)
531531 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
532532 let prBalance = if (isEvaluate)
533533 then getAccBalance(prAssetIdStr)
534534 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
535535 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
536536 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
537537 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
538538 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
539539 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
540540 let res = if ((lpEmission == 0))
541541 then {
542542 let curPriceX18 = zeroBigInt
543543 let slippageX18 = zeroBigInt
544544 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
545545 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
546546 }
547547 else {
548548 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
549549 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
550550 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
551551 if (if ((curPriceX18 != zeroBigInt))
552552 then (slippageX18 > slippageToleranceX18)
553553 else false)
554554 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
555555 else {
556556 let lpEmissionX18 = toX18(lpEmission, scale8)
557557 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
558558 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
559559 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
560560 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
561561 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
562562 let expAmtAssetAmtX18 = expectedAmts._1
563563 let expPriceAssetAmtX18 = expectedAmts._2
564564 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
565565 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
566566 }
567567 }
568568 let calcLpAmt = res._1
569569 let calcAmAssetPmt = res._2
570570 let calcPrAssetPmt = res._3
571571 let curPrice = fromX18(res._4, scale8)
572572 let slippageCalc = fromX18(res._5, scale8)
573573 if ((0 >= calcLpAmt))
574574 then throw("Invalid calculations. LP calculated is less than zero.")
575575 else {
576576 let emitLpAmt = if (!(emitLp))
577577 then 0
578578 else calcLpAmt
579579 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
580580 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
581581 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))]
582582 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
583583 }
584584 }
585585 }
586586
587587
588588 func calcKLp (amountBalance,priceBalance,lpEmission) = {
589589 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
590590 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
591591 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
592592 if ((lpEmission == big0))
593593 then big0
594594 else updatedKLp
595595 }
596596
597597
598598 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
599599 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
600600 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
601601 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
602602 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
603603 currentKLp
604604 }
605605
606606
607607 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
608608 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
609609 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
610610 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
611611 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
612612 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
613613 $Tuple2(actions, updatedKLp)
614614 }
615615
616616
617617 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
618618 then true
619619 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
620620
621621
622622 func validateMatcherOrderAllowed (order) = {
623623 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
624624 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
625625 let amountAssetAmount = order.amount
626626 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
627- let $t02815328365 = if ((order.orderType == Buy))
627+ let $t02815528367 = if ((order.orderType == Buy))
628628 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
629629 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
630- let amountAssetBalanceDelta = $t02815328365._1
631- let priceAssetBalanceDelta = $t02815328365._2
630+ let amountAssetBalanceDelta = $t02815528367._1
631+ let priceAssetBalanceDelta = $t02815528367._2
632632 if (if (if (isGlobalShutdown())
633633 then true
634634 else (cfgPoolStatus == PoolMatcherDisabled))
635635 then true
636636 else (cfgPoolStatus == PoolShutdown))
637637 then throw("Exchange operations disabled")
638638 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
639639 then true
640640 else (order.assetPair.priceAsset != cfgPriceAssetId))
641641 then throw("Wrong order assets.")
642642 else {
643643 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
644- let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
645- let unusedActions = $t02880528905._1
646- let kLpNew = $t02880528905._2
644+ let $t02880728907 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
645+ let unusedActions = $t02880728907._1
646+ let kLpNew = $t02880728907._2
647647 let isOrderValid = (kLpNew >= kLp)
648648 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
649649 $Tuple2(isOrderValid, info)
650650 }
651651 }
652652
653653
654654 func commonGet (i) = if ((size(i.payments) != 1))
655655 then throw("exactly 1 payment is expected")
656656 else {
657657 let pmt = value(i.payments[0])
658658 let pmtAssetId = value(pmt.assetId)
659659 let pmtAmt = pmt.amount
660660 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
661661 let outAmAmt = res._1
662662 let outPrAmt = res._2
663663 let poolStatus = parseIntValue(res._9)
664664 let state = res._10
665665 if (if (isGlobalShutdown())
666666 then true
667667 else (poolStatus == PoolShutdown))
668668 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
669669 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
670670 }
671671
672672
673673 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
674674 then throw("exactly 2 payments are expected")
675675 else {
676676 let amAssetPmt = value(i.payments[0])
677677 let prAssetPmt = value(i.payments[1])
678678 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
679679 let poolStatus = parseIntValue(estPut._8)
680680 if (if (if (isGlobalShutdown())
681681 then true
682682 else (poolStatus == PoolPutDisabled))
683683 then true
684684 else (poolStatus == PoolShutdown))
685685 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
686686 else estPut
687687 }
688688
689689
690690 func emit (amount) = {
691691 let emitInv = invoke(factoryContract, "emit", [amount], nil)
692692 if ((emitInv == emitInv))
693693 then {
694694 let emitInvLegacy = match emitInv {
695695 case legacyFactoryContract: Address =>
696696 invoke(legacyFactoryContract, "emit", [amount], nil)
697697 case _ =>
698698 unit
699699 }
700700 if ((emitInvLegacy == emitInvLegacy))
701701 then amount
702702 else throw("Strict value is not equal to itself.")
703703 }
704704 else throw("Strict value is not equal to itself.")
705705 }
706706
707707
708708 func takeFee (amount,fee) = {
709709 let feeAmount = if ((fee == 0))
710710 then 0
711711 else fraction(amount, fee, scale8)
712712 $Tuple2((amount - feeAmount), feeAmount)
713713 }
714714
715715
716716 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
717717 let isEval = (txId == unit)
718718 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
719719 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
720720 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
721721 then true
722722 else if ((paymentAssetId == cfgPriceAssetId))
723723 then false
724724 else throwErr("invalid asset")
725- let $t03201832311 = if (isEval)
725+ let $t03202032313 = if (isEval)
726726 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
727727 else if (paymentInAmountAsset)
728728 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
729729 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
730- let amountBalanceOld = $t03201832311._1
731- let priceBalanceOld = $t03201832311._2
732- let $t03231532464 = if (paymentInAmountAsset)
730+ let amountBalanceOld = $t03202032313._1
731+ let priceBalanceOld = $t03202032313._2
732+ let $t03231732466 = if (paymentInAmountAsset)
733733 then $Tuple2(paymentAmountRaw, 0)
734734 else $Tuple2(0, paymentAmountRaw)
735- let amountAssetAmountRaw = $t03231532464._1
736- let priceAssetAmountRaw = $t03231532464._2
735+ let amountAssetAmountRaw = $t03231732466._1
736+ let priceAssetAmountRaw = $t03231732466._2
737737 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
738738 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
739- let $t03259632660 = takeFee(paymentAmountRaw, inFee)
740- let paymentAmount = $t03259632660._1
741- let feeAmount = $t03259632660._2
739+ let $t03259832662 = takeFee(paymentAmountRaw, inFee)
740+ let paymentAmount = $t03259832662._1
741+ let feeAmount = $t03259832662._2
742742 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
743743 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
744744 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
745745 let priceNew = fromX18(priceNewX18, scale8)
746746 let paymentBalance = if (paymentInAmountAsset)
747747 then amountBalanceOld
748748 else priceBalanceOld
749749 let paymentBalanceBigInt = toBigInt(paymentBalance)
750750 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
751751 let chechSupply = if ((supplyBigInt > big0))
752752 then true
753753 else throwErr("initial deposit requires all coins")
754754 if ((chechSupply == chechSupply))
755755 then {
756756 let depositBigInt = toBigInt(paymentAmount)
757757 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
758758 let commonState = if (isEval)
759759 then nil
760760 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))]
761761 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
762762 let priceOld = fromX18(priceOldX18, scale8)
763763 let loss = {
764- let $t03434134508 = if (paymentInAmountAsset)
764+ let $t03434334510 = if (paymentInAmountAsset)
765765 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
766766 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
767- let amount = $t03434134508._1
768- let balance = $t03434134508._2
767+ let amount = $t03434334510._1
768+ let balance = $t03434334510._2
769769 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
770770 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
771771 }
772772 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
773773 }
774774 else throw("Strict value is not equal to itself.")
775775 }
776776
777777
778778 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
779779 let isEval = (txId == unit)
780780 let cfg = getPoolConfig()
781781 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
782782 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
783783 let checks = [if ((paymentAssetId == cfgLpAssetId))
784784 then true
785785 else throwErr("invalid lp asset")]
786786 if ((checks == checks))
787787 then {
788788 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
789789 then true
790790 else if ((outAssetId == cfgPriceAssetId))
791791 then false
792792 else throwErr("invalid asset")
793793 let balanceBigInt = if (outInAmountAsset)
794794 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
795795 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
796796 let outInAmountAssetDecimals = if (outInAmountAsset)
797797 then amtAssetDcm
798798 else priceAssetDcm
799799 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
800800 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
801801 let outBalance = if (outInAmountAsset)
802802 then amBalanceOld
803803 else prBalanceOld
804804 let outBalanceBigInt = toBigInt(outBalance)
805805 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
806806 let redeemedBigInt = toBigInt(paymentAmount)
807807 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
808- let $t03658636642 = takeFee(amountRaw, outFee)
809- let totalAmount = $t03658636642._1
810- let feeAmount = $t03658636642._2
811- let $t03664636872 = if (outInAmountAsset)
808+ let $t03658836644 = takeFee(amountRaw, outFee)
809+ let totalAmount = $t03658836644._1
810+ let feeAmount = $t03658836644._2
811+ let $t03664836874 = if (outInAmountAsset)
812812 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
813813 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
814- let outAmAmount = $t03664636872._1
815- let outPrAmount = $t03664636872._2
816- let amBalanceNew = $t03664636872._3
817- let prBalanceNew = $t03664636872._4
814+ let outAmAmount = $t03664836874._1
815+ let outPrAmount = $t03664836874._2
816+ let amBalanceNew = $t03664836874._3
817+ let prBalanceNew = $t03664836874._4
818818 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
819819 let priceNew = fromX18(priceNewX18, scale8)
820820 let commonState = if (isEval)
821821 then nil
822822 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)]
823823 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
824824 let priceOld = fromX18(priceOldX18, scale8)
825825 let loss = {
826826 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
827827 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
828828 }
829829 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
830830 }
831831 else throw("Strict value is not equal to itself.")
832832 }
833833
834834
835835 func managerPublicKeyOrUnit () = match getString(mpk()) {
836836 case s: String =>
837837 fromBase58String(s)
838838 case _: Unit =>
839839 unit
840840 case _ =>
841841 throw("Match error")
842842 }
843843
844844
845845 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
846846 case s: String =>
847847 fromBase58String(s)
848848 case _: Unit =>
849849 unit
850850 case _ =>
851851 throw("Match error")
852852 }
853853
854854
855855 func isManager (i) = match managerPublicKeyOrUnit() {
856856 case pk: ByteVector =>
857857 (i.callerPublicKey == pk)
858858 case _: Unit =>
859859 (i.caller == this)
860860 case _ =>
861861 throw("Match error")
862862 }
863863
864864
865865 func mustManager (i) = {
866866 let pd = throw("Permission denied")
867867 match managerPublicKeyOrUnit() {
868868 case pk: ByteVector =>
869869 if ((i.callerPublicKey == pk))
870870 then true
871871 else pd
872872 case _: Unit =>
873873 if ((i.caller == this))
874874 then true
875875 else pd
876876 case _ =>
877877 throw("Match error")
878878 }
879879 }
880880
881881
882882 @Callable(i)
883883 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
884884
885885
886886
887887 @Callable(i)
888888 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
889- let $t03875839063 = if ((isReverse == false))
889+ let $t03876039065 = if ((isReverse == false))
890890 then {
891891 let assetOut = getStringOrFail(this, pa())
892892 let assetIn = getStringOrFail(this, aa())
893893 $Tuple2(assetOut, assetIn)
894894 }
895895 else {
896896 let assetOut = getStringOrFail(this, aa())
897897 let assetIn = getStringOrFail(this, pa())
898898 $Tuple2(assetOut, assetIn)
899899 }
900- let assetOut = $t03875839063._1
901- let assetIn = $t03875839063._2
900+ let assetOut = $t03876039065._1
901+ let assetIn = $t03876039065._2
902902 let poolAssetInBalance = getAccBalance(assetIn)
903903 let poolAssetOutBalance = getAccBalance(assetOut)
904904 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
905905 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
906906 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
907907 let checkK = if ((newK >= oldK))
908908 then true
909909 else throw("new K is fewer error")
910910 if ((checkK == checkK))
911911 then $Tuple2(nil, amountOut)
912912 else throw("Strict value is not equal to itself.")
913913 }
914914
915915
916916
917917 @Callable(i)
918918 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
919919 let swapContact = {
920920 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
921921 if ($isInstanceOf(@, "String"))
922922 then @
923923 else throw(($getType(@) + " couldn't be cast to String"))
924924 }
925925 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
926926 then true
927927 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
928928 then true
929929 else throwErr("Permission denied")]
930930 if ((checks == checks))
931931 then {
932932 let pmt = value(i.payments[0])
933933 let assetIn = assetIdToString(pmt.assetId)
934934 let assetOut = if ((isReverse == false))
935935 then getStringOrFail(this, pa())
936936 else getStringOrFail(this, aa())
937937 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
938938 let poolAssetOutBalance = getAccBalance(assetOut)
939939 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
940940 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
941941 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
942942 let checkK = if ((newK >= oldK))
943943 then true
944944 else throw("new K is fewer error")
945945 if ((checkK == checkK))
946946 then {
947947 let checkMin = if ((amountOut >= amountOutMin))
948948 then true
949949 else throw("Exchange result is fewer coins than expected")
950950 if ((checkMin == checkMin))
951951 then {
952952 let rebalanceState = rebalanceAsset(assetIn)
953953 if ((rebalanceState == rebalanceState))
954954 then {
955955 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
956956 if ((withdrawState == withdrawState))
957957 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
958958 else throw("Strict value is not equal to itself.")
959959 }
960960 else throw("Strict value is not equal to itself.")
961961 }
962962 else throw("Strict value is not equal to itself.")
963963 }
964964 else throw("Strict value is not equal to itself.")
965965 }
966966 else throw("Strict value is not equal to itself.")
967967 }
968968
969969
970970
971971 @Callable(i)
972972 func setManager (pendingManagerPublicKey) = {
973973 let checkCaller = mustManager(i)
974974 if ((checkCaller == checkCaller))
975975 then {
976976 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
977977 if ((checkManagerPublicKey == checkManagerPublicKey))
978978 then [StringEntry(pmpk(), pendingManagerPublicKey)]
979979 else throw("Strict value is not equal to itself.")
980980 }
981981 else throw("Strict value is not equal to itself.")
982982 }
983983
984984
985985
986986 @Callable(i)
987987 func confirmManager () = {
988988 let pm = pendingManagerPublicKeyOrUnit()
989989 let hasPM = if (isDefined(pm))
990990 then true
991991 else throw("No pending manager")
992992 if ((hasPM == hasPM))
993993 then {
994994 let checkPM = if ((i.callerPublicKey == value(pm)))
995995 then true
996996 else throw("You are not pending manager")
997997 if ((checkPM == checkPM))
998998 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
999999 else throw("Strict value is not equal to itself.")
10001000 }
10011001 else throw("Strict value is not equal to itself.")
10021002 }
10031003
10041004
10051005
10061006 @Callable(i)
10071007 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10081008 then throw("Invalid slippageTolerance passed")
10091009 else {
10101010 let estPut = commonPut(i, slippageTolerance, true)
10111011 let emitLpAmt = estPut._2
10121012 let lpAssetId = estPut._7
10131013 let state = estPut._9
10141014 let amDiff = estPut._10
10151015 let prDiff = estPut._11
10161016 let amId = estPut._12
10171017 let prId = estPut._13
10181018 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10191019 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10201020 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10211021 if ((currentKLp == currentKLp))
10221022 then {
10231023 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10241024 if ((emitInv == emitInv))
10251025 then {
10261026 let emitInvLegacy = match emitInv {
10271027 case legacyFactoryContract: Address =>
10281028 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10291029 case _ =>
10301030 unit
10311031 }
10321032 if ((emitInvLegacy == emitInvLegacy))
10331033 then {
10341034 let slippageAInv = if ((amDiff > 0))
10351035 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10361036 else nil
10371037 if ((slippageAInv == slippageAInv))
10381038 then {
10391039 let slippagePInv = if ((prDiff > 0))
10401040 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10411041 else nil
10421042 if ((slippagePInv == slippagePInv))
10431043 then {
10441044 let lpTransfer = if (shouldAutoStake)
10451045 then {
10461046 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10471047 if ((slpStakeInv == slpStakeInv))
10481048 then nil
10491049 else throw("Strict value is not equal to itself.")
10501050 }
10511051 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1052- let $t04410944571 = refreshKLpInternal(0, 0, 0)
1053- if (($t04410944571 == $t04410944571))
1052+ let $t04411144573 = refreshKLpInternal(0, 0, 0)
1053+ if (($t04411144573 == $t04411144573))
10541054 then {
1055- let updatedKLp = $t04410944571._2
1056- let refreshKLpActions = $t04410944571._1
1055+ let updatedKLp = $t04411144573._2
1056+ let refreshKLpActions = $t04411144573._1
10571057 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10581058 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10591059 then {
10601060 let reb = invoke(this, "rebalance", nil, nil)
10611061 if ((reb == reb))
10621062 then ((state ++ lpTransfer) ++ refreshKLpActions)
10631063 else throw("Strict value is not equal to itself.")
10641064 }
10651065 else throw("Strict value is not equal to itself.")
10661066 }
10671067 else throw("Strict value is not equal to itself.")
10681068 }
10691069 else throw("Strict value is not equal to itself.")
10701070 }
10711071 else throw("Strict value is not equal to itself.")
10721072 }
10731073 else throw("Strict value is not equal to itself.")
10741074 }
10751075 else throw("Strict value is not equal to itself.")
10761076 }
10771077 else throw("Strict value is not equal to itself.")
10781078 }
10791079
10801080
10811081
10821082 @Callable(i)
10831083 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10841084 then throw("Invalid value passed")
10851085 else {
10861086 let estPut = commonPut(i, maxSlippage, false)
10871087 let state = estPut._9
10881088 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10891089 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10901090 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10911091 if ((currentKLp == currentKLp))
10921092 then {
1093- let $t04518345248 = refreshKLpInternal(0, 0, 0)
1094- let refreshKLpActions = $t04518345248._1
1095- let updatedKLp = $t04518345248._2
1093+ let $t04518545250 = refreshKLpInternal(0, 0, 0)
1094+ let refreshKLpActions = $t04518545250._1
1095+ let updatedKLp = $t04518545250._2
10961096 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10971097 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10981098 then (state ++ refreshKLpActions)
10991099 else throw("Strict value is not equal to itself.")
11001100 }
11011101 else throw("Strict value is not equal to itself.")
11021102 }
11031103
11041104
11051105
11061106 @Callable(i)
11071107 func putOneTkn (minOutAmount,autoStake) = {
11081108 let isPoolOneTokenOperationsDisabled = {
11091109 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11101110 if ($isInstanceOf(@, "Boolean"))
11111111 then @
11121112 else throw(($getType(@) + " couldn't be cast to Boolean"))
11131113 }
11141114 let isPutDisabled = if (if (if (isGlobalShutdown())
11151115 then true
11161116 else (cfgPoolStatus == PoolPutDisabled))
11171117 then true
11181118 else (cfgPoolStatus == PoolShutdown))
11191119 then true
11201120 else isPoolOneTokenOperationsDisabled
11211121 let checks = [if (if (!(isPutDisabled))
11221122 then true
11231123 else isManager(i))
11241124 then true
11251125 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11261126 then true
11271127 else throwErr("exactly 1 payment are expected")]
11281128 if ((checks == checks))
11291129 then {
11301130 let payment = i.payments[0]
11311131 let paymentAssetId = payment.assetId
11321132 let paymentAmountRaw = payment.amount
11331133 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11341134 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11351135 else if ((paymentAssetId == cfgPriceAssetId))
11361136 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11371137 else throwErr("payment asset is not supported")
11381138 if ((currentKLp == currentKLp))
11391139 then {
11401140 let userAddress = i.caller
11411141 let txId = i.transactionId
1142- let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1143- if (($t04643646588 == $t04643646588))
1142+ let $t04643846590 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1143+ if (($t04643846590 == $t04643846590))
11441144 then {
1145- let paymentInAmountAsset = $t04643646588._5
1146- let bonus = $t04643646588._4
1147- let feeAmount = $t04643646588._3
1148- let commonState = $t04643646588._2
1149- let emitAmountEstimated = $t04643646588._1
1145+ let paymentInAmountAsset = $t04643846590._5
1146+ let bonus = $t04643846590._4
1147+ let feeAmount = $t04643846590._3
1148+ let commonState = $t04643846590._2
1149+ let emitAmountEstimated = $t04643846590._1
11501150 let emitAmount = if (if ((minOutAmount > 0))
11511151 then (minOutAmount > emitAmountEstimated)
11521152 else false)
11531153 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11541154 else emitAmountEstimated
11551155 let emitInv = emit(emitAmount)
11561156 if ((emitInv == emitInv))
11571157 then {
11581158 let lpTransfer = if (autoStake)
11591159 then {
11601160 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11611161 if ((stakeInv == stakeInv))
11621162 then nil
11631163 else throw("Strict value is not equal to itself.")
11641164 }
11651165 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11661166 let sendFee = if ((feeAmount > 0))
11671167 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11681168 else nil
1169- let $t04717447371 = if ((this == feeCollectorAddress))
1169+ let $t04717647373 = if ((this == feeCollectorAddress))
11701170 then $Tuple2(0, 0)
11711171 else if (paymentInAmountAsset)
11721172 then $Tuple2(-(feeAmount), 0)
11731173 else $Tuple2(0, -(feeAmount))
1174- let amountAssetBalanceDelta = $t04717447371._1
1175- let priceAssetBalanceDelta = $t04717447371._2
1176- let $t04737447482 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1177- let refreshKLpActions = $t04737447482._1
1178- let updatedKLp = $t04737447482._2
1174+ let amountAssetBalanceDelta = $t04717647373._1
1175+ let priceAssetBalanceDelta = $t04717647373._2
1176+ let $t04737647484 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1177+ let refreshKLpActions = $t04737647484._1
1178+ let updatedKLp = $t04737647484._2
11791179 let kLp = value(getString(keyKLp))
11801180 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11811181 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11821182 then {
11831183 let reb = invoke(this, "rebalance", nil, nil)
11841184 if ((reb == reb))
11851185 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11861186 else throw("Strict value is not equal to itself.")
11871187 }
11881188 else throw("Strict value is not equal to itself.")
11891189 }
11901190 else throw("Strict value is not equal to itself.")
11911191 }
11921192 else throw("Strict value is not equal to itself.")
11931193 }
11941194 else throw("Strict value is not equal to itself.")
11951195 }
11961196 else throw("Strict value is not equal to itself.")
11971197 }
11981198
11991199
12001200
12011201 @Callable(i)
12021202 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1203- let $t04783747994 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1204- let emitAmountEstimated = $t04783747994._1
1205- let commonState = $t04783747994._2
1206- let feeAmount = $t04783747994._3
1207- let bonus = $t04783747994._4
1208- let paymentInAmountAsset = $t04783747994._5
1203+ let $t04783947996 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1204+ let emitAmountEstimated = $t04783947996._1
1205+ let commonState = $t04783947996._2
1206+ let feeAmount = $t04783947996._3
1207+ let bonus = $t04783947996._4
1208+ let paymentInAmountAsset = $t04783947996._5
12091209 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12101210 }
12111211
12121212
12131213
12141214 @Callable(i)
12151215 func getOneTkn (outAssetIdStr,minOutAmount) = {
12161216 let isPoolOneTokenOperationsDisabled = {
12171217 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12181218 if ($isInstanceOf(@, "Boolean"))
12191219 then @
12201220 else throw(($getType(@) + " couldn't be cast to Boolean"))
12211221 }
12221222 let isGetDisabled = if (if (isGlobalShutdown())
12231223 then true
12241224 else (cfgPoolStatus == PoolShutdown))
12251225 then true
12261226 else isPoolOneTokenOperationsDisabled
12271227 let checks = [if (if (!(isGetDisabled))
12281228 then true
12291229 else isManager(i))
12301230 then true
12311231 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12321232 then true
12331233 else throwErr("exactly 1 payment are expected")]
12341234 if ((checks == checks))
12351235 then {
12361236 let outAssetId = parseAssetId(outAssetIdStr)
12371237 let payment = i.payments[0]
12381238 let paymentAssetId = payment.assetId
12391239 let paymentAmount = payment.amount
12401240 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12411241 if ((currentKLp == currentKLp))
12421242 then {
12431243 let userAddress = i.caller
12441244 let txId = i.transactionId
1245- let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1246- if (($t04887949032 == $t04887949032))
1245+ let $t04888149034 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1246+ if (($t04888149034 == $t04888149034))
12471247 then {
1248- let outInAmountAsset = $t04887949032._5
1249- let bonus = $t04887949032._4
1250- let feeAmount = $t04887949032._3
1251- let commonState = $t04887949032._2
1252- let amountEstimated = $t04887949032._1
1248+ let outInAmountAsset = $t04888149034._5
1249+ let bonus = $t04888149034._4
1250+ let feeAmount = $t04888149034._3
1251+ let commonState = $t04888149034._2
1252+ let amountEstimated = $t04888149034._1
12531253 let amount = if (if ((minOutAmount > 0))
12541254 then (minOutAmount > amountEstimated)
12551255 else false)
12561256 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12571257 else amountEstimated
12581258 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12591259 if ((burnInv == burnInv))
12601260 then {
1261- let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
1261+ let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12621262 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12631263 let sendFee = if ((feeAmount > 0))
12641264 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12651265 else nil
1266- let $t04960349850 = {
1266+ let $t04969849945 = {
12671267 let feeAmountForCalc = if ((this == feeCollectorAddress))
12681268 then 0
12691269 else feeAmount
12701270 if (outInAmountAsset)
12711271 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12721272 else $Tuple2(0, -((amount + feeAmountForCalc)))
12731273 }
1274- let amountAssetBalanceDelta = $t04960349850._1
1275- let priceAssetBalanceDelta = $t04960349850._2
1276- let $t04985349961 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1277- let refreshKLpActions = $t04985349961._1
1278- let updatedKLp = $t04985349961._2
1274+ let amountAssetBalanceDelta = $t04969849945._1
1275+ let priceAssetBalanceDelta = $t04969849945._2
1276+ let $t04994850056 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1277+ let refreshKLpActions = $t04994850056._1
1278+ let updatedKLp = $t04994850056._2
12791279 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12801280 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12811281 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12821282 else throw("Strict value is not equal to itself.")
12831283 }
12841284 else throw("Strict value is not equal to itself.")
12851285 }
12861286 else throw("Strict value is not equal to itself.")
12871287 }
12881288 else throw("Strict value is not equal to itself.")
12891289 }
12901290 else throw("Strict value is not equal to itself.")
12911291 }
12921292
12931293
12941294
12951295 @Callable(i)
12961296 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1297- let $t05023950395 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1298- let amountEstimated = $t05023950395._1
1299- let commonState = $t05023950395._2
1300- let feeAmount = $t05023950395._3
1301- let bonus = $t05023950395._4
1302- let outInAmountAsset = $t05023950395._5
1297+ let $t05033450490 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1298+ let amountEstimated = $t05033450490._1
1299+ let commonState = $t05033450490._2
1300+ let feeAmount = $t05033450490._3
1301+ let bonus = $t05033450490._4
1302+ let outInAmountAsset = $t05033450490._5
13031303 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13041304 }
13051305
13061306
13071307
13081308 @Callable(i)
13091309 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13101310 let isPoolOneTokenOperationsDisabled = {
13111311 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13121312 if ($isInstanceOf(@, "Boolean"))
13131313 then @
13141314 else throw(($getType(@) + " couldn't be cast to Boolean"))
13151315 }
13161316 let isGetDisabled = if (if (isGlobalShutdown())
13171317 then true
13181318 else (cfgPoolStatus == PoolShutdown))
13191319 then true
13201320 else isPoolOneTokenOperationsDisabled
13211321 let checks = [if (if (!(isGetDisabled))
13221322 then true
13231323 else isManager(i))
13241324 then true
13251325 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13261326 then true
13271327 else throwErr("no payments are expected")]
13281328 if ((checks == checks))
13291329 then {
13301330 let outAssetId = parseAssetId(outAssetIdStr)
13311331 let userAddress = i.caller
13321332 let txId = i.transactionId
13331333 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13341334 if ((currentKLp == currentKLp))
13351335 then {
13361336 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13371337 if ((unstakeInv == unstakeInv))
13381338 then {
1339- let $t05130051451 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1340- if (($t05130051451 == $t05130051451))
1339+ let $t05139551546 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1340+ if (($t05139551546 == $t05139551546))
13411341 then {
1342- let outInAmountAsset = $t05130051451._5
1343- let bonus = $t05130051451._4
1344- let feeAmount = $t05130051451._3
1345- let commonState = $t05130051451._2
1346- let amountEstimated = $t05130051451._1
1342+ let outInAmountAsset = $t05139551546._5
1343+ let bonus = $t05139551546._4
1344+ let feeAmount = $t05139551546._3
1345+ let commonState = $t05139551546._2
1346+ let amountEstimated = $t05139551546._1
13471347 let amount = if (if ((minOutAmount > 0))
13481348 then (minOutAmount > amountEstimated)
13491349 else false)
13501350 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13511351 else amountEstimated
13521352 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13531353 if ((burnInv == burnInv))
13541354 then {
1355- let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
1355+ let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13561356 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13571357 let sendFee = if ((feeAmount > 0))
13581358 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13591359 else nil
1360- let $t05201752264 = {
1360+ let $t05220552452 = {
13611361 let feeAmountForCalc = if ((this == feeCollectorAddress))
13621362 then 0
13631363 else feeAmount
13641364 if (outInAmountAsset)
13651365 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13661366 else $Tuple2(0, -((amount + feeAmountForCalc)))
13671367 }
1368- let amountAssetBalanceDelta = $t05201752264._1
1369- let priceAssetBalanceDelta = $t05201752264._2
1370- let $t05226752375 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1371- let refreshKLpActions = $t05226752375._1
1372- let updatedKLp = $t05226752375._2
1368+ let amountAssetBalanceDelta = $t05220552452._1
1369+ let priceAssetBalanceDelta = $t05220552452._2
1370+ let $t05245552563 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1371+ let refreshKLpActions = $t05245552563._1
1372+ let updatedKLp = $t05245552563._2
13731373 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13741374 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13751375 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13761376 else throw("Strict value is not equal to itself.")
13771377 }
13781378 else throw("Strict value is not equal to itself.")
13791379 }
13801380 else throw("Strict value is not equal to itself.")
13811381 }
13821382 else throw("Strict value is not equal to itself.")
13831383 }
13841384 else throw("Strict value is not equal to itself.")
13851385 }
13861386 else throw("Strict value is not equal to itself.")
13871387 }
13881388
13891389
13901390
13911391 @Callable(i)
13921392 func get () = {
13931393 let res = commonGet(i)
13941394 let outAmAmt = res._1
13951395 let outPrAmt = res._2
13961396 let pmtAmt = res._3
13971397 let pmtAssetId = res._4
13981398 let state = res._5
13991399 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14001400 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14011401 if ((currentKLp == currentKLp))
14021402 then {
14031403 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14041404 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14051405 then {
1406- let $t05347053551 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1407- let refreshKLpActions = $t05347053551._1
1408- let updatedKLp = $t05347053551._2
1406+ let $t05365853739 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1407+ let refreshKLpActions = $t05365853739._1
1408+ let updatedKLp = $t05365853739._2
14091409 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14101410 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14111411 then ((withdrawState ++ state) ++ refreshKLpActions)
14121412 else throw("Strict value is not equal to itself.")
14131413 }
14141414 else throw("Strict value is not equal to itself.")
14151415 }
14161416 else throw("Strict value is not equal to itself.")
14171417 }
14181418
14191419
14201420
14211421 @Callable(i)
14221422 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14231423 let res = commonGet(i)
14241424 let outAmAmt = res._1
14251425 let outPrAmt = res._2
14261426 let pmtAmt = res._3
14271427 let pmtAssetId = res._4
14281428 let state = res._5
14291429 if ((noLessThenAmtAsset > outAmAmt))
14301430 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14311431 else if ((noLessThenPriceAsset > outPrAmt))
14321432 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14331433 else {
14341434 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14351435 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14361436 if ((currentKLp == currentKLp))
14371437 then {
14381438 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14391439 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14401440 then {
1441- let $t05464654727 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1442- let refreshKLpActions = $t05464654727._1
1443- let updatedKLp = $t05464654727._2
1441+ let $t05483454915 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1442+ let refreshKLpActions = $t05483454915._1
1443+ let updatedKLp = $t05483454915._2
14441444 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14451445 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14461446 then ((withdrawState ++ state) ++ refreshKLpActions)
14471447 else throw("Strict value is not equal to itself.")
14481448 }
14491449 else throw("Strict value is not equal to itself.")
14501450 }
14511451 else throw("Strict value is not equal to itself.")
14521452 }
14531453 }
14541454
14551455
14561456
14571457 @Callable(i)
14581458 func unstakeAndGet (amount) = {
14591459 let checkPayments = if ((size(i.payments) != 0))
14601460 then throw("No payments are expected")
14611461 else true
14621462 if ((checkPayments == checkPayments))
14631463 then {
14641464 let cfg = getPoolConfig()
14651465 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14661466 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14671467 if ((currentKLp == currentKLp))
14681468 then {
14691469 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14701470 if ((unstakeInv == unstakeInv))
14711471 then {
14721472 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14731473 let outAmAmt = res._1
14741474 let outPrAmt = res._2
14751475 let poolStatus = parseIntValue(res._9)
14761476 let state = res._10
14771477 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14781478 let checkPoolStatus = if (if (isGlobalShutdown())
14791479 then true
14801480 else (poolStatus == PoolShutdown))
14811481 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14821482 else true
14831483 if ((checkPoolStatus == checkPoolStatus))
14841484 then {
14851485 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14861486 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14871487 then {
1488- let $t05599956080 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1489- let refreshKLpActions = $t05599956080._1
1490- let updatedKLp = $t05599956080._2
1488+ let $t05618756268 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1489+ let refreshKLpActions = $t05618756268._1
1490+ let updatedKLp = $t05618756268._2
14911491 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14921492 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14931493 then ((withdrawState ++ state) ++ refreshKLpActions)
14941494 else throw("Strict value is not equal to itself.")
14951495 }
14961496 else throw("Strict value is not equal to itself.")
14971497 }
14981498 else throw("Strict value is not equal to itself.")
14991499 }
15001500 else throw("Strict value is not equal to itself.")
15011501 }
15021502 else throw("Strict value is not equal to itself.")
15031503 }
15041504 else throw("Strict value is not equal to itself.")
15051505 }
15061506
15071507
15081508
15091509 @Callable(i)
15101510 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15111511 let isGetDisabled = if (isGlobalShutdown())
15121512 then true
15131513 else (cfgPoolStatus == PoolShutdown)
15141514 let checks = [if (!(isGetDisabled))
15151515 then true
15161516 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15171517 then true
15181518 else throw("no payments are expected")]
15191519 if ((checks == checks))
15201520 then {
15211521 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15221522 if ((currentKLp == currentKLp))
15231523 then {
15241524 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15251525 if ((unstakeInv == unstakeInv))
15261526 then {
15271527 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15281528 let outAmAmt = res._1
15291529 let outPrAmt = res._2
15301530 let state = res._10
15311531 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15321532 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15331533 then true
15341534 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15351535 then true
15361536 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15371537 if ((checkAmounts == checkAmounts))
15381538 then {
15391539 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15401540 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15411541 then {
1542- let $t05752157602 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1543- let refreshKLpActions = $t05752157602._1
1544- let updatedKLp = $t05752157602._2
1542+ let $t05770957790 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1543+ let refreshKLpActions = $t05770957790._1
1544+ let updatedKLp = $t05770957790._2
15451545 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15461546 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15471547 then ((withdrawState ++ state) ++ refreshKLpActions)
15481548 else throw("Strict value is not equal to itself.")
15491549 }
15501550 else throw("Strict value is not equal to itself.")
15511551 }
15521552 else throw("Strict value is not equal to itself.")
15531553 }
15541554 else throw("Strict value is not equal to itself.")
15551555 }
15561556 else throw("Strict value is not equal to itself.")
15571557 }
15581558 else throw("Strict value is not equal to itself.")
15591559 }
15601560
15611561
15621562
15631563 @Callable(i)
15641564 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15651565 then throw("permissions denied")
15661566 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15671567
15681568
15691569
15701570 @Callable(i)
15711571 func refreshKLp () = {
15721572 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15731573 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15741574 then unit
15751575 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15761576 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15771577 then {
15781578 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1579- let $t05880658870 = refreshKLpInternal(0, 0, 0)
1580- let kLpUpdateActions = $t05880658870._1
1581- let updatedKLp = $t05880658870._2
1579+ let $t05899459058 = refreshKLpInternal(0, 0, 0)
1580+ let kLpUpdateActions = $t05899459058._1
1581+ let updatedKLp = $t05899459058._2
15821582 let actions = if ((kLp != updatedKLp))
15831583 then kLpUpdateActions
15841584 else throwErr("nothing to refresh")
15851585 $Tuple2(actions, toString(updatedKLp))
15861586 }
15871587 else throw("Strict value is not equal to itself.")
15881588 }
15891589
15901590
15911591
15921592 @Callable(i)
15931593 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
15941594
15951595
15961596
15971597 @Callable(i)
15981598 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
15991599
16001600
16011601
16021602 @Callable(i)
16031603 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16041604 let prices = calcPrices(amAmt, prAmt, lpAmt)
16051605 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16061606 }
16071607
16081608
16091609
16101610 @Callable(i)
16111611 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16121612
16131613
16141614
16151615 @Callable(i)
16161616 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16171617
16181618
16191619
16201620 @Callable(i)
16211621 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16221622
16231623
16241624
16251625 @Callable(i)
16261626 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16271627
16281628
16291629
16301630 @Callable(i)
16311631 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16321632 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16331633 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16341634 }
16351635
16361636
16371637
16381638 @Callable(i)
16391639 func statsREADONLY () = {
16401640 let cfg = getPoolConfig()
16411641 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16421642 let amtAssetId = cfg[idxAmtAssetId]
16431643 let priceAssetId = cfg[idxPriceAssetId]
16441644 let iAmtAssetId = cfg[idxIAmtAssetId]
16451645 let iPriceAssetId = cfg[idxIPriceAssetId]
16461646 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16471647 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16481648 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16491649 let accAmtAssetBalance = getAccBalance(amtAssetId)
16501650 let accPriceAssetBalance = getAccBalance(priceAssetId)
16511651 let pricesList = if ((poolLPBalance == 0))
16521652 then [zeroBigInt, zeroBigInt, zeroBigInt]
16531653 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16541654 let curPrice = 0
16551655 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16561656 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16571657 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16581658 $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))
16591659 }
16601660
16611661
16621662
16631663 @Callable(i)
16641664 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16651665 let cfg = getPoolConfig()
16661666 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16671667 let amAssetIdStr = cfg[idxAmtAssetId]
16681668 let amAssetId = fromBase58String(amAssetIdStr)
16691669 let prAssetIdStr = cfg[idxPriceAssetId]
16701670 let prAssetId = fromBase58String(prAssetIdStr)
16711671 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16721672 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16731673 let poolStatus = cfg[idxPoolStatus]
16741674 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16751675 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16761676 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16771677 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16781678 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16791679 let curPriceX18 = if ((poolLPBalance == 0))
16801680 then zeroBigInt
16811681 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16821682 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16831683 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16841684 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16851685 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16861686 let calcLpAmt = estPut._1
16871687 let curPriceCalc = estPut._3
16881688 let amBalance = estPut._4
16891689 let prBalance = estPut._5
16901690 let lpEmission = estPut._6
16911691 $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))
16921692 }
16931693
16941694
16951695
16961696 @Callable(i)
16971697 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
16981698 let cfg = getPoolConfig()
16991699 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17001700 let amAssetIdStr = cfg[idxAmtAssetId]
17011701 let amAssetId = fromBase58String(amAssetIdStr)
17021702 let prAssetIdStr = cfg[idxPriceAssetId]
17031703 let prAssetId = fromBase58String(prAssetIdStr)
17041704 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17051705 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17061706 let poolStatus = cfg[idxPoolStatus]
17071707 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17081708 let amBalanceRaw = getAccBalance(amAssetIdStr)
17091709 let prBalanceRaw = getAccBalance(prAssetIdStr)
17101710 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17111711 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17121712 let curPriceX18 = if ((poolLPBalance == 0))
17131713 then zeroBigInt
17141714 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17151715 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17161716 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17171717 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17181718 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17191719 let calcLpAmt = estPut._1
17201720 let curPriceCalc = estPut._3
17211721 let amBalance = estPut._4
17221722 let prBalance = estPut._5
17231723 let lpEmission = estPut._6
17241724 $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))
17251725 }
17261726
17271727
17281728
17291729 @Callable(i)
17301730 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17311731 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17321732 let outAmAmt = res._1
17331733 let outPrAmt = res._2
17341734 let amBalance = res._5
17351735 let prBalance = res._6
17361736 let lpEmission = res._7
17371737 let curPrice = res._8
17381738 let poolStatus = parseIntValue(res._9)
17391739 $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))
17401740 }
17411741
17421742
17431743 @Verifier(tx)
17441744 func verify () = {
17451745 let targetPublicKey = match managerPublicKeyOrUnit() {
17461746 case pk: ByteVector =>
17471747 pk
17481748 case _: Unit =>
17491749 tx.senderPublicKey
17501750 case _ =>
17511751 throw("Match error")
17521752 }
17531753 match tx {
17541754 case order: Order =>
17551755 let matcherPub = getMatcherPubOrFail()
1756- let $t06753267601 = validateMatcherOrderAllowed(order)
1757- let orderValid = $t06753267601._1
1758- let orderValidInfo = $t06753267601._2
1756+ let $t06772067789 = validateMatcherOrderAllowed(order)
1757+ let orderValid = $t06772067789._1
1758+ let orderValidInfo = $t06772067789._2
17591759 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17601760 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17611761 if (if (if (orderValid)
17621762 then senderValid
17631763 else false)
17641764 then matcherValid
17651765 else false)
17661766 then true
17671767 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17681768 case s: SetScriptTransaction =>
17691769 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17701770 then true
17711771 else {
17721772 let newHash = blake2b256(value(s.script))
17731773 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17741774 let currentHash = scriptHash(this)
17751775 if ((allowedHash == newHash))
17761776 then (currentHash != newHash)
17771777 else false
17781778 }
17791779 case _ =>
17801780 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17811781 }
17821782 }
17831783

github/deemru/w8io/026f985 
227.62 ms